From b16b9e4656e7199c2aec74a4c8ebc7a875d3ba73 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 2 Feb 2015 15:02:49 +0100 Subject: massive reduction of unneeded files --- nx-X11/lib/FS/FS-def.cpp | 38 - nx-X11/lib/FS/FSClServ.c | 93 - nx-X11/lib/FS/FSCloseFt.c | 70 - nx-X11/lib/FS/FSConnServ.c | 247 - nx-X11/lib/FS/FSErrDis.c | 121 - nx-X11/lib/FS/FSErrHndlr.c | 84 - nx-X11/lib/FS/FSFlush.c | 63 - nx-X11/lib/FS/FSFontInfo.c | 346 - nx-X11/lib/FS/FSFtNames.c | 131 - nx-X11/lib/FS/FSGetCats.c | 114 - nx-X11/lib/FS/FSListCats.c | 132 - nx-X11/lib/FS/FSListExt.c | 125 - nx-X11/lib/FS/FSMisc.c | 64 - nx-X11/lib/FS/FSNextEv.c | 79 - nx-X11/lib/FS/FSOpenFont.c | 92 - nx-X11/lib/FS/FSOpenServ.c | 291 - nx-X11/lib/FS/FSQGlyphs.c | 214 - nx-X11/lib/FS/FSQXExt.c | 176 - nx-X11/lib/FS/FSQXInfo.c | 130 - nx-X11/lib/FS/FSQuExt.c | 82 - nx-X11/lib/FS/FSServName.c | 73 - nx-X11/lib/FS/FSSetCats.c | 94 - nx-X11/lib/FS/FSSync.c | 81 - nx-X11/lib/FS/FSSynchro.c | 91 - nx-X11/lib/FS/FSlib.h | 313 - nx-X11/lib/FS/FSlibInt.c | 1360 -- nx-X11/lib/FS/FSlibint.h | 400 - nx-X11/lib/FS/FSlibos.h | 332 - nx-X11/lib/FS/Imakefile | 58 - nx-X11/lib/GL/apple/Imakefile | 54 - nx-X11/lib/GL/apple/appledri.c | 302 - nx-X11/lib/GL/apple/appledri.h | 106 - nx-X11/lib/GL/apple/appledristr.h | 174 - nx-X11/lib/GL/apple/build-dispatch | 101 - nx-X11/lib/GL/apple/dri_dispatch.c | 153 - nx-X11/lib/GL/apple/dri_dispatch.defs | 856 - nx-X11/lib/GL/apple/dri_dispatch.h | 3861 ---- nx-X11/lib/GL/apple/dri_driver.c | 1141 - nx-X11/lib/GL/apple/dri_driver.h | 188 - nx-X11/lib/GL/apple/dri_glx.c | 265 - nx-X11/lib/GL/apple/dri_glx.h | 67 - nx-X11/lib/GL/dri/drm/Imakefile | 54 - nx-X11/lib/GL/mesa/drivers/dri/Imakefile | 21 - nx-X11/lib/GL/mesa/drivers/dri/ffb/Imakefile | 77 - nx-X11/lib/GL/mesa/drivers/dri/ffb/Imakefile.inc | 151 - nx-X11/lib/GL/mesa/drivers/dri/gamma/Imakefile | 77 - nx-X11/lib/GL/mesa/drivers/dri/gamma/Imakefile.inc | 140 - nx-X11/lib/GL/mesa/drivers/dri/i810/Imakefile | 77 - nx-X11/lib/GL/mesa/drivers/dri/i810/Imakefile.inc | 121 - nx-X11/lib/GL/mesa/drivers/dri/i915/Imakefile | 72 - nx-X11/lib/GL/mesa/drivers/dri/i915/Imakefile.inc | 140 - nx-X11/lib/GL/mesa/drivers/dri/mach64/Imakefile | 77 - .../lib/GL/mesa/drivers/dri/mach64/Imakefile.inc | 131 - nx-X11/lib/GL/mesa/drivers/dri/mga/Imakefile | 78 - nx-X11/lib/GL/mesa/drivers/dri/mga/Imakefile.inc | 135 - nx-X11/lib/GL/mesa/drivers/dri/r128/Imakefile | 77 - nx-X11/lib/GL/mesa/drivers/dri/r128/Imakefile.inc | 123 - nx-X11/lib/GL/mesa/drivers/dri/r200/Imakefile | 78 - nx-X11/lib/GL/mesa/drivers/dri/r200/Imakefile.inc | 200 - nx-X11/lib/GL/mesa/drivers/dri/radeon/Imakefile | 78 - .../lib/GL/mesa/drivers/dri/radeon/Imakefile.inc | 193 - nx-X11/lib/GL/mesa/drivers/dri/savage/Imakefile | 78 - .../lib/GL/mesa/drivers/dri/savage/Imakefile.inc | 105 - nx-X11/lib/GL/mesa/drivers/dri/sis/Imakefile | 80 - nx-X11/lib/GL/mesa/drivers/dri/sis/Imakefile.inc | 156 - nx-X11/lib/GL/mesa/drivers/dri/tdfx/Imakefile | 76 - nx-X11/lib/GL/mesa/drivers/dri/tdfx/Imakefile.inc | 140 - nx-X11/lib/GL/mesa/drivers/dri/unichrome/Imakefile | 80 - .../GL/mesa/drivers/dri/unichrome/Imakefile.inc | 123 - nx-X11/lib/GL/mesa/drivers/dri/via/Imakefile | 80 - nx-X11/lib/GL/mesa/drivers/dri/via/Imakefile.inc | 158 - nx-X11/lib/GLU/GLU-def.cpp | 166 - nx-X11/lib/GLU/Imakefile | 133 - nx-X11/lib/GLU/include/Imakefile | 38 - nx-X11/lib/GLU/libnurbs/interface/Imakefile | 107 - nx-X11/lib/GLU/libnurbs/internals/Imakefile | 269 - nx-X11/lib/GLU/libnurbs/nurbtess/Imakefile | 150 - nx-X11/lib/GLU/libtess/Imakefile | 109 - nx-X11/lib/GLU/libutil/Imakefile | 84 - nx-X11/lib/GLw/GLwM1DrawA.c | 55 - nx-X11/lib/GLw/GLwM2DrawA.c | 55 - nx-X11/lib/GLw/GLwXm/PrimitiveP.h | 90 - nx-X11/lib/GLw/GLwXm/Xm.h | 143 - nx-X11/lib/GLw/GLwXm/XmP.h | 67 - nx-X11/lib/GLw/GLwXm/XmStrDefs.h | 121 - nx-X11/lib/GLw/Imakefile | 87 - nx-X11/lib/GLw/README.html | 242 - nx-X11/lib/GLw/README.txt | 199 - nx-X11/lib/ICE/ICE-def.cpp | 74 - nx-X11/lib/ICE/ICE.h | 102 - nx-X11/lib/ICE/ICEconn.h | 251 - nx-X11/lib/ICE/ICElib.h | 433 - nx-X11/lib/ICE/ICElibint.h | 537 - nx-X11/lib/ICE/ICEmsg.h | 295 - nx-X11/lib/ICE/ICEproto.h | 176 - nx-X11/lib/ICE/ICEutil.h | 126 - nx-X11/lib/ICE/Imakefile | 92 - nx-X11/lib/ICE/accept.c | 188 - nx-X11/lib/ICE/authutil.c | 539 - nx-X11/lib/ICE/connect.c | 543 - nx-X11/lib/ICE/error.c | 641 - nx-X11/lib/ICE/getauth.c | 274 - nx-X11/lib/ICE/globals.h | 64 - nx-X11/lib/ICE/iceauth.c | 278 - nx-X11/lib/ICE/listen.c | 283 - nx-X11/lib/ICE/listenwk.c | 161 - nx-X11/lib/ICE/locking.c | 67 - nx-X11/lib/ICE/misc.c | 630 - nx-X11/lib/ICE/ping.c | 66 - nx-X11/lib/ICE/process.c | 2548 --- nx-X11/lib/ICE/protosetup.c | 293 - nx-X11/lib/ICE/register.c | 256 - nx-X11/lib/ICE/replywait.c | 161 - nx-X11/lib/ICE/setauth.c | 121 - nx-X11/lib/ICE/shutdown.c | 330 - nx-X11/lib/ICE/watch.c | 206 - nx-X11/lib/SM/Imakefile | 56 - nx-X11/lib/SM/SM-def.cpp | 41 - nx-X11/lib/SM/SM.h | 130 - nx-X11/lib/SM/SMlib.h | 545 - nx-X11/lib/SM/SMlibint.h | 517 - nx-X11/lib/SM/SMproto.h | 208 - nx-X11/lib/SM/globals.h | 68 - nx-X11/lib/SM/sm_auth.c | 48 - nx-X11/lib/SM/sm_client.c | 633 - nx-X11/lib/SM/sm_client.c.NX.original | 633 - nx-X11/lib/SM/sm_client.c.SM.original | 631 - nx-X11/lib/SM/sm_error.c | 341 - nx-X11/lib/SM/sm_genid.c | 215 - nx-X11/lib/SM/sm_manager.c | 372 - nx-X11/lib/SM/sm_misc.c | 217 - nx-X11/lib/SM/sm_process.c | 889 - nx-X11/lib/XTrap/Imakefile | 30 - nx-X11/lib/XTrap/XECallBcks.c | 175 - nx-X11/lib/XTrap/XEConTxt.c | 589 - nx-X11/lib/XTrap/XEDsptch.c | 111 - nx-X11/lib/XTrap/XEPrInfo.c | 274 - nx-X11/lib/XTrap/XERqsts.c | 412 - nx-X11/lib/XTrap/XEStrMap.c | 284 - nx-X11/lib/XTrap/XETrapInit.c | 218 - nx-X11/lib/XTrap/XEWrappers.c | 325 - nx-X11/lib/XTrap/XTrap-def.cpp | 76 - nx-X11/lib/Xaw/Actions.c | 1139 - nx-X11/lib/Xaw/AllWidgets.c | 126 - nx-X11/lib/Xaw/AllWidgets.h | 38 - nx-X11/lib/Xaw/AsciiSink.c | 1951 -- nx-X11/lib/Xaw/AsciiSink.h | 82 - nx-X11/lib/Xaw/AsciiSinkP.h | 101 - nx-X11/lib/Xaw/AsciiSrc.c | 1886 -- nx-X11/lib/Xaw/AsciiSrc.h | 175 - nx-X11/lib/Xaw/AsciiSrcP.h | 145 - nx-X11/lib/Xaw/AsciiText.c | 360 - nx-X11/lib/Xaw/AsciiText.h | 128 - nx-X11/lib/Xaw/AsciiTextP.h | 169 - nx-X11/lib/Xaw/Box.c | 675 - nx-X11/lib/Xaw/Box.h | 108 - nx-X11/lib/Xaw/BoxP.h | 103 - nx-X11/lib/Xaw/CHANGES | 153 - nx-X11/lib/Xaw/Cardinals.h | 43 - nx-X11/lib/Xaw/Changelog | 1370 -- nx-X11/lib/Xaw/Command.c | 660 - nx-X11/lib/Xaw/Command.h | 119 - nx-X11/lib/Xaw/CommandP.h | 117 - nx-X11/lib/Xaw/Converters.c | 701 - nx-X11/lib/Xaw/Dialog.c | 463 - nx-X11/lib/Xaw/Dialog.h | 101 - nx-X11/lib/Xaw/DialogP.h | 104 - nx-X11/lib/Xaw/DisplayList.c | 2257 -- nx-X11/lib/Xaw/Form.c | 1110 - nx-X11/lib/Xaw/Form.h | 171 - nx-X11/lib/Xaw/FormP.h | 142 - nx-X11/lib/Xaw/Grip.c | 188 - nx-X11/lib/Xaw/Grip.h | 99 - nx-X11/lib/Xaw/GripP.h | 91 - nx-X11/lib/Xaw/Imakefile | 209 - nx-X11/lib/Xaw/Label.c | 824 - nx-X11/lib/Xaw/Label.h | 135 - nx-X11/lib/Xaw/LabelP.h | 121 - nx-X11/lib/Xaw/List.c | 1273 -- nx-X11/lib/Xaw/List.h | 237 - nx-X11/lib/Xaw/ListP.h | 118 - nx-X11/lib/Xaw/MenuButtoP.h | 80 - nx-X11/lib/Xaw/MenuButton.c | 276 - nx-X11/lib/Xaw/MenuButton.h | 91 - nx-X11/lib/Xaw/MultiSink.c | 978 - nx-X11/lib/Xaw/MultiSink.h | 113 - nx-X11/lib/Xaw/MultiSinkP.h | 141 - nx-X11/lib/Xaw/MultiSrc.c | 1620 -- nx-X11/lib/Xaw/MultiSrc.h | 133 - nx-X11/lib/Xaw/MultiSrcP.h | 182 - nx-X11/lib/Xaw/OS.c | 64 - nx-X11/lib/Xaw/Paned.c | 2067 -- nx-X11/lib/Xaw/Paned.h | 264 - nx-X11/lib/Xaw/PanedP.h | 180 - nx-X11/lib/Xaw/Panner.c | 1082 - nx-X11/lib/Xaw/Panner.h | 107 - nx-X11/lib/Xaw/PannerP.h | 108 - nx-X11/lib/Xaw/Pixmap.c | 993 - nx-X11/lib/Xaw/Porthole.c | 378 - nx-X11/lib/Xaw/Porthole.h | 63 - nx-X11/lib/Xaw/PortholeP.h | 64 - nx-X11/lib/Xaw/Print.h | 132 - nx-X11/lib/Xaw/PrintSP.h | 135 - nx-X11/lib/Xaw/PrintShell.c | 750 - nx-X11/lib/Xaw/Private.h | 154 - nx-X11/lib/Xaw/Repeater.c | 300 - nx-X11/lib/Xaw/Repeater.h | 75 - nx-X11/lib/Xaw/RepeaterP.h | 84 - nx-X11/lib/Xaw/Reports.h | 56 - nx-X11/lib/Xaw/Scrollbar.c | 885 - nx-X11/lib/Xaw/Scrollbar.h | 137 - nx-X11/lib/Xaw/ScrollbarP.h | 109 - nx-X11/lib/Xaw/Simple.c | 504 - nx-X11/lib/Xaw/Simple.h | 116 - nx-X11/lib/Xaw/SimpleMenP.h | 101 - nx-X11/lib/Xaw/SimpleMenu.c | 1834 -- nx-X11/lib/Xaw/SimpleMenu.h | 173 - nx-X11/lib/Xaw/SimpleP.h | 102 - nx-X11/lib/Xaw/Sme.c | 272 - nx-X11/lib/Xaw/Sme.h | 73 - nx-X11/lib/Xaw/SmeBSB.c | 774 - nx-X11/lib/Xaw/SmeBSB.h | 98 - nx-X11/lib/Xaw/SmeBSBP.h | 94 - nx-X11/lib/Xaw/SmeLine.c | 267 - nx-X11/lib/Xaw/SmeLine.h | 71 - nx-X11/lib/Xaw/SmeLineP.h | 75 - nx-X11/lib/Xaw/SmeP.h | 90 - nx-X11/lib/Xaw/StripCharP.h | 110 - nx-X11/lib/Xaw/StripChart.c | 579 - nx-X11/lib/Xaw/StripChart.h | 119 - nx-X11/lib/Xaw/Template.c | 198 - nx-X11/lib/Xaw/Template.h | 70 - nx-X11/lib/Xaw/TemplateP.h | 68 - nx-X11/lib/Xaw/Text.c | 4164 ---- nx-X11/lib/Xaw/Text.h | 373 - nx-X11/lib/Xaw/TextAction.c | 4428 ---- nx-X11/lib/Xaw/TextP.h | 321 - nx-X11/lib/Xaw/TextPop.c | 1554 -- nx-X11/lib/Xaw/TextSink.c | 1829 -- nx-X11/lib/Xaw/TextSink.h | 364 - nx-X11/lib/Xaw/TextSinkP.h | 306 - nx-X11/lib/Xaw/TextSrc.c | 1981 -- nx-X11/lib/Xaw/TextSrc.h | 280 - nx-X11/lib/Xaw/TextSrcP.h | 264 - nx-X11/lib/Xaw/TextTr.c | 159 - nx-X11/lib/Xaw/Tip.c | 638 - nx-X11/lib/Xaw/Tip.h | 120 - nx-X11/lib/Xaw/TipP.h | 77 - nx-X11/lib/Xaw/Toggle.c | 632 - nx-X11/lib/Xaw/Toggle.h | 181 - nx-X11/lib/Xaw/ToggleP.h | 95 - nx-X11/lib/Xaw/Tree.c | 1017 - nx-X11/lib/Xaw/Tree.h | 138 - nx-X11/lib/Xaw/TreeP.h | 141 - nx-X11/lib/Xaw/Vendor.c | 527 - nx-X11/lib/Xaw/VendorEP.h | 84 - nx-X11/lib/Xaw/Viewport.c | 1102 - nx-X11/lib/Xaw/Viewport.h | 121 - nx-X11/lib/Xaw/ViewportP.h | 109 - nx-X11/lib/Xaw/Xaw-def.cpp | 157 - nx-X11/lib/Xaw/Xaw.man | 588 - nx-X11/lib/Xaw/XawI18n.c | 104 - nx-X11/lib/Xaw/XawI18n.h | 122 - nx-X11/lib/Xaw/XawIm.c | 1613 -- nx-X11/lib/Xaw/XawImP.h | 213 - nx-X11/lib/Xaw/XawInit.c | 100 - nx-X11/lib/Xaw/XawInit.h | 64 - nx-X11/lib/Xaw/genlist.sh | 41 - nx-X11/lib/Xaw/jump_funcs | 117 - nx-X11/lib/Xaw/jump_ignore | 7 - nx-X11/lib/Xaw/jump_vars | 83 - nx-X11/lib/Xaw/sharedlib.c | 182 - nx-X11/lib/Xaw6/Imakefile | 170 - nx-X11/lib/Xaw6/Xaw-def.cpp | 144 - nx-X11/lib/Xaw7/Imakefile | 336 - nx-X11/lib/Xaw7/Xaw-def.cpp | 156 - nx-X11/lib/Xbsd/Berklib.c | 331 - nx-X11/lib/Xbsd/Imakefile | 16 - nx-X11/lib/Xevie/AUTHORS | 1 - nx-X11/lib/Xevie/Imakefile | 76 - nx-X11/lib/Xevie/Xevie.c | 211 - nx-X11/lib/Xevie/Xevie.man | 88 - nx-X11/lib/Xevie/xevie.pc.in | 12 - nx-X11/lib/Xevie/xevieplaceholder.h | 0 nx-X11/lib/Xfontcache/FontCache.c | 209 - nx-X11/lib/Xfontcache/Imakefile | 42 - nx-X11/lib/Xfontcache/Xfontcache-def.cpp | 9 - nx-X11/lib/Xfontcache/Xfontcache.man | 137 - nx-X11/lib/Xft/AUTHORS | 10 - nx-X11/lib/Xft/COPYING | 22 - nx-X11/lib/Xft/ChangeLog | 1216 -- nx-X11/lib/Xft/INSTALL | 8 - nx-X11/lib/Xft/Imakefile | 145 - nx-X11/lib/Xft/Makefile.am | 64 - nx-X11/lib/Xft/Makefile.in | 780 - nx-X11/lib/Xft/NEWS | 0 nx-X11/lib/Xft/README | 65 - nx-X11/lib/Xft/Xft-def.cpp | 183 - nx-X11/lib/Xft/Xft.3.in | 847 - nx-X11/lib/Xft/Xft.h | 642 - nx-X11/lib/Xft/XftCompat.h | 165 - nx-X11/lib/Xft/aclocal.m4 | 6858 ------ nx-X11/lib/Xft/autogen.sh | 12 - nx-X11/lib/Xft/config.guess | 1388 -- nx-X11/lib/Xft/config.h.in | 76 - nx-X11/lib/Xft/config.sub | 1489 -- nx-X11/lib/Xft/config/config-subst | 10 - nx-X11/lib/Xft/configure | 21551 ------------------- nx-X11/lib/Xft/configure.ac | 133 - nx-X11/lib/Xft/depcomp | 479 - nx-X11/lib/Xft/install-sh | 294 - nx-X11/lib/Xft/ltmain.sh | 6290 ------ nx-X11/lib/Xft/missing | 336 - nx-X11/lib/Xft/mkinstalldirs | 111 - nx-X11/lib/Xft/xft-config.1.in | 120 - nx-X11/lib/Xft/xft-config.in | 100 - nx-X11/lib/Xft/xft.pc.in | 12 - nx-X11/lib/Xft/xftcolor.c | 125 - nx-X11/lib/Xft/xftcore.c | 1375 -- nx-X11/lib/Xft/xftdbg.c | 48 - nx-X11/lib/Xft/xftdpy.c | 554 - nx-X11/lib/Xft/xftdraw.c | 993 - nx-X11/lib/Xft/xftextent.c | 287 - nx-X11/lib/Xft/xftfont.c | 208 - nx-X11/lib/Xft/xftfreetype.c | 1156 - nx-X11/lib/Xft/xftglyphs.c | 825 - nx-X11/lib/Xft/xftinit.c | 115 - nx-X11/lib/Xft/xftint.h | 459 - nx-X11/lib/Xft/xftlist.c | 60 - nx-X11/lib/Xft/xftname.c | 83 - nx-X11/lib/Xft/xftrender.c | 1009 - nx-X11/lib/Xft/xftstr.c | 37 - nx-X11/lib/Xft/xftswap.c | 121 - nx-X11/lib/Xft/xftxlfd.c | 177 - nx-X11/lib/Xft1/Imakefile | 150 - nx-X11/lib/Xft1/Xft-def.cpp | 171 - nx-X11/lib/Xft1/Xft.h | 486 - nx-X11/lib/Xft1/Xft.man | 180 - nx-X11/lib/Xft1/XftConfig-OBSOLETE | 2 - nx-X11/lib/Xft1/XftFreetype.h | 167 - nx-X11/lib/Xft1/xftcache.c | 608 - nx-X11/lib/Xft1/xftcfg.c | 36 - nx-X11/lib/Xft1/xftcolor.c | 125 - nx-X11/lib/Xft1/xftcore.c | 247 - nx-X11/lib/Xft1/xftdbg.c | 43 - nx-X11/lib/Xft1/xftdir.c | 42 - nx-X11/lib/Xft1/xftdpy.c | 436 - nx-X11/lib/Xft1/xftdraw.c | 482 - nx-X11/lib/Xft1/xftextent.c | 190 - nx-X11/lib/Xft1/xftfont.c | 327 - nx-X11/lib/Xft1/xftfreetype.c | 678 - nx-X11/lib/Xft1/xftfs.c | 44 - nx-X11/lib/Xft1/xftglyphs.c | 491 - nx-X11/lib/Xft1/xftgram.y | 452 - nx-X11/lib/Xft1/xftinit.c | 42 - nx-X11/lib/Xft1/xftint.h | 508 - nx-X11/lib/Xft1/xftlex.l | 275 - nx-X11/lib/Xft1/xftlist.c | 166 - nx-X11/lib/Xft1/xftmatch.c | 37 - nx-X11/lib/Xft1/xftmatrix.c | 104 - nx-X11/lib/Xft1/xftname.c | 59 - nx-X11/lib/Xft1/xftpat.c | 243 - nx-X11/lib/Xft1/xftrender.c | 527 - nx-X11/lib/Xft1/xftstr.c | 259 - nx-X11/lib/Xft1/xftxlfd.c | 334 - nx-X11/lib/Xi/Imakefile | 107 - nx-X11/lib/Xi/XAllowDv.c | 88 - nx-X11/lib/Xi/XChgDCtl.c | 130 - nx-X11/lib/Xi/XChgFCtl.c | 207 - nx-X11/lib/Xi/XChgKMap.c | 94 - nx-X11/lib/Xi/XChgKbd.c | 88 - nx-X11/lib/Xi/XChgPnt.c | 92 - nx-X11/lib/Xi/XChgProp.c | 98 - nx-X11/lib/Xi/XCloseDev.c | 85 - nx-X11/lib/Xi/XDevBell.c | 89 - nx-X11/lib/Xi/XExtInt.c | 663 - nx-X11/lib/Xi/XExtToWire.c | 452 - nx-X11/lib/Xi/XFreeLst.c | 73 - nx-X11/lib/Xi/XGMotion.c | 142 - nx-X11/lib/Xi/XGetBMap.c | 108 - nx-X11/lib/Xi/XGetDCtl.c | 173 - nx-X11/lib/Xi/XGetFCtl.c | 273 - nx-X11/lib/Xi/XGetKMap.c | 111 - nx-X11/lib/Xi/XGetMMap.c | 104 - nx-X11/lib/Xi/XGetProp.c | 120 - nx-X11/lib/Xi/XGetVers.c | 115 - nx-X11/lib/Xi/XGrDvBut.c | 114 - nx-X11/lib/Xi/XGrDvKey.c | 117 - nx-X11/lib/Xi/XGrabDev.c | 109 - nx-X11/lib/Xi/XGtFocus.c | 92 - nx-X11/lib/Xi/XGtSelect.c | 146 - nx-X11/lib/Xi/XIint.h | 25 - nx-X11/lib/Xi/XListDev.c | 259 - nx-X11/lib/Xi/XOpenDev.c | 113 - nx-X11/lib/Xi/XQueryDv.c | 198 - nx-X11/lib/Xi/XSelect.c | 94 - nx-X11/lib/Xi/XSetBMap.c | 93 - nx-X11/lib/Xi/XSetDVal.c | 100 - nx-X11/lib/Xi/XSetMMap.c | 91 - nx-X11/lib/Xi/XSetMode.c | 88 - nx-X11/lib/Xi/XSndExEv.c | 123 - nx-X11/lib/Xi/XStFocus.c | 87 - nx-X11/lib/Xi/XUngrDev.c | 86 - nx-X11/lib/Xi/XUngrDvB.c | 93 - nx-X11/lib/Xi/XUngrDvK.c | 93 - nx-X11/lib/Xi/Xi-def.cpp | 49 - nx-X11/lib/Xmu/AllCmap.c | 158 - nx-X11/lib/Xmu/Atoms.c | 154 - nx-X11/lib/Xmu/Atoms.h | 126 - nx-X11/lib/Xmu/CharSet.h | 77 - nx-X11/lib/Xmu/ClientWin.c | 100 - nx-X11/lib/Xmu/Clip.c | 1617 -- nx-X11/lib/Xmu/CloseHook.c | 297 - nx-X11/lib/Xmu/CloseHook.h | 73 - nx-X11/lib/Xmu/CmapAlloc.c | 346 - nx-X11/lib/Xmu/Converters.h | 281 - nx-X11/lib/Xmu/CrCmap.c | 537 - nx-X11/lib/Xmu/CrPixFBit.c | 85 - nx-X11/lib/Xmu/CurUtil.h | 49 - nx-X11/lib/Xmu/CursorName.c | 141 - nx-X11/lib/Xmu/CvtCache.c | 136 - nx-X11/lib/Xmu/CvtCache.h | 62 - nx-X11/lib/Xmu/CvtStdSel.c | 347 - nx-X11/lib/Xmu/DefErrMsg.c | 173 - nx-X11/lib/Xmu/DelCmap.c | 73 - nx-X11/lib/Xmu/DisplayQue.c | 194 - nx-X11/lib/Xmu/DisplayQue.h | 155 - nx-X11/lib/Xmu/Distinct.c | 92 - nx-X11/lib/Xmu/DrRndRect.c | 182 - nx-X11/lib/Xmu/DrawLogo.c | 155 - nx-X11/lib/Xmu/Drawing.h | 161 - nx-X11/lib/Xmu/Editres.h | 42 - nx-X11/lib/Xmu/EditresCom.c | 2214 -- nx-X11/lib/Xmu/EditresP.h | 409 - nx-X11/lib/Xmu/Error.h | 59 - nx-X11/lib/Xmu/ExtAgent.c | 46 - nx-X11/lib/Xmu/ExtAgent.h | 44 - nx-X11/lib/Xmu/FToCback.c | 48 - nx-X11/lib/Xmu/GetHost.c | 86 - nx-X11/lib/Xmu/GrayPixmap.c | 139 - nx-X11/lib/Xmu/Imakefile | 176 - nx-X11/lib/Xmu/Initer.c | 117 - nx-X11/lib/Xmu/Initer.h | 58 - nx-X11/lib/Xmu/LocBitmap.c | 272 - nx-X11/lib/Xmu/Lookup.c | 279 - nx-X11/lib/Xmu/Lookup.h | 128 - nx-X11/lib/Xmu/LookupCmap.c | 325 - nx-X11/lib/Xmu/Lower.c | 164 - nx-X11/lib/Xmu/Misc.h | 65 - nx-X11/lib/Xmu/README | 8 - nx-X11/lib/Xmu/RdBitF.c | 401 - nx-X11/lib/Xmu/ScrOfWin.c | 60 - nx-X11/lib/Xmu/ShapeWidg.c | 251 - nx-X11/lib/Xmu/StdCmap.c | 236 - nx-X11/lib/Xmu/StdCmap.h | 119 - nx-X11/lib/Xmu/StdSel.h | 57 - nx-X11/lib/Xmu/StrToBS.c | 149 - nx-X11/lib/Xmu/StrToBmap.c | 150 - nx-X11/lib/Xmu/StrToCurs.c | 351 - nx-X11/lib/Xmu/StrToGrav.c | 151 - nx-X11/lib/Xmu/StrToJust.c | 140 - nx-X11/lib/Xmu/StrToLong.c | 83 - nx-X11/lib/Xmu/StrToOrnt.c | 130 - nx-X11/lib/Xmu/StrToShap.c | 125 - nx-X11/lib/Xmu/StrToWidg.c | 225 - nx-X11/lib/Xmu/SysUtil.h | 60 - nx-X11/lib/Xmu/UpdMapHint.c | 62 - nx-X11/lib/Xmu/VisCmap.c | 183 - nx-X11/lib/Xmu/WhitePoint.h | 65 - nx-X11/lib/Xmu/WidgetNode.c | 310 - nx-X11/lib/Xmu/WidgetNode.h | 98 - nx-X11/lib/Xmu/WinUtil.h | 64 - nx-X11/lib/Xmu/Xct.c | 687 - nx-X11/lib/Xmu/Xct.h | 168 - nx-X11/lib/Xmu/Xmu-def.cpp | 145 - nx-X11/lib/Xmu/Xmu.h | 128 - nx-X11/lib/Xmu/sharedlib.c | 76 - nx-X11/lib/Xmuu/Imakefile | 67 - nx-X11/lib/Xmuu/Xmuu-def.cpp | 22 - nx-X11/lib/Xp/Imakefile | 107 - nx-X11/lib/Xp/Xp-def.cpp | 42 - nx-X11/lib/Xp/XpAttr.c | 208 - nx-X11/lib/Xp/XpContext.c | 250 - nx-X11/lib/Xp/XpDoc.c | 159 - nx-X11/lib/Xp/XpExtUtil.c | 355 - nx-X11/lib/Xp/XpExtUtil.h | 41 - nx-X11/lib/Xp/XpExtVer.c | 125 - nx-X11/lib/Xp/XpGetData.c | 215 - nx-X11/lib/Xp/XpImageRes.c | 118 - nx-X11/lib/Xp/XpInput.c | 107 - nx-X11/lib/Xp/XpJob.c | 206 - nx-X11/lib/Xp/XpLocale.c | 269 - nx-X11/lib/Xp/XpNotifyPdm.c | 900 - nx-X11/lib/Xp/XpPage.c | 160 - nx-X11/lib/Xp/XpPageDim.c | 89 - nx-X11/lib/Xp/XpPrinter.c | 248 - nx-X11/lib/Xp/XpPutData.c | 100 - nx-X11/lib/Xp/XpScreens.c | 128 - nx-X11/lib/XprintAppUtil/Imakefile | 21 - nx-X11/lib/XprintAppUtil/xpapputil.c | 550 - nx-X11/lib/XprintAppUtil/xpapputil.h | 175 - nx-X11/lib/XprintUtil/Imakefile | 21 - nx-X11/lib/XprintUtil/xprintutil.c | 2111 -- nx-X11/lib/XprintUtil/xprintutil.h | 250 - nx-X11/lib/XprintUtil/xprintutil_printtofile.c | 498 - nx-X11/lib/Xss/Imakefile | 47 - nx-X11/lib/Xss/XScrnSaver.c | 442 - nx-X11/lib/Xss/Xss-def.cpp | 14 - nx-X11/lib/Xss/Xss.man | 328 - nx-X11/lib/Xt/ActionHook.c | 135 - nx-X11/lib/Xt/Alloc.c | 494 - nx-X11/lib/Xt/ArgList.c | 77 - nx-X11/lib/Xt/Callback.c | 692 - nx-X11/lib/Xt/CallbackI.h | 117 - nx-X11/lib/Xt/ClickTime.c | 93 - nx-X11/lib/Xt/Composite.c | 284 - nx-X11/lib/Xt/Composite.h | 105 - nx-X11/lib/Xt/CompositeP.h | 111 - nx-X11/lib/Xt/ConstrainP.h | 94 - nx-X11/lib/Xt/Constraint.c | 134 - nx-X11/lib/Xt/Constraint.h | 60 - nx-X11/lib/Xt/Convert.c | 1087 - nx-X11/lib/Xt/ConvertI.h | 96 - nx-X11/lib/Xt/Converters.c | 1864 -- nx-X11/lib/Xt/Core.c | 400 - nx-X11/lib/Xt/Core.h | 66 - nx-X11/lib/Xt/CoreP.h | 171 - nx-X11/lib/Xt/Create.c | 779 - nx-X11/lib/Xt/CreateI.h | 37 - nx-X11/lib/Xt/Destroy.c | 374 - nx-X11/lib/Xt/Display.c | 763 - nx-X11/lib/Xt/Error.c | 636 - nx-X11/lib/Xt/Event.c | 1731 -- nx-X11/lib/Xt/EventI.h | 134 - nx-X11/lib/Xt/EventUtil.c | 221 - nx-X11/lib/Xt/Functions.c | 216 - nx-X11/lib/Xt/GCManager.c | 353 - nx-X11/lib/Xt/Geometry.c | 817 - nx-X11/lib/Xt/GetActKey.c | 102 - nx-X11/lib/Xt/GetResList.c | 193 - nx-X11/lib/Xt/GetValues.c | 251 - nx-X11/lib/Xt/HookObj.c | 137 - nx-X11/lib/Xt/HookObjI.h | 71 - nx-X11/lib/Xt/Hooks.c | 158 - nx-X11/lib/Xt/Imakefile | 307 - nx-X11/lib/Xt/Imakefile.NX.original | 307 - nx-X11/lib/Xt/Imakefile.X.original | 271 - nx-X11/lib/Xt/InitialI.h | 429 - nx-X11/lib/Xt/Initialize.c | 1044 - nx-X11/lib/Xt/Intrinsic.c | 1593 -- nx-X11/lib/Xt/Intrinsic.h | 2589 --- nx-X11/lib/Xt/IntrinsicI.h | 261 - nx-X11/lib/Xt/IntrinsicP.h | 327 - nx-X11/lib/Xt/Keyboard.c | 851 - nx-X11/lib/Xt/Manage.c | 491 - nx-X11/lib/Xt/NextEvent.c | 1642 -- nx-X11/lib/Xt/NextEvent.c.NX.original | 1642 -- nx-X11/lib/Xt/NextEvent.c.X.original | 1616 -- nx-X11/lib/Xt/Object.c | 297 - nx-X11/lib/Xt/Object.h | 60 - nx-X11/lib/Xt/ObjectP.h | 139 - nx-X11/lib/Xt/PassivGraI.h | 186 - nx-X11/lib/Xt/PassivGrab.c | 1053 - nx-X11/lib/Xt/Pointer.c | 115 - nx-X11/lib/Xt/Popup.c | 198 - nx-X11/lib/Xt/PopupCB.c | 84 - nx-X11/lib/Xt/RectObj.c | 194 - nx-X11/lib/Xt/RectObj.h | 60 - nx-X11/lib/Xt/RectObjP.h | 129 - nx-X11/lib/Xt/ResConfig.c | 1022 - nx-X11/lib/Xt/ResConfigP.h | 78 - nx-X11/lib/Xt/ResourceI.h | 100 - nx-X11/lib/Xt/Resources.c | 1259 -- nx-X11/lib/Xt/Selection.c | 2295 -- nx-X11/lib/Xt/SelectionI.h | 170 - nx-X11/lib/Xt/SetSens.c | 128 - nx-X11/lib/Xt/SetValues.c | 443 - nx-X11/lib/Xt/SetWMCW.c | 173 - nx-X11/lib/Xt/Shell.c | 3414 --- nx-X11/lib/Xt/ShellI.h | 12 - nx-X11/lib/Xt/ShellP.h | 428 - nx-X11/lib/Xt/TMaction.c | 1056 - nx-X11/lib/Xt/TMgrab.c | 336 - nx-X11/lib/Xt/TMkey.c | 715 - nx-X11/lib/Xt/TMparse.c | 2135 -- nx-X11/lib/Xt/TMprint.c | 881 - nx-X11/lib/Xt/TMstate.c | 2349 -- nx-X11/lib/Xt/Threads.c | 428 - nx-X11/lib/Xt/ThreadsI.h | 130 - nx-X11/lib/Xt/TranslateI.h | 606 - nx-X11/lib/Xt/VarCreate.c | 399 - nx-X11/lib/Xt/VarGet.c | 317 - nx-X11/lib/Xt/Varargs.c | 519 - nx-X11/lib/Xt/VarargsI.h | 65 - nx-X11/lib/Xt/Vendor.c | 159 - nx-X11/lib/Xt/Vendor.h | 71 - nx-X11/lib/Xt/VendorP.h | 103 - nx-X11/lib/Xt/Xt-def.cpp | 352 - nx-X11/lib/Xt/Xtos.h | 77 - nx-X11/lib/Xt/jump_funcs | 756 - nx-X11/lib/Xt/jump_ignore | 15 - nx-X11/lib/Xt/jump_vars | 71 - nx-X11/lib/Xt/libXt.elist | 42 - nx-X11/lib/Xt/sharedlib.c | 236 - nx-X11/lib/Xt/util/Shell.ht | 97 - nx-X11/lib/Xt/util/StrDefs.ct | 54 - nx-X11/lib/Xt/util/StrDefs.ht | 64 - nx-X11/lib/Xt/util/string.list | 399 - nx-X11/lib/Xv/Imakefile | 30 - nx-X11/lib/Xv/Xv-def.cpp | 27 - nx-X11/lib/Xv/Xv.c | 1155 - nx-X11/lib/Xv/Xvlibint.h | 76 - nx-X11/lib/XvMC/Imakefile | 49 - nx-X11/lib/XvMC/XvMC-def.cpp | 8 - nx-X11/lib/XvMC/XvMC.c | 599 - nx-X11/lib/XvMC/XvMClibint.h | 40 - nx-X11/lib/XvMC/hw/i810/I810XvMC.c | 4507 ---- nx-X11/lib/XvMC/hw/i810/I810XvMC.h | 469 - nx-X11/lib/XvMC/hw/i810/Imakefile | 44 - nx-X11/lib/XvMC/hw/via/driDrawable.c | 176 - nx-X11/lib/XvMC/hw/via/driDrawable.h | 64 - nx-X11/lib/XvMC/hw/via/unichrome/Imakefile | 51 - nx-X11/lib/XvMC/hw/via/unichrome/viaLowLevel.c | 1056 - nx-X11/lib/XvMC/hw/via/unichromeProA/Imakefile | 50 - .../lib/XvMC/hw/via/unichromeProA/viaLowLevelPro.c | 1465 -- nx-X11/lib/XvMC/hw/via/viaLowLevel.h | 148 - nx-X11/lib/XvMC/hw/via/viaXvMC.c | 1964 -- nx-X11/lib/XvMC/hw/via/viaXvMCPriv.h | 198 - nx-X11/lib/XvMC/hw/via/xf86dri.c | 592 - nx-X11/lib/XvMC/hw/via/xf86dri.h | 121 - nx-X11/lib/XvMC/hw/via/xf86dristr.h | 343 - nx-X11/lib/XvMC/wrapper/Imakefile | 34 - nx-X11/lib/XvMC/wrapper/XvMCWrapper.c | 779 - nx-X11/lib/apple/AppleWM.man | 340 - nx-X11/lib/apple/Imakefile | 37 - nx-X11/lib/apple/applewm.c | 530 - nx-X11/lib/apple/applewm.h | 190 - nx-X11/lib/apple/applewmstr.h | 226 - nx-X11/lib/dmx/Imakefile | 26 - nx-X11/lib/dmx/dmx.c | 802 - nx-X11/lib/dps/DPSCAP.h | 77 - nx-X11/lib/dps/DPSCAPClient.h | 139 - nx-X11/lib/dps/DPSCAPproto.h | 180 - nx-X11/lib/dps/Imakefile | 265 - nx-X11/lib/dps/XDPS.c | 2235 -- nx-X11/lib/dps/Xlibnet.h | 284 - nx-X11/lib/dps/Xstreams.h | 218 - nx-X11/lib/dps/csconndi.c | 839 - nx-X11/lib/dps/csfindNX.c | 657 - nx-X11/lib/dps/csfindNX.h | 93 - nx-X11/lib/dps/cslibext.c | 762 - nx-X11/lib/dps/cslibint.c | 1910 -- nx-X11/lib/dps/cslibint.h | 302 - nx-X11/lib/dps/csopendi.c | 567 - nx-X11/lib/dps/csstartNX.c | 237 - nx-X11/lib/dps/csstartNX.h | 67 - nx-X11/lib/dps/dps-def.cpp | 991 - nx-X11/lib/dps/dpsNXprops.h | 90 - nx-X11/lib/dps/dpsXclient.c | 1134 - nx-X11/lib/dps/dpsXcmu.c | 1602 -- nx-X11/lib/dps/dpsXint.h | 104 - nx-X11/lib/dps/dpsXops.psw | 80 - nx-X11/lib/dps/dpsXpriv.c | 534 - nx-X11/lib/dps/dpsXpriv.h | 187 - nx-X11/lib/dps/dpsXtdisp.c | 109 - nx-X11/lib/dps/dpsabbrev.c | 360 - nx-X11/lib/dps/dpsassert.h | 57 - nx-X11/lib/dps/dpsclient.c | 2969 --- nx-X11/lib/dps/dpsclrops.psw | 81 - nx-X11/lib/dps/dpsctrlops.psw | 114 - nx-X11/lib/dps/dpsctxtops.psw | 110 - nx-X11/lib/dps/dpsdataops.psw | 258 - nx-X11/lib/dps/dpsdict.c | 189 - nx-X11/lib/dps/dpsdict.h | 78 - nx-X11/lib/dps/dpsendif.txt | 5 - nx-X11/lib/dps/dpsexcept.c | 73 - nx-X11/lib/dps/dpsfontops.psw | 109 - nx-X11/lib/dps/dpsgsttops.psw | 213 - nx-X11/lib/dps/dpsifdef.txt | 7 - nx-X11/lib/dps/dpsint.h | 125 - nx-X11/lib/dps/dpsioops.psw | 153 - nx-X11/lib/dps/dpsl2ops.psw | 208 - nx-X11/lib/dps/dpsmathops.psw | 125 - nx-X11/lib/dps/dpsmiscops.psw | 53 - nx-X11/lib/dps/dpsmtrxops.psw | 65 - nx-X11/lib/dps/dpsname.txt | 4 - nx-X11/lib/dps/dpsopstack.psw | 96 - nx-X11/lib/dps/dpspathops.psw | 169 - nx-X11/lib/dps/dpspntops.psw | 129 - nx-X11/lib/dps/dpsprintf.c | 68 - nx-X11/lib/dps/dpsprivate.h | 127 - nx-X11/lib/dps/dpssimpint.h | 88 - nx-X11/lib/dps/dpssysnames.c | 444 - nx-X11/lib/dps/dpssysops.psw | 149 - nx-X11/lib/dps/dpswinops.psw | 65 - nx-X11/lib/dps/else.txt | 6 - nx-X11/lib/dps/genheader.cmd | 14 - nx-X11/lib/dps/header.txt | 35 - nx-X11/lib/dps/psXops.psw | 81 - nx-X11/lib/dps/psclrops.psw | 81 - nx-X11/lib/dps/psctrlops.psw | 113 - nx-X11/lib/dps/psctxtops.psw | 109 - nx-X11/lib/dps/psdataops.psw | 257 - nx-X11/lib/dps/psendif.txt | 6 - nx-X11/lib/dps/psfontops.psw | 109 - nx-X11/lib/dps/psgsttops.psw | 213 - nx-X11/lib/dps/psifdef.txt | 7 - nx-X11/lib/dps/psioops.psw | 153 - nx-X11/lib/dps/psl2ops.psw | 208 - nx-X11/lib/dps/psmathops.psw | 125 - nx-X11/lib/dps/psmiscops.psw | 53 - nx-X11/lib/dps/psmtrxops.psw | 65 - nx-X11/lib/dps/psname.txt | 3 - nx-X11/lib/dps/psopstack.psw | 96 - nx-X11/lib/dps/pspathops.psw | 169 - nx-X11/lib/dps/pspntops.psw | 129 - nx-X11/lib/dps/pssysops.psw | 150 - nx-X11/lib/dps/pswinops.psw | 66 - nx-X11/lib/dps/publictypes.h | 71 - nx-X11/lib/dpstk/CSBwraps.psw | 343 - nx-X11/lib/dpstk/ColorSB.c | 3388 --- nx-X11/lib/dpstk/ColorSelect.ad | 162 - nx-X11/lib/dpstk/DPSScrollW.c | 3500 --- nx-X11/lib/dpstk/DSWwraps.psw | 75 - nx-X11/lib/dpstk/FSBwraps.psw | 491 - nx-X11/lib/dpstk/FontCreato.c | 1610 -- nx-X11/lib/dpstk/FontSB.c | 4884 ----- nx-X11/lib/dpstk/FontSBI.h | 57 - nx-X11/lib/dpstk/FontSample.c | 1814 -- nx-X11/lib/dpstk/FontSelect.ad | 415 - nx-X11/lib/dpstk/Imakefile | 91 - nx-X11/lib/dpstk/XDPSpreview.c | 636 - nx-X11/lib/dpstk/XDPSpwraps.psw | 97 - nx-X11/lib/dpstk/XDPSshare.c | 727 - nx-X11/lib/dpstk/XDPSswraps.psw | 110 - nx-X11/lib/dpstk/XDPSuserpath.c | 240 - nx-X11/lib/dpstk/dpsXcommonI.h | 73 - nx-X11/lib/dpstk/dpstk-def.cpp | 65 - nx-X11/lib/dpstk/eyedrop16.xbm | 8 - nx-X11/lib/dpstk/eyedrop32.xbm | 16 - nx-X11/lib/dpstk/eyedropmask16.xbm | 8 - nx-X11/lib/dpstk/eyedropmask32.xbm | 16 - nx-X11/lib/dpstk/heyedrop.xbm | 7 - nx-X11/lib/dpstk/square.xbm | 8 - nx-X11/lib/dpstk/squaremask.xbm | 6 - nx-X11/lib/expat/Imakefile | 53 - nx-X11/lib/expat/expat-def.cpp | 73 - nx-X11/lib/expat/expat_config.h | 65 - nx-X11/lib/font/FreeType/Imakefile | 47 - nx-X11/lib/font/FreeType/ft.h | 96 - nx-X11/lib/font/FreeType/ftenc.c | 242 - nx-X11/lib/font/FreeType/ftfuncs.c | 3851 ---- nx-X11/lib/font/FreeType/ftfuncs.h | 189 - nx-X11/lib/font/FreeType/ftsystem.c | 332 - nx-X11/lib/font/FreeType/fttools.c | 201 - nx-X11/lib/font/FreeType/module/Imakefile | 111 - nx-X11/lib/font/FreeType/module/ft2build.h | 45 - nx-X11/lib/font/FreeType/module/ftheader.h | 550 - nx-X11/lib/font/FreeType/module/ftmodule.c | 76 - nx-X11/lib/font/FreeType/module/ftmodule.h | 21 - nx-X11/lib/font/FreeType/module/ftoption.h | 567 - nx-X11/lib/font/FreeType/module/ftstdlib.h | 113 - nx-X11/lib/font/FreeType/module/fttypes.h | 571 - nx-X11/lib/font/FreeType/module/myftstdlib.h | 82 - nx-X11/lib/font/FreeType/xttcap.c | 809 - nx-X11/lib/font/FreeType/xttcap.h | 140 - nx-X11/lib/font/include/fontenc.h | 124 - nx-X11/lib/fontconfig/Imakefile | 464 - nx-X11/lib/fontconfig/config-subst | 10 - nx-X11/lib/fontconfig/fcfreetype.c | 2847 --- nx-X11/lib/fontenc/Imakefile | 36 - nx-X11/lib/fontenc/fontenc-def.cpp | 19 - nx-X11/lib/freetype2/Imakefile | 263 - nx-X11/lib/freetype2/freetype-def.cpp | 211 - nx-X11/lib/freetype2/freetype/Imakefile | 90 - nx-X11/lib/freetype2/freetype/cache/Imakefile | 25 - nx-X11/lib/freetype2/freetype/config/Imakefile | 52 - nx-X11/lib/freetype2/freetype/internal/Imakefile | 52 - .../freetype2/freetype/internal/services/Imakefile | 31 - nx-X11/lib/lbxutil/Imakefile | 31 - nx-X11/lib/lbxutil/delta/Imakefile | 17 - nx-X11/lib/lbxutil/delta/lbxdelta.c | 255 - nx-X11/lib/lbxutil/image/Imakefile | 45 - nx-X11/lib/lbxutil/image/dfaxg42d.c | 420 - nx-X11/lib/lbxutil/image/dpackbits.c | 100 - nx-X11/lib/lbxutil/image/efaxg42d.c | 328 - nx-X11/lib/lbxutil/image/epackbits.c | 202 - nx-X11/lib/lbxutil/image/lbxbwcodes.h | 269 - nx-X11/lib/lbxutil/image/lbxfax.h | 60 - nx-X11/lib/lbxutil/image/misc.c | 213 - nx-X11/lib/lbxutil/image/mkg3states.c | 761 - nx-X11/lib/lbxutil/lbx_zlib/Imakefile | 22 - nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib.c | 543 - nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib.h | 136 - nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib_io.c | 275 - nx-X11/lib/lbxutil/lbx_zlib/reqstats.c | 503 - nx-X11/lib/lbxutil/lbx_zlib/reqstats.h | 43 - nx-X11/lib/misc/snprintf.c | 714 - nx-X11/lib/misc/snprintf.h | 35 - nx-X11/lib/psres/Imakefile | 34 - nx-X11/lib/psres/PSres.c | 1661 -- nx-X11/lib/psres/psres-def.cpp | 11 - nx-X11/lib/regex/Imakefile | 53 - nx-X11/lib/windows/Imakefile | 34 - nx-X11/lib/windows/WindowsWM-def.cpp | 13 - nx-X11/lib/windows/WindowsWM.man | 340 - nx-X11/lib/windows/windowswm.c | 386 - nx-X11/lib/windows/windowswm.h | 195 - nx-X11/lib/windows/windowswmstr.h | 169 - nx-X11/lib/zlib/Imakefile | 56 - 810 files changed, 314759 deletions(-) delete mode 100644 nx-X11/lib/FS/FS-def.cpp delete mode 100644 nx-X11/lib/FS/FSClServ.c delete mode 100644 nx-X11/lib/FS/FSCloseFt.c delete mode 100644 nx-X11/lib/FS/FSConnServ.c delete mode 100644 nx-X11/lib/FS/FSErrDis.c delete mode 100644 nx-X11/lib/FS/FSErrHndlr.c delete mode 100644 nx-X11/lib/FS/FSFlush.c delete mode 100644 nx-X11/lib/FS/FSFontInfo.c delete mode 100644 nx-X11/lib/FS/FSFtNames.c delete mode 100644 nx-X11/lib/FS/FSGetCats.c delete mode 100644 nx-X11/lib/FS/FSListCats.c delete mode 100644 nx-X11/lib/FS/FSListExt.c delete mode 100644 nx-X11/lib/FS/FSMisc.c delete mode 100644 nx-X11/lib/FS/FSNextEv.c delete mode 100644 nx-X11/lib/FS/FSOpenFont.c delete mode 100644 nx-X11/lib/FS/FSOpenServ.c delete mode 100644 nx-X11/lib/FS/FSQGlyphs.c delete mode 100644 nx-X11/lib/FS/FSQXExt.c delete mode 100644 nx-X11/lib/FS/FSQXInfo.c delete mode 100644 nx-X11/lib/FS/FSQuExt.c delete mode 100644 nx-X11/lib/FS/FSServName.c delete mode 100644 nx-X11/lib/FS/FSSetCats.c delete mode 100644 nx-X11/lib/FS/FSSync.c delete mode 100644 nx-X11/lib/FS/FSSynchro.c delete mode 100644 nx-X11/lib/FS/FSlib.h delete mode 100644 nx-X11/lib/FS/FSlibInt.c delete mode 100644 nx-X11/lib/FS/FSlibint.h delete mode 100644 nx-X11/lib/FS/FSlibos.h delete mode 100644 nx-X11/lib/FS/Imakefile delete mode 100644 nx-X11/lib/GL/apple/Imakefile delete mode 100644 nx-X11/lib/GL/apple/appledri.c delete mode 100644 nx-X11/lib/GL/apple/appledri.h delete mode 100644 nx-X11/lib/GL/apple/appledristr.h delete mode 100755 nx-X11/lib/GL/apple/build-dispatch delete mode 100644 nx-X11/lib/GL/apple/dri_dispatch.c delete mode 100644 nx-X11/lib/GL/apple/dri_dispatch.defs delete mode 100644 nx-X11/lib/GL/apple/dri_dispatch.h delete mode 100644 nx-X11/lib/GL/apple/dri_driver.c delete mode 100644 nx-X11/lib/GL/apple/dri_driver.h delete mode 100644 nx-X11/lib/GL/apple/dri_glx.c delete mode 100644 nx-X11/lib/GL/apple/dri_glx.h delete mode 100644 nx-X11/lib/GL/dri/drm/Imakefile delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/Imakefile delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/ffb/Imakefile delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/ffb/Imakefile.inc delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/gamma/Imakefile delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/gamma/Imakefile.inc delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/i810/Imakefile delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/i810/Imakefile.inc delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/i915/Imakefile delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/i915/Imakefile.inc delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/mach64/Imakefile delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/mach64/Imakefile.inc delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/mga/Imakefile delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/mga/Imakefile.inc delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/r128/Imakefile delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/r128/Imakefile.inc delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/r200/Imakefile delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/r200/Imakefile.inc delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/radeon/Imakefile delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/radeon/Imakefile.inc delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/savage/Imakefile delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/savage/Imakefile.inc delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/sis/Imakefile delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/sis/Imakefile.inc delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/tdfx/Imakefile delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/tdfx/Imakefile.inc delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/unichrome/Imakefile delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/unichrome/Imakefile.inc delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/via/Imakefile delete mode 100644 nx-X11/lib/GL/mesa/drivers/dri/via/Imakefile.inc delete mode 100644 nx-X11/lib/GLU/GLU-def.cpp delete mode 100644 nx-X11/lib/GLU/Imakefile delete mode 100644 nx-X11/lib/GLU/include/Imakefile delete mode 100644 nx-X11/lib/GLU/libnurbs/interface/Imakefile delete mode 100644 nx-X11/lib/GLU/libnurbs/internals/Imakefile delete mode 100644 nx-X11/lib/GLU/libnurbs/nurbtess/Imakefile delete mode 100644 nx-X11/lib/GLU/libtess/Imakefile delete mode 100644 nx-X11/lib/GLU/libutil/Imakefile delete mode 100644 nx-X11/lib/GLw/GLwM1DrawA.c delete mode 100644 nx-X11/lib/GLw/GLwM2DrawA.c delete mode 100644 nx-X11/lib/GLw/GLwXm/PrimitiveP.h delete mode 100644 nx-X11/lib/GLw/GLwXm/Xm.h delete mode 100644 nx-X11/lib/GLw/GLwXm/XmP.h delete mode 100644 nx-X11/lib/GLw/GLwXm/XmStrDefs.h delete mode 100644 nx-X11/lib/GLw/Imakefile delete mode 100644 nx-X11/lib/GLw/README.html delete mode 100644 nx-X11/lib/GLw/README.txt delete mode 100644 nx-X11/lib/ICE/ICE-def.cpp delete mode 100644 nx-X11/lib/ICE/ICE.h delete mode 100644 nx-X11/lib/ICE/ICEconn.h delete mode 100644 nx-X11/lib/ICE/ICElib.h delete mode 100644 nx-X11/lib/ICE/ICElibint.h delete mode 100644 nx-X11/lib/ICE/ICEmsg.h delete mode 100644 nx-X11/lib/ICE/ICEproto.h delete mode 100644 nx-X11/lib/ICE/ICEutil.h delete mode 100644 nx-X11/lib/ICE/Imakefile delete mode 100644 nx-X11/lib/ICE/accept.c delete mode 100644 nx-X11/lib/ICE/authutil.c delete mode 100644 nx-X11/lib/ICE/connect.c delete mode 100644 nx-X11/lib/ICE/error.c delete mode 100644 nx-X11/lib/ICE/getauth.c delete mode 100644 nx-X11/lib/ICE/globals.h delete mode 100644 nx-X11/lib/ICE/iceauth.c delete mode 100644 nx-X11/lib/ICE/listen.c delete mode 100644 nx-X11/lib/ICE/listenwk.c delete mode 100644 nx-X11/lib/ICE/locking.c delete mode 100644 nx-X11/lib/ICE/misc.c delete mode 100644 nx-X11/lib/ICE/ping.c delete mode 100644 nx-X11/lib/ICE/process.c delete mode 100644 nx-X11/lib/ICE/protosetup.c delete mode 100644 nx-X11/lib/ICE/register.c delete mode 100644 nx-X11/lib/ICE/replywait.c delete mode 100644 nx-X11/lib/ICE/setauth.c delete mode 100644 nx-X11/lib/ICE/shutdown.c delete mode 100644 nx-X11/lib/ICE/watch.c delete mode 100644 nx-X11/lib/SM/Imakefile delete mode 100644 nx-X11/lib/SM/SM-def.cpp delete mode 100644 nx-X11/lib/SM/SM.h delete mode 100644 nx-X11/lib/SM/SMlib.h delete mode 100644 nx-X11/lib/SM/SMlibint.h delete mode 100644 nx-X11/lib/SM/SMproto.h delete mode 100644 nx-X11/lib/SM/globals.h delete mode 100644 nx-X11/lib/SM/sm_auth.c delete mode 100644 nx-X11/lib/SM/sm_client.c delete mode 100644 nx-X11/lib/SM/sm_client.c.NX.original delete mode 100644 nx-X11/lib/SM/sm_client.c.SM.original delete mode 100644 nx-X11/lib/SM/sm_error.c delete mode 100644 nx-X11/lib/SM/sm_genid.c delete mode 100644 nx-X11/lib/SM/sm_manager.c delete mode 100644 nx-X11/lib/SM/sm_misc.c delete mode 100644 nx-X11/lib/SM/sm_process.c delete mode 100644 nx-X11/lib/XTrap/Imakefile delete mode 100644 nx-X11/lib/XTrap/XECallBcks.c delete mode 100644 nx-X11/lib/XTrap/XEConTxt.c delete mode 100644 nx-X11/lib/XTrap/XEDsptch.c delete mode 100644 nx-X11/lib/XTrap/XEPrInfo.c delete mode 100644 nx-X11/lib/XTrap/XERqsts.c delete mode 100644 nx-X11/lib/XTrap/XEStrMap.c delete mode 100644 nx-X11/lib/XTrap/XETrapInit.c delete mode 100644 nx-X11/lib/XTrap/XEWrappers.c delete mode 100644 nx-X11/lib/XTrap/XTrap-def.cpp delete mode 100644 nx-X11/lib/Xaw/Actions.c delete mode 100644 nx-X11/lib/Xaw/AllWidgets.c delete mode 100644 nx-X11/lib/Xaw/AllWidgets.h delete mode 100644 nx-X11/lib/Xaw/AsciiSink.c delete mode 100644 nx-X11/lib/Xaw/AsciiSink.h delete mode 100644 nx-X11/lib/Xaw/AsciiSinkP.h delete mode 100644 nx-X11/lib/Xaw/AsciiSrc.c delete mode 100644 nx-X11/lib/Xaw/AsciiSrc.h delete mode 100644 nx-X11/lib/Xaw/AsciiSrcP.h delete mode 100644 nx-X11/lib/Xaw/AsciiText.c delete mode 100644 nx-X11/lib/Xaw/AsciiText.h delete mode 100644 nx-X11/lib/Xaw/AsciiTextP.h delete mode 100644 nx-X11/lib/Xaw/Box.c delete mode 100644 nx-X11/lib/Xaw/Box.h delete mode 100644 nx-X11/lib/Xaw/BoxP.h delete mode 100644 nx-X11/lib/Xaw/CHANGES delete mode 100644 nx-X11/lib/Xaw/Cardinals.h delete mode 100644 nx-X11/lib/Xaw/Changelog delete mode 100644 nx-X11/lib/Xaw/Command.c delete mode 100644 nx-X11/lib/Xaw/Command.h delete mode 100644 nx-X11/lib/Xaw/CommandP.h delete mode 100644 nx-X11/lib/Xaw/Converters.c delete mode 100644 nx-X11/lib/Xaw/Dialog.c delete mode 100644 nx-X11/lib/Xaw/Dialog.h delete mode 100644 nx-X11/lib/Xaw/DialogP.h delete mode 100644 nx-X11/lib/Xaw/DisplayList.c delete mode 100644 nx-X11/lib/Xaw/Form.c delete mode 100644 nx-X11/lib/Xaw/Form.h delete mode 100644 nx-X11/lib/Xaw/FormP.h delete mode 100644 nx-X11/lib/Xaw/Grip.c delete mode 100644 nx-X11/lib/Xaw/Grip.h delete mode 100644 nx-X11/lib/Xaw/GripP.h delete mode 100644 nx-X11/lib/Xaw/Imakefile delete mode 100644 nx-X11/lib/Xaw/Label.c delete mode 100644 nx-X11/lib/Xaw/Label.h delete mode 100644 nx-X11/lib/Xaw/LabelP.h delete mode 100644 nx-X11/lib/Xaw/List.c delete mode 100644 nx-X11/lib/Xaw/List.h delete mode 100644 nx-X11/lib/Xaw/ListP.h delete mode 100644 nx-X11/lib/Xaw/MenuButtoP.h delete mode 100644 nx-X11/lib/Xaw/MenuButton.c delete mode 100644 nx-X11/lib/Xaw/MenuButton.h delete mode 100644 nx-X11/lib/Xaw/MultiSink.c delete mode 100644 nx-X11/lib/Xaw/MultiSink.h delete mode 100644 nx-X11/lib/Xaw/MultiSinkP.h delete mode 100644 nx-X11/lib/Xaw/MultiSrc.c delete mode 100644 nx-X11/lib/Xaw/MultiSrc.h delete mode 100644 nx-X11/lib/Xaw/MultiSrcP.h delete mode 100644 nx-X11/lib/Xaw/OS.c delete mode 100644 nx-X11/lib/Xaw/Paned.c delete mode 100644 nx-X11/lib/Xaw/Paned.h delete mode 100644 nx-X11/lib/Xaw/PanedP.h delete mode 100644 nx-X11/lib/Xaw/Panner.c delete mode 100644 nx-X11/lib/Xaw/Panner.h delete mode 100644 nx-X11/lib/Xaw/PannerP.h delete mode 100644 nx-X11/lib/Xaw/Pixmap.c delete mode 100644 nx-X11/lib/Xaw/Porthole.c delete mode 100644 nx-X11/lib/Xaw/Porthole.h delete mode 100644 nx-X11/lib/Xaw/PortholeP.h delete mode 100644 nx-X11/lib/Xaw/Print.h delete mode 100644 nx-X11/lib/Xaw/PrintSP.h delete mode 100644 nx-X11/lib/Xaw/PrintShell.c delete mode 100644 nx-X11/lib/Xaw/Private.h delete mode 100644 nx-X11/lib/Xaw/Repeater.c delete mode 100644 nx-X11/lib/Xaw/Repeater.h delete mode 100644 nx-X11/lib/Xaw/RepeaterP.h delete mode 100644 nx-X11/lib/Xaw/Reports.h delete mode 100644 nx-X11/lib/Xaw/Scrollbar.c delete mode 100644 nx-X11/lib/Xaw/Scrollbar.h delete mode 100644 nx-X11/lib/Xaw/ScrollbarP.h delete mode 100644 nx-X11/lib/Xaw/Simple.c delete mode 100644 nx-X11/lib/Xaw/Simple.h delete mode 100644 nx-X11/lib/Xaw/SimpleMenP.h delete mode 100644 nx-X11/lib/Xaw/SimpleMenu.c delete mode 100644 nx-X11/lib/Xaw/SimpleMenu.h delete mode 100644 nx-X11/lib/Xaw/SimpleP.h delete mode 100644 nx-X11/lib/Xaw/Sme.c delete mode 100644 nx-X11/lib/Xaw/Sme.h delete mode 100644 nx-X11/lib/Xaw/SmeBSB.c delete mode 100644 nx-X11/lib/Xaw/SmeBSB.h delete mode 100644 nx-X11/lib/Xaw/SmeBSBP.h delete mode 100644 nx-X11/lib/Xaw/SmeLine.c delete mode 100644 nx-X11/lib/Xaw/SmeLine.h delete mode 100644 nx-X11/lib/Xaw/SmeLineP.h delete mode 100644 nx-X11/lib/Xaw/SmeP.h delete mode 100644 nx-X11/lib/Xaw/StripCharP.h delete mode 100644 nx-X11/lib/Xaw/StripChart.c delete mode 100644 nx-X11/lib/Xaw/StripChart.h delete mode 100644 nx-X11/lib/Xaw/Template.c delete mode 100644 nx-X11/lib/Xaw/Template.h delete mode 100644 nx-X11/lib/Xaw/TemplateP.h delete mode 100644 nx-X11/lib/Xaw/Text.c delete mode 100644 nx-X11/lib/Xaw/Text.h delete mode 100644 nx-X11/lib/Xaw/TextAction.c delete mode 100644 nx-X11/lib/Xaw/TextP.h delete mode 100644 nx-X11/lib/Xaw/TextPop.c delete mode 100644 nx-X11/lib/Xaw/TextSink.c delete mode 100644 nx-X11/lib/Xaw/TextSink.h delete mode 100644 nx-X11/lib/Xaw/TextSinkP.h delete mode 100644 nx-X11/lib/Xaw/TextSrc.c delete mode 100644 nx-X11/lib/Xaw/TextSrc.h delete mode 100644 nx-X11/lib/Xaw/TextSrcP.h delete mode 100644 nx-X11/lib/Xaw/TextTr.c delete mode 100644 nx-X11/lib/Xaw/Tip.c delete mode 100644 nx-X11/lib/Xaw/Tip.h delete mode 100644 nx-X11/lib/Xaw/TipP.h delete mode 100644 nx-X11/lib/Xaw/Toggle.c delete mode 100644 nx-X11/lib/Xaw/Toggle.h delete mode 100644 nx-X11/lib/Xaw/ToggleP.h delete mode 100644 nx-X11/lib/Xaw/Tree.c delete mode 100644 nx-X11/lib/Xaw/Tree.h delete mode 100644 nx-X11/lib/Xaw/TreeP.h delete mode 100644 nx-X11/lib/Xaw/Vendor.c delete mode 100644 nx-X11/lib/Xaw/VendorEP.h delete mode 100644 nx-X11/lib/Xaw/Viewport.c delete mode 100644 nx-X11/lib/Xaw/Viewport.h delete mode 100644 nx-X11/lib/Xaw/ViewportP.h delete mode 100644 nx-X11/lib/Xaw/Xaw-def.cpp delete mode 100644 nx-X11/lib/Xaw/Xaw.man delete mode 100644 nx-X11/lib/Xaw/XawI18n.c delete mode 100644 nx-X11/lib/Xaw/XawI18n.h delete mode 100644 nx-X11/lib/Xaw/XawIm.c delete mode 100644 nx-X11/lib/Xaw/XawImP.h delete mode 100644 nx-X11/lib/Xaw/XawInit.c delete mode 100644 nx-X11/lib/Xaw/XawInit.h delete mode 100644 nx-X11/lib/Xaw/genlist.sh delete mode 100644 nx-X11/lib/Xaw/jump_funcs delete mode 100644 nx-X11/lib/Xaw/jump_ignore delete mode 100644 nx-X11/lib/Xaw/jump_vars delete mode 100644 nx-X11/lib/Xaw/sharedlib.c delete mode 100644 nx-X11/lib/Xaw6/Imakefile delete mode 100644 nx-X11/lib/Xaw6/Xaw-def.cpp delete mode 100644 nx-X11/lib/Xaw7/Imakefile delete mode 100644 nx-X11/lib/Xaw7/Xaw-def.cpp delete mode 100644 nx-X11/lib/Xbsd/Berklib.c delete mode 100644 nx-X11/lib/Xbsd/Imakefile delete mode 100644 nx-X11/lib/Xevie/AUTHORS delete mode 100644 nx-X11/lib/Xevie/Imakefile delete mode 100644 nx-X11/lib/Xevie/Xevie.c delete mode 100644 nx-X11/lib/Xevie/Xevie.man delete mode 100644 nx-X11/lib/Xevie/xevie.pc.in delete mode 100644 nx-X11/lib/Xevie/xevieplaceholder.h delete mode 100644 nx-X11/lib/Xfontcache/FontCache.c delete mode 100644 nx-X11/lib/Xfontcache/Imakefile delete mode 100644 nx-X11/lib/Xfontcache/Xfontcache-def.cpp delete mode 100644 nx-X11/lib/Xfontcache/Xfontcache.man delete mode 100644 nx-X11/lib/Xft/AUTHORS delete mode 100644 nx-X11/lib/Xft/COPYING delete mode 100644 nx-X11/lib/Xft/ChangeLog delete mode 100644 nx-X11/lib/Xft/INSTALL delete mode 100644 nx-X11/lib/Xft/Imakefile delete mode 100644 nx-X11/lib/Xft/Makefile.am delete mode 100644 nx-X11/lib/Xft/Makefile.in delete mode 100644 nx-X11/lib/Xft/NEWS delete mode 100644 nx-X11/lib/Xft/README delete mode 100644 nx-X11/lib/Xft/Xft-def.cpp delete mode 100644 nx-X11/lib/Xft/Xft.3.in delete mode 100644 nx-X11/lib/Xft/Xft.h delete mode 100644 nx-X11/lib/Xft/XftCompat.h delete mode 100644 nx-X11/lib/Xft/aclocal.m4 delete mode 100755 nx-X11/lib/Xft/autogen.sh delete mode 100755 nx-X11/lib/Xft/config.guess delete mode 100644 nx-X11/lib/Xft/config.h.in delete mode 100755 nx-X11/lib/Xft/config.sub delete mode 100644 nx-X11/lib/Xft/config/config-subst delete mode 100755 nx-X11/lib/Xft/configure delete mode 100644 nx-X11/lib/Xft/configure.ac delete mode 100755 nx-X11/lib/Xft/depcomp delete mode 100755 nx-X11/lib/Xft/install-sh delete mode 100644 nx-X11/lib/Xft/ltmain.sh delete mode 100755 nx-X11/lib/Xft/missing delete mode 100755 nx-X11/lib/Xft/mkinstalldirs delete mode 100644 nx-X11/lib/Xft/xft-config.1.in delete mode 100644 nx-X11/lib/Xft/xft-config.in delete mode 100644 nx-X11/lib/Xft/xft.pc.in delete mode 100644 nx-X11/lib/Xft/xftcolor.c delete mode 100644 nx-X11/lib/Xft/xftcore.c delete mode 100644 nx-X11/lib/Xft/xftdbg.c delete mode 100644 nx-X11/lib/Xft/xftdpy.c delete mode 100644 nx-X11/lib/Xft/xftdraw.c delete mode 100644 nx-X11/lib/Xft/xftextent.c delete mode 100644 nx-X11/lib/Xft/xftfont.c delete mode 100644 nx-X11/lib/Xft/xftfreetype.c delete mode 100644 nx-X11/lib/Xft/xftglyphs.c delete mode 100644 nx-X11/lib/Xft/xftinit.c delete mode 100644 nx-X11/lib/Xft/xftint.h delete mode 100644 nx-X11/lib/Xft/xftlist.c delete mode 100644 nx-X11/lib/Xft/xftname.c delete mode 100644 nx-X11/lib/Xft/xftrender.c delete mode 100644 nx-X11/lib/Xft/xftstr.c delete mode 100644 nx-X11/lib/Xft/xftswap.c delete mode 100644 nx-X11/lib/Xft/xftxlfd.c delete mode 100644 nx-X11/lib/Xft1/Imakefile delete mode 100644 nx-X11/lib/Xft1/Xft-def.cpp delete mode 100644 nx-X11/lib/Xft1/Xft.h delete mode 100644 nx-X11/lib/Xft1/Xft.man delete mode 100644 nx-X11/lib/Xft1/XftConfig-OBSOLETE delete mode 100644 nx-X11/lib/Xft1/XftFreetype.h delete mode 100644 nx-X11/lib/Xft1/xftcache.c delete mode 100644 nx-X11/lib/Xft1/xftcfg.c delete mode 100644 nx-X11/lib/Xft1/xftcolor.c delete mode 100644 nx-X11/lib/Xft1/xftcore.c delete mode 100644 nx-X11/lib/Xft1/xftdbg.c delete mode 100644 nx-X11/lib/Xft1/xftdir.c delete mode 100644 nx-X11/lib/Xft1/xftdpy.c delete mode 100644 nx-X11/lib/Xft1/xftdraw.c delete mode 100644 nx-X11/lib/Xft1/xftextent.c delete mode 100644 nx-X11/lib/Xft1/xftfont.c delete mode 100644 nx-X11/lib/Xft1/xftfreetype.c delete mode 100644 nx-X11/lib/Xft1/xftfs.c delete mode 100644 nx-X11/lib/Xft1/xftglyphs.c delete mode 100644 nx-X11/lib/Xft1/xftgram.y delete mode 100644 nx-X11/lib/Xft1/xftinit.c delete mode 100644 nx-X11/lib/Xft1/xftint.h delete mode 100644 nx-X11/lib/Xft1/xftlex.l delete mode 100644 nx-X11/lib/Xft1/xftlist.c delete mode 100644 nx-X11/lib/Xft1/xftmatch.c delete mode 100644 nx-X11/lib/Xft1/xftmatrix.c delete mode 100644 nx-X11/lib/Xft1/xftname.c delete mode 100644 nx-X11/lib/Xft1/xftpat.c delete mode 100644 nx-X11/lib/Xft1/xftrender.c delete mode 100644 nx-X11/lib/Xft1/xftstr.c delete mode 100644 nx-X11/lib/Xft1/xftxlfd.c delete mode 100644 nx-X11/lib/Xi/Imakefile delete mode 100644 nx-X11/lib/Xi/XAllowDv.c delete mode 100644 nx-X11/lib/Xi/XChgDCtl.c delete mode 100644 nx-X11/lib/Xi/XChgFCtl.c delete mode 100644 nx-X11/lib/Xi/XChgKMap.c delete mode 100644 nx-X11/lib/Xi/XChgKbd.c delete mode 100644 nx-X11/lib/Xi/XChgPnt.c delete mode 100644 nx-X11/lib/Xi/XChgProp.c delete mode 100644 nx-X11/lib/Xi/XCloseDev.c delete mode 100644 nx-X11/lib/Xi/XDevBell.c delete mode 100644 nx-X11/lib/Xi/XExtInt.c delete mode 100644 nx-X11/lib/Xi/XExtToWire.c delete mode 100644 nx-X11/lib/Xi/XFreeLst.c delete mode 100644 nx-X11/lib/Xi/XGMotion.c delete mode 100644 nx-X11/lib/Xi/XGetBMap.c delete mode 100644 nx-X11/lib/Xi/XGetDCtl.c delete mode 100644 nx-X11/lib/Xi/XGetFCtl.c delete mode 100644 nx-X11/lib/Xi/XGetKMap.c delete mode 100644 nx-X11/lib/Xi/XGetMMap.c delete mode 100644 nx-X11/lib/Xi/XGetProp.c delete mode 100644 nx-X11/lib/Xi/XGetVers.c delete mode 100644 nx-X11/lib/Xi/XGrDvBut.c delete mode 100644 nx-X11/lib/Xi/XGrDvKey.c delete mode 100644 nx-X11/lib/Xi/XGrabDev.c delete mode 100644 nx-X11/lib/Xi/XGtFocus.c delete mode 100644 nx-X11/lib/Xi/XGtSelect.c delete mode 100644 nx-X11/lib/Xi/XIint.h delete mode 100644 nx-X11/lib/Xi/XListDev.c delete mode 100644 nx-X11/lib/Xi/XOpenDev.c delete mode 100644 nx-X11/lib/Xi/XQueryDv.c delete mode 100644 nx-X11/lib/Xi/XSelect.c delete mode 100644 nx-X11/lib/Xi/XSetBMap.c delete mode 100644 nx-X11/lib/Xi/XSetDVal.c delete mode 100644 nx-X11/lib/Xi/XSetMMap.c delete mode 100644 nx-X11/lib/Xi/XSetMode.c delete mode 100644 nx-X11/lib/Xi/XSndExEv.c delete mode 100644 nx-X11/lib/Xi/XStFocus.c delete mode 100644 nx-X11/lib/Xi/XUngrDev.c delete mode 100644 nx-X11/lib/Xi/XUngrDvB.c delete mode 100644 nx-X11/lib/Xi/XUngrDvK.c delete mode 100644 nx-X11/lib/Xi/Xi-def.cpp delete mode 100644 nx-X11/lib/Xmu/AllCmap.c delete mode 100644 nx-X11/lib/Xmu/Atoms.c delete mode 100644 nx-X11/lib/Xmu/Atoms.h delete mode 100644 nx-X11/lib/Xmu/CharSet.h delete mode 100644 nx-X11/lib/Xmu/ClientWin.c delete mode 100644 nx-X11/lib/Xmu/Clip.c delete mode 100644 nx-X11/lib/Xmu/CloseHook.c delete mode 100644 nx-X11/lib/Xmu/CloseHook.h delete mode 100644 nx-X11/lib/Xmu/CmapAlloc.c delete mode 100644 nx-X11/lib/Xmu/Converters.h delete mode 100644 nx-X11/lib/Xmu/CrCmap.c delete mode 100644 nx-X11/lib/Xmu/CrPixFBit.c delete mode 100644 nx-X11/lib/Xmu/CurUtil.h delete mode 100644 nx-X11/lib/Xmu/CursorName.c delete mode 100644 nx-X11/lib/Xmu/CvtCache.c delete mode 100644 nx-X11/lib/Xmu/CvtCache.h delete mode 100644 nx-X11/lib/Xmu/CvtStdSel.c delete mode 100644 nx-X11/lib/Xmu/DefErrMsg.c delete mode 100644 nx-X11/lib/Xmu/DelCmap.c delete mode 100644 nx-X11/lib/Xmu/DisplayQue.c delete mode 100644 nx-X11/lib/Xmu/DisplayQue.h delete mode 100644 nx-X11/lib/Xmu/Distinct.c delete mode 100644 nx-X11/lib/Xmu/DrRndRect.c delete mode 100644 nx-X11/lib/Xmu/DrawLogo.c delete mode 100644 nx-X11/lib/Xmu/Drawing.h delete mode 100644 nx-X11/lib/Xmu/Editres.h delete mode 100644 nx-X11/lib/Xmu/EditresCom.c delete mode 100644 nx-X11/lib/Xmu/EditresP.h delete mode 100644 nx-X11/lib/Xmu/Error.h delete mode 100644 nx-X11/lib/Xmu/ExtAgent.c delete mode 100644 nx-X11/lib/Xmu/ExtAgent.h delete mode 100644 nx-X11/lib/Xmu/FToCback.c delete mode 100644 nx-X11/lib/Xmu/GetHost.c delete mode 100644 nx-X11/lib/Xmu/GrayPixmap.c delete mode 100644 nx-X11/lib/Xmu/Imakefile delete mode 100644 nx-X11/lib/Xmu/Initer.c delete mode 100644 nx-X11/lib/Xmu/Initer.h delete mode 100644 nx-X11/lib/Xmu/LocBitmap.c delete mode 100644 nx-X11/lib/Xmu/Lookup.c delete mode 100644 nx-X11/lib/Xmu/Lookup.h delete mode 100644 nx-X11/lib/Xmu/LookupCmap.c delete mode 100644 nx-X11/lib/Xmu/Lower.c delete mode 100644 nx-X11/lib/Xmu/Misc.h delete mode 100644 nx-X11/lib/Xmu/README delete mode 100644 nx-X11/lib/Xmu/RdBitF.c delete mode 100644 nx-X11/lib/Xmu/ScrOfWin.c delete mode 100644 nx-X11/lib/Xmu/ShapeWidg.c delete mode 100644 nx-X11/lib/Xmu/StdCmap.c delete mode 100644 nx-X11/lib/Xmu/StdCmap.h delete mode 100644 nx-X11/lib/Xmu/StdSel.h delete mode 100644 nx-X11/lib/Xmu/StrToBS.c delete mode 100644 nx-X11/lib/Xmu/StrToBmap.c delete mode 100644 nx-X11/lib/Xmu/StrToCurs.c delete mode 100644 nx-X11/lib/Xmu/StrToGrav.c delete mode 100644 nx-X11/lib/Xmu/StrToJust.c delete mode 100644 nx-X11/lib/Xmu/StrToLong.c delete mode 100644 nx-X11/lib/Xmu/StrToOrnt.c delete mode 100644 nx-X11/lib/Xmu/StrToShap.c delete mode 100644 nx-X11/lib/Xmu/StrToWidg.c delete mode 100644 nx-X11/lib/Xmu/SysUtil.h delete mode 100644 nx-X11/lib/Xmu/UpdMapHint.c delete mode 100644 nx-X11/lib/Xmu/VisCmap.c delete mode 100644 nx-X11/lib/Xmu/WhitePoint.h delete mode 100644 nx-X11/lib/Xmu/WidgetNode.c delete mode 100644 nx-X11/lib/Xmu/WidgetNode.h delete mode 100644 nx-X11/lib/Xmu/WinUtil.h delete mode 100644 nx-X11/lib/Xmu/Xct.c delete mode 100644 nx-X11/lib/Xmu/Xct.h delete mode 100644 nx-X11/lib/Xmu/Xmu-def.cpp delete mode 100644 nx-X11/lib/Xmu/Xmu.h delete mode 100644 nx-X11/lib/Xmu/sharedlib.c delete mode 100644 nx-X11/lib/Xmuu/Imakefile delete mode 100644 nx-X11/lib/Xmuu/Xmuu-def.cpp delete mode 100644 nx-X11/lib/Xp/Imakefile delete mode 100644 nx-X11/lib/Xp/Xp-def.cpp delete mode 100644 nx-X11/lib/Xp/XpAttr.c delete mode 100644 nx-X11/lib/Xp/XpContext.c delete mode 100644 nx-X11/lib/Xp/XpDoc.c delete mode 100644 nx-X11/lib/Xp/XpExtUtil.c delete mode 100644 nx-X11/lib/Xp/XpExtUtil.h delete mode 100644 nx-X11/lib/Xp/XpExtVer.c delete mode 100644 nx-X11/lib/Xp/XpGetData.c delete mode 100644 nx-X11/lib/Xp/XpImageRes.c delete mode 100644 nx-X11/lib/Xp/XpInput.c delete mode 100644 nx-X11/lib/Xp/XpJob.c delete mode 100644 nx-X11/lib/Xp/XpLocale.c delete mode 100644 nx-X11/lib/Xp/XpNotifyPdm.c delete mode 100644 nx-X11/lib/Xp/XpPage.c delete mode 100644 nx-X11/lib/Xp/XpPageDim.c delete mode 100644 nx-X11/lib/Xp/XpPrinter.c delete mode 100644 nx-X11/lib/Xp/XpPutData.c delete mode 100644 nx-X11/lib/Xp/XpScreens.c delete mode 100644 nx-X11/lib/XprintAppUtil/Imakefile delete mode 100644 nx-X11/lib/XprintAppUtil/xpapputil.c delete mode 100644 nx-X11/lib/XprintAppUtil/xpapputil.h delete mode 100644 nx-X11/lib/XprintUtil/Imakefile delete mode 100644 nx-X11/lib/XprintUtil/xprintutil.c delete mode 100644 nx-X11/lib/XprintUtil/xprintutil.h delete mode 100644 nx-X11/lib/XprintUtil/xprintutil_printtofile.c delete mode 100644 nx-X11/lib/Xss/Imakefile delete mode 100644 nx-X11/lib/Xss/XScrnSaver.c delete mode 100644 nx-X11/lib/Xss/Xss-def.cpp delete mode 100644 nx-X11/lib/Xss/Xss.man delete mode 100644 nx-X11/lib/Xt/ActionHook.c delete mode 100644 nx-X11/lib/Xt/Alloc.c delete mode 100644 nx-X11/lib/Xt/ArgList.c delete mode 100644 nx-X11/lib/Xt/Callback.c delete mode 100644 nx-X11/lib/Xt/CallbackI.h delete mode 100644 nx-X11/lib/Xt/ClickTime.c delete mode 100644 nx-X11/lib/Xt/Composite.c delete mode 100644 nx-X11/lib/Xt/Composite.h delete mode 100644 nx-X11/lib/Xt/CompositeP.h delete mode 100644 nx-X11/lib/Xt/ConstrainP.h delete mode 100644 nx-X11/lib/Xt/Constraint.c delete mode 100644 nx-X11/lib/Xt/Constraint.h delete mode 100644 nx-X11/lib/Xt/Convert.c delete mode 100644 nx-X11/lib/Xt/ConvertI.h delete mode 100644 nx-X11/lib/Xt/Converters.c delete mode 100644 nx-X11/lib/Xt/Core.c delete mode 100644 nx-X11/lib/Xt/Core.h delete mode 100644 nx-X11/lib/Xt/CoreP.h delete mode 100644 nx-X11/lib/Xt/Create.c delete mode 100644 nx-X11/lib/Xt/CreateI.h delete mode 100644 nx-X11/lib/Xt/Destroy.c delete mode 100644 nx-X11/lib/Xt/Display.c delete mode 100644 nx-X11/lib/Xt/Error.c delete mode 100644 nx-X11/lib/Xt/Event.c delete mode 100644 nx-X11/lib/Xt/EventI.h delete mode 100644 nx-X11/lib/Xt/EventUtil.c delete mode 100644 nx-X11/lib/Xt/Functions.c delete mode 100644 nx-X11/lib/Xt/GCManager.c delete mode 100644 nx-X11/lib/Xt/Geometry.c delete mode 100644 nx-X11/lib/Xt/GetActKey.c delete mode 100644 nx-X11/lib/Xt/GetResList.c delete mode 100644 nx-X11/lib/Xt/GetValues.c delete mode 100644 nx-X11/lib/Xt/HookObj.c delete mode 100644 nx-X11/lib/Xt/HookObjI.h delete mode 100644 nx-X11/lib/Xt/Hooks.c delete mode 100644 nx-X11/lib/Xt/Imakefile delete mode 100644 nx-X11/lib/Xt/Imakefile.NX.original delete mode 100644 nx-X11/lib/Xt/Imakefile.X.original delete mode 100644 nx-X11/lib/Xt/InitialI.h delete mode 100644 nx-X11/lib/Xt/Initialize.c delete mode 100644 nx-X11/lib/Xt/Intrinsic.c delete mode 100644 nx-X11/lib/Xt/Intrinsic.h delete mode 100644 nx-X11/lib/Xt/IntrinsicI.h delete mode 100644 nx-X11/lib/Xt/IntrinsicP.h delete mode 100644 nx-X11/lib/Xt/Keyboard.c delete mode 100644 nx-X11/lib/Xt/Manage.c delete mode 100644 nx-X11/lib/Xt/NextEvent.c delete mode 100644 nx-X11/lib/Xt/NextEvent.c.NX.original delete mode 100644 nx-X11/lib/Xt/NextEvent.c.X.original delete mode 100644 nx-X11/lib/Xt/Object.c delete mode 100644 nx-X11/lib/Xt/Object.h delete mode 100644 nx-X11/lib/Xt/ObjectP.h delete mode 100644 nx-X11/lib/Xt/PassivGraI.h delete mode 100644 nx-X11/lib/Xt/PassivGrab.c delete mode 100644 nx-X11/lib/Xt/Pointer.c delete mode 100644 nx-X11/lib/Xt/Popup.c delete mode 100644 nx-X11/lib/Xt/PopupCB.c delete mode 100644 nx-X11/lib/Xt/RectObj.c delete mode 100644 nx-X11/lib/Xt/RectObj.h delete mode 100644 nx-X11/lib/Xt/RectObjP.h delete mode 100644 nx-X11/lib/Xt/ResConfig.c delete mode 100644 nx-X11/lib/Xt/ResConfigP.h delete mode 100644 nx-X11/lib/Xt/ResourceI.h delete mode 100644 nx-X11/lib/Xt/Resources.c delete mode 100644 nx-X11/lib/Xt/Selection.c delete mode 100644 nx-X11/lib/Xt/SelectionI.h delete mode 100644 nx-X11/lib/Xt/SetSens.c delete mode 100644 nx-X11/lib/Xt/SetValues.c delete mode 100644 nx-X11/lib/Xt/SetWMCW.c delete mode 100644 nx-X11/lib/Xt/Shell.c delete mode 100644 nx-X11/lib/Xt/ShellI.h delete mode 100644 nx-X11/lib/Xt/ShellP.h delete mode 100644 nx-X11/lib/Xt/TMaction.c delete mode 100644 nx-X11/lib/Xt/TMgrab.c delete mode 100644 nx-X11/lib/Xt/TMkey.c delete mode 100644 nx-X11/lib/Xt/TMparse.c delete mode 100644 nx-X11/lib/Xt/TMprint.c delete mode 100644 nx-X11/lib/Xt/TMstate.c delete mode 100644 nx-X11/lib/Xt/Threads.c delete mode 100644 nx-X11/lib/Xt/ThreadsI.h delete mode 100644 nx-X11/lib/Xt/TranslateI.h delete mode 100644 nx-X11/lib/Xt/VarCreate.c delete mode 100644 nx-X11/lib/Xt/VarGet.c delete mode 100644 nx-X11/lib/Xt/Varargs.c delete mode 100644 nx-X11/lib/Xt/VarargsI.h delete mode 100644 nx-X11/lib/Xt/Vendor.c delete mode 100644 nx-X11/lib/Xt/Vendor.h delete mode 100644 nx-X11/lib/Xt/VendorP.h delete mode 100644 nx-X11/lib/Xt/Xt-def.cpp delete mode 100644 nx-X11/lib/Xt/Xtos.h delete mode 100644 nx-X11/lib/Xt/jump_funcs delete mode 100644 nx-X11/lib/Xt/jump_ignore delete mode 100644 nx-X11/lib/Xt/jump_vars delete mode 100644 nx-X11/lib/Xt/libXt.elist delete mode 100644 nx-X11/lib/Xt/sharedlib.c delete mode 100644 nx-X11/lib/Xt/util/Shell.ht delete mode 100644 nx-X11/lib/Xt/util/StrDefs.ct delete mode 100644 nx-X11/lib/Xt/util/StrDefs.ht delete mode 100644 nx-X11/lib/Xt/util/string.list delete mode 100644 nx-X11/lib/Xv/Imakefile delete mode 100644 nx-X11/lib/Xv/Xv-def.cpp delete mode 100644 nx-X11/lib/Xv/Xv.c delete mode 100644 nx-X11/lib/Xv/Xvlibint.h delete mode 100644 nx-X11/lib/XvMC/Imakefile delete mode 100644 nx-X11/lib/XvMC/XvMC-def.cpp delete mode 100644 nx-X11/lib/XvMC/XvMC.c delete mode 100644 nx-X11/lib/XvMC/XvMClibint.h delete mode 100644 nx-X11/lib/XvMC/hw/i810/I810XvMC.c delete mode 100644 nx-X11/lib/XvMC/hw/i810/I810XvMC.h delete mode 100644 nx-X11/lib/XvMC/hw/i810/Imakefile delete mode 100644 nx-X11/lib/XvMC/hw/via/driDrawable.c delete mode 100644 nx-X11/lib/XvMC/hw/via/driDrawable.h delete mode 100644 nx-X11/lib/XvMC/hw/via/unichrome/Imakefile delete mode 100644 nx-X11/lib/XvMC/hw/via/unichrome/viaLowLevel.c delete mode 100644 nx-X11/lib/XvMC/hw/via/unichromeProA/Imakefile delete mode 100644 nx-X11/lib/XvMC/hw/via/unichromeProA/viaLowLevelPro.c delete mode 100644 nx-X11/lib/XvMC/hw/via/viaLowLevel.h delete mode 100644 nx-X11/lib/XvMC/hw/via/viaXvMC.c delete mode 100644 nx-X11/lib/XvMC/hw/via/viaXvMCPriv.h delete mode 100644 nx-X11/lib/XvMC/hw/via/xf86dri.c delete mode 100644 nx-X11/lib/XvMC/hw/via/xf86dri.h delete mode 100644 nx-X11/lib/XvMC/hw/via/xf86dristr.h delete mode 100644 nx-X11/lib/XvMC/wrapper/Imakefile delete mode 100644 nx-X11/lib/XvMC/wrapper/XvMCWrapper.c delete mode 100644 nx-X11/lib/apple/AppleWM.man delete mode 100644 nx-X11/lib/apple/Imakefile delete mode 100644 nx-X11/lib/apple/applewm.c delete mode 100644 nx-X11/lib/apple/applewm.h delete mode 100644 nx-X11/lib/apple/applewmstr.h delete mode 100644 nx-X11/lib/dmx/Imakefile delete mode 100644 nx-X11/lib/dmx/dmx.c delete mode 100644 nx-X11/lib/dps/DPSCAP.h delete mode 100644 nx-X11/lib/dps/DPSCAPClient.h delete mode 100644 nx-X11/lib/dps/DPSCAPproto.h delete mode 100644 nx-X11/lib/dps/Imakefile delete mode 100644 nx-X11/lib/dps/XDPS.c delete mode 100644 nx-X11/lib/dps/Xlibnet.h delete mode 100644 nx-X11/lib/dps/Xstreams.h delete mode 100644 nx-X11/lib/dps/csconndi.c delete mode 100644 nx-X11/lib/dps/csfindNX.c delete mode 100644 nx-X11/lib/dps/csfindNX.h delete mode 100644 nx-X11/lib/dps/cslibext.c delete mode 100644 nx-X11/lib/dps/cslibint.c delete mode 100644 nx-X11/lib/dps/cslibint.h delete mode 100644 nx-X11/lib/dps/csopendi.c delete mode 100644 nx-X11/lib/dps/csstartNX.c delete mode 100644 nx-X11/lib/dps/csstartNX.h delete mode 100644 nx-X11/lib/dps/dps-def.cpp delete mode 100644 nx-X11/lib/dps/dpsNXprops.h delete mode 100644 nx-X11/lib/dps/dpsXclient.c delete mode 100644 nx-X11/lib/dps/dpsXcmu.c delete mode 100644 nx-X11/lib/dps/dpsXint.h delete mode 100644 nx-X11/lib/dps/dpsXops.psw delete mode 100644 nx-X11/lib/dps/dpsXpriv.c delete mode 100644 nx-X11/lib/dps/dpsXpriv.h delete mode 100644 nx-X11/lib/dps/dpsXtdisp.c delete mode 100644 nx-X11/lib/dps/dpsabbrev.c delete mode 100644 nx-X11/lib/dps/dpsassert.h delete mode 100644 nx-X11/lib/dps/dpsclient.c delete mode 100644 nx-X11/lib/dps/dpsclrops.psw delete mode 100644 nx-X11/lib/dps/dpsctrlops.psw delete mode 100644 nx-X11/lib/dps/dpsctxtops.psw delete mode 100644 nx-X11/lib/dps/dpsdataops.psw delete mode 100644 nx-X11/lib/dps/dpsdict.c delete mode 100644 nx-X11/lib/dps/dpsdict.h delete mode 100644 nx-X11/lib/dps/dpsendif.txt delete mode 100644 nx-X11/lib/dps/dpsexcept.c delete mode 100644 nx-X11/lib/dps/dpsfontops.psw delete mode 100644 nx-X11/lib/dps/dpsgsttops.psw delete mode 100644 nx-X11/lib/dps/dpsifdef.txt delete mode 100644 nx-X11/lib/dps/dpsint.h delete mode 100644 nx-X11/lib/dps/dpsioops.psw delete mode 100644 nx-X11/lib/dps/dpsl2ops.psw delete mode 100644 nx-X11/lib/dps/dpsmathops.psw delete mode 100644 nx-X11/lib/dps/dpsmiscops.psw delete mode 100644 nx-X11/lib/dps/dpsmtrxops.psw delete mode 100644 nx-X11/lib/dps/dpsname.txt delete mode 100644 nx-X11/lib/dps/dpsopstack.psw delete mode 100644 nx-X11/lib/dps/dpspathops.psw delete mode 100644 nx-X11/lib/dps/dpspntops.psw delete mode 100644 nx-X11/lib/dps/dpsprintf.c delete mode 100644 nx-X11/lib/dps/dpsprivate.h delete mode 100644 nx-X11/lib/dps/dpssimpint.h delete mode 100644 nx-X11/lib/dps/dpssysnames.c delete mode 100644 nx-X11/lib/dps/dpssysops.psw delete mode 100644 nx-X11/lib/dps/dpswinops.psw delete mode 100644 nx-X11/lib/dps/else.txt delete mode 100644 nx-X11/lib/dps/genheader.cmd delete mode 100644 nx-X11/lib/dps/header.txt delete mode 100644 nx-X11/lib/dps/psXops.psw delete mode 100644 nx-X11/lib/dps/psclrops.psw delete mode 100644 nx-X11/lib/dps/psctrlops.psw delete mode 100644 nx-X11/lib/dps/psctxtops.psw delete mode 100644 nx-X11/lib/dps/psdataops.psw delete mode 100644 nx-X11/lib/dps/psendif.txt delete mode 100644 nx-X11/lib/dps/psfontops.psw delete mode 100644 nx-X11/lib/dps/psgsttops.psw delete mode 100644 nx-X11/lib/dps/psifdef.txt delete mode 100644 nx-X11/lib/dps/psioops.psw delete mode 100644 nx-X11/lib/dps/psl2ops.psw delete mode 100644 nx-X11/lib/dps/psmathops.psw delete mode 100644 nx-X11/lib/dps/psmiscops.psw delete mode 100644 nx-X11/lib/dps/psmtrxops.psw delete mode 100644 nx-X11/lib/dps/psname.txt delete mode 100644 nx-X11/lib/dps/psopstack.psw delete mode 100644 nx-X11/lib/dps/pspathops.psw delete mode 100644 nx-X11/lib/dps/pspntops.psw delete mode 100644 nx-X11/lib/dps/pssysops.psw delete mode 100644 nx-X11/lib/dps/pswinops.psw delete mode 100644 nx-X11/lib/dps/publictypes.h delete mode 100644 nx-X11/lib/dpstk/CSBwraps.psw delete mode 100644 nx-X11/lib/dpstk/ColorSB.c delete mode 100644 nx-X11/lib/dpstk/ColorSelect.ad delete mode 100644 nx-X11/lib/dpstk/DPSScrollW.c delete mode 100644 nx-X11/lib/dpstk/DSWwraps.psw delete mode 100644 nx-X11/lib/dpstk/FSBwraps.psw delete mode 100644 nx-X11/lib/dpstk/FontCreato.c delete mode 100644 nx-X11/lib/dpstk/FontSB.c delete mode 100644 nx-X11/lib/dpstk/FontSBI.h delete mode 100644 nx-X11/lib/dpstk/FontSample.c delete mode 100644 nx-X11/lib/dpstk/FontSelect.ad delete mode 100644 nx-X11/lib/dpstk/Imakefile delete mode 100644 nx-X11/lib/dpstk/XDPSpreview.c delete mode 100644 nx-X11/lib/dpstk/XDPSpwraps.psw delete mode 100644 nx-X11/lib/dpstk/XDPSshare.c delete mode 100644 nx-X11/lib/dpstk/XDPSswraps.psw delete mode 100644 nx-X11/lib/dpstk/XDPSuserpath.c delete mode 100644 nx-X11/lib/dpstk/dpsXcommonI.h delete mode 100644 nx-X11/lib/dpstk/dpstk-def.cpp delete mode 100644 nx-X11/lib/dpstk/eyedrop16.xbm delete mode 100644 nx-X11/lib/dpstk/eyedrop32.xbm delete mode 100644 nx-X11/lib/dpstk/eyedropmask16.xbm delete mode 100644 nx-X11/lib/dpstk/eyedropmask32.xbm delete mode 100644 nx-X11/lib/dpstk/heyedrop.xbm delete mode 100644 nx-X11/lib/dpstk/square.xbm delete mode 100644 nx-X11/lib/dpstk/squaremask.xbm delete mode 100644 nx-X11/lib/expat/Imakefile delete mode 100644 nx-X11/lib/expat/expat-def.cpp delete mode 100644 nx-X11/lib/expat/expat_config.h delete mode 100644 nx-X11/lib/font/FreeType/Imakefile delete mode 100644 nx-X11/lib/font/FreeType/ft.h delete mode 100644 nx-X11/lib/font/FreeType/ftenc.c delete mode 100644 nx-X11/lib/font/FreeType/ftfuncs.c delete mode 100644 nx-X11/lib/font/FreeType/ftfuncs.h delete mode 100644 nx-X11/lib/font/FreeType/ftsystem.c delete mode 100644 nx-X11/lib/font/FreeType/fttools.c delete mode 100644 nx-X11/lib/font/FreeType/module/Imakefile delete mode 100644 nx-X11/lib/font/FreeType/module/ft2build.h delete mode 100644 nx-X11/lib/font/FreeType/module/ftheader.h delete mode 100644 nx-X11/lib/font/FreeType/module/ftmodule.c delete mode 100644 nx-X11/lib/font/FreeType/module/ftmodule.h delete mode 100644 nx-X11/lib/font/FreeType/module/ftoption.h delete mode 100644 nx-X11/lib/font/FreeType/module/ftstdlib.h delete mode 100644 nx-X11/lib/font/FreeType/module/fttypes.h delete mode 100644 nx-X11/lib/font/FreeType/module/myftstdlib.h delete mode 100644 nx-X11/lib/font/FreeType/xttcap.c delete mode 100644 nx-X11/lib/font/FreeType/xttcap.h delete mode 100644 nx-X11/lib/font/include/fontenc.h delete mode 100644 nx-X11/lib/fontconfig/Imakefile delete mode 100644 nx-X11/lib/fontconfig/config-subst delete mode 100644 nx-X11/lib/fontconfig/fcfreetype.c delete mode 100644 nx-X11/lib/fontenc/Imakefile delete mode 100644 nx-X11/lib/fontenc/fontenc-def.cpp delete mode 100644 nx-X11/lib/freetype2/Imakefile delete mode 100644 nx-X11/lib/freetype2/freetype-def.cpp delete mode 100644 nx-X11/lib/freetype2/freetype/Imakefile delete mode 100644 nx-X11/lib/freetype2/freetype/cache/Imakefile delete mode 100644 nx-X11/lib/freetype2/freetype/config/Imakefile delete mode 100644 nx-X11/lib/freetype2/freetype/internal/Imakefile delete mode 100644 nx-X11/lib/freetype2/freetype/internal/services/Imakefile delete mode 100644 nx-X11/lib/lbxutil/Imakefile delete mode 100644 nx-X11/lib/lbxutil/delta/Imakefile delete mode 100644 nx-X11/lib/lbxutil/delta/lbxdelta.c delete mode 100644 nx-X11/lib/lbxutil/image/Imakefile delete mode 100644 nx-X11/lib/lbxutil/image/dfaxg42d.c delete mode 100644 nx-X11/lib/lbxutil/image/dpackbits.c delete mode 100644 nx-X11/lib/lbxutil/image/efaxg42d.c delete mode 100644 nx-X11/lib/lbxutil/image/epackbits.c delete mode 100644 nx-X11/lib/lbxutil/image/lbxbwcodes.h delete mode 100644 nx-X11/lib/lbxutil/image/lbxfax.h delete mode 100644 nx-X11/lib/lbxutil/image/misc.c delete mode 100644 nx-X11/lib/lbxutil/image/mkg3states.c delete mode 100644 nx-X11/lib/lbxutil/lbx_zlib/Imakefile delete mode 100644 nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib.c delete mode 100644 nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib.h delete mode 100644 nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib_io.c delete mode 100644 nx-X11/lib/lbxutil/lbx_zlib/reqstats.c delete mode 100644 nx-X11/lib/lbxutil/lbx_zlib/reqstats.h delete mode 100644 nx-X11/lib/misc/snprintf.c delete mode 100644 nx-X11/lib/misc/snprintf.h delete mode 100644 nx-X11/lib/psres/Imakefile delete mode 100644 nx-X11/lib/psres/PSres.c delete mode 100644 nx-X11/lib/psres/psres-def.cpp delete mode 100644 nx-X11/lib/regex/Imakefile delete mode 100644 nx-X11/lib/windows/Imakefile delete mode 100755 nx-X11/lib/windows/WindowsWM-def.cpp delete mode 100644 nx-X11/lib/windows/WindowsWM.man delete mode 100755 nx-X11/lib/windows/windowswm.c delete mode 100755 nx-X11/lib/windows/windowswm.h delete mode 100755 nx-X11/lib/windows/windowswmstr.h delete mode 100644 nx-X11/lib/zlib/Imakefile (limited to 'nx-X11/lib') diff --git a/nx-X11/lib/FS/FS-def.cpp b/nx-X11/lib/FS/FS-def.cpp deleted file mode 100644 index fd1511263..000000000 --- a/nx-X11/lib/FS/FS-def.cpp +++ /dev/null @@ -1,38 +0,0 @@ -LIBRARY FS -VERSION LIBRARY_VERSION -EXPORTS - FSErrorList DATA - FSErrorListSize DATA - FSCloseFont - FSCloseServer - FSFlush - FSFree - FSFreeCatalogues - FSFreeExtensionList - FSFreeFontNames - FSGetCatalogues - FSGetErrorDatabaseText - FSGetErrorText - FSListCatalogues - FSListExtensions - FSListFonts - FSListFontsWithXInfo - FSMalloc - FSMaxRequestSize - FSNextEvent - FSOpenBitmapFont - FSOpenServer - FSQueryExtension - FSQueryXBitmaps16 - FSQueryXBitmaps8 - FSQueryXExtents16 - FSQueryXExtents8 - FSQueryXInfo - FSServerName - FSSetAfterFunction - FSSetCatalogues - FSSetErrorHandler - FSSetIOErrorHandler - FSSync - FSSynchronize -/* $XFree86$ */ diff --git a/nx-X11/lib/FS/FSClServ.c b/nx-X11/lib/FS/FSClServ.c deleted file mode 100644 index 1866cfcd5..000000000 --- a/nx-X11/lib/FS/FSClServ.c +++ /dev/null @@ -1,93 +0,0 @@ -/* $Xorg: FSClServ.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* @(#)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.4 2001/01/17 19:41:27 dawes Exp $ */ - -/* - -Copyright 1987, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#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/nx-X11/lib/FS/FSCloseFt.c b/nx-X11/lib/FS/FSCloseFt.c deleted file mode 100644 index 38ce7e6b8..000000000 --- a/nx-X11/lib/FS/FSCloseFt.c +++ /dev/null @@ -1,70 +0,0 @@ -/* $Xorg: FSCloseFt.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* @(#)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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#include "FSlibint.h" - - -int -FSCloseFont(svr, fid) - FSServer *svr; - Font fid; -{ - fsResourceReq *req; - - GetResReq(CloseFont, fid, req); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/FS/FSConnServ.c b/nx-X11/lib/FS/FSConnServ.c deleted file mode 100644 index 6a66d87a5..000000000 --- a/nx-X11/lib/FS/FSConnServ.c +++ /dev/null @@ -1,247 +0,0 @@ -/* $Xorg: FSConnServ.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* - * 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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.10 2001/10/28 03:32:27 tsi Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "FSlibint.h" -#include -#include "X11/Xpoll.h" -#ifdef NCD -#include -#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 - -/* - * 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 = NULL; /* 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); -} - - -/* - * 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 { - nfound = Select(svr->fd + 1, &r_mask, &w_mask, NULL, NULL); - 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); - result = Select(svr->fd + 1, &r_mask, NULL, NULL, NULL); - 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/nx-X11/lib/FS/FSErrDis.c b/nx-X11/lib/FS/FSErrDis.c deleted file mode 100644 index cc4abf4b0..000000000 --- a/nx-X11/lib/FS/FSErrDis.c +++ /dev/null @@ -1,121 +0,0 @@ -/* $Xorg: FSErrDis.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* @(#)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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#include -#include "FSlibint.h" -#include - -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/nx-X11/lib/FS/FSErrHndlr.c b/nx-X11/lib/FS/FSErrHndlr.c deleted file mode 100644 index 592fa4896..000000000 --- a/nx-X11/lib/FS/FSErrHndlr.c +++ /dev/null @@ -1,84 +0,0 @@ -/* $Xorg: FSErrHndlr.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* @(#)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.4 2001/01/17 19:41:28 dawes Exp $ */ - -/* - -Copyright 1987, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#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/nx-X11/lib/FS/FSFlush.c b/nx-X11/lib/FS/FSFlush.c deleted file mode 100644 index e4b14390b..000000000 --- a/nx-X11/lib/FS/FSFlush.c +++ /dev/null @@ -1,63 +0,0 @@ -/* $Xorg: FSFlush.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* @(#)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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#include "FSlibint.h" - -int FSFlush(svr) - FSServer *svr; -{ - _FSFlush(svr); - return 1; -} diff --git a/nx-X11/lib/FS/FSFontInfo.c b/nx-X11/lib/FS/FSFontInfo.c deleted file mode 100644 index d79ad9e26..000000000 --- a/nx-X11/lib/FS/FSFontInfo.c +++ /dev/null @@ -1,346 +0,0 @@ -/* $Xorg: FSFontInfo.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ -/* - * 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/FSFontInfo.c,v 1.5tsi Exp $ */ - -/* - -Copyright 1987, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#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; - size_t 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) { - - if (reply.nReplies > SIZE_MAX - i - 1) - goto badmem; - size = i + reply.nReplies + 1; - - if (size > SIZE_MAX / sizeof(char *)) - goto badmem; - - 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; - -#if SIZE_MAX <= UINT_MAX - if (pi[i]->num_offsets > SIZE_MAX / sizeof(FSPropOffset)) - goto badmem; -#endif - - 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; jnum_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)); - } - /* avoid integer overflow */ - if (i > INT_MAX - 1) { - goto badmem; - } - } - *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/nx-X11/lib/FS/FSFtNames.c b/nx-X11/lib/FS/FSFtNames.c deleted file mode 100644 index 2d512e41c..000000000 --- a/nx-X11/lib/FS/FSFtNames.c +++ /dev/null @@ -1,131 +0,0 @@ -/* $Xorg: FSFtNames.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ -/* - * 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/FSFtNames.c,v 1.6tsi Exp $ */ - -/* - -Copyright 1987, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#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 -#if (SIZE_MAX >> 2) <= UINT_MAX - && rep.nFonts <= SIZE_MAX / sizeof(char *) - && rep.length <= (SIZE_MAX >> 2) -#endif - ) { - 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/nx-X11/lib/FS/FSGetCats.c b/nx-X11/lib/FS/FSGetCats.c deleted file mode 100644 index 39792f696..000000000 --- a/nx-X11/lib/FS/FSGetCats.c +++ /dev/null @@ -1,114 +0,0 @@ -/* $Xorg: FSGetCats.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ -/* - * 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/FSGetCats.c,v 1.6tsi Exp $ */ - -/* - -Copyright 1987, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#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 -#if (SIZE_MAX >> 2) <= UINT_MAX - && rep.num_catalogues <= SIZE_MAX/sizeof(char *) - && rep.length <= (SIZE_MAX >> 2) -#endif - ) { - 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/nx-X11/lib/FS/FSListCats.c b/nx-X11/lib/FS/FSListCats.c deleted file mode 100644 index 99b540014..000000000 --- a/nx-X11/lib/FS/FSListCats.c +++ /dev/null @@ -1,132 +0,0 @@ -/* $Xorg: FSListCats.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ -/* - * 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/FSListCats.c,v 1.6tsi Exp $ */ - -/* - -Copyright 1987, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#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 -#if (SIZE_MAX >> 2) <= UINT_MAX - && rep.num_catalogues <= SIZE_MAX/sizeof(char *) - && rep.length <= (SIZE_MAX>>2) -#endif - ) { - 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/nx-X11/lib/FS/FSListExt.c b/nx-X11/lib/FS/FSListExt.c deleted file mode 100644 index 0f42f5968..000000000 --- a/nx-X11/lib/FS/FSListExt.c +++ /dev/null @@ -1,125 +0,0 @@ -/* $Xorg: FSListExt.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* @(#)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. - */ -/* $XFree86: xc/lib/FS/FSListExt.c,v 1.6tsi Exp $ */ - -/* - -Copyright 1987, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#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 -#if (SIZE_MAX >> 2) <= UINT_MAX - && rep.nExtensions <= SIZE_MAX / sizeof(char *) - && rep.length <= (SIZE_MAX>>2) -#endif - ) { - 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/nx-X11/lib/FS/FSMisc.c b/nx-X11/lib/FS/FSMisc.c deleted file mode 100644 index af0e78ce1..000000000 --- a/nx-X11/lib/FS/FSMisc.c +++ /dev/null @@ -1,64 +0,0 @@ -/* $Xorg: FSMisc.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* @(#)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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#include "FSlibint.h" - -long -FSMaxRequestSize(svr) - FSServer *svr; -{ - return svr->max_request_size; -} diff --git a/nx-X11/lib/FS/FSNextEv.c b/nx-X11/lib/FS/FSNextEv.c deleted file mode 100644 index 69e009db3..000000000 --- a/nx-X11/lib/FS/FSNextEv.c +++ /dev/null @@ -1,79 +0,0 @@ -/* $Xorg: FSNextEv.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* @(#)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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#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/nx-X11/lib/FS/FSOpenFont.c b/nx-X11/lib/FS/FSOpenFont.c deleted file mode 100644 index da6889a53..000000000 --- a/nx-X11/lib/FS/FSOpenFont.c +++ /dev/null @@ -1,92 +0,0 @@ -/* $Xorg: FSOpenFont.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* - * 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.6tsi Exp $ */ - -/* - -Copyright 1987, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#include "FSlibint.h" - -Font -FSOpenBitmapFont(svr, hint, fmask, name, otherid) - FSServer *svr; - FSBitmapFormat hint; - FSBitmapFormatMask fmask; - char *name; - Font *otherid; -{ - unsigned int 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/nx-X11/lib/FS/FSOpenServ.c b/nx-X11/lib/FS/FSOpenServ.c deleted file mode 100644 index 662577945..000000000 --- a/nx-X11/lib/FS/FSOpenServ.c +++ /dev/null @@ -1,291 +0,0 @@ -/* $Xorg: FSOpenServ.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* @(#)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.8tsi Exp $ */ - -/* - -Copyright 1987, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "FSlibint.h" -#include - -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; - unsigned long setuplength; - - 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 (setuplength > (SIZE_MAX>>2) - || (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; - -#if SIZE_MAX <= UINT_MAX - if (prefix.num_alternates > SIZE_MAX / sizeof(AlternateServer)) { - errno = ENOMEM; - FSfree((char *) alt_data); - FSfree((char *) svr); - return (FSServer *) 0; - } -#endif - - alts = (AlternateServer *) - FSmalloc(sizeof(AlternateServer) * prefix.num_alternates); - if (!alts) { - errno = ENOMEM; - FSfree((char *) alt_data); - 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 (setuplength > (SIZE_MAX>>2) - || (auth_data = (char *) - (setup = FSmalloc((unsigned) setuplength))) == NULL) { - errno = ENOMEM; - FSfree((char *) alts); - 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 *) alts); - 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 *) auth_data); - FSfree((char *) alts); - 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/nx-X11/lib/FS/FSQGlyphs.c b/nx-X11/lib/FS/FSQGlyphs.c deleted file mode 100644 index 5ba2eb0f7..000000000 --- a/nx-X11/lib/FS/FSQGlyphs.c +++ /dev/null @@ -1,214 +0,0 @@ -/* $Xorg: FSQGlyphs.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ -/* - * 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/FSQGlyphs.c,v 1.5tsi Exp $ */ - -/* - -Copyright 1987, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#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; - -#if SIZE_MAX <= UINT_MAX - if (reply.num_chars > SIZE_MAX / sizeof(FSOffset)) - return FSBadAlloc; -#endif - - offs = (FSOffset *) FSmalloc(sizeof(FSOffset) * reply.num_chars); - *offsets = offs; - if (!offs) - return FSBadAlloc; -#if (SIZE_MAX >> 2) <= UINT_MAX - /* XXX This thest is incomplete */ - if (reply.length > (SIZE_MAX >> 2)) { - FSfree((char *) offs); - return FSBadAlloc; - } -#endif - 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; iposition = 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; - - if (str_len > SIZE_MAX/SIZEOF(fsChar2b_version1)) - return FSBadAlloc; - 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; - -#if SIZE_MAX <= UINT_MAX - if(reply.num_chars > SIZE_MAX/sizeof(FSOffset)) - return FSBadAlloc; -#endif - offs = (FSOffset *) FSmalloc(sizeof(FSOffset) * reply.num_chars); - *offsets = offs; - if (!offs) - return FSBadAlloc; -#if (SIZE_MAX >> 2) <= UINT_MAX - /* XXX - this test is incomplete */ - if (reply.length > (SIZE_MAX>>2)) { - FSfree((char *) offs); - return FSBadAlloc; - } -#endif - 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; iposition = local_offs.position; - offs->length = local_offs.length; - offs++; - } - _FSReadPad(svr, (char *) gd, left); - - SyncHandle(); - return FSSuccess; -} diff --git a/nx-X11/lib/FS/FSQXExt.c b/nx-X11/lib/FS/FSQXExt.c deleted file mode 100644 index e240d3aeb..000000000 --- a/nx-X11/lib/FS/FSQXExt.c +++ /dev/null @@ -1,176 +0,0 @@ -/* $Xorg: FSQXExt.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* - * 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.7tsi Exp $ */ - -/* - -Copyright 1987, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#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; - -#if SIZE_MAX <= UINT_MAX - if (reply.num_extents > SIZE_MAX / sizeof(FSXCharInfo)) - return FSBadAlloc; -#endif - - 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; - -#if SIZE_MAX <= UINT_MAX - if (reply.num_extents > SIZE_MAX/sizeof(FSXCharInfo)) - return FSBadAlloc; -#endif - - 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/nx-X11/lib/FS/FSQXInfo.c b/nx-X11/lib/FS/FSQXInfo.c deleted file mode 100644 index 083f95dce..000000000 --- a/nx-X11/lib/FS/FSQXInfo.c +++ /dev/null @@ -1,130 +0,0 @@ -/* $Xorg: FSQXInfo.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ -/* - * 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/FSQXInfo.c,v 1.5tsi Exp $ */ - -/* - -Copyright 1987, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#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; - -#if SIZE_MAX <= UINT_MAX - if (props->num_offsets > SIZE_MAX / sizeof(FSPropOffset)) - return FSBadAlloc; -#endif - - /* 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; jnum_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/nx-X11/lib/FS/FSQuExt.c b/nx-X11/lib/FS/FSQuExt.c deleted file mode 100644 index 198bcee9f..000000000 --- a/nx-X11/lib/FS/FSQuExt.c +++ /dev/null @@ -1,82 +0,0 @@ -/* $Xorg: FSQuExt.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* - * 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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#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/nx-X11/lib/FS/FSServName.c b/nx-X11/lib/FS/FSServName.c deleted file mode 100644 index 886ffa589..000000000 --- a/nx-X11/lib/FS/FSServName.c +++ /dev/null @@ -1,73 +0,0 @@ -/* $Xorg: FSServName.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* @(#)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. - */ -/* $XFree86: xc/lib/FS/FSServName.c,v 1.3 2001/07/29 05:01:11 tsi Exp $ */ - -/* - -Copyright 1987, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#include -#include -#include - -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/nx-X11/lib/FS/FSSetCats.c b/nx-X11/lib/FS/FSSetCats.c deleted file mode 100644 index 194ce457b..000000000 --- a/nx-X11/lib/FS/FSSetCats.c +++ /dev/null @@ -1,94 +0,0 @@ -/* $Xorg: FSSetCats.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* @(#)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.4 2001/01/17 19:41:28 dawes Exp $ */ - -/* - -Copyright 1987, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#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/nx-X11/lib/FS/FSSync.c b/nx-X11/lib/FS/FSSync.c deleted file mode 100644 index eefd0318c..000000000 --- a/nx-X11/lib/FS/FSSync.c +++ /dev/null @@ -1,81 +0,0 @@ -/* $Xorg: FSSync.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* - * 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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#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/nx-X11/lib/FS/FSSynchro.c b/nx-X11/lib/FS/FSSynchro.c deleted file mode 100644 index c1c2d31a4..000000000 --- a/nx-X11/lib/FS/FSSynchro.c +++ /dev/null @@ -1,91 +0,0 @@ -/* $Xorg: FSSynchro.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* @(#)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.4 2001/01/17 19:41:28 dawes Exp $ */ - -/* - -Copyright 1987, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#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/nx-X11/lib/FS/FSlib.h b/nx-X11/lib/FS/FSlib.h deleted file mode 100644 index c2719f803..000000000 --- a/nx-X11/lib/FS/FSlib.h +++ /dev/null @@ -1,313 +0,0 @@ -/* $Xorg: FSlib.h,v 1.5 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* - * 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.6 2001/12/14 19:53:33 dawes Exp $ */ - -/* - -Copyright 1987, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 - -#include -#include - -#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) -#define FSQLength(svr) ((svr)->qlen) -#define FSNextRequest(svr) ((svr)->request + 1) -#define FSLastKnownRequestProcessed(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 */ - -_XFUNCPROTOBEGIN - -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 FSFree ( char *data ); -extern unsigned char * FSMalloc ( unsigned size ); - -_XFUNCPROTOEND - -#endif /* _FSLIB_H_ */ diff --git a/nx-X11/lib/FS/FSlibInt.c b/nx-X11/lib/FS/FSlibInt.c deleted file mode 100644 index 3e1ac54d0..000000000 --- a/nx-X11/lib/FS/FSlibInt.c +++ /dev/null @@ -1,1360 +0,0 @@ -/* $Xorg: FSlibInt.c,v 1.5 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* - * 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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.10tsi Exp $ */ - -/* - * FSlibInt.c - Internal support routines for the C subroutine - * interface library (FSlib). - */ -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "FSlibint.h" -#include - -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) { - int pad_bytes_read = bytes_read - iov[0].iov_len; - iov[1].iov_len -= pad_bytes_read; - iov[1].iov_base = - (char *)iov[1].iov_base + pad_bytes_read; - iov[0].iov_len = 0; - } else { - iov[0].iov_len -= bytes_read; - 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", - FSNextRequest(svr) - 1, FSLastKnownRequestProcessed(svr), - FSQLength(svr)); - - if (ECHECK(EPIPE)) { - (void) fprintf(stderr, - " The connection was probably broken by a server shutdown.\r\n"); - } - exit(1); - /* NOTREACHED */ -} - -/* - * _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] */ -#ifndef __QNX__ /* QNX's uname nodename entry is not same as tcpip hostname */ -#define NEED_UTSNAME -#endif -#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 -#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 -#include - -/* This is all probably superfluous given Xos.h above */ -#ifdef USG -#ifndef __TYPES__ -#include /* forgot to protect it... */ -#define __TYPES__ -#endif /* __TYPES__ */ -#else -#if defined(_POSIX_SOURCE) && defined(MOTOROLA) -#undef _POSIX_SOURCE -#include -#define _POSIX_SOURCE -#else -#include -#endif -#endif /* USG */ - -#include "FSlib.h" -#include "FSlibos.h" -#include -#include - -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(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(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(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(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(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/nx-X11/lib/FS/FSlibos.h b/nx-X11/lib/FS/FSlibos.h deleted file mode 100644 index d14ee8ef8..000000000 --- a/nx-X11/lib/FS/FSlibos.h +++ /dev/null @@ -1,332 +0,0 @@ -/* $XdotOrg: xc/lib/FS/FSlibos.h,v 1.5 2005/11/08 06:33:25 jkj Exp $ */ -/* $Xorg: FSlibos.h,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* @(#)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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.10 2003/09/01 20:50:10 herrb Exp $ */ - -/* - * FSlib networking & os include file - */ - -#include -#include - -#ifndef WIN32 - -#if defined(__SCO__) || defined(__UNIXWARE__) -#include /* For SIZE_MAX */ -#endif - -/* - * 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 -#else -#define _POSIX_SOURCE -#include -#undef _POSIX_SOURCE -#endif -#endif -#ifndef SIZE_MAX -# ifdef ULONG_MAX -# define SIZE_MAX ULONG_MAX -# else -# define SIZE_MAX UINT_MAX -# endif -#endif -#ifndef OPEN_MAX -#ifdef SVR4 -#define OPEN_MAX 256 -#else -#include -#ifndef OPEN_MAX -#ifdef __OSF1__ -#define OPEN_MAX 256 -#else -#ifdef NOFILE -#define OPEN_MAX NOFILE -#else -#if !defined(__UNIXOS2__) && !defined(__QNX__) -#ifdef __GNU__ -#define OPEN_MAX (sysconf(_SC_OPEN_MAX)) -#else /* !__GNU__ */ -#define OPEN_MAX NOFILES_MAX -#endif /* __GNU__ */ -#else /* !__UNIXOS2__ && !__QNX__ */ -#define OPEN_MAX 256 -#endif /* __UNIXOS2__ */ -#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; cri4 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 -#include - -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 -#include -#include - -/* - * 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 . 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 */ - 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/nx-X11/lib/FS/Imakefile b/nx-X11/lib/FS/Imakefile deleted file mode 100644 index a1c616363..000000000 --- a/nx-X11/lib/FS/Imakefile +++ /dev/null @@ -1,58 +0,0 @@ -XCOMM $Xorg: Imakefile,v 1.4 2000/08/17 19:44:07 cpqbld Exp $ -XCOMM $XdotOrg: xc/lib/FS/Imakefile,v 1.4 2004/08/27 22:47:45 eich Exp $ - - - - -XCOMM $XFree86: xc/lib/FS/Imakefile,v 3.5 2001/01/17 19:41:28 dawes 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 - -#ifdef SharedFSReqs -REQUIREDLIBS = SharedFSReqs -#endif - -DEPEND_DEFINES = $(TRANS_INCLUDES) $(CONN_DEFINES) DependDefines - -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 $(XTRANS_FAILDEFINES) -#if HasBSD44Sockets -SOCK_DEFINES = -DBSD44SOCKETS -#endif - -#include - -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/nx-X11/lib/GL/apple/Imakefile b/nx-X11/lib/GL/apple/Imakefile deleted file mode 100644 index 0a593e63e..000000000 --- a/nx-X11/lib/GL/apple/Imakefile +++ /dev/null @@ -1,54 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/apple/Imakefile,v 1.2 2003/10/09 23:42:32 torrey Exp $ - -#include - -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) -#define DoExtraLib SharedLibGlx -#define DoDebugLib DebugLibGlx -#define DoProfileLib ProfileLibGlx - - XPRDIR = $(SERVERSRC)/hw/darwin/quartz/xpr - -LinkSourceFile(x-list.c,$(XPRDIR)) -LinkSourceFile(x-list.h,$(XPRDIR)) -LinkSourceFile(x-hash.c,$(XPRDIR)) -LinkSourceFile(x-hash.h,$(XPRDIR)) - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - - DRI_SRCS = dri_glx.c dri_driver.c dri_dispatch.c x-hash.c x-list.c - DRI_OBJS = dri_glx.o dri_driver.o dri_dispatch.o x-hash.o x-list.o - DRI_INCS = -I. -I$(GLXLIBSRC)/glx -I$(INCLUDESRC) -I$(INCLUDESRC)/GL \ - -I$(XINCLUDESRC) -I$(SERVERSRC)/GL/dri -I$(XPINCDIR) \ - -I$(MESASRCDIR)/include -I$(MESASRCDIR)/src/mesa/glapi \ - -I$(GLXLIBSRC)/include - - AS = /System/Library/Frameworks/ApplicationServices.framework - - DEFINES = $(ALLOC_DEFINES) GlxDefines $(GLX_DEFS) -DXP_NO_X_HEADERS=1 \ - -DOSVERSION=OSMajorVersion*100+OSMinorVersion - INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) -I$(XF86OSSRC) \ - -I$(DRMSRCDIR)/shared-core -I$(DRI_INCS) -F$(AS)/Frameworks - SRCS = appledri.c $(DRI_SRCS) - OBJS = appledri.o $(DRI_OBJS) - -/* We won't require this to run when building normally, just for updating. - Also, don't give it any dependences so make doesn't attempt to rebuild - it if the dates get screwed up. (It actually depends on build-dispatch - and dri_dispatch.defs) */ -dri_dispatch.h : - ./build-dispatch $@ - -LinkSourceFile(drm.h,$(DRMSRCDIR)/shared-core) - -#include - -LibraryObjectRule() - -SubdirLibraryRule($(OBJS)) -NormalLintTarget($(SRCS)) - -DependTarget() diff --git a/nx-X11/lib/GL/apple/appledri.c b/nx-X11/lib/GL/apple/appledri.c deleted file mode 100644 index ed48fcb0c..000000000 --- a/nx-X11/lib/GL/apple/appledri.c +++ /dev/null @@ -1,302 +0,0 @@ -/* $XFree86: xc/lib/GL/dri/XF86dri.c,v 1.12 2001/08/27 17:40:57 dawes Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -Copyright 2000 VA Linux Systems, Inc. -Copyright (c) 2002 Apple Computer, 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, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Kevin E. Martin - * Jens Owen - * Rickard E. (Rik) Faith - * - */ - -/* THIS IS NOT AN X CONSORTIUM STANDARD */ - -#define NEED_EVENTS -#define NEED_REPLIES -#include -#include "appledristr.h" -#include -#include "extutil.h" -#include - -static XExtensionInfo _appledri_info_data; -static XExtensionInfo *appledri_info = &_appledri_info_data; -static char *appledri_extension_name = APPLEDRINAME; - -#define AppleDRICheckExtension(dpy,i,val) \ - XextCheckExtension(dpy, i, appledri_extension_name, val) - -/***************************************************************************** - * * - * private utility routines * - * * - *****************************************************************************/ - -static int close_display(Display *dpy, XExtCodes *extCodes); -static Bool wire_to_event(); - -static /* const */ XExtensionHooks appledri_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 */ - NULL, /* event_to_wire */ - NULL, /* error */ - NULL, /* error_string */ -}; - -static XEXT_GENERATE_FIND_DISPLAY(find_display, appledri_info, - appledri_extension_name, - &appledri_extension_hooks, - AppleDRINumberEvents, NULL) - -static XEXT_GENERATE_CLOSE_DISPLAY(close_display, appledri_info) - -static void (*surface_notify_handler)(); - -void * -XAppleDRISetSurfaceNotifyHandler(void (*fun)()) -{ - void *old = surface_notify_handler; - surface_notify_handler = fun; - return old; -} - -static Bool wire_to_event(dpy, re, event) - Display *dpy; - XEvent *re; - xEvent *event; -{ - XExtDisplayInfo *info = find_display(dpy); - xAppleDRINotifyEvent *sevent; - - AppleDRICheckExtension(dpy, info, False); - - switch ((event->u.u.type & 0x7f) - info->codes->first_event) { - case AppleDRISurfaceNotify: - sevent = (xAppleDRINotifyEvent *) event; - if (surface_notify_handler != NULL) { - (*surface_notify_handler)(dpy, (unsigned int) sevent->arg, - (int) sevent->kind); - } - return False; - } - return False; -} - -/***************************************************************************** - * * - * public Apple-DRI Extension routines * - * * - *****************************************************************************/ - -#if 0 -#include -#define TRACE(msg) fprintf(stderr, "AppleDRI%s\n", msg); -#else -#define TRACE(msg) -#endif - - -Bool XAppleDRIQueryExtension(dpy, event_basep, error_basep) - Display *dpy; - int *event_basep, *error_basep; -{ - XExtDisplayInfo *info = find_display(dpy); - - TRACE("QueryExtension..."); - if (XextHasExtension(info)) { - *event_basep = info->codes->first_event; - *error_basep = info->codes->first_error; - TRACE("QueryExtension... return True"); - return True; - } else { - TRACE("QueryExtension... return False"); - return False; - } -} - -Bool XAppleDRIQueryVersion(dpy, majorVersion, minorVersion, patchVersion) - Display* dpy; - int* majorVersion; - int* minorVersion; - int* patchVersion; -{ - XExtDisplayInfo *info = find_display(dpy); - xAppleDRIQueryVersionReply rep; - xAppleDRIQueryVersionReq *req; - - TRACE("QueryVersion..."); - AppleDRICheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(AppleDRIQueryVersion, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_AppleDRIQueryVersion; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("QueryVersion... return False"); - return False; - } - *majorVersion = rep.majorVersion; - *minorVersion = rep.minorVersion; - *patchVersion = rep.patchVersion; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("QueryVersion... return True"); - return True; -} - -Bool XAppleDRIQueryDirectRenderingCapable(dpy, screen, isCapable) - Display* dpy; - int screen; - Bool* isCapable; -{ - XExtDisplayInfo *info = find_display(dpy); - xAppleDRIQueryDirectRenderingCapableReply rep; - xAppleDRIQueryDirectRenderingCapableReq *req; - - TRACE("QueryDirectRenderingCapable..."); - AppleDRICheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(AppleDRIQueryDirectRenderingCapable, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_AppleDRIQueryDirectRenderingCapable; - req->screen = screen; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("QueryDirectRenderingCapable... return False"); - return False; - } - *isCapable = rep.isCapable; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("QueryDirectRenderingCapable... return True"); - return True; -} - -Bool XAppleDRIAuthConnection(dpy, screen, magic) - Display* dpy; - int screen; - unsigned int magic; -{ - XExtDisplayInfo *info = find_display(dpy); - xAppleDRIAuthConnectionReq *req; - xAppleDRIAuthConnectionReply rep; - - TRACE("AuthConnection..."); - AppleDRICheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(AppleDRIAuthConnection, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_AppleDRIAuthConnection; - req->screen = screen; - req->magic = magic; - rep.authenticated = 0; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse) || !rep.authenticated) { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("AuthConnection... return False"); - return False; - } - UnlockDisplay(dpy); - SyncHandle(); - TRACE("AuthConnection... return True"); - return True; -} - -Bool XAppleDRICreateSurface(dpy, screen, drawable, client_id, key, uid) - Display* dpy; - int screen; - Drawable drawable; - unsigned int client_id; - unsigned int *key; - unsigned int *uid; -{ - XExtDisplayInfo *info = find_display(dpy); - xAppleDRICreateSurfaceReply rep; - xAppleDRICreateSurfaceReq *req; - - TRACE("CreateSurface..."); - AppleDRICheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(AppleDRICreateSurface, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_AppleDRICreateSurface; - req->screen = screen; - req->drawable = drawable; - req->client_id = client_id; - rep.key_0 = rep.key_1 = rep.uid = 0; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse) || !rep.key_0) { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("CreateSurface... return False"); - return False; - } - key[0] = rep.key_0; - key[1] = rep.key_1; - *uid = rep.uid; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("CreateSurface... return True"); - return True; -} - -Bool XAppleDRIDestroySurface(dpy, screen, drawable) - Display* dpy; - int screen; - Drawable drawable; -{ - XExtDisplayInfo *info = find_display(dpy); - xAppleDRIDestroySurfaceReq *req; - - TRACE("DestroySurface..."); - AppleDRICheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(AppleDRIDestroySurface, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_AppleDRIDestroySurface; - req->screen = screen; - req->drawable = drawable; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("DestroySurface... return True"); - return True; -} diff --git a/nx-X11/lib/GL/apple/appledri.h b/nx-X11/lib/GL/apple/appledri.h deleted file mode 100644 index fafdc236c..000000000 --- a/nx-X11/lib/GL/apple/appledri.h +++ /dev/null @@ -1,106 +0,0 @@ -/* $XFree86: xc/lib/GL/apple/appledri.h,v 1.1 2003/06/30 01:45:10 torrey Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -Copyright 2000 VA Linux Systems, Inc. -Copyright (c) 2002 Apple Computer, 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, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Kevin E. Martin - * Jens Owen - * Rickard E. (Rik) Faith - * - */ - -#ifndef _APPLEDRI_H_ -#define _APPLEDRI_H_ - -#include - -#define X_AppleDRIQueryVersion 0 -#define X_AppleDRIQueryDirectRenderingCapable 1 -#define X_AppleDRICreateSurface 2 -#define X_AppleDRIDestroySurface 3 -#define X_AppleDRIAuthConnection 4 -/* Requests up to and including 18 were used in a previous version */ - -/* Events */ -#define AppleDRIObsoleteEvent1 0 -#define AppleDRIObsoleteEvent2 1 -#define AppleDRIObsoleteEvent3 2 -#define AppleDRISurfaceNotify 3 -#define AppleDRINumberEvents 4 - -/* Errors */ -#define AppleDRIClientNotLocal 0 -#define AppleDRIOperationNotSupported 1 -#define AppleDRINumberErrors (AppleDRIOperationNotSupported + 1) - -/* Kinds of SurfaceNotify events: */ -#define AppleDRISurfaceNotifyChanged 0 -#define AppleDRISurfaceNotifyDestroyed 1 - -#ifndef _APPLEDRI_SERVER_ - -typedef struct { - int type; /* of event */ - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came frome a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; /* window of event */ - Time time; /* server timestamp when event happened */ - int kind; /* subtype of event */ - int arg; -} XAppleDRINotifyEvent; - -_XFUNCPROTOBEGIN - -Bool XAppleDRIQueryExtension (Display *dpy, int *event_base, int *error_base); - -Bool XAppleDRIQueryVersion (Display *dpy, int *majorVersion, - int *minorVersion, int *patchVersion); - -Bool XAppleDRIQueryDirectRenderingCapable (Display *dpy, int screen, - Bool *isCapable); - -void *XAppleDRISetSurfaceNotifyHandler (void (*fun) (Display *dpy, - unsigned uid, int kind)); - -Bool XAppleDRIAuthConnection (Display *dpy, int screen, unsigned int magic); - -Bool XAppleDRICreateSurface (Display *dpy, int screen, Drawable drawable, - unsigned int client_id, unsigned int key[2], - unsigned int* uid); - -Bool XAppleDRIDestroySurface (Display *dpy, int screen, Drawable drawable); - -Bool XAppleDRISynchronizeSurfaces (Display *dpy); - -_XFUNCPROTOEND - -#endif /* _APPLEDRI_SERVER_ */ -#endif /* _APPLEDRI_H_ */ diff --git a/nx-X11/lib/GL/apple/appledristr.h b/nx-X11/lib/GL/apple/appledristr.h deleted file mode 100644 index ec4158391..000000000 --- a/nx-X11/lib/GL/apple/appledristr.h +++ /dev/null @@ -1,174 +0,0 @@ -/* $XFree86: xc/lib/GL/apple/appledristr.h,v 1.1 2003/06/30 01:45:10 torrey Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -Copyright 2000 VA Linux Systems, Inc. -Copyright (c) 2002 Apple Computer, 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, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Kevin E. Martin - * Jens Owen - * Rickard E. (Rik) Fiath - * - */ - -#ifndef _APPLEDRISTR_H_ -#define _APPLEDRISTR_H_ - -#include "appledri.h" - -#define APPLEDRINAME "Apple-DRI" - -#define APPLE_DRI_MAJOR_VERSION 1 /* current version numbers */ -#define APPLE_DRI_MINOR_VERSION 0 -#define APPLE_DRI_PATCH_VERSION 0 - -typedef struct _AppleDRIQueryVersion { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRIQueryVersion */ - CARD16 length B16; -} xAppleDRIQueryVersionReq; -#define sz_xAppleDRIQueryVersionReq 4 - -typedef struct { - BYTE type; /* X_Reply */ - BOOL pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD16 majorVersion B16; /* major version of DRI protocol */ - CARD16 minorVersion B16; /* minor version of DRI protocol */ - CARD32 patchVersion B32; /* patch version of DRI protocol */ - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; -} xAppleDRIQueryVersionReply; -#define sz_xAppleDRIQueryVersionReply 32 - -typedef struct _AppleDRIQueryDirectRenderingCapable { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */ - CARD16 length B16; - CARD32 screen B32; -} xAppleDRIQueryDirectRenderingCapableReq; -#define sz_xAppleDRIQueryDirectRenderingCapableReq 8 - -typedef struct { - BYTE type; /* X_Reply */ - BOOL pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - BOOL isCapable; - BOOL pad2; - BOOL pad3; - BOOL pad4; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; - CARD32 pad8 B32; - CARD32 pad9 B32; -} xAppleDRIQueryDirectRenderingCapableReply; -#define sz_xAppleDRIQueryDirectRenderingCapableReply 32 - -typedef struct _AppleDRIAuthConnection { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRICloseConnection */ - CARD16 length B16; - CARD32 screen B32; - CARD32 magic B32; -} xAppleDRIAuthConnectionReq; -#define sz_xAppleDRIAuthConnectionReq 12 - -typedef struct { - BYTE type; - BOOL pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 authenticated B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; -} xAppleDRIAuthConnectionReply; -#define zx_xAppleDRIAuthConnectionReply 32 - -typedef struct _AppleDRICreateSurface { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRICreateSurface */ - CARD16 length B16; - CARD32 screen B32; - CARD32 drawable B32; - CARD32 client_id B32; -} xAppleDRICreateSurfaceReq; -#define sz_xAppleDRICreateSurfaceReq 16 - -typedef struct { - BYTE type; /* X_Reply */ - BOOL pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 key_0 B32; - CARD32 key_1 B32; - CARD32 uid B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; -} xAppleDRICreateSurfaceReply; -#define sz_xAppleDRICreateSurfaceReply 32 - -typedef struct _AppleDRIDestroySurface { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRIDestroySurface */ - CARD16 length B16; - CARD32 screen B32; - CARD32 drawable B32; -} xAppleDRIDestroySurfaceReq; -#define sz_xAppleDRIDestroySurfaceReq 12 - -typedef struct _AppleDRINotify { - BYTE type; /* always eventBase + event type */ - BYTE kind; - CARD16 sequenceNumber B16; - Time time B32; /* time of change */ - CARD16 pad1 B16; - CARD32 arg B32; - CARD32 pad3 B32; -} xAppleDRINotifyEvent; -#define sz_xAppleDRINotifyEvent 20 - -#ifdef _APPLEDRI_SERVER_ - -void AppleDRISendEvent ( - int /* type */, - unsigned int /* mask */, - int /* which */, - int /* arg */ -); - -#endif /* _APPLEDRI_SERVER_ */ -#endif /* _APPLEDRISTR_H_ */ diff --git a/nx-X11/lib/GL/apple/build-dispatch b/nx-X11/lib/GL/apple/build-dispatch deleted file mode 100755 index 862e10c0d..000000000 --- a/nx-X11/lib/GL/apple/build-dispatch +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/sh -exec rep "$0" "$@" -!# - -;; build-dispatch - -;; $Id: build-dispatch,v 1.2 2004/04/23 18:43:09 eich Exp $ -;; $XFree86: $ - -;; Copyright (c) 2002 Apple Computer, 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 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. - -;; This lisp script is used to build the C dispatch table from the -;; .defs file. It currently uses my (jsh's) rep interpreter. The -;; created file is checked into cvs, so it only needs to be run when -;; the .defs file is touched - -(structure () - - (open rep - rep.regexp) - - (defmacro @ args `(format standard-output ,@args)) - - (define stubs '()) - - (define (strip-args s) - (mapcar (lambda (x) - (and (string-match "[ \t\n*]+([a-zA-Z0-9_]+)$" x) - (expand-last-match "\\1"))) - (string-split "," s))) - - (@ "/* dri_dispatch.h -- built automatically, DO NOT EDIT\n $%s$\n $%s$ */\n\n" "Id" "XFree86: ") - - (condition-case nil - (while t - (let* ((form (read standard-input)) - (args (unless (string= (nth 3 form) "void") - (strip-args (nth 3 form)))) - (internal (>= (nth 2 form) 0)) - (alias (nth 4 form)) - (prefix (if (eq (nth 0 form) 'void) - "_VOID \(" - (format nil " \(%s, " (nth 0 form))))) - (when (or internal (not alias)) - (@ "DEFUN_%s%s%s,\n (%s),\n (%s)\)\n\n" - (if internal "LOCAL" "EXTERN") - prefix - (nth 1 form) - (if (string= (nth 3 form) "void") - (if internal "void *rend" "") - (if internal (format nil "void *rend, %s" (nth 3 form)) (nth 3 form))) - (mapconcat identity args ", "))) - (when alias - (@ "DEFUN_ALIAS%s%s, %s,\n (%s),\n (%s)\)\n\n" - prefix (nth 1 form) alias (nth 3 form) - (mapconcat identity args ", "))) - (when internal - (setq stubs (cons form stubs))))) - - (end-of-stream)) - - (setq stubs (nreverse stubs)) - - (@ "#define INDIRECT_DISPATCH_INIT(d,p) \\\n") - (@ "do { \\\n") - - (setq stubs (sort stubs (lambda (a b) - (< (nth 2 a) (nth 2 b))))) - - (let loop ((rest stubs)) - (when rest - (let ((form (car rest))) - (@ " (d)[%s] = (void *) &p ## %s; \\\n" (nth 2 form) (nth 1 form))) - (loop (cdr rest)))) - - (@ "} while (0)\n")) diff --git a/nx-X11/lib/GL/apple/dri_dispatch.c b/nx-X11/lib/GL/apple/dri_dispatch.c deleted file mode 100644 index 8e5c4ddfd..000000000 --- a/nx-X11/lib/GL/apple/dri_dispatch.c +++ /dev/null @@ -1,153 +0,0 @@ -/* dri_dispatch.c - $Id: dri_dispatch.c,v 1.5 2005/07/03 07:00:55 daniels Exp $ - - Copyright (c) 2002 Apple Computer, Inc. All rights reserved. - Copyright (c) Torrey T. Lyons. 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 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. */ -/* $XFree86: xc/lib/GL/apple/dri_dispatch.c,v 1.4 2004/04/21 04:59:40 torrey Exp $ */ - -#include -#include - -/* We use Apple's GL headers, but as of Panther its glext.h - did not define the following. */ -#ifndef GL_ARB_vertex_buffer_object -#include -typedef ptrdiff_t GLintptrARB; -typedef ptrdiff_t GLsizeiptrARB; -#endif - -#define GLAPIENTRYP * -#include "glapi.h" -#include "glapitable.h" -#include "glxclient.h" - -#include -#include - -#ifdef __GNUC__ -# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) -#else -# define GCC_VERSION 0 -#endif - -#if GCC_VERSION < 3000 -# define __builtin_expect(a, b) a -#endif - -static int indirect_noop (void) -{ - return 0; -} - -/* Macro used for gl functions that exist in OpenGL.framework. We'll - use the existing stub for the initial dispatch, but need this - function to handle indirect contexts. */ -#define DEFUN_LOCAL_1(ret, return, gn, proto, args) \ -static ret indirect__ ## gn proto \ -{ \ - struct _glapi_table *disp; \ - \ - disp = _glapi_Dispatch; \ - if (__builtin_expect (disp == NULL, 0)) \ - disp = _glapi_get_dispatch (); \ - \ - return (*disp->gn) args; \ -} - -/* Macro used for gl functions that don't exist in OpenGL.framework. - We drop them on the floor in direct rendering mode, but pass them - over the wire normally for indirect contexts. */ -#define DEFUN_EXTERN_1(ret, return, gn, proto, args) \ -ret gl ## gn proto \ -{ \ - __GLXcontext *gc; \ - struct _glapi_table *disp; \ - \ - gc = __glXGetCurrentContext (); \ - if (!gc->isDirect) { \ - disp = _glapi_Dispatch; \ - if (__builtin_expect (disp == NULL, 0)) \ - disp = _glapi_get_dispatch (); \ - \ - return (*disp->gn) args; \ - } else { \ - int a = 0; return (ret) a; \ - } \ -} - -/* Macro for functions that already exist, but with a different name. */ -#define DEFUN_ALIAS_1(ret, return, gn, on, proto, args) \ -ret gl ## gn proto \ -{ \ - return gl ## on args; \ -} - -#define DEFUN_LOCAL(r, gn, p, a) \ - DEFUN_LOCAL_1 (r, return, gn, p, a) -#define DEFUN_LOCAL_VOID(gn, p, a) \ - DEFUN_LOCAL_1 (void, , gn, p, a) - -#define DEFUN_EXTERN(r, gn, p, a) \ - DEFUN_EXTERN_1 (r, return, gn, p, a) -#define DEFUN_EXTERN_VOID(gn, p, a) \ - DEFUN_EXTERN_1 (void, , gn, p, a) - -#define DEFUN_ALIAS(r, gn, on, p, a) \ - DEFUN_ALIAS_1 (r, return, gn, on, p, a) -#define DEFUN_ALIAS_VOID(gn, on, p, a) \ - DEFUN_ALIAS_1 (void, , gn, on, p, a) - -#include "dri_dispatch.h" - -__private_extern__ const CGLContextObj -XAppleDRIGetIndirectContext (void) -{ - static CGLContextObj ctx; - void **t; - int i; - - if (ctx != NULL) - return ctx; - - /* initialize gl */ - CGLSetOption (kCGLGOResetLibrary, 0); - - /* Create an empty "context" for dispatching purposes. Add some slop - in case the dispatch table grows in future updates. */ - ctx = Xcalloc (1, sizeof (struct _CGLContextObject) + 1024); - - /* fill it with no-op vectors */ - t = (void **) &ctx->disp; - for (i = 0; i < (int) (sizeof (ctx->disp) / sizeof (t[0])); i++) - t[i] = &indirect_noop; - - /* then install the functions we actually support */ - INDIRECT_DISPATCH_INIT (((void **) (&ctx->disp)), indirect__); - - return ctx; -} diff --git a/nx-X11/lib/GL/apple/dri_dispatch.defs b/nx-X11/lib/GL/apple/dri_dispatch.defs deleted file mode 100644 index 7d268e929..000000000 --- a/nx-X11/lib/GL/apple/dri_dispatch.defs +++ /dev/null @@ -1,856 +0,0 @@ -;; -*- lisp -*- - -;; dri_dispatch.defs - -;; $Id: dri_dispatch.defs,v 1.5 2004/08/18 23:12:49 kem Exp $ -;; $XFree86: xc/lib/GL/apple/dri_dispatch.defs,v 1.6 2004/04/21 04:59:40 torrey Exp $ - -;; Copyright (c) 2002 Apple Computer, Inc. All rights reserved. -;; Copyright (c) 2003-2004 Torrey T. Lyons. 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 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. - -;; This file maps the Mesa GL api that X uses to the Apple CGL entry -;; points. It's used to automatically generate the CGL dispatch table -;; that's installed when an indirect context is current - -;; The format is (RETURN-TYPE MESA-NAME CGL-INDEX "ARGS" [ALIAS]) - -;; For the script to work, ARGS must be either the string "void" or a -;; comma separated list of parameters. Each parameter name _must_ be -;; the last non-whitespace token in the field (i.e. inline function -;; declarations won't work) - -;; CGL-INDEX is an index into the function vector table defined in -;; . The names of the entries in this table -;; aren't guaranteed to remain the same, but the table is guaranteed to -;; be binary-compatible in future revisions, so we use indices. - -;; If CGL-INDEX is -1, it denotes that OpenGL.framework doesn't -;; implement that function. We'll generate our own stub and make -;; it work in indirect mode (unless it has an alias). - -;; ALIAS is the name of the function that should be used to define an -;; external entry point for the function (because it doesn't exist in -;; OpenGL.framework) - -;; The ordering matches the Mesa api table, but that's not important - -;; This table has some dependencies on the version of Mac OS X. -;; Currently the script used to process this table does not handle -;; these dependencies appropriately, so they must be added by hand. -;; They are indicated by MAC_OS_X_VERSION in the comments below. - -(void NewList 177 "GLuint list, GLenum mode") -(void EndList 75 "void") -(void CallList 8 "GLuint list") -(void CallLists 9 "GLsizei n, GLenum type, const GLvoid * lists") -(void DeleteLists 58 "GLuint list, GLsizei range") -(GLuint GenLists 97 "GLsizei range") -(void ListBase 156 "GLuint base") -(void Begin 4 "GLenum mode") -(void Bitmap 6 "GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap") -(void Color3b 17 "GLbyte red, GLbyte green, GLbyte blue") -(void Color3bv 18 "const GLbyte * v") -(void Color3d 19 "GLdouble red, GLdouble green, GLdouble blue") -(void Color3dv 20 "const GLdouble * v") -(void Color3f 21 "GLfloat red, GLfloat green, GLfloat blue") -(void Color3fv 22 "const GLfloat * v") -(void Color3i 23 "GLint red, GLint green, GLint blue") -(void Color3iv 24 "const GLint * v") -(void Color3s 25 "GLshort red, GLshort green, GLshort blue") -(void Color3sv 26 "const GLshort * v") -(void Color3ub 27 "GLubyte red, GLubyte green, GLubyte blue") -(void Color3ubv 28 "const GLubyte * v") -(void Color3ui 29 "GLuint red, GLuint green, GLuint blue") -(void Color3uiv 30 "const GLuint * v") -(void Color3us 31 "GLushort red, GLushort green, GLushort blue") -(void Color3usv 32 "const GLushort * v") -(void Color4b 33 "GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha") -(void Color4bv 34 "const GLbyte * v") -(void Color4d 35 "GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha") -(void Color4dv 36 "const GLdouble * v") -(void Color4f 37 "GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha") -(void Color4fv 38 "const GLfloat * v") -(void Color4i 39 "GLint red, GLint green, GLint blue, GLint alpha") -(void Color4iv 40 "const GLint * v") -(void Color4s 41 "GLshort red, GLshort green, GLshort blue, GLshort alpha") -(void Color4sv 42 "const GLshort * v") -(void Color4ub 43 "GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha") -(void Color4ubv 44 "const GLubyte * v") -(void Color4ui 45 "GLuint red, GLuint green, GLuint blue, GLuint alpha") -(void Color4uiv 46 "const GLuint * v") -(void Color4us 47 "GLushort red, GLushort green, GLushort blue, GLushort alpha") -(void Color4usv 48 "const GLushort * v") -(void EdgeFlag 69 "GLboolean flag") -(void EdgeFlagv 71 "const GLboolean * flag") -(void End 74 "void") -(void Indexd 131 "GLdouble c") -(void Indexdv 132 "const GLdouble * c") -(void Indexf 133 "GLfloat c") -(void Indexfv 134 "const GLfloat * c") -(void Indexi 135 "GLint c") -(void Indexiv 136 "const GLint * c") -(void Indexs 137 "GLshort c") -(void Indexsv 138 "const GLshort * c") -(void Normal3b 178 "GLbyte nx, GLbyte ny, GLbyte nz") -(void Normal3bv 179 "const GLbyte * v") -(void Normal3d 180 "GLdouble nx, GLdouble ny, GLdouble nz") -(void Normal3dv 181 "const GLdouble * v") -(void Normal3f 182 "GLfloat nx, GLfloat ny, GLfloat nz") -(void Normal3fv 183 "const GLfloat * v") -(void Normal3i 184 "GLint nx, GLint ny, GLint nz") -(void Normal3iv 185 "const GLint * v") -(void Normal3s 186 "GLshort nx, GLshort ny, GLshort nz") -(void Normal3sv 187 "const GLshort * v") -(void RasterPos2d 212 "GLdouble x, GLdouble y") -(void RasterPos2dv 213 "const GLdouble * v") -(void RasterPos2f 214 "GLfloat x, GLfloat y") -(void RasterPos2fv 215 "const GLfloat * v") -(void RasterPos2i 216 "GLint x, GLint y") -(void RasterPos2iv 217 "const GLint * v") -(void RasterPos2s 218 "GLshort x, GLshort y") -(void RasterPos2sv 219 "const GLshort * v") -(void RasterPos3d 220 "GLdouble x, GLdouble y, GLdouble z") -(void RasterPos3dv 221 "const GLdouble * v") -(void RasterPos3f 222 "GLfloat x, GLfloat y, GLfloat z") -(void RasterPos3fv 223 "const GLfloat * v") -(void RasterPos3i 224 "GLint x, GLint y, GLint z") -(void RasterPos3iv 225 "const GLint * v") -(void RasterPos3s 226 "GLshort x, GLshort y, GLshort z") -(void RasterPos3sv 227 "const GLshort * v") -(void RasterPos4d 228 "GLdouble x, GLdouble y, GLdouble z, GLdouble w") -(void RasterPos4dv 229 "const GLdouble * v") -(void RasterPos4f 230 "GLfloat x, GLfloat y, GLfloat z, GLfloat w") -(void RasterPos4fv 231 "const GLfloat * v") -(void RasterPos4i 232 "GLint x, GLint y, GLint z, GLint w") -(void RasterPos4iv 233 "const GLint * v") -(void RasterPos4s 234 "GLshort x, GLshort y, GLshort z, GLshort w") -(void RasterPos4sv 235 "const GLshort * v") -(void Rectd 238 "GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2") -(void Rectdv 239 "const GLdouble * v1, const GLdouble * v2") -(void Rectf 240 "GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2") -(void Rectfv 241 "const GLfloat * v1, const GLfloat * v2") -(void Recti 242 "GLint x1, GLint y1, GLint x2, GLint y2") -(void Rectiv 243 "const GLint * v1, const GLint * v2") -(void Rects 244 "GLshort x1, GLshort y1, GLshort x2, GLshort y2") -(void Rectsv 245 "const GLshort * v1, const GLshort * v2") -(void TexCoord1d 257 "GLdouble s") -(void TexCoord1dv 258 "const GLdouble * v") -(void TexCoord1f 259 "GLfloat s") -(void TexCoord1fv 260 "const GLfloat * v") -(void TexCoord1i 261 "GLint s") -(void TexCoord1iv 262 "const GLint * v") -(void TexCoord1s 263 "GLshort s") -(void TexCoord1sv 264 "const GLshort * v") -(void TexCoord2d 265 "GLdouble s, GLdouble t") -(void TexCoord2dv 266 "const GLdouble * v") -(void TexCoord2f 267 "GLfloat s, GLfloat t") -(void TexCoord2fv 268 "const GLfloat * v") -(void TexCoord2i 269 "GLint s, GLint t") -(void TexCoord2iv 270 "const GLint * v") -(void TexCoord2s 271 "GLshort s, GLshort t") -(void TexCoord2sv 272 "const GLshort * v") -(void TexCoord3d 273 "GLdouble s, GLdouble t, GLdouble r") -(void TexCoord3dv 274 "const GLdouble * v") -(void TexCoord3f 275 "GLfloat s, GLfloat t, GLfloat r") -(void TexCoord3fv 276 "const GLfloat * v") -(void TexCoord3i 277 "GLint s, GLint t, GLint r") -(void TexCoord3iv 278 "const GLint * v") -(void TexCoord3s 279 "GLshort s, GLshort t, GLshort r") -(void TexCoord3sv 280 "const GLshort * v") -(void TexCoord4d 281 "GLdouble s, GLdouble t, GLdouble r, GLdouble q") -(void TexCoord4dv 282 "const GLdouble * v") -(void TexCoord4f 283 "GLfloat s, GLfloat t, GLfloat r, GLfloat q") -(void TexCoord4fv 284 "const GLfloat * v") -(void TexCoord4i 285 "GLint s, GLint t, GLint r, GLint q") -(void TexCoord4iv 286 "const GLint * v") -(void TexCoord4s 287 "GLshort s, GLshort t, GLshort r, GLshort q") -(void TexCoord4sv 288 "const GLshort * v") -(void Vertex2d 310 "GLdouble x, GLdouble y") -(void Vertex2dv 311 "const GLdouble * v") -(void Vertex2f 312 "GLfloat x, GLfloat y") -(void Vertex2fv 313 "const GLfloat * v") -(void Vertex2i 314 "GLint x, GLint y") -(void Vertex2iv 315 "const GLint * v") -(void Vertex2s 316 "GLshort x, GLshort y") -(void Vertex2sv 317 "const GLshort * v") -(void Vertex3d 318 "GLdouble x, GLdouble y, GLdouble z") -(void Vertex3dv 319 "const GLdouble * v") -(void Vertex3f 320 "GLfloat x, GLfloat y, GLfloat z") -(void Vertex3fv 321 "const GLfloat * v") -(void Vertex3i 322 "GLint x, GLint y, GLint z") -(void Vertex3iv 323 "const GLint * v") -(void Vertex3s 324 "GLshort x, GLshort y, GLshort z") -(void Vertex3sv 325 "const GLshort * v") -(void Vertex4d 326 "GLdouble x, GLdouble y, GLdouble z, GLdouble w") -(void Vertex4dv 327 "const GLdouble * v") -(void Vertex4f 328 "GLfloat x, GLfloat y, GLfloat z, GLfloat w") -(void Vertex4fv 329 "const GLfloat * v") -(void Vertex4i 330 "GLint x, GLint y, GLint z, GLint w") -(void Vertex4iv 331 "const GLint * v") -(void Vertex4s 332 "GLshort x, GLshort y, GLshort z, GLshort w") -(void Vertex4sv 333 "const GLshort * v") -(void ClipPlane 16 "GLenum plane, const GLdouble * equation") -(void ColorMaterial 50 "GLenum face, GLenum mode") -(void CullFace 57 "GLenum mode") -(void Fogf 91 "GLenum pname, GLfloat param") -(void Fogfv 92 "GLenum pname, const GLfloat * params") -(void Fogi 93 "GLenum pname, GLint param") -(void Fogiv 94 "GLenum pname, const GLint * params") -(void FrontFace 95 "GLenum mode") -(void Hint 128 "GLenum target, GLenum mode") -(void Lightf 150 "GLenum light, GLenum pname, GLfloat param") -(void Lightfv 151 "GLenum light, GLenum pname, const GLfloat * params") -(void Lighti 152 "GLenum light, GLenum pname, GLint param") -(void Lightiv 153 "GLenum light, GLenum pname, const GLint * params") -(void LightModelf 146 "GLenum pname, GLfloat param") -(void LightModelfv 147 "GLenum pname, const GLfloat * params") -(void LightModeli 148 "GLenum pname, GLint param") -(void LightModeliv 149 "GLenum pname, const GLint * params") -(void LineStipple 154 "GLint factor, GLushort pattern") -(void LineWidth 155 "GLfloat width") -(void Materialf 170 "GLenum face, GLenum pname, GLfloat param") -(void Materialfv 171 "GLenum face, GLenum pname, const GLfloat * params") -(void Materiali 172 "GLenum face, GLenum pname, GLint param") -(void Materialiv 173 "GLenum face, GLenum pname, const GLint * params") -(void PointSize 199 "GLfloat size") -(void PolygonMode 200 "GLenum face, GLenum mode") -(void PolygonStipple 202 "const GLubyte * mask") -(void Scissor 251 "GLint x, GLint y, GLsizei width, GLsizei height") -(void ShadeModel 253 "GLenum mode") -(void TexParameterf 302 "GLenum target, GLenum pname, GLfloat param") -(void TexParameterfv 303 "GLenum target, GLenum pname, const GLfloat * params") -(void TexParameteri 304 "GLenum target, GLenum pname, GLint param") -(void TexParameteriv 305 "GLenum target, GLenum pname, const GLint * params") -(void TexImage1D 300 "GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels") -(void TexImage2D 301 "GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels") -(void TexEnvf 290 "GLenum target, GLenum pname, GLfloat param") -(void TexEnvfv 291 "GLenum target, GLenum pname, const GLfloat * params") -(void TexEnvi 292 "GLenum target, GLenum pname, GLint param") -(void TexEnviv 293 "GLenum target, GLenum pname, const GLint * params") -(void TexGend 294 "GLenum coord, GLenum pname, GLdouble param") -(void TexGendv 295 "GLenum coord, GLenum pname, const GLdouble * params") -(void TexGenf 296 "GLenum coord, GLenum pname, GLfloat param") -(void TexGenfv 297 "GLenum coord, GLenum pname, const GLfloat * params") -(void TexGeni 298 "GLenum coord, GLenum pname, GLint param") -(void TexGeniv 299 "GLenum coord, GLenum pname, const GLint * params") -(void FeedbackBuffer 88 "GLsizei size, GLenum type, GLfloat * buffer") -(void SelectBuffer 252 "GLsizei size, GLuint * buffer") -(GLint RenderMode 246 "GLenum mode") -(void InitNames 141 "void") -(void LoadName 160 "GLuint name") -(void PassThrough 190 "GLfloat token") -(void PopName 206 "void") -(void PushName 211 "GLuint name") -(void DrawBuffer 66 "GLenum mode") -(void Clear 10 "GLbitfield mask") -(void ClearAccum 11 "GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha") -(void ClearIndex 14 "GLfloat c") -(void ClearColor 12 "GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha") -(void ClearStencil 15 "GLint s") -(void ClearDepth 13 "GLclampd depth") -(void StencilMask 255 "GLuint mask") -(void ColorMask 49 "GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha") -(void DepthMask 61 "GLboolean flag") -(void IndexMask 129 "GLuint mask") -(void Accum 0 "GLenum op, GLfloat value") -(void Disable 63 "GLenum cap") -(void Enable 72 "GLenum cap") -(void Finish 89 "void") -(void Flush 90 "void") -(void PopAttrib 203 "void") -(void PushAttrib 208 "GLbitfield mask") -(void Map1d 162 "GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble * points") -(void Map1f 163 "GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat * points") -(void Map2d 164 "GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble * points") -(void Map2f 165 "GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat * points") -(void MapGrid1d 166 "GLint un, GLdouble u1, GLdouble u2") -(void MapGrid1f 167 "GLint un, GLfloat u1, GLfloat u2") -(void MapGrid2d 168 "GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2") -(void MapGrid2f 169 "GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2") -(void EvalCoord1d 76 "GLdouble u") -(void EvalCoord1dv 77 "const GLdouble * u") -(void EvalCoord1f 78 "GLfloat u") -(void EvalCoord1fv 79 "const GLfloat * u") -(void EvalCoord2d 80 "GLdouble u, GLdouble v") -(void EvalCoord2dv 81 "const GLdouble * u") -(void EvalCoord2f 82 "GLfloat u, GLfloat v") -(void EvalCoord2fv 83 "const GLfloat * u") -(void EvalMesh1 84 "GLenum mode, GLint i1, GLint i2") -(void EvalPoint1 86 "GLint i") -(void EvalMesh2 85 "GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2") -(void EvalPoint2 87 "GLint i, GLint j") -(void AlphaFunc 1 "GLenum func, GLclampf ref") -(void BlendFunc 7 "GLenum sfactor, GLenum dfactor") -(void LogicOp 161 "GLenum opcode") -(void StencilFunc 254 "GLenum func, GLint ref, GLuint mask") -(void StencilOp 256 "GLenum fail, GLenum zfail, GLenum zpass") -(void DepthFunc 60 "GLenum func") -(void PixelZoom 198 "GLfloat xfactor, GLfloat yfactor") -(void PixelTransferf 196 "GLenum pname, GLfloat param") -(void PixelTransferi 197 "GLenum pname, GLint param") -(void PixelStoref 194 "GLenum pname, GLfloat param") -(void PixelStorei 195 "GLenum pname, GLint param") -(void PixelMapfv 191 "GLenum map, GLint mapsize, const GLfloat * values") -(void PixelMapuiv 192 "GLenum map, GLint mapsize, const GLuint * values") -(void PixelMapusv 193 "GLenum map, GLint mapsize, const GLushort * values") -(void ReadBuffer 236 "GLenum mode") -(void CopyPixels 52 "GLint x, GLint y, GLsizei width, GLsizei height, GLenum type") -(void ReadPixels 237 "GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * pixels") -(void DrawPixels 68 "GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels") -(void GetBooleanv 99 "GLenum pname, GLboolean * params") -(void GetClipPlane 100 "GLenum plane, GLdouble * equation") -(void GetDoublev 101 "GLenum pname, GLdouble * params") -(GLenum GetError 102 "void") -(void GetFloatv 103 "GLenum pname, GLfloat * params") -(void GetIntegerv 104 "GLenum pname, GLint * params") -(void GetLightfv 105 "GLenum light, GLenum pname, GLfloat * params") -(void GetLightiv 106 "GLenum light, GLenum pname, GLint * params") -(void GetMapdv 107 "GLenum target, GLenum query, GLdouble * v") -(void GetMapfv 108 "GLenum target, GLenum query, GLfloat * v") -(void GetMapiv 109 "GLenum target, GLenum query, GLint * v") -(void GetMaterialfv 110 "GLenum face, GLenum pname, GLfloat * params") -(void GetMaterialiv 111 "GLenum face, GLenum pname, GLint * params") -(void GetPixelMapfv 112 "GLenum map, GLfloat * values") -(void GetPixelMapuiv 113 "GLenum map, GLuint * values") -(void GetPixelMapusv 114 "GLenum map, GLushort * values") -(void GetPolygonStipple 116 "GLubyte * mask") -(|const GLubyte *| GetString 117 "GLenum name") -(void GetTexEnvfv 118 "GLenum target, GLenum pname, GLfloat * params") -(void GetTexEnviv 119 "GLenum target, GLenum pname, GLint * params") -(void GetTexGendv 120 "GLenum coord, GLenum pname, GLdouble * params") -(void GetTexGenfv 121 "GLenum coord, GLenum pname, GLfloat * params") -(void GetTexGeniv 122 "GLenum coord, GLenum pname, GLint * params") -(void GetTexImage 123 "GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels") -(void GetTexParameterfv 126 "GLenum target, GLenum pname, GLfloat * params") -(void GetTexParameteriv 127 "GLenum target, GLenum pname, GLint * params") -(void GetTexLevelParameterfv 124 "GLenum target, GLint level, GLenum pname, GLfloat * params") -(void GetTexLevelParameteriv 125 "GLenum target, GLint level, GLenum pname, GLint * params") -(GLboolean IsEnabled 143 "GLenum cap") -(GLboolean IsList 144 "GLuint list") -(void DepthRange 62 "GLclampd zNear, GLclampd zFar") -(void Frustum 96 "GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar") -(void LoadIdentity 157 "void") -(void LoadMatrixf 159 "const GLfloat * m") -(void LoadMatrixd 158 "const GLdouble * m") -(void MatrixMode 174 "GLenum mode") -(void MultMatrixf 176 "const GLfloat * m") -(void MultMatrixd 175 "const GLdouble * m") -(void Ortho 189 "GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar") -(void PopMatrix 205 "void") -(void PushMatrix 210 "void") -(void Rotated 247 "GLdouble angle, GLdouble x, GLdouble y, GLdouble z") -(void Rotatef 248 "GLfloat angle, GLfloat x, GLfloat y, GLfloat z") -(void Scaled 249 "GLdouble x, GLdouble y, GLdouble z") -(void Scalef 250 "GLfloat x, GLfloat y, GLfloat z") -(void Translated 308 "GLdouble x, GLdouble y, GLdouble z") -(void Translatef 309 "GLfloat x, GLfloat y, GLfloat z") -(void Viewport 335 "GLint x, GLint y, GLsizei width, GLsizei height") -(void ArrayElement 3 "GLint i") -(void BindTexture 5 "GLenum target, GLenum texture") -(void ColorPointer 51 "GLint size, GLenum type, GLsizei stride, const GLvoid * pointer") -(void DisableClientState 64 "GLenum array") -(void DrawArrays 65 "GLenum mode, GLint first, GLsizei count") -(void DrawElements 67 "GLenum mode, GLsizei count, GLenum type, const GLvoid * indices") -(void EdgeFlagPointer 70 "GLsizei stride, const GLvoid * pointer") -(void EnableClientState 73 "GLenum array") -(void IndexPointer 130 "GLenum type, GLsizei stride, const GLvoid * pointer") -(void Indexub 139 "GLubyte c") -(void Indexubv 140 "const GLubyte * c") -(void InterleavedArrays 142 "GLenum format, GLsizei stride, const GLvoid * pointer") -(void NormalPointer 188 "GLenum type, GLsizei stride, const GLvoid * pointer") -(void PolygonOffset 201 "GLfloat factor, GLfloat units") -(void TexCoordPointer 289 "GLint size, GLenum type, GLsizei stride, const GLvoid * pointer") -(void VertexPointer 334 "GLint size, GLenum type, GLsizei stride, const GLvoid * pointer") -(GLboolean AreTexturesResident 2 "GLsizei n, const GLenum * textures, GLboolean * residences") -(void CopyTexImage1D 53 "GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border") -(void CopyTexImage2D 54 "GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border") -(void CopyTexSubImage1D 55 "GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width") -(void CopyTexSubImage2D 56 "GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height") -(void DeleteTextures 59 "GLsizei n, const GLenum * textures") -(void GenTextures 98 "GLsizei n, GLenum * textures") -(void GetPointerv 115 "GLenum pname, GLvoid * * params") -(GLboolean IsTexture 145 "GLenum texture") -(void PrioritizeTextures 207 "GLsizei n, const GLenum * textures, const GLclampf * priorities") -(void TexSubImage1D 306 "GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels") -(void TexSubImage2D 307 "GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels") -(void PopClientAttrib 204 "void") -(void PushClientAttrib 209 "GLbitfield mask") -(void BlendColor 337 "GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha") -(void BlendEquation 338 "GLenum mode") -(void DrawRangeElements 405 "GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices") -(void ColorTable 406 "GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table") -(void ColorTableParameterfv 407 "GLenum target, GLenum pname, const GLfloat * params") -(void ColorTableParameteriv 408 "GLenum target, GLenum pname, const GLint * params") -(void CopyColorTable 409 "GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width") -(void GetColorTable 410 "GLenum target, GLenum format, GLenum type, GLvoid * table") -(void GetColorTableParameterfv 411 "GLenum target, GLenum pname, GLfloat * params") -(void GetColorTableParameteriv 412 "GLenum target, GLenum pname, GLint * params") -(void ColorSubTable 413 "GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data") -(void CopyColorSubTable 414 "GLenum target, GLsizei start, GLint x, GLint y, GLsizei width") -(void ConvolutionFilter1D 415 "GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image") -(void ConvolutionFilter2D 416 "GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image") -(void ConvolutionParameterf 417 "GLenum target, GLenum pname, GLfloat params") -(void ConvolutionParameterfv 418 "GLenum target, GLenum pname, const GLfloat * params") -(void ConvolutionParameteri 419 "GLenum target, GLenum pname, GLint params") -(void ConvolutionParameteriv 420 "GLenum target, GLenum pname, const GLint * params") -(void CopyConvolutionFilter1D 421 "GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width") -(void CopyConvolutionFilter2D 422 "GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height") -(void GetConvolutionFilter 423 "GLenum target, GLenum format, GLenum type, GLvoid * image") -(void GetConvolutionParameterfv 424 "GLenum target, GLenum pname, GLfloat * params") -(void GetConvolutionParameteriv 425 "GLenum target, GLenum pname, GLint * params") -(void GetSeparableFilter 426 "GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span") -(void SeparableFilter2D 427 "GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column") -(void GetHistogram 428 "GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values") -(void GetHistogramParameterfv 429 "GLenum target, GLenum pname, GLfloat * params") -(void GetHistogramParameteriv 430 "GLenum target, GLenum pname, GLint * params") -(void GetMinmax 431 "GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values") -(void GetMinmaxParameterfv 432 "GLenum target, GLenum pname, GLfloat * params") -(void GetMinmaxParameteriv 433 "GLenum target, GLenum pname, GLint * params") -(void Histogram 434 "GLenum target, GLsizei width, GLenum internalformat, GLboolean sink") -(void Minmax 435 "GLenum target, GLenum internalformat, GLboolean sink") -(void ResetHistogram 436 "GLenum target") -(void ResetMinmax 437 "GLenum target") -(void TexImage3D 438 "GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels") -(void TexSubImage3D 439 "GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels") -(void CopyTexSubImage3D 440 "GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height") -(void ActiveTextureARB 342 "GLenum texture") -(void ClientActiveTextureARB 341 "GLenum texture") -(void MultiTexCoord1dARB 343 "GLenum target, GLdouble s") -(void MultiTexCoord1dvARB 344 "GLenum target, const GLdouble * v") -(void MultiTexCoord1fARB 345 "GLenum target, GLfloat s") -(void MultiTexCoord1fvARB 346 "GLenum target, const GLfloat * v") -(void MultiTexCoord1iARB 347 "GLenum target, GLint s") -(void MultiTexCoord1ivARB 348 "GLenum target, const GLint * v") -(void MultiTexCoord1sARB 349 "GLenum target, GLshort s") -(void MultiTexCoord1svARB 350 "GLenum target, const GLshort * v") -(void MultiTexCoord2dARB 351 "GLenum target, GLdouble s, GLdouble t") -(void MultiTexCoord2dvARB 352 "GLenum target, const GLdouble * v") -(void MultiTexCoord2fARB 353 "GLenum target, GLfloat s, GLfloat t") -(void MultiTexCoord2fvARB 354 "GLenum target, const GLfloat * v") -(void MultiTexCoord2iARB 355 "GLenum target, GLint s, GLint t") -(void MultiTexCoord2ivARB 356 "GLenum target, const GLint * v") -(void MultiTexCoord2sARB 357 "GLenum target, GLshort s, GLshort t") -(void MultiTexCoord2svARB 358 "GLenum target, const GLshort * v") -(void MultiTexCoord3dARB 359 "GLenum target, GLdouble s, GLdouble t, GLdouble r") -(void MultiTexCoord3dvARB 360 "GLenum target, const GLdouble * v") -(void MultiTexCoord3fARB 361 "GLenum target, GLfloat s, GLfloat t, GLfloat r") -(void MultiTexCoord3fvARB 362 "GLenum target, const GLfloat * v") -(void MultiTexCoord3iARB 363 "GLenum target, GLint s, GLint t, GLint r") -(void MultiTexCoord3ivARB 364 "GLenum target, const GLint * v") -(void MultiTexCoord3sARB 365 "GLenum target, GLshort s, GLshort t, GLshort r") -(void MultiTexCoord3svARB 366 "GLenum target, const GLshort * v") -(void MultiTexCoord4dARB 367 "GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q") -(void MultiTexCoord4dvARB 368 "GLenum target, const GLdouble * v") -(void MultiTexCoord4fARB 369 "GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q") -(void MultiTexCoord4fvARB 370 "GLenum target, const GLfloat * v") -(void MultiTexCoord4iARB 371 "GLenum target, GLint s, GLint t, GLint r, GLint q") -(void MultiTexCoord4ivARB 372 "GLenum target, const GLint * v") -(void MultiTexCoord4sARB 373 "GLenum target, GLshort s, GLshort t, GLshort r, GLshort q") -(void MultiTexCoord4svARB 374 "GLenum target, const GLshort * v") -(void LoadTransposeMatrixfARB 376 "const GLfloat * m") -(void LoadTransposeMatrixdARB 375 "const GLdouble * m") -(void MultTransposeMatrixfARB 378 "const GLfloat * m") -(void MultTransposeMatrixdARB 377 "const GLdouble * m") -(void SampleCoverageARB 459 "GLclampf value, GLboolean invert") -(void __unused413 -1 "void") -(void PolygonOffsetEXT -1 "GLfloat factor, GLfloat bias" PolygonOffset) -(void GetTexFilterFuncSGIS -1 "GLenum target, GLenum filter, GLfloat * weights") -(void TexFilterFuncSGIS -1 "GLenum target, GLenum filter, GLsizei n, const GLfloat * weights") -(void GetHistogramEXT -1 "GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values" GetHistogram) -(void GetHistogramParameterfvEXT -1 "GLenum target, GLenum pname, GLfloat * params" GetHistogramParameterfv) -(void GetHistogramParameterivEXT -1 "GLenum target, GLenum pname, GLint * params" GetHistogramParameteriv) -(void GetMinmaxEXT -1 "GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values" GetMinmax) -(void GetMinmaxParameterfvEXT -1 "GLenum target, GLenum pname, GLfloat * params" GetMinmaxParameterfv) -(void GetMinmaxParameterivEXT -1 "GLenum target, GLenum pname, GLint * params" GetMinmaxParameteriv) -(void GetConvolutionFilterEXT -1 "GLenum target, GLenum format, GLenum type, GLvoid * image" GetConvolutionFilter) -(void GetConvolutionParameterfvEXT -1 "GLenum target, GLenum pname, GLfloat * params" GetConvolutionParameterfv) -(void GetConvolutionParameterivEXT -1 "GLenum target, GLenum pname, GLint * params" GetConvolutionParameteriv) -(void GetSeparableFilterEXT -1 "GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span" GetSeparableFilter) -(void GetColorTableSGI -1 "GLenum target, GLenum format, GLenum type, GLvoid * table" GetColorTable) -(void GetColorTableParameterfvSGI -1 "GLenum target, GLenum pname, GLfloat * params" GetColorTableParameterfv) -(void GetColorTableParameterivSGI -1 "GLenum target, GLenum pname, GLint * params" GetColorTableParameteriv) -(void PixelTexGenSGIX -1 "GLenum mode") -(void PixelTexGenParameteriSGIS -1 "GLenum pname, GLint param") -(void PixelTexGenParameterivSGIS -1 "GLenum pname, const GLint * params") -(void PixelTexGenParameterfSGIS -1 "GLenum pname, GLfloat param") -(void PixelTexGenParameterfvSGIS -1 "GLenum pname, const GLfloat * params") -(void GetPixelTexGenParameterivSGIS -1 "GLenum pname, GLint * params") -(void GetPixelTexGenParameterfvSGIS -1 "GLenum pname, GLfloat * params") -(void TexImage4DSGIS -1 "GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid * pixels") -(void TexSubImage4DSGIS -1 "GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid * pixels") -(GLboolean AreTexturesResidentEXT -1 "GLsizei n, const GLenum * textures, GLboolean * residences" AreTexturesResident) -(void GenTexturesEXT -1 "GLsizei n, GLenum * textures" GenTextures) -(GLboolean IsTextureEXT -1 "GLenum texture") -(void DetailTexFuncSGIS -1 "GLenum target, GLsizei n, const GLfloat * points") -(void GetDetailTexFuncSGIS -1 "GLenum target, GLfloat * points") -(void SharpenTexFuncSGIS -1 "GLenum target, GLsizei n, const GLfloat * points") -(void GetSharpenTexFuncSGIS -1 "GLenum target, GLfloat * points") -(void SampleMaskSGIS -1 "GLclampf value, GLboolean invert") -(void SamplePatternSGIS -1 "GLenum pattern") -(void ColorPointerEXT -1 "GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer") -(void EdgeFlagPointerEXT -1 "GLsizei stride, GLsizei count, const GLboolean * pointer") -(void IndexPointerEXT -1 "GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer") -(void NormalPointerEXT -1 "GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer") -(void TexCoordPointerEXT -1 "GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer") -(void VertexPointerEXT -1 "GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer") -(void SpriteParameterfSGIX -1 "GLenum pname, GLfloat param") -(void SpriteParameterfvSGIX -1 "GLenum pname, const GLfloat * params") -(void SpriteParameteriSGIX -1 "GLenum pname, GLint param") -(void SpriteParameterivSGIX -1 "GLenum pname, const GLint * params") -(void PointParameterfEXT 540 "GLenum pname, GLfloat param" PointParameterf) -(void PointParameterfvEXT 541 "GLenum pname, const GLfloat * params" PointParameterfv) -(GLint GetInstrumentsSGIX -1 "void") -(void InstrumentsBufferSGIX -1 "GLsizei size, GLint * buffer") -(GLint PollInstrumentsSGIX -1 "GLint * marker_p") -(void ReadInstrumentsSGIX -1 "GLint marker") -(void StartInstrumentsSGIX -1 "void") -(void StopInstrumentsSGIX -1 "GLint marker") -(void FrameZoomSGIX -1 "GLint factor") -(void TagSampleBufferSGIX -1 "void") -(void ReferencePlaneSGIX -1 "const GLdouble * equation") -(void FlushRasterSGIX -1 "void") -(void GetListParameterfvSGIX -1 "GLuint list, GLenum pname, GLfloat * params") -(void GetListParameterivSGIX -1 "GLuint list, GLenum pname, GLint * params") -(void ListParameterfSGIX -1 "GLuint list, GLenum pname, GLfloat param") -(void ListParameterfvSGIX -1 "GLuint list, GLenum pname, const GLfloat * params") -(void ListParameteriSGIX -1 "GLuint list, GLenum pname, GLint param") -(void ListParameterivSGIX -1 "GLuint list, GLenum pname, const GLint * params") -(void FragmentColorMaterialSGIX -1 "GLenum face, GLenum mode") -(void FragmentLightfSGIX -1 "GLenum light, GLenum pname, GLfloat param") -(void FragmentLightfvSGIX -1 "GLenum light, GLenum pname, const GLfloat * params") -(void FragmentLightiSGIX -1 "GLenum light, GLenum pname, GLint param") -(void FragmentLightivSGIX -1 "GLenum light, GLenum pname, const GLint * params") -(void FragmentLightModelfSGIX -1 "GLenum pname, GLfloat param") -(void FragmentLightModelfvSGIX -1 "GLenum pname, const GLfloat * params") -(void FragmentLightModeliSGIX -1 "GLenum pname, GLint param") -(void FragmentLightModelivSGIX -1 "GLenum pname, const GLint * params") -(void FragmentMaterialfSGIX -1 "GLenum face, GLenum pname, GLfloat param") -(void FragmentMaterialfvSGIX -1 "GLenum face, GLenum pname, const GLfloat * params") -(void FragmentMaterialiSGIX -1 "GLenum face, GLenum pname, GLint param") -(void FragmentMaterialivSGIX -1 "GLenum face, GLenum pname, const GLint * params") -(void GetFragmentLightfvSGIX -1 "GLenum light, GLenum pname, GLfloat * params") -(void GetFragmentLightivSGIX -1 "GLenum light, GLenum pname, GLint * params") -(void GetFragmentMaterialfvSGIX -1 "GLenum face, GLenum pname, GLfloat * params") -(void GetFragmentMaterialivSGIX -1 "GLenum face, GLenum pname, GLint * params") -(void LightEnviSGIX -1 "GLenum pname, GLint param") -(void VertexWeightfEXT -1 "GLfloat weight") -(void VertexWeightfvEXT -1 "const GLfloat * weight") -(void VertexWeightPointerEXT -1 "GLsizei size, GLenum type, GLsizei stride, const GLvoid * pointer") -(void FlushVertexArrayRangeNV -1 "void") -(void VertexArrayRangeNV 403 "GLsizei length, const GLvoid * pointer" VertexArrayRangeAPPLE) -(void CombinerParameterfvNV 441 "GLenum pname, const GLfloat * params") -(void CombinerParameterfNV 442 "GLenum pname, GLfloat param") -(void CombinerParameterivNV 443 "GLenum pname, const GLint * params") -(void CombinerParameteriNV 444 "GLenum pname, GLint param") -(void CombinerInputNV 445 "GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage") -(void CombinerOutputNV 446 "GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum") -(void FinalCombinerInputNV 447 "GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage") -(void GetCombinerInputParameterfvNV 448 "GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params") -(void GetCombinerInputParameterivNV 449 "GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params") -(void GetCombinerOutputParameterfvNV 450 "GLenum stage, GLenum portion, GLenum pname, GLfloat * params") -(void GetCombinerOutputParameterivNV 451 "GLenum stage, GLenum portion, GLenum pname, GLint * params") -(void GetFinalCombinerInputParameterfvNV 452 "GLenum variable, GLenum pname, GLfloat * params") -(void GetFinalCombinerInputParameterivNV 453 "GLenum variable, GLenum pname, GLint * params") -(void ResizeBuffersMESA -1 "void") -(void WindowPos2dMESA 569 "GLdouble x, GLdouble y" WindowPos2d) -(void WindowPos2dvMESA 570 "const GLdouble * v" WindowPos2dv) -(void WindowPos2fMESA 571 "GLfloat x, GLfloat y" WindowPos2f) -(void WindowPos2fvMESA 572 "const GLfloat * v" WindowPos2fv) -(void WindowPos2iMESA 573 "GLint x, GLint y" WindowPos2i) -(void WindowPos2ivMESA 574 "const GLint * v" WindowPos2iv) -(void WindowPos2sMESA 575 "GLshort x, GLshort y" WindowPos2s) -(void WindowPos2svMESA 576 "const GLshort * v" WindowPos2sv) -(void WindowPos3dMESA 577 "GLdouble x, GLdouble y, GLdouble z" WindowPos3d) -(void WindowPos3dvMESA 578 "const GLdouble * v" WindowPos3dv) -(void WindowPos3fMESA 579 "GLfloat x, GLfloat y, GLfloat z" WindowPos3f) -(void WindowPos3fvMESA 580 "const GLfloat * v" WindowPos3fv) -(void WindowPos3iMESA 581 "GLint x, GLint y, GLint z" WindowPos3i) -(void WindowPos3ivMESA 582 "const GLint * v" WindowPos3iv) -(void WindowPos3sMESA 583 "GLshort x, GLshort y, GLshort z" WindowPos3s) -(void WindowPos3svMESA 584 "const GLshort * v" WindowPos3sv) -(void WindowPos4dMESA -1 "GLdouble x, GLdouble y, GLdouble z, GLdouble w") -(void WindowPos4dvMESA -1 "const GLdouble * v") -(void WindowPos4fMESA -1 "GLfloat x, GLfloat y, GLfloat z, GLfloat w") -(void WindowPos4fvMESA -1 "const GLfloat * v") -(void WindowPos4iMESA -1 "GLint x, GLint y, GLint z, GLint w") -(void WindowPos4ivMESA -1 "const GLint * v") -(void WindowPos4sMESA -1 "GLshort x, GLshort y, GLshort z, GLshort w") -(void WindowPos4svMESA -1 "const GLshort * v") -(void BlendFuncSeparateEXT 336 "GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha") -(void IndexMaterialEXT -1 "GLenum face, GLenum mode") -(void IndexFuncEXT -1 "GLenum func, GLclampf ref") -(void LockArraysEXT 339 "GLint first, GLsizei count") -(void UnlockArraysEXT 340 "void") -(void CullParameterdvEXT -1 "GLenum pname, GLdouble * params") -(void CullParameterfvEXT -1 "GLenum pname, GLfloat * params") -(void HintPGI -1 "GLenum target, GLint mode") -(void FogCoordfEXT 544 "GLfloat coord") -(void FogCoordfvEXT 545 "const GLfloat * coord") -(void FogCoorddEXT 546 "GLdouble coord") -(void FogCoorddvEXT 547 "const GLdouble * coord") -(void FogCoordPointerEXT 548 "GLenum type, GLsizei stride, const GLvoid * pointer") -;; OpenGL.framework defines these, but doesn't have dispatch slots for them -;; (void GetColorTableEXT -1 "GLenum target, GLenum format, GLenum type, GLvoid * data" GetColorTable) -;; (void GetColorTableParameterivEXT -1 "GLenum target, GLenum pname, GLint * params" GetColorTableParameteriv) -;; (void GetColorTableParameterfvEXT -1 "GLenum target, GLenum pname, GLfloat * params" GetColorTableParameterfv) -(void TbufferMask3DFX -1 "GLuint mask") -(void CompressedTexImage3DARB 379 "GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data") -(void CompressedTexImage2DARB 380 "GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data") -(void CompressedTexImage1DARB 381 "GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data") -(void CompressedTexSubImage3DARB 382 "GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data") -(void CompressedTexSubImage2DARB 383 "GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data") -(void CompressedTexSubImage1DARB 384 "GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data") -(void GetCompressedTexImageARB 385 "GLenum target, GLint level, void * img") -(void SecondaryColor3bEXT 386 "GLbyte red, GLbyte green, GLbyte blue") -(void SecondaryColor3bvEXT 387 "const GLbyte * v") -(void SecondaryColor3dEXT 388 "GLdouble red, GLdouble green, GLdouble blue") -(void SecondaryColor3dvEXT 389 "const GLdouble * v") -(void SecondaryColor3fEXT 390 "GLfloat red, GLfloat green, GLfloat blue") -(void SecondaryColor3fvEXT 391 "const GLfloat * v") -(void SecondaryColor3iEXT 392 "GLint red, GLint green, GLint blue") -(void SecondaryColor3ivEXT 393 "const GLint * v") -(void SecondaryColor3sEXT 394 "GLshort red, GLshort green, GLshort blue") -(void SecondaryColor3svEXT 395 "const GLshort * v") -(void SecondaryColor3ubEXT 396 "GLubyte red, GLubyte green, GLubyte blue") -(void SecondaryColor3ubvEXT 397 "const GLubyte * v") -(void SecondaryColor3uiEXT 398 "GLuint red, GLuint green, GLuint blue") -(void SecondaryColor3uivEXT 399 "const GLuint * v") -(void SecondaryColor3usEXT 400 "GLushort red, GLushort green, GLushort blue") -(void SecondaryColor3usvEXT 401 "const GLushort * v") -(void SecondaryColorPointerEXT 402 "GLint size, GLenum type, GLsizei stride, const GLvoid * pointer") -(GLboolean AreProgramsResidentNV -1 "GLsizei n, const GLuint * ids, GLboolean * residences") -(void BindProgramNV 471 "GLenum target, GLuint id" BindProgramARB) -(void DeleteProgramsNV 472 "GLsizei n, const GLuint * ids" DeleteProgramsARB) -(void ExecuteProgramNV -1 "GLenum target, GLuint id, const GLfloat * params") -(void GenProgramsNV 473 "GLsizei n, GLuint * ids" GenProgramsARB) -(void GetProgramParameterdvNV -1 "GLenum target, GLuint index, GLenum pname, GLdouble * params") -(void GetProgramParameterfvNV -1 "GLenum target, GLuint index, GLenum pname, GLfloat * params") -(void GetProgramivNV -1 "GLuint id, GLenum pname, GLint * params") -(void GetProgramStringNV -1 "GLuint id, GLenum pname, GLubyte * program") -(void GetTrackMatrixivNV -1 "GLenum target, GLuint address, GLenum pname, GLint * params") -(void GetVertexAttribdvNV 514 "GLuint index, GLenum pname, GLdouble * params" GetVertexAttribdvARB) -(void GetVertexAttribfvNV 515 "GLuint index, GLenum pname, GLfloat * params" GetVertexAttribfvARB) -(void GetVertexAttribivNV 516 "GLuint index, GLenum pname, GLint * params" GetVertexAttribivNV) -(void GetVertexAttribPointervNV 517 "GLuint index, GLenum pname, GLvoid ** pointer" GetVertexAttribPointervARB) -(GLboolean IsProgramNV 474 "GLuint id" IsProgramARB) -(void LoadProgramNV -1 "GLenum target, GLuint id, GLsizei len, const GLubyte * program") -(void ProgramParameter4dNV -1 "GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w") -(void ProgramParameter4dvNV -1 "GLenum target, GLuint index, const GLdouble * params") -(void ProgramParameter4fNV -1 "GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w") -(void ProgramParameter4fvNV -1 "GLenum target, GLuint index, const GLfloat * params") -(void ProgramParameters4dvNV -1 "GLenum target, GLuint index, GLuint num, const GLdouble * params") -(void ProgramParameters4fvNV -1 "GLenum target, GLuint index, GLuint num, const GLfloat * params") -(void RequestResidentProgramsNV -1 "GLsizei n, const GLuint * ids") -(void TrackMatrixNV -1 "GLenum target, GLuint address, GLenum matrix, GLenum transform") -(void VertexAttribPointerNV -1 "GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer") -(void VertexAttrib1dNV 477 "GLuint index, GLdouble x" VertexAttrib1dARB) -(void VertexAttrib1dvNV 490 "GLuint index, const GLdouble * v" VertexAttrib1dvARB) -(void VertexAttrib1fNV 476 "GLuint index, GLfloat x" VertexAttrib1fARB) -(void VertexAttrib1fvNV 489 "GLuint index, const GLfloat * v" VertexAttrib1fvARB) -(void VertexAttrib1sNV 475 "GLuint index, GLshort x" VertexAttrib1sARB) -(void VertexAttrib1svNV 488 "GLuint index, const GLshort * v" VertexAttrib1svARB) -(void VertexAttrib2dNV 480 "GLuint index, GLdouble x, GLdouble y" VertexAttrib2dARB) -(void VertexAttrib2dvNV 493 "GLuint index, const GLdouble * v" VertexAttrib2dvARB) -(void VertexAttrib2fNV 479 "GLuint index, GLfloat x, GLfloat y" VertexAttrib2fARB) -(void VertexAttrib2fvNV 492 "GLuint index, const GLfloat * v" VertexAttrib2fvARB) -(void VertexAttrib2sNV 478 "GLuint index, GLshort x, GLshort y" VertexAttrib2sARB) -(void VertexAttrib2svNV 491 "GLuint index, const GLshort * v" VertexAttrib2svARB) -(void VertexAttrib3dNV 483 "GLuint index, GLdouble x, GLdouble y, GLdouble z" VertexAttrib3dARB) -(void VertexAttrib3dvNV 496 "GLuint index, const GLdouble * v" VertexAttrib3dvARB) -(void VertexAttrib3fNV 482 "GLuint index, GLfloat x, GLfloat y, GLfloat z" VertexAttrib3fARB) -(void VertexAttrib3fvNV 495 "GLuint index, const GLfloat * v" VertexAttrib3fvARB) -(void VertexAttrib3sNV 481 "GLuint index, GLshort x, GLshort y, GLshort z" VertexAttrib3sARB) -(void VertexAttrib3svNV 494 "GLuint index, const GLshort * v" VertexAttrib3svARB) -(void VertexAttrib4dNV 486 "GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w" VertexAttrib4dARB) -(void VertexAttrib4dvNV 504 "GLuint index, const GLdouble * v" VertexAttrib4dvARB) -(void VertexAttrib4fNV 485 "GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w" VertexAttrib4fARB) -(void VertexAttrib4fvNV 503 "GLuint index, const GLfloat * v" VertexAttrib4fvARB) -(void VertexAttrib4sNV 484 "GLuint index, GLshort x, GLshort y, GLshort z, GLshort w" VertexAttrib4sARB) -(void VertexAttrib4svNV 498 "GLuint index, const GLshort * v" VertexAttrib4svARB) -(void VertexAttrib4ubNV 487 "GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w" VertexAttrib4NubARB) -(void VertexAttrib4ubvNV 500 "GLuint index, const GLubyte * v" VertexAttrib4ubvARB) -(void VertexAttribs1dvNV -1 "GLuint index, GLsizei n, const GLdouble * v") -(void VertexAttribs1fvNV -1 "GLuint index, GLsizei n, const GLfloat * v") -(void VertexAttribs1svNV -1 "GLuint index, GLsizei n, const GLshort * v") -(void VertexAttribs2dvNV -1 "GLuint index, GLsizei n, const GLdouble * v") -(void VertexAttribs2fvNV -1 "GLuint index, GLsizei n, const GLfloat * v") -(void VertexAttribs2svNV -1 "GLuint index, GLsizei n, const GLshort * v") -(void VertexAttribs3dvNV -1 "GLuint index, GLsizei n, const GLdouble * v") -(void VertexAttribs3fvNV -1 "GLuint index, GLsizei n, const GLfloat * v") -(void VertexAttribs3svNV -1 "GLuint index, GLsizei n, const GLshort * v") -(void VertexAttribs4dvNV -1 "GLuint index, GLsizei n, const GLdouble * v") -(void VertexAttribs4fvNV -1 "GLuint index, GLsizei n, const GLfloat * v") -(void VertexAttribs4svNV -1 "GLuint index, GLsizei n, const GLshort * v") -(void VertexAttribs4ubvNV -1 "GLuint index, GLsizei n, const GLubyte * v") -(void PointParameteriNV 542 "GLenum pname, GLint params") -(void PointParameterivNV 543 "GLenum pname, const GLint * params") -(void MultiDrawArraysEXT 567 "GLenum mode, GLint * first, GLsizei * count, GLsizei primcount") -(void MultiDrawElementsEXT 568 "GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount") -(void ActiveStencilFaceEXT 585 "GLenum face") -(void DeleteFencesNV -1 "GLsizei n, const GLuint * fences") -(void GenFencesNV -1 "GLsizei n, GLuint * fences") -(GLboolean IsFenceNV -1 "GLuint fence") -(GLboolean TestFenceNV -1 "GLuint fence") -(void GetFenceivNV -1 "GLuint fence, GLenum pname, GLint * params") -(void FinishFenceNV -1 "GLuint fence") -(void SetFenceNV -1 "GLuint fence, GLenum condition") -(void VertexAttrib4bvARB 497 "GLuint index, const GLbyte * v") -(void VertexAttrib4ivARB 499 "GLuint index, const GLint * v") -(void VertexAttrib4ubvARB 500 "GLuint index, const GLubyte * v") -(void VertexAttrib4usvARB 501 "GLuint index, const GLushort * v") -(void VertexAttrib4uivARB 502 "GLuint index, const GLuint * v") -(void VertexAttrib4NbvARB 505 "GLuint index, const GLbyte * v") -(void VertexAttrib4NsvARB 498 "GLuint index, const GLshort * v") -(void VertexAttrib4NivARB 507 "GLuint index, const GLint * v") -(void VertexAttrib4NusvARB 509 "GLuint index, const GLushort * v") -(void VertexAttrib4NuivARB 510 "GLuint index, const GLuint * v") -(void VertexAttribPointerARB 511 "GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer") -(void EnableVertexAttribArrayARB 512 "GLuint index") -(void DisableVertexAttribArrayARB 513 "GLuint index") -(void ProgramStringARB 530 "GLenum target, GLenum format, GLsizei len, const GLvoid * string") -(void ProgramEnvParameter4dARB 518 "GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w") -(void ProgramEnvParameter4dvARB 519 "GLenum target, GLuint index, const GLdouble * params") -(void ProgramEnvParameter4fARB 520 "GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w") -(void ProgramEnvParameter4fvARB 521 "GLenum target, GLuint index, const GLfloat * params") -(void ProgramLocalParameter4dARB 522 "GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w") -(void ProgramLocalParameter4dvARB 523 "GLenum target, GLuint index, const GLdouble * params") -(void ProgramLocalParameter4fARB 524 "GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w") -(void ProgramLocalParameter4fvARB 525 "GLenum target, GLuint index, const GLfloat * params") -(void GetProgramEnvParameterdvARB 526 "GLenum target, GLuint index, GLdouble * params") -(void GetProgramEnvParameterfvARB 527 "GLenum target, GLuint index, GLfloat * params") -(void GetProgramLocalParameterdvARB 528 "GLenum target, GLuint index, GLdouble * params") -(void GetProgramLocalParameterfvARB 529 "GLenum target, GLuint index, GLfloat * params") -(void GetProgramivARB 532 "GLenum target, GLenum pname, GLint * params") -(void GetProgramStringARB 531 "GLenum target, GLenum pname, GLvoid * string") -(void ProgramNamedParameter4fNV -1 "GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w") -(void ProgramNamedParameter4dNV -1 "GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w") -(void ProgramNamedParameter4fvNV -1 "GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v") -(void ProgramNamedParameter4dvNV -1 "GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v") -(void GetProgramNamedParameterfvNV -1 "GLuint id, GLsizei len, const GLubyte * name, GLfloat * params") -(void GetProgramNamedParameterdvNV -1 "GLuint id, GLsizei len, const GLubyte * name, GLdouble * params") -;; On newer versions of Mac OS X, OpenGL.framework defines these but -;; doesn't have dispatch slots for them. On earlier versions, they are -;; not defined. -;; if MAC_OS_X_VERSION < 10.3.4 -;; (void BindBufferARB -1 "GLenum target, GLuint buffer") -;; (void BufferDataARB -1 "GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage") -;; (void BufferSubDataARB -1 "GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data") -;; (void DeleteBuffersARB -1 "GLsizei n, const GLuint * buffer") -;; (void GenBuffersARB -1 "GLsizei n, GLuint * buffer") -;; (void GetBufferParameterivARB -1 "GLenum target, GLenum pname, GLint * params") -;; (void GetBufferPointervARB -1 "GLenum target, GLenum pname, GLvoid ** params") -;; (void GetBufferSubDataARB -1 "GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data") -;; (GLboolean IsBufferARB -1 "GLuint buffer") -;; (void* MapBufferARB -1 "GLenum target, GLenum access") -;; (GLboolean UnmapBufferARB -1 "GLenum target") -;; (void DepthBoundsEXT -1 "GLclampd zmin, GLclampd zmax") -;; endif -;; if MAC_OS_X_VERSION < 10.3.0 -;; (void GenQueriesARB -1 "GLsizei n, GLuint * ids") -;; (void DeleteQueriesARB -1 "GLsizei n, const GLuint * ids") -;; (GLboolean IsQueryARB -1 "GLuint id") -;; (void BeginQueryARB -1 "GLenum target, GLuint id") -;; (void EndQueryARB -1 "GLenum target") -;; (void GetQueryivARB -1 "GLenum target, GLenum pname, GLint * params") -;; (void GetQueryObjectivARB -1 "GLuint id, GLenum pname, GLint * params") -;; (void GetQueryObjectuivARB -1 "GLuint id, GLenum pname, GLuint * params") -;; endif -(void MultiModeDrawArraysIBM -1 "const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride") -(void MultiModeDrawElementsIBM -1 "const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride") -;; if MAC_OS_X_VERSION < 10.3.4 -;; (void BlendEquationSeparateEXT 458 "GLenum modeRGB, GLenum modeA" BlendEquationSeparateATI) -;; else -(void BlendEquationSeparateEXT 458 "GLenum modeRGB, GLenum modeA") -;; endif - -;; Entry points that exist in standard XFree86 libGL, but aren't in the -;; Mesa dispatch table, and aren't in OpenGL.framework - -(void ArrayElementEXT -1 "GLint i" ArrayElement) -(void BindTextureEXT -1 "GLenum target, GLuint texture" BindTexture) -(void BlendFuncSeparateINGR -1 "GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha" BlendFuncSeparateEXT) -(void ColorTableParameterfvSGI -1 "GLenum target, GLenum pname, const GLfloat * params" ColorTableParameterfv) -(void ColorTableParameterivSGI -1 "GLenum target, GLenum pname, const GLint * params" ColorTableParameteriv) -(void ColorTableSGI -1 "GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table" ColorTable) -(void ConvolutionFilter1DEXT -1 "GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image" ConvolutionFilter1D) -(void ConvolutionFilter2DEXT -1 "GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image" ConvolutionFilter2D) -(void ConvolutionParameterfEXT -1 "GLenum target, GLenum pname, GLfloat params" ConvolutionParameterf) -(void ConvolutionParameterfvEXT -1 "GLenum target, GLenum pname, const GLfloat * params" ConvolutionParameterfv) -(void ConvolutionParameteriEXT -1 "GLenum target, GLenum pname, GLint params" ConvolutionParameteri) -(void ConvolutionParameterivEXT -1 "GLenum target, GLenum pname, const GLint * params" ConvolutionParameteriv) -(void CopyColorSubTableEXT -1 "GLenum target, GLsizei start, GLint x, GLint y, GLsizei width" CopyColorSubTable) -(void CopyColorTableSGI -1 "GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width" CopyColorTable) -(void CopyConvolutionFilter1DEXT -1 "GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width" CopyConvolutionFilter1D) -(void CopyConvolutionFilter2DEXT -1 "GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height" CopyConvolutionFilter2D) -(void CopyTexImage1DEXT -1 "GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border" CopyTexImage1D) -(void CopyTexImage2DEXT -1 "GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border" CopyTexImage2D) -(void CopyTexSubImage1DEXT -1 "GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width" CopyTexSubImage1D) -(void CopyTexSubImage2DEXT -1 "GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height" CopyTexSubImage2D) -(void CopyTexSubImage3DEXT -1 "GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height" CopyTexSubImage3D) -(void DeleteTexturesEXT -1 "GLsizei n, const GLuint *textures" DeleteTextures) -(void DrawArraysEXT -1 "GLenum mode, GLint first, GLsizei count" DrawArrays) -(void GetPointervEXT -1 "GLenum pname, GLvoid * * params" GetPointerv) -(void HistogramEXT -1 "GLenum target, GLsizei width, GLenum internalformat, GLboolean sink" Histogram) -(void MinmaxEXT -1 "GLenum target, GLenum internalformat, GLboolean sink" Minmax) -(void PointParameterfSGIS -1 "GLenum pname, GLfloat param" PointParameterf) -(void PointParameterfvSGIS -1 "GLenum pname, const GLfloat * params" PointParameterfv) -(void PointParameteri -1 "GLenum pname, GLint params" PointParameteriNV) -(void PointParameteriv -1 "GLenum pname, const GLint * params" PointParameterivNV) -(void PrioritizeTexturesEXT -1 "GLsizei n, const GLenum * textures, const GLclampf * priorities" PrioritizeTextures) -(void ResetHistogramEXT -1 "GLenum target" ResetHistogram) -(void ResetMinmaxEXT -1 "GLenum target" ResetMinmax) -(void SampleMaskEXT -1 "GLclampf value, GLboolean invert" SampleMaskSGIS) -(void SamplePatternEXT -1 "GLenum pattern" SamplePatternSGIS) -(void SeparableFilter2DEXT -1 "GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column" SeparableFilter2D) -(void TexImage3DEXT -1 "GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels" TexImage3D) -(void TexSubImage1DEXT -1 "GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels" TexSubImage1D) -(void TexSubImage2DEXT -1 "GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels" TexSubImage2D) -(void TexSubImage3DEXT -1 "GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels" TexSubImage3D) -;; if MAC_OS_X_VERSION < 10.3.4 -;; (void BindBuffer -1 "GLenum target, GLuint buffer" BindBufferARB) -;; (void BufferData -1 "GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage" BufferDataARB) -;; (void BufferSubData -1 "GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data" BufferSubDataARB) -;; (void DeleteBuffers -1 "GLsizei n, const GLuint * buffer" DeleteBuffersARB) -;; (void GenBuffers -1 "GLsizei n, GLuint * buffer" GenBuffersARB) -;; (void GetBufferParameteriv -1 "GLenum target, GLenum pname, GLint * params" GetBufferParameterivARB) -;; (void GetBufferPointerv -1 "GLenum target, GLenum pname, GLvoid ** params" GetBufferPointervARB) -;; (void GetBufferSubData -1 "GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data" GetBufferSubDataARB) -;; (GLboolean IsBuffer -1 "GLuint buffer" IsBufferARB) -;; (void* MapBuffer -1 "GLenum target, GLenum access" MapBufferARB) -;; (GLboolean UnmapBuffer -1 "GLenum target" UnmapBufferARB) -;; endif -;; if MAC_OS_X_VERSION < 10.3.0 -;; (void GenQueries -1 "GLsizei n, GLuint * ids" GenQueriesARB) -;; (void DeleteQueries -1 "GLsizei n, const GLuint * ids" DeleteQueriesARB) -;; (GLboolean IsQuery -1 "GLuint id" IsQueryARB) -;; (void BeginQuery -1 "GLenum target, GLuint id" BeginQueryARB) -;; (void EndQuery -1 "GLenum target" EndQueryARB) -;; (void GetQueryiv -1 "GLenum target, GLenum pname, GLint * params" GetQueryivARB) -;; (void GetQueryObjectiv -1 "GLuint id, GLenum pname, GLint * params" GetQueryObjectivARB) -;; (void GetQueryObjectuiv -1 "GLuint id, GLenum pname, GLuint * params" GetQueryObjectuivARB) -;; endif diff --git a/nx-X11/lib/GL/apple/dri_dispatch.h b/nx-X11/lib/GL/apple/dri_dispatch.h deleted file mode 100644 index 854bbc302..000000000 --- a/nx-X11/lib/GL/apple/dri_dispatch.h +++ /dev/null @@ -1,3861 +0,0 @@ -/* dri_dispatch.h -- built automatically, DO NOT EDIT - $Id: dri_dispatch.h,v 1.6 2005/07/03 07:00:55 daniels Exp $ - $XFree86: $ */ -/* - Actually, this file has been edited to add necessary - dependencies on the version of Mac OS X. Someday the - automatic script should handle this. - */ - -DEFUN_LOCAL_VOID (NewList, - (void *rend, GLuint list, GLenum mode), - (list, mode)) - -DEFUN_LOCAL_VOID (EndList, - (void *rend), - ()) - -DEFUN_LOCAL_VOID (CallList, - (void *rend, GLuint list), - (list)) - -DEFUN_LOCAL_VOID (CallLists, - (void *rend, GLsizei n, GLenum type, const GLvoid * lists), - (n, type, lists)) - -DEFUN_LOCAL_VOID (DeleteLists, - (void *rend, GLuint list, GLsizei range), - (list, range)) - -DEFUN_LOCAL (GLuint, GenLists, - (void *rend, GLsizei range), - (range)) - -DEFUN_LOCAL_VOID (ListBase, - (void *rend, GLuint base), - (base)) - -DEFUN_LOCAL_VOID (Begin, - (void *rend, GLenum mode), - (mode)) - -DEFUN_LOCAL_VOID (Bitmap, - (void *rend, GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap), - (width, height, xorig, yorig, xmove, ymove, bitmap)) - -DEFUN_LOCAL_VOID (Color3b, - (void *rend, GLbyte red, GLbyte green, GLbyte blue), - (red, green, blue)) - -DEFUN_LOCAL_VOID (Color3bv, - (void *rend, const GLbyte * v), - (v)) - -DEFUN_LOCAL_VOID (Color3d, - (void *rend, GLdouble red, GLdouble green, GLdouble blue), - (red, green, blue)) - -DEFUN_LOCAL_VOID (Color3dv, - (void *rend, const GLdouble * v), - (v)) - -DEFUN_LOCAL_VOID (Color3f, - (void *rend, GLfloat red, GLfloat green, GLfloat blue), - (red, green, blue)) - -DEFUN_LOCAL_VOID (Color3fv, - (void *rend, const GLfloat * v), - (v)) - -DEFUN_LOCAL_VOID (Color3i, - (void *rend, GLint red, GLint green, GLint blue), - (red, green, blue)) - -DEFUN_LOCAL_VOID (Color3iv, - (void *rend, const GLint * v), - (v)) - -DEFUN_LOCAL_VOID (Color3s, - (void *rend, GLshort red, GLshort green, GLshort blue), - (red, green, blue)) - -DEFUN_LOCAL_VOID (Color3sv, - (void *rend, const GLshort * v), - (v)) - -DEFUN_LOCAL_VOID (Color3ub, - (void *rend, GLubyte red, GLubyte green, GLubyte blue), - (red, green, blue)) - -DEFUN_LOCAL_VOID (Color3ubv, - (void *rend, const GLubyte * v), - (v)) - -DEFUN_LOCAL_VOID (Color3ui, - (void *rend, GLuint red, GLuint green, GLuint blue), - (red, green, blue)) - -DEFUN_LOCAL_VOID (Color3uiv, - (void *rend, const GLuint * v), - (v)) - -DEFUN_LOCAL_VOID (Color3us, - (void *rend, GLushort red, GLushort green, GLushort blue), - (red, green, blue)) - -DEFUN_LOCAL_VOID (Color3usv, - (void *rend, const GLushort * v), - (v)) - -DEFUN_LOCAL_VOID (Color4b, - (void *rend, GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha), - (red, green, blue, alpha)) - -DEFUN_LOCAL_VOID (Color4bv, - (void *rend, const GLbyte * v), - (v)) - -DEFUN_LOCAL_VOID (Color4d, - (void *rend, GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha), - (red, green, blue, alpha)) - -DEFUN_LOCAL_VOID (Color4dv, - (void *rend, const GLdouble * v), - (v)) - -DEFUN_LOCAL_VOID (Color4f, - (void *rend, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha), - (red, green, blue, alpha)) - -DEFUN_LOCAL_VOID (Color4fv, - (void *rend, const GLfloat * v), - (v)) - -DEFUN_LOCAL_VOID (Color4i, - (void *rend, GLint red, GLint green, GLint blue, GLint alpha), - (red, green, blue, alpha)) - -DEFUN_LOCAL_VOID (Color4iv, - (void *rend, const GLint * v), - (v)) - -DEFUN_LOCAL_VOID (Color4s, - (void *rend, GLshort red, GLshort green, GLshort blue, GLshort alpha), - (red, green, blue, alpha)) - -DEFUN_LOCAL_VOID (Color4sv, - (void *rend, const GLshort * v), - (v)) - -DEFUN_LOCAL_VOID (Color4ub, - (void *rend, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha), - (red, green, blue, alpha)) - -DEFUN_LOCAL_VOID (Color4ubv, - (void *rend, const GLubyte * v), - (v)) - -DEFUN_LOCAL_VOID (Color4ui, - (void *rend, GLuint red, GLuint green, GLuint blue, GLuint alpha), - (red, green, blue, alpha)) - -DEFUN_LOCAL_VOID (Color4uiv, - (void *rend, const GLuint * v), - (v)) - -DEFUN_LOCAL_VOID (Color4us, - (void *rend, GLushort red, GLushort green, GLushort blue, GLushort alpha), - (red, green, blue, alpha)) - -DEFUN_LOCAL_VOID (Color4usv, - (void *rend, const GLushort * v), - (v)) - -DEFUN_LOCAL_VOID (EdgeFlag, - (void *rend, GLboolean flag), - (flag)) - -DEFUN_LOCAL_VOID (EdgeFlagv, - (void *rend, const GLboolean * flag), - (flag)) - -DEFUN_LOCAL_VOID (End, - (void *rend), - ()) - -DEFUN_LOCAL_VOID (Indexd, - (void *rend, GLdouble c), - (c)) - -DEFUN_LOCAL_VOID (Indexdv, - (void *rend, const GLdouble * c), - (c)) - -DEFUN_LOCAL_VOID (Indexf, - (void *rend, GLfloat c), - (c)) - -DEFUN_LOCAL_VOID (Indexfv, - (void *rend, const GLfloat * c), - (c)) - -DEFUN_LOCAL_VOID (Indexi, - (void *rend, GLint c), - (c)) - -DEFUN_LOCAL_VOID (Indexiv, - (void *rend, const GLint * c), - (c)) - -DEFUN_LOCAL_VOID (Indexs, - (void *rend, GLshort c), - (c)) - -DEFUN_LOCAL_VOID (Indexsv, - (void *rend, const GLshort * c), - (c)) - -DEFUN_LOCAL_VOID (Normal3b, - (void *rend, GLbyte nx, GLbyte ny, GLbyte nz), - (nx, ny, nz)) - -DEFUN_LOCAL_VOID (Normal3bv, - (void *rend, const GLbyte * v), - (v)) - -DEFUN_LOCAL_VOID (Normal3d, - (void *rend, GLdouble nx, GLdouble ny, GLdouble nz), - (nx, ny, nz)) - -DEFUN_LOCAL_VOID (Normal3dv, - (void *rend, const GLdouble * v), - (v)) - -DEFUN_LOCAL_VOID (Normal3f, - (void *rend, GLfloat nx, GLfloat ny, GLfloat nz), - (nx, ny, nz)) - -DEFUN_LOCAL_VOID (Normal3fv, - (void *rend, const GLfloat * v), - (v)) - -DEFUN_LOCAL_VOID (Normal3i, - (void *rend, GLint nx, GLint ny, GLint nz), - (nx, ny, nz)) - -DEFUN_LOCAL_VOID (Normal3iv, - (void *rend, const GLint * v), - (v)) - -DEFUN_LOCAL_VOID (Normal3s, - (void *rend, GLshort nx, GLshort ny, GLshort nz), - (nx, ny, nz)) - -DEFUN_LOCAL_VOID (Normal3sv, - (void *rend, const GLshort * v), - (v)) - -DEFUN_LOCAL_VOID (RasterPos2d, - (void *rend, GLdouble x, GLdouble y), - (x, y)) - -DEFUN_LOCAL_VOID (RasterPos2dv, - (void *rend, const GLdouble * v), - (v)) - -DEFUN_LOCAL_VOID (RasterPos2f, - (void *rend, GLfloat x, GLfloat y), - (x, y)) - -DEFUN_LOCAL_VOID (RasterPos2fv, - (void *rend, const GLfloat * v), - (v)) - -DEFUN_LOCAL_VOID (RasterPos2i, - (void *rend, GLint x, GLint y), - (x, y)) - -DEFUN_LOCAL_VOID (RasterPos2iv, - (void *rend, const GLint * v), - (v)) - -DEFUN_LOCAL_VOID (RasterPos2s, - (void *rend, GLshort x, GLshort y), - (x, y)) - -DEFUN_LOCAL_VOID (RasterPos2sv, - (void *rend, const GLshort * v), - (v)) - -DEFUN_LOCAL_VOID (RasterPos3d, - (void *rend, GLdouble x, GLdouble y, GLdouble z), - (x, y, z)) - -DEFUN_LOCAL_VOID (RasterPos3dv, - (void *rend, const GLdouble * v), - (v)) - -DEFUN_LOCAL_VOID (RasterPos3f, - (void *rend, GLfloat x, GLfloat y, GLfloat z), - (x, y, z)) - -DEFUN_LOCAL_VOID (RasterPos3fv, - (void *rend, const GLfloat * v), - (v)) - -DEFUN_LOCAL_VOID (RasterPos3i, - (void *rend, GLint x, GLint y, GLint z), - (x, y, z)) - -DEFUN_LOCAL_VOID (RasterPos3iv, - (void *rend, const GLint * v), - (v)) - -DEFUN_LOCAL_VOID (RasterPos3s, - (void *rend, GLshort x, GLshort y, GLshort z), - (x, y, z)) - -DEFUN_LOCAL_VOID (RasterPos3sv, - (void *rend, const GLshort * v), - (v)) - -DEFUN_LOCAL_VOID (RasterPos4d, - (void *rend, GLdouble x, GLdouble y, GLdouble z, GLdouble w), - (x, y, z, w)) - -DEFUN_LOCAL_VOID (RasterPos4dv, - (void *rend, const GLdouble * v), - (v)) - -DEFUN_LOCAL_VOID (RasterPos4f, - (void *rend, GLfloat x, GLfloat y, GLfloat z, GLfloat w), - (x, y, z, w)) - -DEFUN_LOCAL_VOID (RasterPos4fv, - (void *rend, const GLfloat * v), - (v)) - -DEFUN_LOCAL_VOID (RasterPos4i, - (void *rend, GLint x, GLint y, GLint z, GLint w), - (x, y, z, w)) - -DEFUN_LOCAL_VOID (RasterPos4iv, - (void *rend, const GLint * v), - (v)) - -DEFUN_LOCAL_VOID (RasterPos4s, - (void *rend, GLshort x, GLshort y, GLshort z, GLshort w), - (x, y, z, w)) - -DEFUN_LOCAL_VOID (RasterPos4sv, - (void *rend, const GLshort * v), - (v)) - -DEFUN_LOCAL_VOID (Rectd, - (void *rend, GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2), - (x1, y1, x2, y2)) - -DEFUN_LOCAL_VOID (Rectdv, - (void *rend, const GLdouble * v1, const GLdouble * v2), - (v1, v2)) - -DEFUN_LOCAL_VOID (Rectf, - (void *rend, GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2), - (x1, y1, x2, y2)) - -DEFUN_LOCAL_VOID (Rectfv, - (void *rend, const GLfloat * v1, const GLfloat * v2), - (v1, v2)) - -DEFUN_LOCAL_VOID (Recti, - (void *rend, GLint x1, GLint y1, GLint x2, GLint y2), - (x1, y1, x2, y2)) - -DEFUN_LOCAL_VOID (Rectiv, - (void *rend, const GLint * v1, const GLint * v2), - (v1, v2)) - -DEFUN_LOCAL_VOID (Rects, - (void *rend, GLshort x1, GLshort y1, GLshort x2, GLshort y2), - (x1, y1, x2, y2)) - -DEFUN_LOCAL_VOID (Rectsv, - (void *rend, const GLshort * v1, const GLshort * v2), - (v1, v2)) - -DEFUN_LOCAL_VOID (TexCoord1d, - (void *rend, GLdouble s), - (s)) - -DEFUN_LOCAL_VOID (TexCoord1dv, - (void *rend, const GLdouble * v), - (v)) - -DEFUN_LOCAL_VOID (TexCoord1f, - (void *rend, GLfloat s), - (s)) - -DEFUN_LOCAL_VOID (TexCoord1fv, - (void *rend, const GLfloat * v), - (v)) - -DEFUN_LOCAL_VOID (TexCoord1i, - (void *rend, GLint s), - (s)) - -DEFUN_LOCAL_VOID (TexCoord1iv, - (void *rend, const GLint * v), - (v)) - -DEFUN_LOCAL_VOID (TexCoord1s, - (void *rend, GLshort s), - (s)) - -DEFUN_LOCAL_VOID (TexCoord1sv, - (void *rend, const GLshort * v), - (v)) - -DEFUN_LOCAL_VOID (TexCoord2d, - (void *rend, GLdouble s, GLdouble t), - (s, t)) - -DEFUN_LOCAL_VOID (TexCoord2dv, - (void *rend, const GLdouble * v), - (v)) - -DEFUN_LOCAL_VOID (TexCoord2f, - (void *rend, GLfloat s, GLfloat t), - (s, t)) - -DEFUN_LOCAL_VOID (TexCoord2fv, - (void *rend, const GLfloat * v), - (v)) - -DEFUN_LOCAL_VOID (TexCoord2i, - (void *rend, GLint s, GLint t), - (s, t)) - -DEFUN_LOCAL_VOID (TexCoord2iv, - (void *rend, const GLint * v), - (v)) - -DEFUN_LOCAL_VOID (TexCoord2s, - (void *rend, GLshort s, GLshort t), - (s, t)) - -DEFUN_LOCAL_VOID (TexCoord2sv, - (void *rend, const GLshort * v), - (v)) - -DEFUN_LOCAL_VOID (TexCoord3d, - (void *rend, GLdouble s, GLdouble t, GLdouble r), - (s, t, r)) - -DEFUN_LOCAL_VOID (TexCoord3dv, - (void *rend, const GLdouble * v), - (v)) - -DEFUN_LOCAL_VOID (TexCoord3f, - (void *rend, GLfloat s, GLfloat t, GLfloat r), - (s, t, r)) - -DEFUN_LOCAL_VOID (TexCoord3fv, - (void *rend, const GLfloat * v), - (v)) - -DEFUN_LOCAL_VOID (TexCoord3i, - (void *rend, GLint s, GLint t, GLint r), - (s, t, r)) - -DEFUN_LOCAL_VOID (TexCoord3iv, - (void *rend, const GLint * v), - (v)) - -DEFUN_LOCAL_VOID (TexCoord3s, - (void *rend, GLshort s, GLshort t, GLshort r), - (s, t, r)) - -DEFUN_LOCAL_VOID (TexCoord3sv, - (void *rend, const GLshort * v), - (v)) - -DEFUN_LOCAL_VOID (TexCoord4d, - (void *rend, GLdouble s, GLdouble t, GLdouble r, GLdouble q), - (s, t, r, q)) - -DEFUN_LOCAL_VOID (TexCoord4dv, - (void *rend, const GLdouble * v), - (v)) - -DEFUN_LOCAL_VOID (TexCoord4f, - (void *rend, GLfloat s, GLfloat t, GLfloat r, GLfloat q), - (s, t, r, q)) - -DEFUN_LOCAL_VOID (TexCoord4fv, - (void *rend, const GLfloat * v), - (v)) - -DEFUN_LOCAL_VOID (TexCoord4i, - (void *rend, GLint s, GLint t, GLint r, GLint q), - (s, t, r, q)) - -DEFUN_LOCAL_VOID (TexCoord4iv, - (void *rend, const GLint * v), - (v)) - -DEFUN_LOCAL_VOID (TexCoord4s, - (void *rend, GLshort s, GLshort t, GLshort r, GLshort q), - (s, t, r, q)) - -DEFUN_LOCAL_VOID (TexCoord4sv, - (void *rend, const GLshort * v), - (v)) - -DEFUN_LOCAL_VOID (Vertex2d, - (void *rend, GLdouble x, GLdouble y), - (x, y)) - -DEFUN_LOCAL_VOID (Vertex2dv, - (void *rend, const GLdouble * v), - (v)) - -DEFUN_LOCAL_VOID (Vertex2f, - (void *rend, GLfloat x, GLfloat y), - (x, y)) - -DEFUN_LOCAL_VOID (Vertex2fv, - (void *rend, const GLfloat * v), - (v)) - -DEFUN_LOCAL_VOID (Vertex2i, - (void *rend, GLint x, GLint y), - (x, y)) - -DEFUN_LOCAL_VOID (Vertex2iv, - (void *rend, const GLint * v), - (v)) - -DEFUN_LOCAL_VOID (Vertex2s, - (void *rend, GLshort x, GLshort y), - (x, y)) - -DEFUN_LOCAL_VOID (Vertex2sv, - (void *rend, const GLshort * v), - (v)) - -DEFUN_LOCAL_VOID (Vertex3d, - (void *rend, GLdouble x, GLdouble y, GLdouble z), - (x, y, z)) - -DEFUN_LOCAL_VOID (Vertex3dv, - (void *rend, const GLdouble * v), - (v)) - -DEFUN_LOCAL_VOID (Vertex3f, - (void *rend, GLfloat x, GLfloat y, GLfloat z), - (x, y, z)) - -DEFUN_LOCAL_VOID (Vertex3fv, - (void *rend, const GLfloat * v), - (v)) - -DEFUN_LOCAL_VOID (Vertex3i, - (void *rend, GLint x, GLint y, GLint z), - (x, y, z)) - -DEFUN_LOCAL_VOID (Vertex3iv, - (void *rend, const GLint * v), - (v)) - -DEFUN_LOCAL_VOID (Vertex3s, - (void *rend, GLshort x, GLshort y, GLshort z), - (x, y, z)) - -DEFUN_LOCAL_VOID (Vertex3sv, - (void *rend, const GLshort * v), - (v)) - -DEFUN_LOCAL_VOID (Vertex4d, - (void *rend, GLdouble x, GLdouble y, GLdouble z, GLdouble w), - (x, y, z, w)) - -DEFUN_LOCAL_VOID (Vertex4dv, - (void *rend, const GLdouble * v), - (v)) - -DEFUN_LOCAL_VOID (Vertex4f, - (void *rend, GLfloat x, GLfloat y, GLfloat z, GLfloat w), - (x, y, z, w)) - -DEFUN_LOCAL_VOID (Vertex4fv, - (void *rend, const GLfloat * v), - (v)) - -DEFUN_LOCAL_VOID (Vertex4i, - (void *rend, GLint x, GLint y, GLint z, GLint w), - (x, y, z, w)) - -DEFUN_LOCAL_VOID (Vertex4iv, - (void *rend, const GLint * v), - (v)) - -DEFUN_LOCAL_VOID (Vertex4s, - (void *rend, GLshort x, GLshort y, GLshort z, GLshort w), - (x, y, z, w)) - -DEFUN_LOCAL_VOID (Vertex4sv, - (void *rend, const GLshort * v), - (v)) - -DEFUN_LOCAL_VOID (ClipPlane, - (void *rend, GLenum plane, const GLdouble * equation), - (plane, equation)) - -DEFUN_LOCAL_VOID (ColorMaterial, - (void *rend, GLenum face, GLenum mode), - (face, mode)) - -DEFUN_LOCAL_VOID (CullFace, - (void *rend, GLenum mode), - (mode)) - -DEFUN_LOCAL_VOID (Fogf, - (void *rend, GLenum pname, GLfloat param), - (pname, param)) - -DEFUN_LOCAL_VOID (Fogfv, - (void *rend, GLenum pname, const GLfloat * params), - (pname, params)) - -DEFUN_LOCAL_VOID (Fogi, - (void *rend, GLenum pname, GLint param), - (pname, param)) - -DEFUN_LOCAL_VOID (Fogiv, - (void *rend, GLenum pname, const GLint * params), - (pname, params)) - -DEFUN_LOCAL_VOID (FrontFace, - (void *rend, GLenum mode), - (mode)) - -DEFUN_LOCAL_VOID (Hint, - (void *rend, GLenum target, GLenum mode), - (target, mode)) - -DEFUN_LOCAL_VOID (Lightf, - (void *rend, GLenum light, GLenum pname, GLfloat param), - (light, pname, param)) - -DEFUN_LOCAL_VOID (Lightfv, - (void *rend, GLenum light, GLenum pname, const GLfloat * params), - (light, pname, params)) - -DEFUN_LOCAL_VOID (Lighti, - (void *rend, GLenum light, GLenum pname, GLint param), - (light, pname, param)) - -DEFUN_LOCAL_VOID (Lightiv, - (void *rend, GLenum light, GLenum pname, const GLint * params), - (light, pname, params)) - -DEFUN_LOCAL_VOID (LightModelf, - (void *rend, GLenum pname, GLfloat param), - (pname, param)) - -DEFUN_LOCAL_VOID (LightModelfv, - (void *rend, GLenum pname, const GLfloat * params), - (pname, params)) - -DEFUN_LOCAL_VOID (LightModeli, - (void *rend, GLenum pname, GLint param), - (pname, param)) - -DEFUN_LOCAL_VOID (LightModeliv, - (void *rend, GLenum pname, const GLint * params), - (pname, params)) - -DEFUN_LOCAL_VOID (LineStipple, - (void *rend, GLint factor, GLushort pattern), - (factor, pattern)) - -DEFUN_LOCAL_VOID (LineWidth, - (void *rend, GLfloat width), - (width)) - -DEFUN_LOCAL_VOID (Materialf, - (void *rend, GLenum face, GLenum pname, GLfloat param), - (face, pname, param)) - -DEFUN_LOCAL_VOID (Materialfv, - (void *rend, GLenum face, GLenum pname, const GLfloat * params), - (face, pname, params)) - -DEFUN_LOCAL_VOID (Materiali, - (void *rend, GLenum face, GLenum pname, GLint param), - (face, pname, param)) - -DEFUN_LOCAL_VOID (Materialiv, - (void *rend, GLenum face, GLenum pname, const GLint * params), - (face, pname, params)) - -DEFUN_LOCAL_VOID (PointSize, - (void *rend, GLfloat size), - (size)) - -DEFUN_LOCAL_VOID (PolygonMode, - (void *rend, GLenum face, GLenum mode), - (face, mode)) - -DEFUN_LOCAL_VOID (PolygonStipple, - (void *rend, const GLubyte * mask), - (mask)) - -DEFUN_LOCAL_VOID (Scissor, - (void *rend, GLint x, GLint y, GLsizei width, GLsizei height), - (x, y, width, height)) - -DEFUN_LOCAL_VOID (ShadeModel, - (void *rend, GLenum mode), - (mode)) - -DEFUN_LOCAL_VOID (TexParameterf, - (void *rend, GLenum target, GLenum pname, GLfloat param), - (target, pname, param)) - -DEFUN_LOCAL_VOID (TexParameterfv, - (void *rend, GLenum target, GLenum pname, const GLfloat * params), - (target, pname, params)) - -DEFUN_LOCAL_VOID (TexParameteri, - (void *rend, GLenum target, GLenum pname, GLint param), - (target, pname, param)) - -DEFUN_LOCAL_VOID (TexParameteriv, - (void *rend, GLenum target, GLenum pname, const GLint * params), - (target, pname, params)) - -DEFUN_LOCAL_VOID (TexImage1D, - (void *rend, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels), - (target, level, internalformat, width, border, format, type, pixels)) - -DEFUN_LOCAL_VOID (TexImage2D, - (void *rend, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels), - (target, level, internalformat, width, height, border, format, type, pixels)) - -DEFUN_LOCAL_VOID (TexEnvf, - (void *rend, GLenum target, GLenum pname, GLfloat param), - (target, pname, param)) - -DEFUN_LOCAL_VOID (TexEnvfv, - (void *rend, GLenum target, GLenum pname, const GLfloat * params), - (target, pname, params)) - -DEFUN_LOCAL_VOID (TexEnvi, - (void *rend, GLenum target, GLenum pname, GLint param), - (target, pname, param)) - -DEFUN_LOCAL_VOID (TexEnviv, - (void *rend, GLenum target, GLenum pname, const GLint * params), - (target, pname, params)) - -DEFUN_LOCAL_VOID (TexGend, - (void *rend, GLenum coord, GLenum pname, GLdouble param), - (coord, pname, param)) - -DEFUN_LOCAL_VOID (TexGendv, - (void *rend, GLenum coord, GLenum pname, const GLdouble * params), - (coord, pname, params)) - -DEFUN_LOCAL_VOID (TexGenf, - (void *rend, GLenum coord, GLenum pname, GLfloat param), - (coord, pname, param)) - -DEFUN_LOCAL_VOID (TexGenfv, - (void *rend, GLenum coord, GLenum pname, const GLfloat * params), - (coord, pname, params)) - -DEFUN_LOCAL_VOID (TexGeni, - (void *rend, GLenum coord, GLenum pname, GLint param), - (coord, pname, param)) - -DEFUN_LOCAL_VOID (TexGeniv, - (void *rend, GLenum coord, GLenum pname, const GLint * params), - (coord, pname, params)) - -DEFUN_LOCAL_VOID (FeedbackBuffer, - (void *rend, GLsizei size, GLenum type, GLfloat * buffer), - (size, type, buffer)) - -DEFUN_LOCAL_VOID (SelectBuffer, - (void *rend, GLsizei size, GLuint * buffer), - (size, buffer)) - -DEFUN_LOCAL (GLint, RenderMode, - (void *rend, GLenum mode), - (mode)) - -DEFUN_LOCAL_VOID (InitNames, - (void *rend), - ()) - -DEFUN_LOCAL_VOID (LoadName, - (void *rend, GLuint name), - (name)) - -DEFUN_LOCAL_VOID (PassThrough, - (void *rend, GLfloat token), - (token)) - -DEFUN_LOCAL_VOID (PopName, - (void *rend), - ()) - -DEFUN_LOCAL_VOID (PushName, - (void *rend, GLuint name), - (name)) - -DEFUN_LOCAL_VOID (DrawBuffer, - (void *rend, GLenum mode), - (mode)) - -DEFUN_LOCAL_VOID (Clear, - (void *rend, GLbitfield mask), - (mask)) - -DEFUN_LOCAL_VOID (ClearAccum, - (void *rend, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha), - (red, green, blue, alpha)) - -DEFUN_LOCAL_VOID (ClearIndex, - (void *rend, GLfloat c), - (c)) - -DEFUN_LOCAL_VOID (ClearColor, - (void *rend, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha), - (red, green, blue, alpha)) - -DEFUN_LOCAL_VOID (ClearStencil, - (void *rend, GLint s), - (s)) - -DEFUN_LOCAL_VOID (ClearDepth, - (void *rend, GLclampd depth), - (depth)) - -DEFUN_LOCAL_VOID (StencilMask, - (void *rend, GLuint mask), - (mask)) - -DEFUN_LOCAL_VOID (ColorMask, - (void *rend, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha), - (red, green, blue, alpha)) - -DEFUN_LOCAL_VOID (DepthMask, - (void *rend, GLboolean flag), - (flag)) - -DEFUN_LOCAL_VOID (IndexMask, - (void *rend, GLuint mask), - (mask)) - -DEFUN_LOCAL_VOID (Accum, - (void *rend, GLenum op, GLfloat value), - (op, value)) - -DEFUN_LOCAL_VOID (Disable, - (void *rend, GLenum cap), - (cap)) - -DEFUN_LOCAL_VOID (Enable, - (void *rend, GLenum cap), - (cap)) - -DEFUN_LOCAL_VOID (Finish, - (void *rend), - ()) - -DEFUN_LOCAL_VOID (Flush, - (void *rend), - ()) - -DEFUN_LOCAL_VOID (PopAttrib, - (void *rend), - ()) - -DEFUN_LOCAL_VOID (PushAttrib, - (void *rend, GLbitfield mask), - (mask)) - -DEFUN_LOCAL_VOID (Map1d, - (void *rend, GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble * points), - (target, u1, u2, stride, order, points)) - -DEFUN_LOCAL_VOID (Map1f, - (void *rend, GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat * points), - (target, u1, u2, stride, order, points)) - -DEFUN_LOCAL_VOID (Map2d, - (void *rend, GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble * points), - (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points)) - -DEFUN_LOCAL_VOID (Map2f, - (void *rend, GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat * points), - (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points)) - -DEFUN_LOCAL_VOID (MapGrid1d, - (void *rend, GLint un, GLdouble u1, GLdouble u2), - (un, u1, u2)) - -DEFUN_LOCAL_VOID (MapGrid1f, - (void *rend, GLint un, GLfloat u1, GLfloat u2), - (un, u1, u2)) - -DEFUN_LOCAL_VOID (MapGrid2d, - (void *rend, GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2), - (un, u1, u2, vn, v1, v2)) - -DEFUN_LOCAL_VOID (MapGrid2f, - (void *rend, GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2), - (un, u1, u2, vn, v1, v2)) - -DEFUN_LOCAL_VOID (EvalCoord1d, - (void *rend, GLdouble u), - (u)) - -DEFUN_LOCAL_VOID (EvalCoord1dv, - (void *rend, const GLdouble * u), - (u)) - -DEFUN_LOCAL_VOID (EvalCoord1f, - (void *rend, GLfloat u), - (u)) - -DEFUN_LOCAL_VOID (EvalCoord1fv, - (void *rend, const GLfloat * u), - (u)) - -DEFUN_LOCAL_VOID (EvalCoord2d, - (void *rend, GLdouble u, GLdouble v), - (u, v)) - -DEFUN_LOCAL_VOID (EvalCoord2dv, - (void *rend, const GLdouble * u), - (u)) - -DEFUN_LOCAL_VOID (EvalCoord2f, - (void *rend, GLfloat u, GLfloat v), - (u, v)) - -DEFUN_LOCAL_VOID (EvalCoord2fv, - (void *rend, const GLfloat * u), - (u)) - -DEFUN_LOCAL_VOID (EvalMesh1, - (void *rend, GLenum mode, GLint i1, GLint i2), - (mode, i1, i2)) - -DEFUN_LOCAL_VOID (EvalPoint1, - (void *rend, GLint i), - (i)) - -DEFUN_LOCAL_VOID (EvalMesh2, - (void *rend, GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2), - (mode, i1, i2, j1, j2)) - -DEFUN_LOCAL_VOID (EvalPoint2, - (void *rend, GLint i, GLint j), - (i, j)) - -DEFUN_LOCAL_VOID (AlphaFunc, - (void *rend, GLenum func, GLclampf ref), - (func, ref)) - -DEFUN_LOCAL_VOID (BlendFunc, - (void *rend, GLenum sfactor, GLenum dfactor), - (sfactor, dfactor)) - -DEFUN_LOCAL_VOID (LogicOp, - (void *rend, GLenum opcode), - (opcode)) - -DEFUN_LOCAL_VOID (StencilFunc, - (void *rend, GLenum func, GLint ref, GLuint mask), - (func, ref, mask)) - -DEFUN_LOCAL_VOID (StencilOp, - (void *rend, GLenum fail, GLenum zfail, GLenum zpass), - (fail, zfail, zpass)) - -DEFUN_LOCAL_VOID (DepthFunc, - (void *rend, GLenum func), - (func)) - -DEFUN_LOCAL_VOID (PixelZoom, - (void *rend, GLfloat xfactor, GLfloat yfactor), - (xfactor, yfactor)) - -DEFUN_LOCAL_VOID (PixelTransferf, - (void *rend, GLenum pname, GLfloat param), - (pname, param)) - -DEFUN_LOCAL_VOID (PixelTransferi, - (void *rend, GLenum pname, GLint param), - (pname, param)) - -DEFUN_LOCAL_VOID (PixelStoref, - (void *rend, GLenum pname, GLfloat param), - (pname, param)) - -DEFUN_LOCAL_VOID (PixelStorei, - (void *rend, GLenum pname, GLint param), - (pname, param)) - -DEFUN_LOCAL_VOID (PixelMapfv, - (void *rend, GLenum map, GLint mapsize, const GLfloat * values), - (map, mapsize, values)) - -DEFUN_LOCAL_VOID (PixelMapuiv, - (void *rend, GLenum map, GLint mapsize, const GLuint * values), - (map, mapsize, values)) - -DEFUN_LOCAL_VOID (PixelMapusv, - (void *rend, GLenum map, GLint mapsize, const GLushort * values), - (map, mapsize, values)) - -DEFUN_LOCAL_VOID (ReadBuffer, - (void *rend, GLenum mode), - (mode)) - -DEFUN_LOCAL_VOID (CopyPixels, - (void *rend, GLint x, GLint y, GLsizei width, GLsizei height, GLenum type), - (x, y, width, height, type)) - -DEFUN_LOCAL_VOID (ReadPixels, - (void *rend, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * pixels), - (x, y, width, height, format, type, pixels)) - -DEFUN_LOCAL_VOID (DrawPixels, - (void *rend, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels), - (width, height, format, type, pixels)) - -DEFUN_LOCAL_VOID (GetBooleanv, - (void *rend, GLenum pname, GLboolean * params), - (pname, params)) - -DEFUN_LOCAL_VOID (GetClipPlane, - (void *rend, GLenum plane, GLdouble * equation), - (plane, equation)) - -DEFUN_LOCAL_VOID (GetDoublev, - (void *rend, GLenum pname, GLdouble * params), - (pname, params)) - -DEFUN_LOCAL (GLenum, GetError, - (void *rend), - ()) - -DEFUN_LOCAL_VOID (GetFloatv, - (void *rend, GLenum pname, GLfloat * params), - (pname, params)) - -DEFUN_LOCAL_VOID (GetIntegerv, - (void *rend, GLenum pname, GLint * params), - (pname, params)) - -DEFUN_LOCAL_VOID (GetLightfv, - (void *rend, GLenum light, GLenum pname, GLfloat * params), - (light, pname, params)) - -DEFUN_LOCAL_VOID (GetLightiv, - (void *rend, GLenum light, GLenum pname, GLint * params), - (light, pname, params)) - -DEFUN_LOCAL_VOID (GetMapdv, - (void *rend, GLenum target, GLenum query, GLdouble * v), - (target, query, v)) - -DEFUN_LOCAL_VOID (GetMapfv, - (void *rend, GLenum target, GLenum query, GLfloat * v), - (target, query, v)) - -DEFUN_LOCAL_VOID (GetMapiv, - (void *rend, GLenum target, GLenum query, GLint * v), - (target, query, v)) - -DEFUN_LOCAL_VOID (GetMaterialfv, - (void *rend, GLenum face, GLenum pname, GLfloat * params), - (face, pname, params)) - -DEFUN_LOCAL_VOID (GetMaterialiv, - (void *rend, GLenum face, GLenum pname, GLint * params), - (face, pname, params)) - -DEFUN_LOCAL_VOID (GetPixelMapfv, - (void *rend, GLenum map, GLfloat * values), - (map, values)) - -DEFUN_LOCAL_VOID (GetPixelMapuiv, - (void *rend, GLenum map, GLuint * values), - (map, values)) - -DEFUN_LOCAL_VOID (GetPixelMapusv, - (void *rend, GLenum map, GLushort * values), - (map, values)) - -DEFUN_LOCAL_VOID (GetPolygonStipple, - (void *rend, GLubyte * mask), - (mask)) - -DEFUN_LOCAL (const GLubyte *, GetString, - (void *rend, GLenum name), - (name)) - -DEFUN_LOCAL_VOID (GetTexEnvfv, - (void *rend, GLenum target, GLenum pname, GLfloat * params), - (target, pname, params)) - -DEFUN_LOCAL_VOID (GetTexEnviv, - (void *rend, GLenum target, GLenum pname, GLint * params), - (target, pname, params)) - -DEFUN_LOCAL_VOID (GetTexGendv, - (void *rend, GLenum coord, GLenum pname, GLdouble * params), - (coord, pname, params)) - -DEFUN_LOCAL_VOID (GetTexGenfv, - (void *rend, GLenum coord, GLenum pname, GLfloat * params), - (coord, pname, params)) - -DEFUN_LOCAL_VOID (GetTexGeniv, - (void *rend, GLenum coord, GLenum pname, GLint * params), - (coord, pname, params)) - -DEFUN_LOCAL_VOID (GetTexImage, - (void *rend, GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels), - (target, level, format, type, pixels)) - -DEFUN_LOCAL_VOID (GetTexParameterfv, - (void *rend, GLenum target, GLenum pname, GLfloat * params), - (target, pname, params)) - -DEFUN_LOCAL_VOID (GetTexParameteriv, - (void *rend, GLenum target, GLenum pname, GLint * params), - (target, pname, params)) - -DEFUN_LOCAL_VOID (GetTexLevelParameterfv, - (void *rend, GLenum target, GLint level, GLenum pname, GLfloat * params), - (target, level, pname, params)) - -DEFUN_LOCAL_VOID (GetTexLevelParameteriv, - (void *rend, GLenum target, GLint level, GLenum pname, GLint * params), - (target, level, pname, params)) - -DEFUN_LOCAL (GLboolean, IsEnabled, - (void *rend, GLenum cap), - (cap)) - -DEFUN_LOCAL (GLboolean, IsList, - (void *rend, GLuint list), - (list)) - -DEFUN_LOCAL_VOID (DepthRange, - (void *rend, GLclampd zNear, GLclampd zFar), - (zNear, zFar)) - -DEFUN_LOCAL_VOID (Frustum, - (void *rend, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar), - (left, right, bottom, top, zNear, zFar)) - -DEFUN_LOCAL_VOID (LoadIdentity, - (void *rend), - ()) - -DEFUN_LOCAL_VOID (LoadMatrixf, - (void *rend, const GLfloat * m), - (m)) - -DEFUN_LOCAL_VOID (LoadMatrixd, - (void *rend, const GLdouble * m), - (m)) - -DEFUN_LOCAL_VOID (MatrixMode, - (void *rend, GLenum mode), - (mode)) - -DEFUN_LOCAL_VOID (MultMatrixf, - (void *rend, const GLfloat * m), - (m)) - -DEFUN_LOCAL_VOID (MultMatrixd, - (void *rend, const GLdouble * m), - (m)) - -DEFUN_LOCAL_VOID (Ortho, - (void *rend, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar), - (left, right, bottom, top, zNear, zFar)) - -DEFUN_LOCAL_VOID (PopMatrix, - (void *rend), - ()) - -DEFUN_LOCAL_VOID (PushMatrix, - (void *rend), - ()) - -DEFUN_LOCAL_VOID (Rotated, - (void *rend, GLdouble angle, GLdouble x, GLdouble y, GLdouble z), - (angle, x, y, z)) - -DEFUN_LOCAL_VOID (Rotatef, - (void *rend, GLfloat angle, GLfloat x, GLfloat y, GLfloat z), - (angle, x, y, z)) - -DEFUN_LOCAL_VOID (Scaled, - (void *rend, GLdouble x, GLdouble y, GLdouble z), - (x, y, z)) - -DEFUN_LOCAL_VOID (Scalef, - (void *rend, GLfloat x, GLfloat y, GLfloat z), - (x, y, z)) - -DEFUN_LOCAL_VOID (Translated, - (void *rend, GLdouble x, GLdouble y, GLdouble z), - (x, y, z)) - -DEFUN_LOCAL_VOID (Translatef, - (void *rend, GLfloat x, GLfloat y, GLfloat z), - (x, y, z)) - -DEFUN_LOCAL_VOID (Viewport, - (void *rend, GLint x, GLint y, GLsizei width, GLsizei height), - (x, y, width, height)) - -DEFUN_LOCAL_VOID (ArrayElement, - (void *rend, GLint i), - (i)) - -DEFUN_LOCAL_VOID (BindTexture, - (void *rend, GLenum target, GLenum texture), - (target, texture)) - -DEFUN_LOCAL_VOID (ColorPointer, - (void *rend, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer), - (size, type, stride, pointer)) - -DEFUN_LOCAL_VOID (DisableClientState, - (void *rend, GLenum array), - (array)) - -DEFUN_LOCAL_VOID (DrawArrays, - (void *rend, GLenum mode, GLint first, GLsizei count), - (mode, first, count)) - -DEFUN_LOCAL_VOID (DrawElements, - (void *rend, GLenum mode, GLsizei count, GLenum type, const GLvoid * indices), - (mode, count, type, indices)) - -DEFUN_LOCAL_VOID (EdgeFlagPointer, - (void *rend, GLsizei stride, const GLvoid * pointer), - (stride, pointer)) - -DEFUN_LOCAL_VOID (EnableClientState, - (void *rend, GLenum array), - (array)) - -DEFUN_LOCAL_VOID (IndexPointer, - (void *rend, GLenum type, GLsizei stride, const GLvoid * pointer), - (type, stride, pointer)) - -DEFUN_LOCAL_VOID (Indexub, - (void *rend, GLubyte c), - (c)) - -DEFUN_LOCAL_VOID (Indexubv, - (void *rend, const GLubyte * c), - (c)) - -DEFUN_LOCAL_VOID (InterleavedArrays, - (void *rend, GLenum format, GLsizei stride, const GLvoid * pointer), - (format, stride, pointer)) - -DEFUN_LOCAL_VOID (NormalPointer, - (void *rend, GLenum type, GLsizei stride, const GLvoid * pointer), - (type, stride, pointer)) - -DEFUN_LOCAL_VOID (PolygonOffset, - (void *rend, GLfloat factor, GLfloat units), - (factor, units)) - -DEFUN_LOCAL_VOID (TexCoordPointer, - (void *rend, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer), - (size, type, stride, pointer)) - -DEFUN_LOCAL_VOID (VertexPointer, - (void *rend, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer), - (size, type, stride, pointer)) - -DEFUN_LOCAL (GLboolean, AreTexturesResident, - (void *rend, GLsizei n, const GLenum * textures, GLboolean * residences), - (n, textures, residences)) - -DEFUN_LOCAL_VOID (CopyTexImage1D, - (void *rend, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border), - (target, level, internalformat, x, y, width, border)) - -DEFUN_LOCAL_VOID (CopyTexImage2D, - (void *rend, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border), - (target, level, internalformat, x, y, width, height, border)) - -DEFUN_LOCAL_VOID (CopyTexSubImage1D, - (void *rend, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width), - (target, level, xoffset, x, y, width)) - -DEFUN_LOCAL_VOID (CopyTexSubImage2D, - (void *rend, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height), - (target, level, xoffset, yoffset, x, y, width, height)) - -DEFUN_LOCAL_VOID (DeleteTextures, - (void *rend, GLsizei n, const GLenum * textures), - (n, textures)) - -DEFUN_LOCAL_VOID (GenTextures, - (void *rend, GLsizei n, GLenum * textures), - (n, textures)) - -DEFUN_LOCAL_VOID (GetPointerv, - (void *rend, GLenum pname, GLvoid * * params), - (pname, params)) - -DEFUN_LOCAL (GLboolean, IsTexture, - (void *rend, GLenum texture), - (texture)) - -DEFUN_LOCAL_VOID (PrioritizeTextures, - (void *rend, GLsizei n, const GLenum * textures, const GLclampf * priorities), - (n, textures, priorities)) - -DEFUN_LOCAL_VOID (TexSubImage1D, - (void *rend, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels), - (target, level, xoffset, width, format, type, pixels)) - -DEFUN_LOCAL_VOID (TexSubImage2D, - (void *rend, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels), - (target, level, xoffset, yoffset, width, height, format, type, pixels)) - -DEFUN_LOCAL_VOID (PopClientAttrib, - (void *rend), - ()) - -DEFUN_LOCAL_VOID (PushClientAttrib, - (void *rend, GLbitfield mask), - (mask)) - -DEFUN_LOCAL_VOID (BlendColor, - (void *rend, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha), - (red, green, blue, alpha)) - -DEFUN_LOCAL_VOID (BlendEquation, - (void *rend, GLenum mode), - (mode)) - -DEFUN_LOCAL_VOID (DrawRangeElements, - (void *rend, GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices), - (mode, start, end, count, type, indices)) - -DEFUN_LOCAL_VOID (ColorTable, - (void *rend, GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table), - (target, internalformat, width, format, type, table)) - -DEFUN_LOCAL_VOID (ColorTableParameterfv, - (void *rend, GLenum target, GLenum pname, const GLfloat * params), - (target, pname, params)) - -DEFUN_LOCAL_VOID (ColorTableParameteriv, - (void *rend, GLenum target, GLenum pname, const GLint * params), - (target, pname, params)) - -DEFUN_LOCAL_VOID (CopyColorTable, - (void *rend, GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width), - (target, internalformat, x, y, width)) - -DEFUN_LOCAL_VOID (GetColorTable, - (void *rend, GLenum target, GLenum format, GLenum type, GLvoid * table), - (target, format, type, table)) - -DEFUN_LOCAL_VOID (GetColorTableParameterfv, - (void *rend, GLenum target, GLenum pname, GLfloat * params), - (target, pname, params)) - -DEFUN_LOCAL_VOID (GetColorTableParameteriv, - (void *rend, GLenum target, GLenum pname, GLint * params), - (target, pname, params)) - -DEFUN_LOCAL_VOID (ColorSubTable, - (void *rend, GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data), - (target, start, count, format, type, data)) - -DEFUN_LOCAL_VOID (CopyColorSubTable, - (void *rend, GLenum target, GLsizei start, GLint x, GLint y, GLsizei width), - (target, start, x, y, width)) - -DEFUN_LOCAL_VOID (ConvolutionFilter1D, - (void *rend, GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image), - (target, internalformat, width, format, type, image)) - -DEFUN_LOCAL_VOID (ConvolutionFilter2D, - (void *rend, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image), - (target, internalformat, width, height, format, type, image)) - -DEFUN_LOCAL_VOID (ConvolutionParameterf, - (void *rend, GLenum target, GLenum pname, GLfloat params), - (target, pname, params)) - -DEFUN_LOCAL_VOID (ConvolutionParameterfv, - (void *rend, GLenum target, GLenum pname, const GLfloat * params), - (target, pname, params)) - -DEFUN_LOCAL_VOID (ConvolutionParameteri, - (void *rend, GLenum target, GLenum pname, GLint params), - (target, pname, params)) - -DEFUN_LOCAL_VOID (ConvolutionParameteriv, - (void *rend, GLenum target, GLenum pname, const GLint * params), - (target, pname, params)) - -DEFUN_LOCAL_VOID (CopyConvolutionFilter1D, - (void *rend, GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width), - (target, internalformat, x, y, width)) - -DEFUN_LOCAL_VOID (CopyConvolutionFilter2D, - (void *rend, GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height), - (target, internalformat, x, y, width, height)) - -DEFUN_LOCAL_VOID (GetConvolutionFilter, - (void *rend, GLenum target, GLenum format, GLenum type, GLvoid * image), - (target, format, type, image)) - -DEFUN_LOCAL_VOID (GetConvolutionParameterfv, - (void *rend, GLenum target, GLenum pname, GLfloat * params), - (target, pname, params)) - -DEFUN_LOCAL_VOID (GetConvolutionParameteriv, - (void *rend, GLenum target, GLenum pname, GLint * params), - (target, pname, params)) - -DEFUN_LOCAL_VOID (GetSeparableFilter, - (void *rend, GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span), - (target, format, type, row, column, span)) - -DEFUN_LOCAL_VOID (SeparableFilter2D, - (void *rend, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column), - (target, internalformat, width, height, format, type, row, column)) - -DEFUN_LOCAL_VOID (GetHistogram, - (void *rend, GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values), - (target, reset, format, type, values)) - -DEFUN_LOCAL_VOID (GetHistogramParameterfv, - (void *rend, GLenum target, GLenum pname, GLfloat * params), - (target, pname, params)) - -DEFUN_LOCAL_VOID (GetHistogramParameteriv, - (void *rend, GLenum target, GLenum pname, GLint * params), - (target, pname, params)) - -DEFUN_LOCAL_VOID (GetMinmax, - (void *rend, GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values), - (target, reset, format, type, values)) - -DEFUN_LOCAL_VOID (GetMinmaxParameterfv, - (void *rend, GLenum target, GLenum pname, GLfloat * params), - (target, pname, params)) - -DEFUN_LOCAL_VOID (GetMinmaxParameteriv, - (void *rend, GLenum target, GLenum pname, GLint * params), - (target, pname, params)) - -DEFUN_LOCAL_VOID (Histogram, - (void *rend, GLenum target, GLsizei width, GLenum internalformat, GLboolean sink), - (target, width, internalformat, sink)) - -DEFUN_LOCAL_VOID (Minmax, - (void *rend, GLenum target, GLenum internalformat, GLboolean sink), - (target, internalformat, sink)) - -DEFUN_LOCAL_VOID (ResetHistogram, - (void *rend, GLenum target), - (target)) - -DEFUN_LOCAL_VOID (ResetMinmax, - (void *rend, GLenum target), - (target)) - -DEFUN_LOCAL_VOID (TexImage3D, - (void *rend, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels), - (target, level, internalformat, width, height, depth, border, format, type, pixels)) - -DEFUN_LOCAL_VOID (TexSubImage3D, - (void *rend, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels), - (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels)) - -DEFUN_LOCAL_VOID (CopyTexSubImage3D, - (void *rend, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height), - (target, level, xoffset, yoffset, zoffset, x, y, width, height)) - -DEFUN_LOCAL_VOID (ActiveTextureARB, - (void *rend, GLenum texture), - (texture)) - -DEFUN_LOCAL_VOID (ClientActiveTextureARB, - (void *rend, GLenum texture), - (texture)) - -DEFUN_LOCAL_VOID (MultiTexCoord1dARB, - (void *rend, GLenum target, GLdouble s), - (target, s)) - -DEFUN_LOCAL_VOID (MultiTexCoord1dvARB, - (void *rend, GLenum target, const GLdouble * v), - (target, v)) - -DEFUN_LOCAL_VOID (MultiTexCoord1fARB, - (void *rend, GLenum target, GLfloat s), - (target, s)) - -DEFUN_LOCAL_VOID (MultiTexCoord1fvARB, - (void *rend, GLenum target, const GLfloat * v), - (target, v)) - -DEFUN_LOCAL_VOID (MultiTexCoord1iARB, - (void *rend, GLenum target, GLint s), - (target, s)) - -DEFUN_LOCAL_VOID (MultiTexCoord1ivARB, - (void *rend, GLenum target, const GLint * v), - (target, v)) - -DEFUN_LOCAL_VOID (MultiTexCoord1sARB, - (void *rend, GLenum target, GLshort s), - (target, s)) - -DEFUN_LOCAL_VOID (MultiTexCoord1svARB, - (void *rend, GLenum target, const GLshort * v), - (target, v)) - -DEFUN_LOCAL_VOID (MultiTexCoord2dARB, - (void *rend, GLenum target, GLdouble s, GLdouble t), - (target, s, t)) - -DEFUN_LOCAL_VOID (MultiTexCoord2dvARB, - (void *rend, GLenum target, const GLdouble * v), - (target, v)) - -DEFUN_LOCAL_VOID (MultiTexCoord2fARB, - (void *rend, GLenum target, GLfloat s, GLfloat t), - (target, s, t)) - -DEFUN_LOCAL_VOID (MultiTexCoord2fvARB, - (void *rend, GLenum target, const GLfloat * v), - (target, v)) - -DEFUN_LOCAL_VOID (MultiTexCoord2iARB, - (void *rend, GLenum target, GLint s, GLint t), - (target, s, t)) - -DEFUN_LOCAL_VOID (MultiTexCoord2ivARB, - (void *rend, GLenum target, const GLint * v), - (target, v)) - -DEFUN_LOCAL_VOID (MultiTexCoord2sARB, - (void *rend, GLenum target, GLshort s, GLshort t), - (target, s, t)) - -DEFUN_LOCAL_VOID (MultiTexCoord2svARB, - (void *rend, GLenum target, const GLshort * v), - (target, v)) - -DEFUN_LOCAL_VOID (MultiTexCoord3dARB, - (void *rend, GLenum target, GLdouble s, GLdouble t, GLdouble r), - (target, s, t, r)) - -DEFUN_LOCAL_VOID (MultiTexCoord3dvARB, - (void *rend, GLenum target, const GLdouble * v), - (target, v)) - -DEFUN_LOCAL_VOID (MultiTexCoord3fARB, - (void *rend, GLenum target, GLfloat s, GLfloat t, GLfloat r), - (target, s, t, r)) - -DEFUN_LOCAL_VOID (MultiTexCoord3fvARB, - (void *rend, GLenum target, const GLfloat * v), - (target, v)) - -DEFUN_LOCAL_VOID (MultiTexCoord3iARB, - (void *rend, GLenum target, GLint s, GLint t, GLint r), - (target, s, t, r)) - -DEFUN_LOCAL_VOID (MultiTexCoord3ivARB, - (void *rend, GLenum target, const GLint * v), - (target, v)) - -DEFUN_LOCAL_VOID (MultiTexCoord3sARB, - (void *rend, GLenum target, GLshort s, GLshort t, GLshort r), - (target, s, t, r)) - -DEFUN_LOCAL_VOID (MultiTexCoord3svARB, - (void *rend, GLenum target, const GLshort * v), - (target, v)) - -DEFUN_LOCAL_VOID (MultiTexCoord4dARB, - (void *rend, GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q), - (target, s, t, r, q)) - -DEFUN_LOCAL_VOID (MultiTexCoord4dvARB, - (void *rend, GLenum target, const GLdouble * v), - (target, v)) - -DEFUN_LOCAL_VOID (MultiTexCoord4fARB, - (void *rend, GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q), - (target, s, t, r, q)) - -DEFUN_LOCAL_VOID (MultiTexCoord4fvARB, - (void *rend, GLenum target, const GLfloat * v), - (target, v)) - -DEFUN_LOCAL_VOID (MultiTexCoord4iARB, - (void *rend, GLenum target, GLint s, GLint t, GLint r, GLint q), - (target, s, t, r, q)) - -DEFUN_LOCAL_VOID (MultiTexCoord4ivARB, - (void *rend, GLenum target, const GLint * v), - (target, v)) - -DEFUN_LOCAL_VOID (MultiTexCoord4sARB, - (void *rend, GLenum target, GLshort s, GLshort t, GLshort r, GLshort q), - (target, s, t, r, q)) - -DEFUN_LOCAL_VOID (MultiTexCoord4svARB, - (void *rend, GLenum target, const GLshort * v), - (target, v)) - -DEFUN_LOCAL_VOID (LoadTransposeMatrixfARB, - (void *rend, const GLfloat * m), - (m)) - -DEFUN_LOCAL_VOID (LoadTransposeMatrixdARB, - (void *rend, const GLdouble * m), - (m)) - -DEFUN_LOCAL_VOID (MultTransposeMatrixfARB, - (void *rend, const GLfloat * m), - (m)) - -DEFUN_LOCAL_VOID (MultTransposeMatrixdARB, - (void *rend, const GLdouble * m), - (m)) - -DEFUN_LOCAL_VOID (SampleCoverageARB, - (void *rend, GLclampf value, GLboolean invert), - (value, invert)) - -DEFUN_EXTERN_VOID (__unused413, - (), - ()) - -DEFUN_ALIAS_VOID (PolygonOffsetEXT, PolygonOffset, - (GLfloat factor, GLfloat bias), - (factor, bias)) - -DEFUN_EXTERN_VOID (GetTexFilterFuncSGIS, - (GLenum target, GLenum filter, GLfloat * weights), - (target, filter, weights)) - -DEFUN_EXTERN_VOID (TexFilterFuncSGIS, - (GLenum target, GLenum filter, GLsizei n, const GLfloat * weights), - (target, filter, n, weights)) - -DEFUN_ALIAS_VOID (GetHistogramEXT, GetHistogram, - (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values), - (target, reset, format, type, values)) - -DEFUN_ALIAS_VOID (GetHistogramParameterfvEXT, GetHistogramParameterfv, - (GLenum target, GLenum pname, GLfloat * params), - (target, pname, params)) - -DEFUN_ALIAS_VOID (GetHistogramParameterivEXT, GetHistogramParameteriv, - (GLenum target, GLenum pname, GLint * params), - (target, pname, params)) - -DEFUN_ALIAS_VOID (GetMinmaxEXT, GetMinmax, - (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values), - (target, reset, format, type, values)) - -DEFUN_ALIAS_VOID (GetMinmaxParameterfvEXT, GetMinmaxParameterfv, - (GLenum target, GLenum pname, GLfloat * params), - (target, pname, params)) - -DEFUN_ALIAS_VOID (GetMinmaxParameterivEXT, GetMinmaxParameteriv, - (GLenum target, GLenum pname, GLint * params), - (target, pname, params)) - -DEFUN_ALIAS_VOID (GetConvolutionFilterEXT, GetConvolutionFilter, - (GLenum target, GLenum format, GLenum type, GLvoid * image), - (target, format, type, image)) - -DEFUN_ALIAS_VOID (GetConvolutionParameterfvEXT, GetConvolutionParameterfv, - (GLenum target, GLenum pname, GLfloat * params), - (target, pname, params)) - -DEFUN_ALIAS_VOID (GetConvolutionParameterivEXT, GetConvolutionParameteriv, - (GLenum target, GLenum pname, GLint * params), - (target, pname, params)) - -DEFUN_ALIAS_VOID (GetSeparableFilterEXT, GetSeparableFilter, - (GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span), - (target, format, type, row, column, span)) - -DEFUN_ALIAS_VOID (GetColorTableSGI, GetColorTable, - (GLenum target, GLenum format, GLenum type, GLvoid * table), - (target, format, type, table)) - -DEFUN_ALIAS_VOID (GetColorTableParameterfvSGI, GetColorTableParameterfv, - (GLenum target, GLenum pname, GLfloat * params), - (target, pname, params)) - -DEFUN_ALIAS_VOID (GetColorTableParameterivSGI, GetColorTableParameteriv, - (GLenum target, GLenum pname, GLint * params), - (target, pname, params)) - -DEFUN_EXTERN_VOID (PixelTexGenSGIX, - (GLenum mode), - (mode)) - -DEFUN_EXTERN_VOID (PixelTexGenParameteriSGIS, - (GLenum pname, GLint param), - (pname, param)) - -DEFUN_EXTERN_VOID (PixelTexGenParameterivSGIS, - (GLenum pname, const GLint * params), - (pname, params)) - -DEFUN_EXTERN_VOID (PixelTexGenParameterfSGIS, - (GLenum pname, GLfloat param), - (pname, param)) - -DEFUN_EXTERN_VOID (PixelTexGenParameterfvSGIS, - (GLenum pname, const GLfloat * params), - (pname, params)) - -DEFUN_EXTERN_VOID (GetPixelTexGenParameterivSGIS, - (GLenum pname, GLint * params), - (pname, params)) - -DEFUN_EXTERN_VOID (GetPixelTexGenParameterfvSGIS, - (GLenum pname, GLfloat * params), - (pname, params)) - -DEFUN_EXTERN_VOID (TexImage4DSGIS, - (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid * pixels), - (target, level, internalformat, width, height, depth, size4d, border, format, type, pixels)) - -DEFUN_EXTERN_VOID (TexSubImage4DSGIS, - (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid * pixels), - (target, level, xoffset, yoffset, zoffset, woffset, width, height, depth, size4d, format, type, pixels)) - -DEFUN_ALIAS (GLboolean, AreTexturesResidentEXT, AreTexturesResident, - (GLsizei n, const GLenum * textures, GLboolean * residences), - (n, textures, residences)) - -DEFUN_ALIAS_VOID (GenTexturesEXT, GenTextures, - (GLsizei n, GLenum * textures), - (n, textures)) - -DEFUN_EXTERN (GLboolean, IsTextureEXT, - (GLenum texture), - (texture)) - -DEFUN_EXTERN_VOID (DetailTexFuncSGIS, - (GLenum target, GLsizei n, const GLfloat * points), - (target, n, points)) - -DEFUN_EXTERN_VOID (GetDetailTexFuncSGIS, - (GLenum target, GLfloat * points), - (target, points)) - -DEFUN_EXTERN_VOID (SharpenTexFuncSGIS, - (GLenum target, GLsizei n, const GLfloat * points), - (target, n, points)) - -DEFUN_EXTERN_VOID (GetSharpenTexFuncSGIS, - (GLenum target, GLfloat * points), - (target, points)) - -DEFUN_EXTERN_VOID (SampleMaskSGIS, - (GLclampf value, GLboolean invert), - (value, invert)) - -DEFUN_EXTERN_VOID (SamplePatternSGIS, - (GLenum pattern), - (pattern)) - -DEFUN_EXTERN_VOID (ColorPointerEXT, - (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer), - (size, type, stride, count, pointer)) - -DEFUN_EXTERN_VOID (EdgeFlagPointerEXT, - (GLsizei stride, GLsizei count, const GLboolean * pointer), - (stride, count, pointer)) - -DEFUN_EXTERN_VOID (IndexPointerEXT, - (GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer), - (type, stride, count, pointer)) - -DEFUN_EXTERN_VOID (NormalPointerEXT, - (GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer), - (type, stride, count, pointer)) - -DEFUN_EXTERN_VOID (TexCoordPointerEXT, - (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer), - (size, type, stride, count, pointer)) - -DEFUN_EXTERN_VOID (VertexPointerEXT, - (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer), - (size, type, stride, count, pointer)) - -DEFUN_EXTERN_VOID (SpriteParameterfSGIX, - (GLenum pname, GLfloat param), - (pname, param)) - -DEFUN_EXTERN_VOID (SpriteParameterfvSGIX, - (GLenum pname, const GLfloat * params), - (pname, params)) - -DEFUN_EXTERN_VOID (SpriteParameteriSGIX, - (GLenum pname, GLint param), - (pname, param)) - -DEFUN_EXTERN_VOID (SpriteParameterivSGIX, - (GLenum pname, const GLint * params), - (pname, params)) - -DEFUN_LOCAL_VOID (PointParameterfEXT, - (void *rend, GLenum pname, GLfloat param), - (pname, param)) - -DEFUN_ALIAS_VOID (PointParameterfEXT, PointParameterf, - (GLenum pname, GLfloat param), - (pname, param)) - -DEFUN_LOCAL_VOID (PointParameterfvEXT, - (void *rend, GLenum pname, const GLfloat * params), - (pname, params)) - -DEFUN_ALIAS_VOID (PointParameterfvEXT, PointParameterfv, - (GLenum pname, const GLfloat * params), - (pname, params)) - -DEFUN_EXTERN (GLint, GetInstrumentsSGIX, - (), - ()) - -DEFUN_EXTERN_VOID (InstrumentsBufferSGIX, - (GLsizei size, GLint * buffer), - (size, buffer)) - -DEFUN_EXTERN (GLint, PollInstrumentsSGIX, - (GLint * marker_p), - (marker_p)) - -DEFUN_EXTERN_VOID (ReadInstrumentsSGIX, - (GLint marker), - (marker)) - -DEFUN_EXTERN_VOID (StartInstrumentsSGIX, - (), - ()) - -DEFUN_EXTERN_VOID (StopInstrumentsSGIX, - (GLint marker), - (marker)) - -DEFUN_EXTERN_VOID (FrameZoomSGIX, - (GLint factor), - (factor)) - -DEFUN_EXTERN_VOID (TagSampleBufferSGIX, - (), - ()) - -DEFUN_EXTERN_VOID (ReferencePlaneSGIX, - (const GLdouble * equation), - (equation)) - -DEFUN_EXTERN_VOID (FlushRasterSGIX, - (), - ()) - -DEFUN_EXTERN_VOID (GetListParameterfvSGIX, - (GLuint list, GLenum pname, GLfloat * params), - (list, pname, params)) - -DEFUN_EXTERN_VOID (GetListParameterivSGIX, - (GLuint list, GLenum pname, GLint * params), - (list, pname, params)) - -DEFUN_EXTERN_VOID (ListParameterfSGIX, - (GLuint list, GLenum pname, GLfloat param), - (list, pname, param)) - -DEFUN_EXTERN_VOID (ListParameterfvSGIX, - (GLuint list, GLenum pname, const GLfloat * params), - (list, pname, params)) - -DEFUN_EXTERN_VOID (ListParameteriSGIX, - (GLuint list, GLenum pname, GLint param), - (list, pname, param)) - -DEFUN_EXTERN_VOID (ListParameterivSGIX, - (GLuint list, GLenum pname, const GLint * params), - (list, pname, params)) - -DEFUN_EXTERN_VOID (FragmentColorMaterialSGIX, - (GLenum face, GLenum mode), - (face, mode)) - -DEFUN_EXTERN_VOID (FragmentLightfSGIX, - (GLenum light, GLenum pname, GLfloat param), - (light, pname, param)) - -DEFUN_EXTERN_VOID (FragmentLightfvSGIX, - (GLenum light, GLenum pname, const GLfloat * params), - (light, pname, params)) - -DEFUN_EXTERN_VOID (FragmentLightiSGIX, - (GLenum light, GLenum pname, GLint param), - (light, pname, param)) - -DEFUN_EXTERN_VOID (FragmentLightivSGIX, - (GLenum light, GLenum pname, const GLint * params), - (light, pname, params)) - -DEFUN_EXTERN_VOID (FragmentLightModelfSGIX, - (GLenum pname, GLfloat param), - (pname, param)) - -DEFUN_EXTERN_VOID (FragmentLightModelfvSGIX, - (GLenum pname, const GLfloat * params), - (pname, params)) - -DEFUN_EXTERN_VOID (FragmentLightModeliSGIX, - (GLenum pname, GLint param), - (pname, param)) - -DEFUN_EXTERN_VOID (FragmentLightModelivSGIX, - (GLenum pname, const GLint * params), - (pname, params)) - -DEFUN_EXTERN_VOID (FragmentMaterialfSGIX, - (GLenum face, GLenum pname, GLfloat param), - (face, pname, param)) - -DEFUN_EXTERN_VOID (FragmentMaterialfvSGIX, - (GLenum face, GLenum pname, const GLfloat * params), - (face, pname, params)) - -DEFUN_EXTERN_VOID (FragmentMaterialiSGIX, - (GLenum face, GLenum pname, GLint param), - (face, pname, param)) - -DEFUN_EXTERN_VOID (FragmentMaterialivSGIX, - (GLenum face, GLenum pname, const GLint * params), - (face, pname, params)) - -DEFUN_EXTERN_VOID (GetFragmentLightfvSGIX, - (GLenum light, GLenum pname, GLfloat * params), - (light, pname, params)) - -DEFUN_EXTERN_VOID (GetFragmentLightivSGIX, - (GLenum light, GLenum pname, GLint * params), - (light, pname, params)) - -DEFUN_EXTERN_VOID (GetFragmentMaterialfvSGIX, - (GLenum face, GLenum pname, GLfloat * params), - (face, pname, params)) - -DEFUN_EXTERN_VOID (GetFragmentMaterialivSGIX, - (GLenum face, GLenum pname, GLint * params), - (face, pname, params)) - -DEFUN_EXTERN_VOID (LightEnviSGIX, - (GLenum pname, GLint param), - (pname, param)) - -DEFUN_EXTERN_VOID (VertexWeightfEXT, - (GLfloat weight), - (weight)) - -DEFUN_EXTERN_VOID (VertexWeightfvEXT, - (const GLfloat * weight), - (weight)) - -DEFUN_EXTERN_VOID (VertexWeightPointerEXT, - (GLsizei size, GLenum type, GLsizei stride, const GLvoid * pointer), - (size, type, stride, pointer)) - -DEFUN_EXTERN_VOID (FlushVertexArrayRangeNV, - (), - ()) - -DEFUN_LOCAL_VOID (VertexArrayRangeNV, - (void *rend, GLsizei length, const GLvoid * pointer), - (length, pointer)) - -DEFUN_ALIAS_VOID (VertexArrayRangeNV, VertexArrayRangeAPPLE, - (GLsizei length, const GLvoid * pointer), - (length, pointer)) - -DEFUN_LOCAL_VOID (CombinerParameterfvNV, - (void *rend, GLenum pname, const GLfloat * params), - (pname, params)) - -DEFUN_LOCAL_VOID (CombinerParameterfNV, - (void *rend, GLenum pname, GLfloat param), - (pname, param)) - -DEFUN_LOCAL_VOID (CombinerParameterivNV, - (void *rend, GLenum pname, const GLint * params), - (pname, params)) - -DEFUN_LOCAL_VOID (CombinerParameteriNV, - (void *rend, GLenum pname, GLint param), - (pname, param)) - -DEFUN_LOCAL_VOID (CombinerInputNV, - (void *rend, GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage), - (stage, portion, variable, input, mapping, componentUsage)) - -DEFUN_LOCAL_VOID (CombinerOutputNV, - (void *rend, GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum), - (stage, portion, abOutput, cdOutput, sumOutput, scale, bias, abDotProduct, cdDotProduct, muxSum)) - -DEFUN_LOCAL_VOID (FinalCombinerInputNV, - (void *rend, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage), - (variable, input, mapping, componentUsage)) - -DEFUN_LOCAL_VOID (GetCombinerInputParameterfvNV, - (void *rend, GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params), - (stage, portion, variable, pname, params)) - -DEFUN_LOCAL_VOID (GetCombinerInputParameterivNV, - (void *rend, GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params), - (stage, portion, variable, pname, params)) - -DEFUN_LOCAL_VOID (GetCombinerOutputParameterfvNV, - (void *rend, GLenum stage, GLenum portion, GLenum pname, GLfloat * params), - (stage, portion, pname, params)) - -DEFUN_LOCAL_VOID (GetCombinerOutputParameterivNV, - (void *rend, GLenum stage, GLenum portion, GLenum pname, GLint * params), - (stage, portion, pname, params)) - -DEFUN_LOCAL_VOID (GetFinalCombinerInputParameterfvNV, - (void *rend, GLenum variable, GLenum pname, GLfloat * params), - (variable, pname, params)) - -DEFUN_LOCAL_VOID (GetFinalCombinerInputParameterivNV, - (void *rend, GLenum variable, GLenum pname, GLint * params), - (variable, pname, params)) - -DEFUN_EXTERN_VOID (ResizeBuffersMESA, - (), - ()) - -DEFUN_LOCAL_VOID (WindowPos2dMESA, - (void *rend, GLdouble x, GLdouble y), - (x, y)) - -DEFUN_ALIAS_VOID (WindowPos2dMESA, WindowPos2d, - (GLdouble x, GLdouble y), - (x, y)) - -DEFUN_LOCAL_VOID (WindowPos2dvMESA, - (void *rend, const GLdouble * v), - (v)) - -DEFUN_ALIAS_VOID (WindowPos2dvMESA, WindowPos2dv, - (const GLdouble * v), - (v)) - -DEFUN_LOCAL_VOID (WindowPos2fMESA, - (void *rend, GLfloat x, GLfloat y), - (x, y)) - -DEFUN_ALIAS_VOID (WindowPos2fMESA, WindowPos2f, - (GLfloat x, GLfloat y), - (x, y)) - -DEFUN_LOCAL_VOID (WindowPos2fvMESA, - (void *rend, const GLfloat * v), - (v)) - -DEFUN_ALIAS_VOID (WindowPos2fvMESA, WindowPos2fv, - (const GLfloat * v), - (v)) - -DEFUN_LOCAL_VOID (WindowPos2iMESA, - (void *rend, GLint x, GLint y), - (x, y)) - -DEFUN_ALIAS_VOID (WindowPos2iMESA, WindowPos2i, - (GLint x, GLint y), - (x, y)) - -DEFUN_LOCAL_VOID (WindowPos2ivMESA, - (void *rend, const GLint * v), - (v)) - -DEFUN_ALIAS_VOID (WindowPos2ivMESA, WindowPos2iv, - (const GLint * v), - (v)) - -DEFUN_LOCAL_VOID (WindowPos2sMESA, - (void *rend, GLshort x, GLshort y), - (x, y)) - -DEFUN_ALIAS_VOID (WindowPos2sMESA, WindowPos2s, - (GLshort x, GLshort y), - (x, y)) - -DEFUN_LOCAL_VOID (WindowPos2svMESA, - (void *rend, const GLshort * v), - (v)) - -DEFUN_ALIAS_VOID (WindowPos2svMESA, WindowPos2sv, - (const GLshort * v), - (v)) - -DEFUN_LOCAL_VOID (WindowPos3dMESA, - (void *rend, GLdouble x, GLdouble y, GLdouble z), - (x, y, z)) - -DEFUN_ALIAS_VOID (WindowPos3dMESA, WindowPos3d, - (GLdouble x, GLdouble y, GLdouble z), - (x, y, z)) - -DEFUN_LOCAL_VOID (WindowPos3dvMESA, - (void *rend, const GLdouble * v), - (v)) - -DEFUN_ALIAS_VOID (WindowPos3dvMESA, WindowPos3dv, - (const GLdouble * v), - (v)) - -DEFUN_LOCAL_VOID (WindowPos3fMESA, - (void *rend, GLfloat x, GLfloat y, GLfloat z), - (x, y, z)) - -DEFUN_ALIAS_VOID (WindowPos3fMESA, WindowPos3f, - (GLfloat x, GLfloat y, GLfloat z), - (x, y, z)) - -DEFUN_LOCAL_VOID (WindowPos3fvMESA, - (void *rend, const GLfloat * v), - (v)) - -DEFUN_ALIAS_VOID (WindowPos3fvMESA, WindowPos3fv, - (const GLfloat * v), - (v)) - -DEFUN_LOCAL_VOID (WindowPos3iMESA, - (void *rend, GLint x, GLint y, GLint z), - (x, y, z)) - -DEFUN_ALIAS_VOID (WindowPos3iMESA, WindowPos3i, - (GLint x, GLint y, GLint z), - (x, y, z)) - -DEFUN_LOCAL_VOID (WindowPos3ivMESA, - (void *rend, const GLint * v), - (v)) - -DEFUN_ALIAS_VOID (WindowPos3ivMESA, WindowPos3iv, - (const GLint * v), - (v)) - -DEFUN_LOCAL_VOID (WindowPos3sMESA, - (void *rend, GLshort x, GLshort y, GLshort z), - (x, y, z)) - -DEFUN_ALIAS_VOID (WindowPos3sMESA, WindowPos3s, - (GLshort x, GLshort y, GLshort z), - (x, y, z)) - -DEFUN_LOCAL_VOID (WindowPos3svMESA, - (void *rend, const GLshort * v), - (v)) - -DEFUN_ALIAS_VOID (WindowPos3svMESA, WindowPos3sv, - (const GLshort * v), - (v)) - -DEFUN_EXTERN_VOID (WindowPos4dMESA, - (GLdouble x, GLdouble y, GLdouble z, GLdouble w), - (x, y, z, w)) - -DEFUN_EXTERN_VOID (WindowPos4dvMESA, - (const GLdouble * v), - (v)) - -DEFUN_EXTERN_VOID (WindowPos4fMESA, - (GLfloat x, GLfloat y, GLfloat z, GLfloat w), - (x, y, z, w)) - -DEFUN_EXTERN_VOID (WindowPos4fvMESA, - (const GLfloat * v), - (v)) - -DEFUN_EXTERN_VOID (WindowPos4iMESA, - (GLint x, GLint y, GLint z, GLint w), - (x, y, z, w)) - -DEFUN_EXTERN_VOID (WindowPos4ivMESA, - (const GLint * v), - (v)) - -DEFUN_EXTERN_VOID (WindowPos4sMESA, - (GLshort x, GLshort y, GLshort z, GLshort w), - (x, y, z, w)) - -DEFUN_EXTERN_VOID (WindowPos4svMESA, - (const GLshort * v), - (v)) - -DEFUN_LOCAL_VOID (BlendFuncSeparateEXT, - (void *rend, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha), - (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha)) - -DEFUN_EXTERN_VOID (IndexMaterialEXT, - (GLenum face, GLenum mode), - (face, mode)) - -DEFUN_EXTERN_VOID (IndexFuncEXT, - (GLenum func, GLclampf ref), - (func, ref)) - -DEFUN_LOCAL_VOID (LockArraysEXT, - (void *rend, GLint first, GLsizei count), - (first, count)) - -DEFUN_LOCAL_VOID (UnlockArraysEXT, - (void *rend), - ()) - -DEFUN_EXTERN_VOID (CullParameterdvEXT, - (GLenum pname, GLdouble * params), - (pname, params)) - -DEFUN_EXTERN_VOID (CullParameterfvEXT, - (GLenum pname, GLfloat * params), - (pname, params)) - -DEFUN_EXTERN_VOID (HintPGI, - (GLenum target, GLint mode), - (target, mode)) - -DEFUN_LOCAL_VOID (FogCoordfEXT, - (void *rend, GLfloat coord), - (coord)) - -DEFUN_LOCAL_VOID (FogCoordfvEXT, - (void *rend, const GLfloat * coord), - (coord)) - -DEFUN_LOCAL_VOID (FogCoorddEXT, - (void *rend, GLdouble coord), - (coord)) - -DEFUN_LOCAL_VOID (FogCoorddvEXT, - (void *rend, const GLdouble * coord), - (coord)) - -DEFUN_LOCAL_VOID (FogCoordPointerEXT, - (void *rend, GLenum type, GLsizei stride, const GLvoid * pointer), - (type, stride, pointer)) - -DEFUN_EXTERN_VOID (TbufferMask3DFX, - (GLuint mask), - (mask)) - -DEFUN_LOCAL_VOID (CompressedTexImage3DARB, - (void *rend, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data), - (target, level, internalformat, width, height, depth, border, imageSize, data)) - -DEFUN_LOCAL_VOID (CompressedTexImage2DARB, - (void *rend, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data), - (target, level, internalformat, width, height, border, imageSize, data)) - -DEFUN_LOCAL_VOID (CompressedTexImage1DARB, - (void *rend, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data), - (target, level, internalformat, width, border, imageSize, data)) - -DEFUN_LOCAL_VOID (CompressedTexSubImage3DARB, - (void *rend, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data), - (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data)) - -DEFUN_LOCAL_VOID (CompressedTexSubImage2DARB, - (void *rend, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data), - (target, level, xoffset, yoffset, width, height, format, imageSize, data)) - -DEFUN_LOCAL_VOID (CompressedTexSubImage1DARB, - (void *rend, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data), - (target, level, xoffset, width, format, imageSize, data)) - -DEFUN_LOCAL_VOID (GetCompressedTexImageARB, - (void *rend, GLenum target, GLint level, void * img), - (target, level, img)) - -DEFUN_LOCAL_VOID (SecondaryColor3bEXT, - (void *rend, GLbyte red, GLbyte green, GLbyte blue), - (red, green, blue)) - -DEFUN_LOCAL_VOID (SecondaryColor3bvEXT, - (void *rend, const GLbyte * v), - (v)) - -DEFUN_LOCAL_VOID (SecondaryColor3dEXT, - (void *rend, GLdouble red, GLdouble green, GLdouble blue), - (red, green, blue)) - -DEFUN_LOCAL_VOID (SecondaryColor3dvEXT, - (void *rend, const GLdouble * v), - (v)) - -DEFUN_LOCAL_VOID (SecondaryColor3fEXT, - (void *rend, GLfloat red, GLfloat green, GLfloat blue), - (red, green, blue)) - -DEFUN_LOCAL_VOID (SecondaryColor3fvEXT, - (void *rend, const GLfloat * v), - (v)) - -DEFUN_LOCAL_VOID (SecondaryColor3iEXT, - (void *rend, GLint red, GLint green, GLint blue), - (red, green, blue)) - -DEFUN_LOCAL_VOID (SecondaryColor3ivEXT, - (void *rend, const GLint * v), - (v)) - -DEFUN_LOCAL_VOID (SecondaryColor3sEXT, - (void *rend, GLshort red, GLshort green, GLshort blue), - (red, green, blue)) - -DEFUN_LOCAL_VOID (SecondaryColor3svEXT, - (void *rend, const GLshort * v), - (v)) - -DEFUN_LOCAL_VOID (SecondaryColor3ubEXT, - (void *rend, GLubyte red, GLubyte green, GLubyte blue), - (red, green, blue)) - -DEFUN_LOCAL_VOID (SecondaryColor3ubvEXT, - (void *rend, const GLubyte * v), - (v)) - -DEFUN_LOCAL_VOID (SecondaryColor3uiEXT, - (void *rend, GLuint red, GLuint green, GLuint blue), - (red, green, blue)) - -DEFUN_LOCAL_VOID (SecondaryColor3uivEXT, - (void *rend, const GLuint * v), - (v)) - -DEFUN_LOCAL_VOID (SecondaryColor3usEXT, - (void *rend, GLushort red, GLushort green, GLushort blue), - (red, green, blue)) - -DEFUN_LOCAL_VOID (SecondaryColor3usvEXT, - (void *rend, const GLushort * v), - (v)) - -DEFUN_LOCAL_VOID (SecondaryColorPointerEXT, - (void *rend, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer), - (size, type, stride, pointer)) - -DEFUN_EXTERN (GLboolean, AreProgramsResidentNV, - (GLsizei n, const GLuint * ids, GLboolean * residences), - (n, ids, residences)) - -DEFUN_LOCAL_VOID (BindProgramNV, - (void *rend, GLenum target, GLuint id), - (target, id)) - -DEFUN_ALIAS_VOID (BindProgramNV, BindProgramARB, - (GLenum target, GLuint id), - (target, id)) - -DEFUN_LOCAL_VOID (DeleteProgramsNV, - (void *rend, GLsizei n, const GLuint * ids), - (n, ids)) - -DEFUN_ALIAS_VOID (DeleteProgramsNV, DeleteProgramsARB, - (GLsizei n, const GLuint * ids), - (n, ids)) - -DEFUN_EXTERN_VOID (ExecuteProgramNV, - (GLenum target, GLuint id, const GLfloat * params), - (target, id, params)) - -DEFUN_LOCAL_VOID (GenProgramsNV, - (void *rend, GLsizei n, GLuint * ids), - (n, ids)) - -DEFUN_ALIAS_VOID (GenProgramsNV, GenProgramsARB, - (GLsizei n, GLuint * ids), - (n, ids)) - -DEFUN_EXTERN_VOID (GetProgramParameterdvNV, - (GLenum target, GLuint index, GLenum pname, GLdouble * params), - (target, index, pname, params)) - -DEFUN_EXTERN_VOID (GetProgramParameterfvNV, - (GLenum target, GLuint index, GLenum pname, GLfloat * params), - (target, index, pname, params)) - -DEFUN_EXTERN_VOID (GetProgramivNV, - (GLuint id, GLenum pname, GLint * params), - (id, pname, params)) - -DEFUN_EXTERN_VOID (GetProgramStringNV, - (GLuint id, GLenum pname, GLubyte * program), - (id, pname, program)) - -DEFUN_EXTERN_VOID (GetTrackMatrixivNV, - (GLenum target, GLuint address, GLenum pname, GLint * params), - (target, address, pname, params)) - -DEFUN_LOCAL_VOID (GetVertexAttribdvNV, - (void *rend, GLuint index, GLenum pname, GLdouble * params), - (index, pname, params)) - -DEFUN_ALIAS_VOID (GetVertexAttribdvNV, GetVertexAttribdvARB, - (GLuint index, GLenum pname, GLdouble * params), - (index, pname, params)) - -DEFUN_LOCAL_VOID (GetVertexAttribfvNV, - (void *rend, GLuint index, GLenum pname, GLfloat * params), - (index, pname, params)) - -DEFUN_ALIAS_VOID (GetVertexAttribfvNV, GetVertexAttribfvARB, - (GLuint index, GLenum pname, GLfloat * params), - (index, pname, params)) - -DEFUN_LOCAL_VOID (GetVertexAttribivNV, - (void *rend, GLuint index, GLenum pname, GLint * params), - (index, pname, params)) - -DEFUN_ALIAS_VOID (GetVertexAttribivNV, GetVertexAttribivNV, - (GLuint index, GLenum pname, GLint * params), - (index, pname, params)) - -DEFUN_LOCAL_VOID (GetVertexAttribPointervNV, - (void *rend, GLuint index, GLenum pname, GLvoid ** pointer), - (index, pname, pointer)) - -DEFUN_ALIAS_VOID (GetVertexAttribPointervNV, GetVertexAttribPointervARB, - (GLuint index, GLenum pname, GLvoid ** pointer), - (index, pname, pointer)) - -DEFUN_LOCAL (GLboolean, IsProgramNV, - (void *rend, GLuint id), - (id)) - -DEFUN_ALIAS (GLboolean, IsProgramNV, IsProgramARB, - (GLuint id), - (id)) - -DEFUN_EXTERN_VOID (LoadProgramNV, - (GLenum target, GLuint id, GLsizei len, const GLubyte * program), - (target, id, len, program)) - -DEFUN_EXTERN_VOID (ProgramParameter4dNV, - (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w), - (target, index, x, y, z, w)) - -DEFUN_EXTERN_VOID (ProgramParameter4dvNV, - (GLenum target, GLuint index, const GLdouble * params), - (target, index, params)) - -DEFUN_EXTERN_VOID (ProgramParameter4fNV, - (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w), - (target, index, x, y, z, w)) - -DEFUN_EXTERN_VOID (ProgramParameter4fvNV, - (GLenum target, GLuint index, const GLfloat * params), - (target, index, params)) - -DEFUN_EXTERN_VOID (ProgramParameters4dvNV, - (GLenum target, GLuint index, GLuint num, const GLdouble * params), - (target, index, num, params)) - -DEFUN_EXTERN_VOID (ProgramParameters4fvNV, - (GLenum target, GLuint index, GLuint num, const GLfloat * params), - (target, index, num, params)) - -DEFUN_EXTERN_VOID (RequestResidentProgramsNV, - (GLsizei n, const GLuint * ids), - (n, ids)) - -DEFUN_EXTERN_VOID (TrackMatrixNV, - (GLenum target, GLuint address, GLenum matrix, GLenum transform), - (target, address, matrix, transform)) - -DEFUN_EXTERN_VOID (VertexAttribPointerNV, - (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer), - (index, size, type, stride, pointer)) - -DEFUN_LOCAL_VOID (VertexAttrib1dNV, - (void *rend, GLuint index, GLdouble x), - (index, x)) - -DEFUN_ALIAS_VOID (VertexAttrib1dNV, VertexAttrib1dARB, - (GLuint index, GLdouble x), - (index, x)) - -DEFUN_LOCAL_VOID (VertexAttrib1dvNV, - (void *rend, GLuint index, const GLdouble * v), - (index, v)) - -DEFUN_ALIAS_VOID (VertexAttrib1dvNV, VertexAttrib1dvARB, - (GLuint index, const GLdouble * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib1fNV, - (void *rend, GLuint index, GLfloat x), - (index, x)) - -DEFUN_ALIAS_VOID (VertexAttrib1fNV, VertexAttrib1fARB, - (GLuint index, GLfloat x), - (index, x)) - -DEFUN_LOCAL_VOID (VertexAttrib1fvNV, - (void *rend, GLuint index, const GLfloat * v), - (index, v)) - -DEFUN_ALIAS_VOID (VertexAttrib1fvNV, VertexAttrib1fvARB, - (GLuint index, const GLfloat * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib1sNV, - (void *rend, GLuint index, GLshort x), - (index, x)) - -DEFUN_ALIAS_VOID (VertexAttrib1sNV, VertexAttrib1sARB, - (GLuint index, GLshort x), - (index, x)) - -DEFUN_LOCAL_VOID (VertexAttrib1svNV, - (void *rend, GLuint index, const GLshort * v), - (index, v)) - -DEFUN_ALIAS_VOID (VertexAttrib1svNV, VertexAttrib1svARB, - (GLuint index, const GLshort * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib2dNV, - (void *rend, GLuint index, GLdouble x, GLdouble y), - (index, x, y)) - -DEFUN_ALIAS_VOID (VertexAttrib2dNV, VertexAttrib2dARB, - (GLuint index, GLdouble x, GLdouble y), - (index, x, y)) - -DEFUN_LOCAL_VOID (VertexAttrib2dvNV, - (void *rend, GLuint index, const GLdouble * v), - (index, v)) - -DEFUN_ALIAS_VOID (VertexAttrib2dvNV, VertexAttrib2dvARB, - (GLuint index, const GLdouble * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib2fNV, - (void *rend, GLuint index, GLfloat x, GLfloat y), - (index, x, y)) - -DEFUN_ALIAS_VOID (VertexAttrib2fNV, VertexAttrib2fARB, - (GLuint index, GLfloat x, GLfloat y), - (index, x, y)) - -DEFUN_LOCAL_VOID (VertexAttrib2fvNV, - (void *rend, GLuint index, const GLfloat * v), - (index, v)) - -DEFUN_ALIAS_VOID (VertexAttrib2fvNV, VertexAttrib2fvARB, - (GLuint index, const GLfloat * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib2sNV, - (void *rend, GLuint index, GLshort x, GLshort y), - (index, x, y)) - -DEFUN_ALIAS_VOID (VertexAttrib2sNV, VertexAttrib2sARB, - (GLuint index, GLshort x, GLshort y), - (index, x, y)) - -DEFUN_LOCAL_VOID (VertexAttrib2svNV, - (void *rend, GLuint index, const GLshort * v), - (index, v)) - -DEFUN_ALIAS_VOID (VertexAttrib2svNV, VertexAttrib2svARB, - (GLuint index, const GLshort * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib3dNV, - (void *rend, GLuint index, GLdouble x, GLdouble y, GLdouble z), - (index, x, y, z)) - -DEFUN_ALIAS_VOID (VertexAttrib3dNV, VertexAttrib3dARB, - (GLuint index, GLdouble x, GLdouble y, GLdouble z), - (index, x, y, z)) - -DEFUN_LOCAL_VOID (VertexAttrib3dvNV, - (void *rend, GLuint index, const GLdouble * v), - (index, v)) - -DEFUN_ALIAS_VOID (VertexAttrib3dvNV, VertexAttrib3dvARB, - (GLuint index, const GLdouble * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib3fNV, - (void *rend, GLuint index, GLfloat x, GLfloat y, GLfloat z), - (index, x, y, z)) - -DEFUN_ALIAS_VOID (VertexAttrib3fNV, VertexAttrib3fARB, - (GLuint index, GLfloat x, GLfloat y, GLfloat z), - (index, x, y, z)) - -DEFUN_LOCAL_VOID (VertexAttrib3fvNV, - (void *rend, GLuint index, const GLfloat * v), - (index, v)) - -DEFUN_ALIAS_VOID (VertexAttrib3fvNV, VertexAttrib3fvARB, - (GLuint index, const GLfloat * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib3sNV, - (void *rend, GLuint index, GLshort x, GLshort y, GLshort z), - (index, x, y, z)) - -DEFUN_ALIAS_VOID (VertexAttrib3sNV, VertexAttrib3sARB, - (GLuint index, GLshort x, GLshort y, GLshort z), - (index, x, y, z)) - -DEFUN_LOCAL_VOID (VertexAttrib3svNV, - (void *rend, GLuint index, const GLshort * v), - (index, v)) - -DEFUN_ALIAS_VOID (VertexAttrib3svNV, VertexAttrib3svARB, - (GLuint index, const GLshort * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib4dNV, - (void *rend, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w), - (index, x, y, z, w)) - -DEFUN_ALIAS_VOID (VertexAttrib4dNV, VertexAttrib4dARB, - (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w), - (index, x, y, z, w)) - -DEFUN_LOCAL_VOID (VertexAttrib4dvNV, - (void *rend, GLuint index, const GLdouble * v), - (index, v)) - -DEFUN_ALIAS_VOID (VertexAttrib4dvNV, VertexAttrib4dvARB, - (GLuint index, const GLdouble * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib4fNV, - (void *rend, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w), - (index, x, y, z, w)) - -DEFUN_ALIAS_VOID (VertexAttrib4fNV, VertexAttrib4fARB, - (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w), - (index, x, y, z, w)) - -DEFUN_LOCAL_VOID (VertexAttrib4fvNV, - (void *rend, GLuint index, const GLfloat * v), - (index, v)) - -DEFUN_ALIAS_VOID (VertexAttrib4fvNV, VertexAttrib4fvARB, - (GLuint index, const GLfloat * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib4sNV, - (void *rend, GLuint index, GLshort x, GLshort y, GLshort z, GLshort w), - (index, x, y, z, w)) - -DEFUN_ALIAS_VOID (VertexAttrib4sNV, VertexAttrib4sARB, - (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w), - (index, x, y, z, w)) - -DEFUN_LOCAL_VOID (VertexAttrib4svNV, - (void *rend, GLuint index, const GLshort * v), - (index, v)) - -DEFUN_ALIAS_VOID (VertexAttrib4svNV, VertexAttrib4svARB, - (GLuint index, const GLshort * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib4ubNV, - (void *rend, GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w), - (index, x, y, z, w)) - -DEFUN_ALIAS_VOID (VertexAttrib4ubNV, VertexAttrib4NubARB, - (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w), - (index, x, y, z, w)) - -DEFUN_LOCAL_VOID (VertexAttrib4ubvNV, - (void *rend, GLuint index, const GLubyte * v), - (index, v)) - -DEFUN_ALIAS_VOID (VertexAttrib4ubvNV, VertexAttrib4ubvARB, - (GLuint index, const GLubyte * v), - (index, v)) - -DEFUN_EXTERN_VOID (VertexAttribs1dvNV, - (GLuint index, GLsizei n, const GLdouble * v), - (index, n, v)) - -DEFUN_EXTERN_VOID (VertexAttribs1fvNV, - (GLuint index, GLsizei n, const GLfloat * v), - (index, n, v)) - -DEFUN_EXTERN_VOID (VertexAttribs1svNV, - (GLuint index, GLsizei n, const GLshort * v), - (index, n, v)) - -DEFUN_EXTERN_VOID (VertexAttribs2dvNV, - (GLuint index, GLsizei n, const GLdouble * v), - (index, n, v)) - -DEFUN_EXTERN_VOID (VertexAttribs2fvNV, - (GLuint index, GLsizei n, const GLfloat * v), - (index, n, v)) - -DEFUN_EXTERN_VOID (VertexAttribs2svNV, - (GLuint index, GLsizei n, const GLshort * v), - (index, n, v)) - -DEFUN_EXTERN_VOID (VertexAttribs3dvNV, - (GLuint index, GLsizei n, const GLdouble * v), - (index, n, v)) - -DEFUN_EXTERN_VOID (VertexAttribs3fvNV, - (GLuint index, GLsizei n, const GLfloat * v), - (index, n, v)) - -DEFUN_EXTERN_VOID (VertexAttribs3svNV, - (GLuint index, GLsizei n, const GLshort * v), - (index, n, v)) - -DEFUN_EXTERN_VOID (VertexAttribs4dvNV, - (GLuint index, GLsizei n, const GLdouble * v), - (index, n, v)) - -DEFUN_EXTERN_VOID (VertexAttribs4fvNV, - (GLuint index, GLsizei n, const GLfloat * v), - (index, n, v)) - -DEFUN_EXTERN_VOID (VertexAttribs4svNV, - (GLuint index, GLsizei n, const GLshort * v), - (index, n, v)) - -DEFUN_EXTERN_VOID (VertexAttribs4ubvNV, - (GLuint index, GLsizei n, const GLubyte * v), - (index, n, v)) - -DEFUN_LOCAL_VOID (PointParameteriNV, - (void *rend, GLenum pname, GLint params), - (pname, params)) - -DEFUN_LOCAL_VOID (PointParameterivNV, - (void *rend, GLenum pname, const GLint * params), - (pname, params)) - -DEFUN_LOCAL_VOID (MultiDrawArraysEXT, - (void *rend, GLenum mode, GLint * first, GLsizei * count, GLsizei primcount), - (mode, first, count, primcount)) - -DEFUN_LOCAL_VOID (MultiDrawElementsEXT, - (void *rend, GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount), - (mode, count, type, indices, primcount)) - -DEFUN_LOCAL_VOID (ActiveStencilFaceEXT, - (void *rend, GLenum face), - (face)) - -DEFUN_EXTERN_VOID (DeleteFencesNV, - (GLsizei n, const GLuint * fences), - (n, fences)) - -DEFUN_EXTERN_VOID (GenFencesNV, - (GLsizei n, GLuint * fences), - (n, fences)) - -DEFUN_EXTERN (GLboolean, IsFenceNV, - (GLuint fence), - (fence)) - -DEFUN_EXTERN (GLboolean, TestFenceNV, - (GLuint fence), - (fence)) - -DEFUN_EXTERN_VOID (GetFenceivNV, - (GLuint fence, GLenum pname, GLint * params), - (fence, pname, params)) - -DEFUN_EXTERN_VOID (FinishFenceNV, - (GLuint fence), - (fence)) - -DEFUN_EXTERN_VOID (SetFenceNV, - (GLuint fence, GLenum condition), - (fence, condition)) - -DEFUN_LOCAL_VOID (VertexAttrib4bvARB, - (void *rend, GLuint index, const GLbyte * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib4ivARB, - (void *rend, GLuint index, const GLint * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib4ubvARB, - (void *rend, GLuint index, const GLubyte * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib4usvARB, - (void *rend, GLuint index, const GLushort * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib4uivARB, - (void *rend, GLuint index, const GLuint * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib4NbvARB, - (void *rend, GLuint index, const GLbyte * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib4NsvARB, - (void *rend, GLuint index, const GLshort * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib4NivARB, - (void *rend, GLuint index, const GLint * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib4NusvARB, - (void *rend, GLuint index, const GLushort * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttrib4NuivARB, - (void *rend, GLuint index, const GLuint * v), - (index, v)) - -DEFUN_LOCAL_VOID (VertexAttribPointerARB, - (void *rend, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer), - (index, size, type, normalized, stride, pointer)) - -DEFUN_LOCAL_VOID (EnableVertexAttribArrayARB, - (void *rend, GLuint index), - (index)) - -DEFUN_LOCAL_VOID (DisableVertexAttribArrayARB, - (void *rend, GLuint index), - (index)) - -DEFUN_LOCAL_VOID (ProgramStringARB, - (void *rend, GLenum target, GLenum format, GLsizei len, const GLvoid * string), - (target, format, len, string)) - -DEFUN_LOCAL_VOID (ProgramEnvParameter4dARB, - (void *rend, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w), - (target, index, x, y, z, w)) - -DEFUN_LOCAL_VOID (ProgramEnvParameter4dvARB, - (void *rend, GLenum target, GLuint index, const GLdouble * params), - (target, index, params)) - -DEFUN_LOCAL_VOID (ProgramEnvParameter4fARB, - (void *rend, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w), - (target, index, x, y, z, w)) - -DEFUN_LOCAL_VOID (ProgramEnvParameter4fvARB, - (void *rend, GLenum target, GLuint index, const GLfloat * params), - (target, index, params)) - -DEFUN_LOCAL_VOID (ProgramLocalParameter4dARB, - (void *rend, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w), - (target, index, x, y, z, w)) - -DEFUN_LOCAL_VOID (ProgramLocalParameter4dvARB, - (void *rend, GLenum target, GLuint index, const GLdouble * params), - (target, index, params)) - -DEFUN_LOCAL_VOID (ProgramLocalParameter4fARB, - (void *rend, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w), - (target, index, x, y, z, w)) - -DEFUN_LOCAL_VOID (ProgramLocalParameter4fvARB, - (void *rend, GLenum target, GLuint index, const GLfloat * params), - (target, index, params)) - -DEFUN_LOCAL_VOID (GetProgramEnvParameterdvARB, - (void *rend, GLenum target, GLuint index, GLdouble * params), - (target, index, params)) - -DEFUN_LOCAL_VOID (GetProgramEnvParameterfvARB, - (void *rend, GLenum target, GLuint index, GLfloat * params), - (target, index, params)) - -DEFUN_LOCAL_VOID (GetProgramLocalParameterdvARB, - (void *rend, GLenum target, GLuint index, GLdouble * params), - (target, index, params)) - -DEFUN_LOCAL_VOID (GetProgramLocalParameterfvARB, - (void *rend, GLenum target, GLuint index, GLfloat * params), - (target, index, params)) - -DEFUN_LOCAL_VOID (GetProgramivARB, - (void *rend, GLenum target, GLenum pname, GLint * params), - (target, pname, params)) - -DEFUN_LOCAL_VOID (GetProgramStringARB, - (void *rend, GLenum target, GLenum pname, GLvoid * string), - (target, pname, string)) - -DEFUN_EXTERN_VOID (ProgramNamedParameter4fNV, - (GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w), - (id, len, name, x, y, z, w)) - -DEFUN_EXTERN_VOID (ProgramNamedParameter4dNV, - (GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w), - (id, len, name, x, y, z, w)) - -DEFUN_EXTERN_VOID (ProgramNamedParameter4fvNV, - (GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v), - (id, len, name, v)) - -DEFUN_EXTERN_VOID (ProgramNamedParameter4dvNV, - (GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v), - (id, len, name, v)) - -DEFUN_EXTERN_VOID (GetProgramNamedParameterfvNV, - (GLuint id, GLsizei len, const GLubyte * name, GLfloat * params), - (id, len, name, params)) - -DEFUN_EXTERN_VOID (GetProgramNamedParameterdvNV, - (GLuint id, GLsizei len, const GLubyte * name, GLdouble * params), - (id, len, name, params)) - -#if OSVERSION < 704 /* Mac OS X 10.3.4 */ - -DEFUN_EXTERN_VOID (BindBufferARB, - (GLenum target, GLuint buffer), - (target, buffer)) - -DEFUN_EXTERN_VOID (BufferDataARB, - (GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage), - (target, size, data, usage)) - -DEFUN_EXTERN_VOID (BufferSubDataARB, - (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data), - (target, offset, size, data)) - -DEFUN_EXTERN_VOID (DeleteBuffersARB, - (GLsizei n, const GLuint * buffer), - (n, buffer)) - -DEFUN_EXTERN_VOID (GenBuffersARB, - (GLsizei n, GLuint * buffer), - (n, buffer)) - -DEFUN_EXTERN_VOID (GetBufferParameterivARB, - (GLenum target, GLenum pname, GLint * params), - (target, pname, params)) - -DEFUN_EXTERN_VOID (GetBufferPointervARB, - (GLenum target, GLenum pname, GLvoid ** params), - (target, pname, params)) - -DEFUN_EXTERN_VOID (GetBufferSubDataARB, - (GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data), - (target, offset, size, data)) - -DEFUN_EXTERN (GLboolean, IsBufferARB, - (GLuint buffer), - (buffer)) - -DEFUN_EXTERN (void*, MapBufferARB, - (GLenum target, GLenum access), - (target, access)) - -DEFUN_EXTERN (GLboolean, UnmapBufferARB, - (GLenum target), - (target)) - -DEFUN_EXTERN_VOID (DepthBoundsEXT, - (GLclampd zmin, GLclampd zmax), - (zmin, zmax)) - -#endif /* OSVERSION < 704 */ - -#if OSVERSION < 700 /* Mac OS X 10.3.0 */ - -DEFUN_EXTERN_VOID (GenQueriesARB, - (GLsizei n, GLuint * ids), - (n, ids)) - -DEFUN_EXTERN_VOID (DeleteQueriesARB, - (GLsizei n, const GLuint * ids), - (n, ids)) - -DEFUN_EXTERN (GLboolean, IsQueryARB, - (GLuint id), - (id)) - -DEFUN_EXTERN_VOID (BeginQueryARB, - (GLenum target, GLuint id), - (target, id)) - -DEFUN_EXTERN_VOID (EndQueryARB, - (GLenum target), - (target)) - -DEFUN_EXTERN_VOID (GetQueryivARB, - (GLenum target, GLenum pname, GLint * params), - (target, pname, params)) - -DEFUN_EXTERN_VOID (GetQueryObjectivARB, - (GLuint id, GLenum pname, GLint * params), - (id, pname, params)) - -DEFUN_EXTERN_VOID (GetQueryObjectuivARB, - (GLuint id, GLenum pname, GLuint * params), - (id, pname, params)) - -#endif /* OSVERSION < 700 */ - -DEFUN_EXTERN_VOID (MultiModeDrawArraysIBM, - (const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride), - (mode, first, count, primcount, modestride)) - -DEFUN_EXTERN_VOID (MultiModeDrawElementsIBM, - (const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride), - (mode, count, type, indices, primcount, modestride)) - -DEFUN_LOCAL_VOID (BlendEquationSeparateEXT, - (void *rend, GLenum modeRGB, GLenum modeA), - (modeRGB, modeA)) - -#if OSVERSION < 704 - -DEFUN_ALIAS_VOID (BlendEquationSeparateEXT, BlendEquationSeparateATI, - (GLenum modeRGB, GLenum modeA), - (modeRGB, modeA)) - -#endif /* OSVERSION < 704 */ - -DEFUN_ALIAS_VOID (ArrayElementEXT, ArrayElement, - (GLint i), - (i)) - -DEFUN_ALIAS_VOID (BindTextureEXT, BindTexture, - (GLenum target, GLuint texture), - (target, texture)) - -DEFUN_ALIAS_VOID (BlendFuncSeparateINGR, BlendFuncSeparateEXT, - (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha), - (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha)) - -DEFUN_ALIAS_VOID (ColorTableParameterfvSGI, ColorTableParameterfv, - (GLenum target, GLenum pname, const GLfloat * params), - (target, pname, params)) - -DEFUN_ALIAS_VOID (ColorTableParameterivSGI, ColorTableParameteriv, - (GLenum target, GLenum pname, const GLint * params), - (target, pname, params)) - -DEFUN_ALIAS_VOID (ColorTableSGI, ColorTable, - (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table), - (target, internalformat, width, format, type, table)) - -DEFUN_ALIAS_VOID (ConvolutionFilter1DEXT, ConvolutionFilter1D, - (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image), - (target, internalformat, width, format, type, image)) - -DEFUN_ALIAS_VOID (ConvolutionFilter2DEXT, ConvolutionFilter2D, - (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image), - (target, internalformat, width, height, format, type, image)) - -DEFUN_ALIAS_VOID (ConvolutionParameterfEXT, ConvolutionParameterf, - (GLenum target, GLenum pname, GLfloat params), - (target, pname, params)) - -DEFUN_ALIAS_VOID (ConvolutionParameterfvEXT, ConvolutionParameterfv, - (GLenum target, GLenum pname, const GLfloat * params), - (target, pname, params)) - -DEFUN_ALIAS_VOID (ConvolutionParameteriEXT, ConvolutionParameteri, - (GLenum target, GLenum pname, GLint params), - (target, pname, params)) - -DEFUN_ALIAS_VOID (ConvolutionParameterivEXT, ConvolutionParameteriv, - (GLenum target, GLenum pname, const GLint * params), - (target, pname, params)) - -DEFUN_ALIAS_VOID (CopyColorSubTableEXT, CopyColorSubTable, - (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width), - (target, start, x, y, width)) - -DEFUN_ALIAS_VOID (CopyColorTableSGI, CopyColorTable, - (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width), - (target, internalformat, x, y, width)) - -DEFUN_ALIAS_VOID (CopyConvolutionFilter1DEXT, CopyConvolutionFilter1D, - (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width), - (target, internalformat, x, y, width)) - -DEFUN_ALIAS_VOID (CopyConvolutionFilter2DEXT, CopyConvolutionFilter2D, - (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height), - (target, internalformat, x, y, width, height)) - -DEFUN_ALIAS_VOID (CopyTexImage1DEXT, CopyTexImage1D, - (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border), - (target, level, internalformat, x, y, width, border)) - -DEFUN_ALIAS_VOID (CopyTexImage2DEXT, CopyTexImage2D, - (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border), - (target, level, internalformat, x, y, width, height, border)) - -DEFUN_ALIAS_VOID (CopyTexSubImage1DEXT, CopyTexSubImage1D, - (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width), - (target, level, xoffset, x, y, width)) - -DEFUN_ALIAS_VOID (CopyTexSubImage2DEXT, CopyTexSubImage2D, - (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height), - (target, level, xoffset, yoffset, x, y, width, height)) - -DEFUN_ALIAS_VOID (CopyTexSubImage3DEXT, CopyTexSubImage3D, - (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height), - (target, level, xoffset, yoffset, zoffset, x, y, width, height)) - -DEFUN_ALIAS_VOID (DeleteTexturesEXT, DeleteTextures, - (GLsizei n, const GLuint *textures), - (n, textures)) - -DEFUN_ALIAS_VOID (DrawArraysEXT, DrawArrays, - (GLenum mode, GLint first, GLsizei count), - (mode, first, count)) - -DEFUN_ALIAS_VOID (GetPointervEXT, GetPointerv, - (GLenum pname, GLvoid * * params), - (pname, params)) - -DEFUN_ALIAS_VOID (HistogramEXT, Histogram, - (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink), - (target, width, internalformat, sink)) - -DEFUN_ALIAS_VOID (MinmaxEXT, Minmax, - (GLenum target, GLenum internalformat, GLboolean sink), - (target, internalformat, sink)) - -DEFUN_ALIAS_VOID (PointParameterfSGIS, PointParameterf, - (GLenum pname, GLfloat param), - (pname, param)) - -DEFUN_ALIAS_VOID (PointParameterfvSGIS, PointParameterfv, - (GLenum pname, const GLfloat * params), - (pname, params)) - -DEFUN_ALIAS_VOID (PointParameteri, PointParameteriNV, - (GLenum pname, GLint params), - (pname, params)) - -DEFUN_ALIAS_VOID (PointParameteriv, PointParameterivNV, - (GLenum pname, const GLint * params), - (pname, params)) - -DEFUN_ALIAS_VOID (PrioritizeTexturesEXT, PrioritizeTextures, - (GLsizei n, const GLenum * textures, const GLclampf * priorities), - (n, textures, priorities)) - -DEFUN_ALIAS_VOID (ResetHistogramEXT, ResetHistogram, - (GLenum target), - (target)) - -DEFUN_ALIAS_VOID (ResetMinmaxEXT, ResetMinmax, - (GLenum target), - (target)) - -DEFUN_ALIAS_VOID (SampleMaskEXT, SampleMaskSGIS, - (GLclampf value, GLboolean invert), - (value, invert)) - -DEFUN_ALIAS_VOID (SamplePatternEXT, SamplePatternSGIS, - (GLenum pattern), - (pattern)) - -DEFUN_ALIAS_VOID (SeparableFilter2DEXT, SeparableFilter2D, - (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column), - (target, internalformat, width, height, format, type, row, column)) - -DEFUN_ALIAS_VOID (TexImage3DEXT, TexImage3D, - (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels), - (target, level, internalformat, width, height, depth, border, format, type, pixels)) - -DEFUN_ALIAS_VOID (TexSubImage1DEXT, TexSubImage1D, - (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels), - (target, level, xoffset, width, format, type, pixels)) - -DEFUN_ALIAS_VOID (TexSubImage2DEXT, TexSubImage2D, - (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels), - (target, level, xoffset, yoffset, width, height, format, type, pixels)) - -DEFUN_ALIAS_VOID (TexSubImage3DEXT, TexSubImage3D, - (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels), - (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels)) - -#if OSVERSION < 704 - -DEFUN_ALIAS_VOID (BindBuffer, BindBufferARB, - (GLenum target, GLuint buffer), - (target, buffer)) - -DEFUN_ALIAS_VOID (BufferData, BufferDataARB, - (GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage), - (target, size, data, usage)) - -DEFUN_ALIAS_VOID (BufferSubData, BufferSubDataARB, - (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data), - (target, offset, size, data)) - -DEFUN_ALIAS_VOID (DeleteBuffers, DeleteBuffersARB, - (GLsizei n, const GLuint * buffer), - (n, buffer)) - -DEFUN_ALIAS_VOID (GenBuffers, GenBuffersARB, - (GLsizei n, GLuint * buffer), - (n, buffer)) - -DEFUN_ALIAS_VOID (GetBufferParameteriv, GetBufferParameterivARB, - (GLenum target, GLenum pname, GLint * params), - (target, pname, params)) - -DEFUN_ALIAS_VOID (GetBufferPointerv, GetBufferPointervARB, - (GLenum target, GLenum pname, GLvoid ** params), - (target, pname, params)) - -DEFUN_ALIAS_VOID (GetBufferSubData, GetBufferSubDataARB, - (GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data), - (target, offset, size, data)) - -DEFUN_ALIAS (GLboolean, IsBuffer, IsBufferARB, - (GLuint buffer), - (buffer)) - -DEFUN_ALIAS (void*, MapBuffer, MapBufferARB, - (GLenum target, GLenum access), - (target, access)) - -DEFUN_ALIAS (GLboolean, UnmapBuffer, UnmapBufferARB, - (GLenum target), - (target)) - -#endif /* OSVERSION < 704 */ - -#if OSVERSION < 700 /* Mac OS X 10.3.0 */ - -DEFUN_ALIAS_VOID (GenQueries, GenQueriesARB, - (GLsizei n, GLuint * ids), - (n, ids)) - -DEFUN_ALIAS_VOID (DeleteQueries, DeleteQueriesARB, - (GLsizei n, const GLuint * ids), - (n, ids)) - -DEFUN_ALIAS (GLboolean, IsQuery, IsQueryARB, - (GLuint id), - (id)) - -DEFUN_ALIAS_VOID (BeginQuery, BeginQueryARB, - (GLenum target, GLuint id), - (target, id)) - -DEFUN_ALIAS_VOID (EndQuery, EndQueryARB, - (GLenum target), - (target)) - -DEFUN_ALIAS_VOID (GetQueryiv, GetQueryivARB, - (GLenum target, GLenum pname, GLint * params), - (target, pname, params)) - -DEFUN_ALIAS_VOID (GetQueryObjectiv, GetQueryObjectivARB, - (GLuint id, GLenum pname, GLint * params), - (id, pname, params)) - -DEFUN_ALIAS_VOID (GetQueryObjectuiv, GetQueryObjectuivARB, - (GLuint id, GLenum pname, GLuint * params), - (id, pname, params)) - -#endif /* OSVERSION < 700 */ - -#define INDIRECT_DISPATCH_INIT(d,p) \ -do { \ - (d)[0] = (void *) &p ## Accum; \ - (d)[1] = (void *) &p ## AlphaFunc; \ - (d)[2] = (void *) &p ## AreTexturesResident; \ - (d)[3] = (void *) &p ## ArrayElement; \ - (d)[4] = (void *) &p ## Begin; \ - (d)[5] = (void *) &p ## BindTexture; \ - (d)[6] = (void *) &p ## Bitmap; \ - (d)[7] = (void *) &p ## BlendFunc; \ - (d)[8] = (void *) &p ## CallList; \ - (d)[9] = (void *) &p ## CallLists; \ - (d)[10] = (void *) &p ## Clear; \ - (d)[11] = (void *) &p ## ClearAccum; \ - (d)[12] = (void *) &p ## ClearColor; \ - (d)[13] = (void *) &p ## ClearDepth; \ - (d)[14] = (void *) &p ## ClearIndex; \ - (d)[15] = (void *) &p ## ClearStencil; \ - (d)[16] = (void *) &p ## ClipPlane; \ - (d)[17] = (void *) &p ## Color3b; \ - (d)[18] = (void *) &p ## Color3bv; \ - (d)[19] = (void *) &p ## Color3d; \ - (d)[20] = (void *) &p ## Color3dv; \ - (d)[21] = (void *) &p ## Color3f; \ - (d)[22] = (void *) &p ## Color3fv; \ - (d)[23] = (void *) &p ## Color3i; \ - (d)[24] = (void *) &p ## Color3iv; \ - (d)[25] = (void *) &p ## Color3s; \ - (d)[26] = (void *) &p ## Color3sv; \ - (d)[27] = (void *) &p ## Color3ub; \ - (d)[28] = (void *) &p ## Color3ubv; \ - (d)[29] = (void *) &p ## Color3ui; \ - (d)[30] = (void *) &p ## Color3uiv; \ - (d)[31] = (void *) &p ## Color3us; \ - (d)[32] = (void *) &p ## Color3usv; \ - (d)[33] = (void *) &p ## Color4b; \ - (d)[34] = (void *) &p ## Color4bv; \ - (d)[35] = (void *) &p ## Color4d; \ - (d)[36] = (void *) &p ## Color4dv; \ - (d)[37] = (void *) &p ## Color4f; \ - (d)[38] = (void *) &p ## Color4fv; \ - (d)[39] = (void *) &p ## Color4i; \ - (d)[40] = (void *) &p ## Color4iv; \ - (d)[41] = (void *) &p ## Color4s; \ - (d)[42] = (void *) &p ## Color4sv; \ - (d)[43] = (void *) &p ## Color4ub; \ - (d)[44] = (void *) &p ## Color4ubv; \ - (d)[45] = (void *) &p ## Color4ui; \ - (d)[46] = (void *) &p ## Color4uiv; \ - (d)[47] = (void *) &p ## Color4us; \ - (d)[48] = (void *) &p ## Color4usv; \ - (d)[49] = (void *) &p ## ColorMask; \ - (d)[50] = (void *) &p ## ColorMaterial; \ - (d)[51] = (void *) &p ## ColorPointer; \ - (d)[52] = (void *) &p ## CopyPixels; \ - (d)[53] = (void *) &p ## CopyTexImage1D; \ - (d)[54] = (void *) &p ## CopyTexImage2D; \ - (d)[55] = (void *) &p ## CopyTexSubImage1D; \ - (d)[56] = (void *) &p ## CopyTexSubImage2D; \ - (d)[57] = (void *) &p ## CullFace; \ - (d)[58] = (void *) &p ## DeleteLists; \ - (d)[59] = (void *) &p ## DeleteTextures; \ - (d)[60] = (void *) &p ## DepthFunc; \ - (d)[61] = (void *) &p ## DepthMask; \ - (d)[62] = (void *) &p ## DepthRange; \ - (d)[63] = (void *) &p ## Disable; \ - (d)[64] = (void *) &p ## DisableClientState; \ - (d)[65] = (void *) &p ## DrawArrays; \ - (d)[66] = (void *) &p ## DrawBuffer; \ - (d)[67] = (void *) &p ## DrawElements; \ - (d)[68] = (void *) &p ## DrawPixels; \ - (d)[69] = (void *) &p ## EdgeFlag; \ - (d)[70] = (void *) &p ## EdgeFlagPointer; \ - (d)[71] = (void *) &p ## EdgeFlagv; \ - (d)[72] = (void *) &p ## Enable; \ - (d)[73] = (void *) &p ## EnableClientState; \ - (d)[74] = (void *) &p ## End; \ - (d)[75] = (void *) &p ## EndList; \ - (d)[76] = (void *) &p ## EvalCoord1d; \ - (d)[77] = (void *) &p ## EvalCoord1dv; \ - (d)[78] = (void *) &p ## EvalCoord1f; \ - (d)[79] = (void *) &p ## EvalCoord1fv; \ - (d)[80] = (void *) &p ## EvalCoord2d; \ - (d)[81] = (void *) &p ## EvalCoord2dv; \ - (d)[82] = (void *) &p ## EvalCoord2f; \ - (d)[83] = (void *) &p ## EvalCoord2fv; \ - (d)[84] = (void *) &p ## EvalMesh1; \ - (d)[85] = (void *) &p ## EvalMesh2; \ - (d)[86] = (void *) &p ## EvalPoint1; \ - (d)[87] = (void *) &p ## EvalPoint2; \ - (d)[88] = (void *) &p ## FeedbackBuffer; \ - (d)[89] = (void *) &p ## Finish; \ - (d)[90] = (void *) &p ## Flush; \ - (d)[91] = (void *) &p ## Fogf; \ - (d)[92] = (void *) &p ## Fogfv; \ - (d)[93] = (void *) &p ## Fogi; \ - (d)[94] = (void *) &p ## Fogiv; \ - (d)[95] = (void *) &p ## FrontFace; \ - (d)[96] = (void *) &p ## Frustum; \ - (d)[97] = (void *) &p ## GenLists; \ - (d)[98] = (void *) &p ## GenTextures; \ - (d)[99] = (void *) &p ## GetBooleanv; \ - (d)[100] = (void *) &p ## GetClipPlane; \ - (d)[101] = (void *) &p ## GetDoublev; \ - (d)[102] = (void *) &p ## GetError; \ - (d)[103] = (void *) &p ## GetFloatv; \ - (d)[104] = (void *) &p ## GetIntegerv; \ - (d)[105] = (void *) &p ## GetLightfv; \ - (d)[106] = (void *) &p ## GetLightiv; \ - (d)[107] = (void *) &p ## GetMapdv; \ - (d)[108] = (void *) &p ## GetMapfv; \ - (d)[109] = (void *) &p ## GetMapiv; \ - (d)[110] = (void *) &p ## GetMaterialfv; \ - (d)[111] = (void *) &p ## GetMaterialiv; \ - (d)[112] = (void *) &p ## GetPixelMapfv; \ - (d)[113] = (void *) &p ## GetPixelMapuiv; \ - (d)[114] = (void *) &p ## GetPixelMapusv; \ - (d)[115] = (void *) &p ## GetPointerv; \ - (d)[116] = (void *) &p ## GetPolygonStipple; \ - (d)[117] = (void *) &p ## GetString; \ - (d)[118] = (void *) &p ## GetTexEnvfv; \ - (d)[119] = (void *) &p ## GetTexEnviv; \ - (d)[120] = (void *) &p ## GetTexGendv; \ - (d)[121] = (void *) &p ## GetTexGenfv; \ - (d)[122] = (void *) &p ## GetTexGeniv; \ - (d)[123] = (void *) &p ## GetTexImage; \ - (d)[124] = (void *) &p ## GetTexLevelParameterfv; \ - (d)[125] = (void *) &p ## GetTexLevelParameteriv; \ - (d)[126] = (void *) &p ## GetTexParameterfv; \ - (d)[127] = (void *) &p ## GetTexParameteriv; \ - (d)[128] = (void *) &p ## Hint; \ - (d)[129] = (void *) &p ## IndexMask; \ - (d)[130] = (void *) &p ## IndexPointer; \ - (d)[131] = (void *) &p ## Indexd; \ - (d)[132] = (void *) &p ## Indexdv; \ - (d)[133] = (void *) &p ## Indexf; \ - (d)[134] = (void *) &p ## Indexfv; \ - (d)[135] = (void *) &p ## Indexi; \ - (d)[136] = (void *) &p ## Indexiv; \ - (d)[137] = (void *) &p ## Indexs; \ - (d)[138] = (void *) &p ## Indexsv; \ - (d)[139] = (void *) &p ## Indexub; \ - (d)[140] = (void *) &p ## Indexubv; \ - (d)[141] = (void *) &p ## InitNames; \ - (d)[142] = (void *) &p ## InterleavedArrays; \ - (d)[143] = (void *) &p ## IsEnabled; \ - (d)[144] = (void *) &p ## IsList; \ - (d)[145] = (void *) &p ## IsTexture; \ - (d)[146] = (void *) &p ## LightModelf; \ - (d)[147] = (void *) &p ## LightModelfv; \ - (d)[148] = (void *) &p ## LightModeli; \ - (d)[149] = (void *) &p ## LightModeliv; \ - (d)[150] = (void *) &p ## Lightf; \ - (d)[151] = (void *) &p ## Lightfv; \ - (d)[152] = (void *) &p ## Lighti; \ - (d)[153] = (void *) &p ## Lightiv; \ - (d)[154] = (void *) &p ## LineStipple; \ - (d)[155] = (void *) &p ## LineWidth; \ - (d)[156] = (void *) &p ## ListBase; \ - (d)[157] = (void *) &p ## LoadIdentity; \ - (d)[158] = (void *) &p ## LoadMatrixd; \ - (d)[159] = (void *) &p ## LoadMatrixf; \ - (d)[160] = (void *) &p ## LoadName; \ - (d)[161] = (void *) &p ## LogicOp; \ - (d)[162] = (void *) &p ## Map1d; \ - (d)[163] = (void *) &p ## Map1f; \ - (d)[164] = (void *) &p ## Map2d; \ - (d)[165] = (void *) &p ## Map2f; \ - (d)[166] = (void *) &p ## MapGrid1d; \ - (d)[167] = (void *) &p ## MapGrid1f; \ - (d)[168] = (void *) &p ## MapGrid2d; \ - (d)[169] = (void *) &p ## MapGrid2f; \ - (d)[170] = (void *) &p ## Materialf; \ - (d)[171] = (void *) &p ## Materialfv; \ - (d)[172] = (void *) &p ## Materiali; \ - (d)[173] = (void *) &p ## Materialiv; \ - (d)[174] = (void *) &p ## MatrixMode; \ - (d)[175] = (void *) &p ## MultMatrixd; \ - (d)[176] = (void *) &p ## MultMatrixf; \ - (d)[177] = (void *) &p ## NewList; \ - (d)[178] = (void *) &p ## Normal3b; \ - (d)[179] = (void *) &p ## Normal3bv; \ - (d)[180] = (void *) &p ## Normal3d; \ - (d)[181] = (void *) &p ## Normal3dv; \ - (d)[182] = (void *) &p ## Normal3f; \ - (d)[183] = (void *) &p ## Normal3fv; \ - (d)[184] = (void *) &p ## Normal3i; \ - (d)[185] = (void *) &p ## Normal3iv; \ - (d)[186] = (void *) &p ## Normal3s; \ - (d)[187] = (void *) &p ## Normal3sv; \ - (d)[188] = (void *) &p ## NormalPointer; \ - (d)[189] = (void *) &p ## Ortho; \ - (d)[190] = (void *) &p ## PassThrough; \ - (d)[191] = (void *) &p ## PixelMapfv; \ - (d)[192] = (void *) &p ## PixelMapuiv; \ - (d)[193] = (void *) &p ## PixelMapusv; \ - (d)[194] = (void *) &p ## PixelStoref; \ - (d)[195] = (void *) &p ## PixelStorei; \ - (d)[196] = (void *) &p ## PixelTransferf; \ - (d)[197] = (void *) &p ## PixelTransferi; \ - (d)[198] = (void *) &p ## PixelZoom; \ - (d)[199] = (void *) &p ## PointSize; \ - (d)[200] = (void *) &p ## PolygonMode; \ - (d)[201] = (void *) &p ## PolygonOffset; \ - (d)[202] = (void *) &p ## PolygonStipple; \ - (d)[203] = (void *) &p ## PopAttrib; \ - (d)[204] = (void *) &p ## PopClientAttrib; \ - (d)[205] = (void *) &p ## PopMatrix; \ - (d)[206] = (void *) &p ## PopName; \ - (d)[207] = (void *) &p ## PrioritizeTextures; \ - (d)[208] = (void *) &p ## PushAttrib; \ - (d)[209] = (void *) &p ## PushClientAttrib; \ - (d)[210] = (void *) &p ## PushMatrix; \ - (d)[211] = (void *) &p ## PushName; \ - (d)[212] = (void *) &p ## RasterPos2d; \ - (d)[213] = (void *) &p ## RasterPos2dv; \ - (d)[214] = (void *) &p ## RasterPos2f; \ - (d)[215] = (void *) &p ## RasterPos2fv; \ - (d)[216] = (void *) &p ## RasterPos2i; \ - (d)[217] = (void *) &p ## RasterPos2iv; \ - (d)[218] = (void *) &p ## RasterPos2s; \ - (d)[219] = (void *) &p ## RasterPos2sv; \ - (d)[220] = (void *) &p ## RasterPos3d; \ - (d)[221] = (void *) &p ## RasterPos3dv; \ - (d)[222] = (void *) &p ## RasterPos3f; \ - (d)[223] = (void *) &p ## RasterPos3fv; \ - (d)[224] = (void *) &p ## RasterPos3i; \ - (d)[225] = (void *) &p ## RasterPos3iv; \ - (d)[226] = (void *) &p ## RasterPos3s; \ - (d)[227] = (void *) &p ## RasterPos3sv; \ - (d)[228] = (void *) &p ## RasterPos4d; \ - (d)[229] = (void *) &p ## RasterPos4dv; \ - (d)[230] = (void *) &p ## RasterPos4f; \ - (d)[231] = (void *) &p ## RasterPos4fv; \ - (d)[232] = (void *) &p ## RasterPos4i; \ - (d)[233] = (void *) &p ## RasterPos4iv; \ - (d)[234] = (void *) &p ## RasterPos4s; \ - (d)[235] = (void *) &p ## RasterPos4sv; \ - (d)[236] = (void *) &p ## ReadBuffer; \ - (d)[237] = (void *) &p ## ReadPixels; \ - (d)[238] = (void *) &p ## Rectd; \ - (d)[239] = (void *) &p ## Rectdv; \ - (d)[240] = (void *) &p ## Rectf; \ - (d)[241] = (void *) &p ## Rectfv; \ - (d)[242] = (void *) &p ## Recti; \ - (d)[243] = (void *) &p ## Rectiv; \ - (d)[244] = (void *) &p ## Rects; \ - (d)[245] = (void *) &p ## Rectsv; \ - (d)[246] = (void *) &p ## RenderMode; \ - (d)[247] = (void *) &p ## Rotated; \ - (d)[248] = (void *) &p ## Rotatef; \ - (d)[249] = (void *) &p ## Scaled; \ - (d)[250] = (void *) &p ## Scalef; \ - (d)[251] = (void *) &p ## Scissor; \ - (d)[252] = (void *) &p ## SelectBuffer; \ - (d)[253] = (void *) &p ## ShadeModel; \ - (d)[254] = (void *) &p ## StencilFunc; \ - (d)[255] = (void *) &p ## StencilMask; \ - (d)[256] = (void *) &p ## StencilOp; \ - (d)[257] = (void *) &p ## TexCoord1d; \ - (d)[258] = (void *) &p ## TexCoord1dv; \ - (d)[259] = (void *) &p ## TexCoord1f; \ - (d)[260] = (void *) &p ## TexCoord1fv; \ - (d)[261] = (void *) &p ## TexCoord1i; \ - (d)[262] = (void *) &p ## TexCoord1iv; \ - (d)[263] = (void *) &p ## TexCoord1s; \ - (d)[264] = (void *) &p ## TexCoord1sv; \ - (d)[265] = (void *) &p ## TexCoord2d; \ - (d)[266] = (void *) &p ## TexCoord2dv; \ - (d)[267] = (void *) &p ## TexCoord2f; \ - (d)[268] = (void *) &p ## TexCoord2fv; \ - (d)[269] = (void *) &p ## TexCoord2i; \ - (d)[270] = (void *) &p ## TexCoord2iv; \ - (d)[271] = (void *) &p ## TexCoord2s; \ - (d)[272] = (void *) &p ## TexCoord2sv; \ - (d)[273] = (void *) &p ## TexCoord3d; \ - (d)[274] = (void *) &p ## TexCoord3dv; \ - (d)[275] = (void *) &p ## TexCoord3f; \ - (d)[276] = (void *) &p ## TexCoord3fv; \ - (d)[277] = (void *) &p ## TexCoord3i; \ - (d)[278] = (void *) &p ## TexCoord3iv; \ - (d)[279] = (void *) &p ## TexCoord3s; \ - (d)[280] = (void *) &p ## TexCoord3sv; \ - (d)[281] = (void *) &p ## TexCoord4d; \ - (d)[282] = (void *) &p ## TexCoord4dv; \ - (d)[283] = (void *) &p ## TexCoord4f; \ - (d)[284] = (void *) &p ## TexCoord4fv; \ - (d)[285] = (void *) &p ## TexCoord4i; \ - (d)[286] = (void *) &p ## TexCoord4iv; \ - (d)[287] = (void *) &p ## TexCoord4s; \ - (d)[288] = (void *) &p ## TexCoord4sv; \ - (d)[289] = (void *) &p ## TexCoordPointer; \ - (d)[290] = (void *) &p ## TexEnvf; \ - (d)[291] = (void *) &p ## TexEnvfv; \ - (d)[292] = (void *) &p ## TexEnvi; \ - (d)[293] = (void *) &p ## TexEnviv; \ - (d)[294] = (void *) &p ## TexGend; \ - (d)[295] = (void *) &p ## TexGendv; \ - (d)[296] = (void *) &p ## TexGenf; \ - (d)[297] = (void *) &p ## TexGenfv; \ - (d)[298] = (void *) &p ## TexGeni; \ - (d)[299] = (void *) &p ## TexGeniv; \ - (d)[300] = (void *) &p ## TexImage1D; \ - (d)[301] = (void *) &p ## TexImage2D; \ - (d)[302] = (void *) &p ## TexParameterf; \ - (d)[303] = (void *) &p ## TexParameterfv; \ - (d)[304] = (void *) &p ## TexParameteri; \ - (d)[305] = (void *) &p ## TexParameteriv; \ - (d)[306] = (void *) &p ## TexSubImage1D; \ - (d)[307] = (void *) &p ## TexSubImage2D; \ - (d)[308] = (void *) &p ## Translated; \ - (d)[309] = (void *) &p ## Translatef; \ - (d)[310] = (void *) &p ## Vertex2d; \ - (d)[311] = (void *) &p ## Vertex2dv; \ - (d)[312] = (void *) &p ## Vertex2f; \ - (d)[313] = (void *) &p ## Vertex2fv; \ - (d)[314] = (void *) &p ## Vertex2i; \ - (d)[315] = (void *) &p ## Vertex2iv; \ - (d)[316] = (void *) &p ## Vertex2s; \ - (d)[317] = (void *) &p ## Vertex2sv; \ - (d)[318] = (void *) &p ## Vertex3d; \ - (d)[319] = (void *) &p ## Vertex3dv; \ - (d)[320] = (void *) &p ## Vertex3f; \ - (d)[321] = (void *) &p ## Vertex3fv; \ - (d)[322] = (void *) &p ## Vertex3i; \ - (d)[323] = (void *) &p ## Vertex3iv; \ - (d)[324] = (void *) &p ## Vertex3s; \ - (d)[325] = (void *) &p ## Vertex3sv; \ - (d)[326] = (void *) &p ## Vertex4d; \ - (d)[327] = (void *) &p ## Vertex4dv; \ - (d)[328] = (void *) &p ## Vertex4f; \ - (d)[329] = (void *) &p ## Vertex4fv; \ - (d)[330] = (void *) &p ## Vertex4i; \ - (d)[331] = (void *) &p ## Vertex4iv; \ - (d)[332] = (void *) &p ## Vertex4s; \ - (d)[333] = (void *) &p ## Vertex4sv; \ - (d)[334] = (void *) &p ## VertexPointer; \ - (d)[335] = (void *) &p ## Viewport; \ - (d)[336] = (void *) &p ## BlendFuncSeparateEXT; \ - (d)[337] = (void *) &p ## BlendColor; \ - (d)[338] = (void *) &p ## BlendEquation; \ - (d)[339] = (void *) &p ## LockArraysEXT; \ - (d)[340] = (void *) &p ## UnlockArraysEXT; \ - (d)[341] = (void *) &p ## ClientActiveTextureARB; \ - (d)[342] = (void *) &p ## ActiveTextureARB; \ - (d)[343] = (void *) &p ## MultiTexCoord1dARB; \ - (d)[344] = (void *) &p ## MultiTexCoord1dvARB; \ - (d)[345] = (void *) &p ## MultiTexCoord1fARB; \ - (d)[346] = (void *) &p ## MultiTexCoord1fvARB; \ - (d)[347] = (void *) &p ## MultiTexCoord1iARB; \ - (d)[348] = (void *) &p ## MultiTexCoord1ivARB; \ - (d)[349] = (void *) &p ## MultiTexCoord1sARB; \ - (d)[350] = (void *) &p ## MultiTexCoord1svARB; \ - (d)[351] = (void *) &p ## MultiTexCoord2dARB; \ - (d)[352] = (void *) &p ## MultiTexCoord2dvARB; \ - (d)[353] = (void *) &p ## MultiTexCoord2fARB; \ - (d)[354] = (void *) &p ## MultiTexCoord2fvARB; \ - (d)[355] = (void *) &p ## MultiTexCoord2iARB; \ - (d)[356] = (void *) &p ## MultiTexCoord2ivARB; \ - (d)[357] = (void *) &p ## MultiTexCoord2sARB; \ - (d)[358] = (void *) &p ## MultiTexCoord2svARB; \ - (d)[359] = (void *) &p ## MultiTexCoord3dARB; \ - (d)[360] = (void *) &p ## MultiTexCoord3dvARB; \ - (d)[361] = (void *) &p ## MultiTexCoord3fARB; \ - (d)[362] = (void *) &p ## MultiTexCoord3fvARB; \ - (d)[363] = (void *) &p ## MultiTexCoord3iARB; \ - (d)[364] = (void *) &p ## MultiTexCoord3ivARB; \ - (d)[365] = (void *) &p ## MultiTexCoord3sARB; \ - (d)[366] = (void *) &p ## MultiTexCoord3svARB; \ - (d)[367] = (void *) &p ## MultiTexCoord4dARB; \ - (d)[368] = (void *) &p ## MultiTexCoord4dvARB; \ - (d)[369] = (void *) &p ## MultiTexCoord4fARB; \ - (d)[370] = (void *) &p ## MultiTexCoord4fvARB; \ - (d)[371] = (void *) &p ## MultiTexCoord4iARB; \ - (d)[372] = (void *) &p ## MultiTexCoord4ivARB; \ - (d)[373] = (void *) &p ## MultiTexCoord4sARB; \ - (d)[374] = (void *) &p ## MultiTexCoord4svARB; \ - (d)[375] = (void *) &p ## LoadTransposeMatrixdARB; \ - (d)[376] = (void *) &p ## LoadTransposeMatrixfARB; \ - (d)[377] = (void *) &p ## MultTransposeMatrixdARB; \ - (d)[378] = (void *) &p ## MultTransposeMatrixfARB; \ - (d)[379] = (void *) &p ## CompressedTexImage3DARB; \ - (d)[380] = (void *) &p ## CompressedTexImage2DARB; \ - (d)[381] = (void *) &p ## CompressedTexImage1DARB; \ - (d)[382] = (void *) &p ## CompressedTexSubImage3DARB; \ - (d)[383] = (void *) &p ## CompressedTexSubImage2DARB; \ - (d)[384] = (void *) &p ## CompressedTexSubImage1DARB; \ - (d)[385] = (void *) &p ## GetCompressedTexImageARB; \ - (d)[386] = (void *) &p ## SecondaryColor3bEXT; \ - (d)[387] = (void *) &p ## SecondaryColor3bvEXT; \ - (d)[388] = (void *) &p ## SecondaryColor3dEXT; \ - (d)[389] = (void *) &p ## SecondaryColor3dvEXT; \ - (d)[390] = (void *) &p ## SecondaryColor3fEXT; \ - (d)[391] = (void *) &p ## SecondaryColor3fvEXT; \ - (d)[392] = (void *) &p ## SecondaryColor3iEXT; \ - (d)[393] = (void *) &p ## SecondaryColor3ivEXT; \ - (d)[394] = (void *) &p ## SecondaryColor3sEXT; \ - (d)[395] = (void *) &p ## SecondaryColor3svEXT; \ - (d)[396] = (void *) &p ## SecondaryColor3ubEXT; \ - (d)[397] = (void *) &p ## SecondaryColor3ubvEXT; \ - (d)[398] = (void *) &p ## SecondaryColor3uiEXT; \ - (d)[399] = (void *) &p ## SecondaryColor3uivEXT; \ - (d)[400] = (void *) &p ## SecondaryColor3usEXT; \ - (d)[401] = (void *) &p ## SecondaryColor3usvEXT; \ - (d)[402] = (void *) &p ## SecondaryColorPointerEXT; \ - (d)[403] = (void *) &p ## VertexArrayRangeNV; \ - (d)[405] = (void *) &p ## DrawRangeElements; \ - (d)[406] = (void *) &p ## ColorTable; \ - (d)[407] = (void *) &p ## ColorTableParameterfv; \ - (d)[408] = (void *) &p ## ColorTableParameteriv; \ - (d)[409] = (void *) &p ## CopyColorTable; \ - (d)[410] = (void *) &p ## GetColorTable; \ - (d)[411] = (void *) &p ## GetColorTableParameterfv; \ - (d)[412] = (void *) &p ## GetColorTableParameteriv; \ - (d)[413] = (void *) &p ## ColorSubTable; \ - (d)[414] = (void *) &p ## CopyColorSubTable; \ - (d)[415] = (void *) &p ## ConvolutionFilter1D; \ - (d)[416] = (void *) &p ## ConvolutionFilter2D; \ - (d)[417] = (void *) &p ## ConvolutionParameterf; \ - (d)[418] = (void *) &p ## ConvolutionParameterfv; \ - (d)[419] = (void *) &p ## ConvolutionParameteri; \ - (d)[420] = (void *) &p ## ConvolutionParameteriv; \ - (d)[421] = (void *) &p ## CopyConvolutionFilter1D; \ - (d)[422] = (void *) &p ## CopyConvolutionFilter2D; \ - (d)[423] = (void *) &p ## GetConvolutionFilter; \ - (d)[424] = (void *) &p ## GetConvolutionParameterfv; \ - (d)[425] = (void *) &p ## GetConvolutionParameteriv; \ - (d)[426] = (void *) &p ## GetSeparableFilter; \ - (d)[427] = (void *) &p ## SeparableFilter2D; \ - (d)[428] = (void *) &p ## GetHistogram; \ - (d)[429] = (void *) &p ## GetHistogramParameterfv; \ - (d)[430] = (void *) &p ## GetHistogramParameteriv; \ - (d)[431] = (void *) &p ## GetMinmax; \ - (d)[432] = (void *) &p ## GetMinmaxParameterfv; \ - (d)[433] = (void *) &p ## GetMinmaxParameteriv; \ - (d)[434] = (void *) &p ## Histogram; \ - (d)[435] = (void *) &p ## Minmax; \ - (d)[436] = (void *) &p ## ResetHistogram; \ - (d)[437] = (void *) &p ## ResetMinmax; \ - (d)[438] = (void *) &p ## TexImage3D; \ - (d)[439] = (void *) &p ## TexSubImage3D; \ - (d)[440] = (void *) &p ## CopyTexSubImage3D; \ - (d)[441] = (void *) &p ## CombinerParameterfvNV; \ - (d)[442] = (void *) &p ## CombinerParameterfNV; \ - (d)[443] = (void *) &p ## CombinerParameterivNV; \ - (d)[444] = (void *) &p ## CombinerParameteriNV; \ - (d)[445] = (void *) &p ## CombinerInputNV; \ - (d)[446] = (void *) &p ## CombinerOutputNV; \ - (d)[447] = (void *) &p ## FinalCombinerInputNV; \ - (d)[448] = (void *) &p ## GetCombinerInputParameterfvNV; \ - (d)[449] = (void *) &p ## GetCombinerInputParameterivNV; \ - (d)[450] = (void *) &p ## GetCombinerOutputParameterfvNV; \ - (d)[451] = (void *) &p ## GetCombinerOutputParameterivNV; \ - (d)[452] = (void *) &p ## GetFinalCombinerInputParameterfvNV; \ - (d)[453] = (void *) &p ## GetFinalCombinerInputParameterivNV; \ - (d)[458] = (void *) &p ## BlendEquationSeparateEXT; \ - (d)[459] = (void *) &p ## SampleCoverageARB; \ - (d)[471] = (void *) &p ## BindProgramNV; \ - (d)[472] = (void *) &p ## DeleteProgramsNV; \ - (d)[473] = (void *) &p ## GenProgramsNV; \ - (d)[474] = (void *) &p ## IsProgramNV; \ - (d)[475] = (void *) &p ## VertexAttrib1sNV; \ - (d)[476] = (void *) &p ## VertexAttrib1fNV; \ - (d)[477] = (void *) &p ## VertexAttrib1dNV; \ - (d)[478] = (void *) &p ## VertexAttrib2sNV; \ - (d)[479] = (void *) &p ## VertexAttrib2fNV; \ - (d)[480] = (void *) &p ## VertexAttrib2dNV; \ - (d)[481] = (void *) &p ## VertexAttrib3sNV; \ - (d)[482] = (void *) &p ## VertexAttrib3fNV; \ - (d)[483] = (void *) &p ## VertexAttrib3dNV; \ - (d)[484] = (void *) &p ## VertexAttrib4sNV; \ - (d)[485] = (void *) &p ## VertexAttrib4fNV; \ - (d)[486] = (void *) &p ## VertexAttrib4dNV; \ - (d)[487] = (void *) &p ## VertexAttrib4ubNV; \ - (d)[488] = (void *) &p ## VertexAttrib1svNV; \ - (d)[489] = (void *) &p ## VertexAttrib1fvNV; \ - (d)[490] = (void *) &p ## VertexAttrib1dvNV; \ - (d)[491] = (void *) &p ## VertexAttrib2svNV; \ - (d)[492] = (void *) &p ## VertexAttrib2fvNV; \ - (d)[493] = (void *) &p ## VertexAttrib2dvNV; \ - (d)[494] = (void *) &p ## VertexAttrib3svNV; \ - (d)[495] = (void *) &p ## VertexAttrib3fvNV; \ - (d)[496] = (void *) &p ## VertexAttrib3dvNV; \ - (d)[497] = (void *) &p ## VertexAttrib4bvARB; \ - (d)[498] = (void *) &p ## VertexAttrib4svNV; \ - (d)[498] = (void *) &p ## VertexAttrib4NsvARB; \ - (d)[499] = (void *) &p ## VertexAttrib4ivARB; \ - (d)[500] = (void *) &p ## VertexAttrib4ubvNV; \ - (d)[500] = (void *) &p ## VertexAttrib4ubvARB; \ - (d)[501] = (void *) &p ## VertexAttrib4usvARB; \ - (d)[502] = (void *) &p ## VertexAttrib4uivARB; \ - (d)[503] = (void *) &p ## VertexAttrib4fvNV; \ - (d)[504] = (void *) &p ## VertexAttrib4dvNV; \ - (d)[505] = (void *) &p ## VertexAttrib4NbvARB; \ - (d)[507] = (void *) &p ## VertexAttrib4NivARB; \ - (d)[509] = (void *) &p ## VertexAttrib4NusvARB; \ - (d)[510] = (void *) &p ## VertexAttrib4NuivARB; \ - (d)[511] = (void *) &p ## VertexAttribPointerARB; \ - (d)[512] = (void *) &p ## EnableVertexAttribArrayARB; \ - (d)[513] = (void *) &p ## DisableVertexAttribArrayARB; \ - (d)[514] = (void *) &p ## GetVertexAttribdvNV; \ - (d)[515] = (void *) &p ## GetVertexAttribfvNV; \ - (d)[516] = (void *) &p ## GetVertexAttribivNV; \ - (d)[517] = (void *) &p ## GetVertexAttribPointervNV; \ - (d)[518] = (void *) &p ## ProgramEnvParameter4dARB; \ - (d)[519] = (void *) &p ## ProgramEnvParameter4dvARB; \ - (d)[520] = (void *) &p ## ProgramEnvParameter4fARB; \ - (d)[521] = (void *) &p ## ProgramEnvParameter4fvARB; \ - (d)[522] = (void *) &p ## ProgramLocalParameter4dARB; \ - (d)[523] = (void *) &p ## ProgramLocalParameter4dvARB; \ - (d)[524] = (void *) &p ## ProgramLocalParameter4fARB; \ - (d)[525] = (void *) &p ## ProgramLocalParameter4fvARB; \ - (d)[526] = (void *) &p ## GetProgramEnvParameterdvARB; \ - (d)[527] = (void *) &p ## GetProgramEnvParameterfvARB; \ - (d)[528] = (void *) &p ## GetProgramLocalParameterdvARB; \ - (d)[529] = (void *) &p ## GetProgramLocalParameterfvARB; \ - (d)[530] = (void *) &p ## ProgramStringARB; \ - (d)[531] = (void *) &p ## GetProgramStringARB; \ - (d)[532] = (void *) &p ## GetProgramivARB; \ - (d)[540] = (void *) &p ## PointParameterfEXT; \ - (d)[541] = (void *) &p ## PointParameterfvEXT; \ - (d)[542] = (void *) &p ## PointParameteriNV; \ - (d)[543] = (void *) &p ## PointParameterivNV; \ - (d)[544] = (void *) &p ## FogCoordfEXT; \ - (d)[545] = (void *) &p ## FogCoordfvEXT; \ - (d)[546] = (void *) &p ## FogCoorddEXT; \ - (d)[547] = (void *) &p ## FogCoorddvEXT; \ - (d)[548] = (void *) &p ## FogCoordPointerEXT; \ - (d)[567] = (void *) &p ## MultiDrawArraysEXT; \ - (d)[568] = (void *) &p ## MultiDrawElementsEXT; \ - (d)[569] = (void *) &p ## WindowPos2dMESA; \ - (d)[570] = (void *) &p ## WindowPos2dvMESA; \ - (d)[571] = (void *) &p ## WindowPos2fMESA; \ - (d)[572] = (void *) &p ## WindowPos2fvMESA; \ - (d)[573] = (void *) &p ## WindowPos2iMESA; \ - (d)[574] = (void *) &p ## WindowPos2ivMESA; \ - (d)[575] = (void *) &p ## WindowPos2sMESA; \ - (d)[576] = (void *) &p ## WindowPos2svMESA; \ - (d)[577] = (void *) &p ## WindowPos3dMESA; \ - (d)[578] = (void *) &p ## WindowPos3dvMESA; \ - (d)[579] = (void *) &p ## WindowPos3fMESA; \ - (d)[580] = (void *) &p ## WindowPos3fvMESA; \ - (d)[581] = (void *) &p ## WindowPos3iMESA; \ - (d)[582] = (void *) &p ## WindowPos3ivMESA; \ - (d)[583] = (void *) &p ## WindowPos3sMESA; \ - (d)[584] = (void *) &p ## WindowPos3svMESA; \ - (d)[585] = (void *) &p ## ActiveStencilFaceEXT; \ -} while (0) diff --git a/nx-X11/lib/GL/apple/dri_driver.c b/nx-X11/lib/GL/apple/dri_driver.c deleted file mode 100644 index ce8b0736a..000000000 --- a/nx-X11/lib/GL/apple/dri_driver.c +++ /dev/null @@ -1,1141 +0,0 @@ -/* $XFree86: xc/lib/GL/apple/dri_driver.c,v 1.2 2003/10/31 02:22:12 torrey Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -Copyright (c) 2002 Apple Computer, Inc. -Copyright (c) 2004 Torrey T. Lyons -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Original Authors: - * Kevin E. Martin - * Brian E. Paul - */ - -/* - * This file follows Mesa's dri_util.c closely. The code in dri_util.c - * gets compiled into each of the DRI 3D drivers. A typical DRI driver, - * is loaded dynamically by libGL, so libGL knows nothing about the - * internal functions here. On Mac OS X the AppleDRI driver code is - * statically linked into libGL, but otherwise it tries to behave like - * a standard DRI driver. - * - * The functions defined here are called from the GL library via function - * pointers in the __DRIdisplayRec, __DRIscreenRec, __DRIcontextRec, - * __DRIdrawableRec structures defined in glxclient.h. Those function - * pointers are initialized by code in this file. The process starts when - * libGL calls the __driCreateScreen() function at the end of this file. - * - * The above-mentioned DRI structures have no dependencies on Mesa. - * Each structure instead has a generic (void *) private pointer that - * points to a private structure. For Mesa drivers, these private - * structures are the __DRIdrawablePrivateRec, __DRIcontextPrivateRec, - * __DRIscreenPrivateRec, and __DRIvisualPrivateRec structures defined - * in dri_mesaint.h. We allocate and attach those structs here in - * this file. - */ - - -#ifdef GLX_DIRECT_RENDERING - -/* These are first to ensure that Apple's GL headers are used. */ -#include -#include - -#include -#include -#include - -#define GLAPIENTRYP * -#include "extutil.h" -#include "glxclient.h" -#include "appledri.h" -#include "dri_driver.h" -#include "x-list.h" -#include "x-hash.h" - -/** - * This is used in a couple of places that call \c driMesaCreateNewDrawable. - */ -static const int empty_attribute_list[1] = { None }; - -/* Context binding */ -static Bool driMesaBindContext(Display *dpy, int scrn, - GLXDrawable draw, GLXContext gc); -static Bool driMesaUnbindContext(Display *dpy, int scrn, - GLXDrawable draw, GLXContext gc, - int will_rebind); - -/* Drawable methods */ -static void *driMesaCreateNewDrawable(__DRInativeDisplay *dpy, - const __GLcontextModes *modes, - __DRIid draw, __DRIdrawable *pdraw, - int renderType, const int *attrs); -static __DRIdrawable *driMesaGetDrawable(__DRInativeDisplay *dpy, - GLXDrawable draw, - void *screenPrivate); -static void driMesaSwapBuffers(__DRInativeDisplay *dpy, void *drawPrivate); -static void driMesaDestroyDrawable(__DRInativeDisplay *dpy, void *drawPrivate); - -/* Context methods */ -static void *driMesaCreateContext(Display *dpy, XVisualInfo *vis, void *shared, - __DRIcontext *pctx); -static void driMesaDestroyContext(__DRInativeDisplay *dpy, int scrn, - void *screenPrivate); - -/* Screen methods */ -static void *driMesaCreateScreen(__DRInativeDisplay *dpy, int scrn, - __DRIscreen *psc, int numConfigs, - __GLXvisualConfig *config); -static void driMesaDestroyScreen(__DRInativeDisplay *dpy, int scrn, - void *screenPrivate); - -static void driMesaCreateSurface(Display *dpy, int scrn, - __DRIdrawablePrivate *pdp); - -static void unwrap_context(__DRIcontextPrivate *pcp); -static void wrap_context(__DRIcontextPrivate *pcp); - -extern const CGLContextObj XAppleDRIGetIndirectContext(void); - -/*****************************************************************/ - -/* Maintain a list of drawables */ - -static inline Bool -__driMesaAddDrawable(x_hash_table *drawHash, __DRIdrawable *pdraw) -{ - __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)pdraw->private; - - assert(drawHash != NULL); - - x_hash_table_insert(drawHash, (void *) pdp->draw, pdraw); - - return GL_TRUE; -} - -static inline __DRIdrawable * -__driMesaFindDrawable(x_hash_table *drawHash, GLXDrawable draw) -{ - if (drawHash == NULL) - return NULL; - - return x_hash_table_lookup(drawHash, (void *) draw, NULL); -} - -struct find_by_uid_closure { - unsigned int uid; - __DRIdrawable *ret; -}; - -static void -find_by_uid_cb(void *k, void *v, void *data) -{ - __DRIdrawable *pdraw = v; - __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)pdraw->private; - struct find_by_uid_closure *c = data; - - if (pdp->uid == c->uid) - c->ret = pdraw; -} - -static __DRIdrawable * -__driMesaFindDrawableByUID(x_hash_table *drawHash, unsigned int uid) -{ - struct find_by_uid_closure c; - - c.uid = uid; - c.ret = NULL; - x_hash_table_foreach(drawHash, find_by_uid_cb, &c); - - return c.ret; -} - -static inline void -__driMesaRemoveDrawable(x_hash_table *drawHash, __DRIdrawable *pdraw) -{ - __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)pdraw->private; - - if (drawHash == NULL) - return; - - x_hash_table_remove(drawHash, (void *) pdp->draw); -} - -static Bool __driMesaWindowExistsFlag; - -static int __driMesaWindowExistsErrorHandler(Display *dpy, XErrorEvent *xerr) -{ - if (xerr->error_code == BadWindow) { - __driMesaWindowExistsFlag = GL_FALSE; - } - return 0; -} - -static Bool __driMesaWindowExists(Display *dpy, GLXDrawable draw) -{ - XWindowAttributes xwa; - int (*oldXErrorHandler)(Display *, XErrorEvent *); - - __driMesaWindowExistsFlag = GL_TRUE; - oldXErrorHandler = XSetErrorHandler(__driMesaWindowExistsErrorHandler); - XGetWindowAttributes(dpy, draw, &xwa); /* dummy request */ - XSetErrorHandler(oldXErrorHandler); - return __driMesaWindowExistsFlag; -} - -static void __driMesaCollectCallback(void *k, void *v, void *data) -{ - GLXDrawable draw = (GLXDrawable) k; - __DRIdrawable *pdraw = v; - x_list **todelete = data; - - __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)pdraw->private; - Display *dpy; - - dpy = pdp->driScreenPriv->display; - XSync(dpy, GL_FALSE); - if (!pdp->destroyed && !__driMesaWindowExists(dpy, draw)) { - /* Destroy the local drawable data in the hash table, if the - drawable no longer exists in the Xserver */ - pdp->destroyed = TRUE; - *todelete = x_list_prepend(*todelete, pdraw); - } -} - -/* pdp->mutex is held. */ -static void __driMesaGarbageCollectDrawables(void *drawHash) -{ - __DRIdrawable *pdraw; - __DRIdrawablePrivate *pdp; - Display *dpy; - x_list *todelete = NULL, *node; - - x_hash_table_foreach(drawHash, __driMesaCollectCallback, &todelete); - - for (node = todelete; node != NULL; node = node->next) - { - pdraw = node->data; - pdp = (__DRIdrawablePrivate *)pdraw->private; - dpy = pdp->driScreenPriv->display; - - /* Destroy the local drawable data in the hash table, if the - drawable no longer exists in the Xserver */ - - __driMesaRemoveDrawable(drawHash, pdraw); - (*pdraw->destroyDrawable)(dpy, pdraw->private); - Xfree(pdraw); - } - - x_list_free(todelete); -} - -/*****************************************************************/ - -/* returns with psp->mutex locked if successful. */ -static Bool -driMesaFindDrawableByUID(Display *dpy,unsigned int uid, - __DRIscreenPrivate **psp_ret, - __DRIdrawablePrivate **pdp_ret) -{ - __DRIscreen *pDRIScreen; - __DRIscreenPrivate *psp; - __DRIdrawable *pdraw; - int scrn; - - for (scrn = 0; scrn < ScreenCount(dpy); scrn++) - { - if (!(pDRIScreen = __glXFindDRIScreen(dpy, scrn))) { - /* ERROR!!! */ - return FALSE; - } else if (!(psp = (__DRIscreenPrivate *)pDRIScreen->private)) { - /* ERROR!!! */ - return FALSE; - } - - xmutex_lock(psp->mutex); - - pdraw = __driMesaFindDrawableByUID(psp->drawHash, uid); - if (pdraw != NULL) { - *psp_ret = psp; - *pdp_ret = pdraw->private; - return TRUE; - }; - - xmutex_unlock(psp->mutex); - } - - return FALSE; -} - -static void -unbind_context(__DRIcontextPrivate *pcp) -{ - /* Unbind the context from its old drawable. */ - - if (pcp->driDrawablePriv != NULL) - { - if (pcp->next != NULL) - pcp->next->prev = pcp->prev; - if (pcp->prev != NULL) - pcp->prev->next = pcp->next; - - if (pcp->driDrawablePriv->driContextPriv == pcp) - pcp->driDrawablePriv->driContextPriv = pcp->next; - - pcp->driDrawablePriv = NULL; - pcp->prev = pcp->next = NULL; - } - - if (pcp->surface_id != 0) - { - pcp->surface_id = 0; - pcp->pending_clear = TRUE; - } -} - -static void -unbind_drawable(__DRIdrawablePrivate *pdp) -{ - __DRIcontextPrivate *pcp, *next; - - for (pcp = pdp->driContextPriv; pcp != NULL; pcp = next) - { - next = pcp->next; - unbind_context(pcp); - } -} - -static void -update_context(__DRIcontextPrivate *pcp) -{ - if (pcp->pending_clear) - { - CGLClearDrawable(pcp->ctx); - pcp->pending_clear = FALSE; - } - - if (pcp->pending_update && pcp->surface_id != 0) - { - xp_update_gl_context(pcp->ctx); - pcp->pending_update = FALSE; - } -} - -static Bool driMesaUnbindContext(Display *dpy, int scrn, - GLXDrawable draw, GLXContext gc, - int will_rebind) -{ - __DRIscreen *pDRIScreen; -// __DRIdrawable *pdraw; - __DRIcontextPrivate *pcp; - __DRIscreenPrivate *psp; - __DRIdrawablePrivate *pdp; - - /* - ** Assume error checking is done properly in glXMakeCurrent before - ** calling driMesaUnbindContext. - */ - - if (gc == NULL || draw == None) { - /* ERROR!!! */ - return GL_FALSE; - } - - if (!(pDRIScreen = __glXFindDRIScreen(dpy, scrn))) { - /* ERROR!!! */ - return GL_FALSE; - } else if (!(psp = (__DRIscreenPrivate *)pDRIScreen->private)) { - /* ERROR!!! */ - return GL_FALSE; - } - - xmutex_lock(psp->mutex); - - pcp = (__DRIcontextPrivate *)gc->driContext.private; - - pdp = pcp->driDrawablePriv; - if (pdp == NULL) { - /* ERROR!!! */ - xmutex_unlock(psp->mutex); - return GL_FALSE; - } - - /* Put this thread back into normal (indirect) dispatch mode. */ - CGLSetCurrentContext(XAppleDRIGetIndirectContext()); - pcp->thread_id = 0; - - /* Lazily unbind the drawable from the context */ - unbind_context(pcp); - - if (pdp->refcount == 0) { - /* ERROR!!! */ - xmutex_unlock(psp->mutex); - return GL_FALSE; - } else if (--pdp->refcount == 0) { -#if 0 - /* - ** NOT_DONE: When a drawable is unbound from one direct - ** rendering context and then bound to another, we do not want - ** to destroy the drawable data structure each time only to - ** recreate it immediatly afterwards when binding to the next - ** context. This also causes conflicts with caching of the - ** drawable stamp. - ** - ** In addition, we don't destroy the drawable here since Mesa - ** keeps private data internally (e.g., software accumulation - ** buffers) that should not be destroyed unless the client - ** explicitly requests that the window be destroyed. - ** - ** When GLX 1.3 is integrated, the create and destroy drawable - ** functions will have user level counterparts and the memory - ** will be able to be recovered. - ** - ** Below is an example of what needs to go into the destroy - ** drawable routine to support GLX 1.3. - */ - __driMesaRemoveDrawable(psp->drawHash, pdraw); - (*pdraw->destroyDrawable)(dpy, pdraw->private); - Xfree(pdraw); -#endif - } - - xmutex_unlock(psp->mutex); - return GL_TRUE; -} - -static Bool driMesaBindContext(Display *dpy, int scrn, - GLXDrawable draw, GLXContext gc) -{ - __DRIscreen *pDRIScreen; - const __GLcontextModes *modes; - __DRIdrawable *pdraw; - __DRIdrawablePrivate *pdp; - __DRIscreenPrivate *psp; - __DRIcontextPrivate *pcp; - - /* - ** Assume error checking is done properly in glXMakeCurrent before - ** calling driMesaBindContext. - */ - - if (gc == NULL || draw == None) { - /* ERROR!!! */ - return GL_FALSE; - } - - if (!(pDRIScreen = __glXFindDRIScreen(dpy, scrn))) { - /* ERROR!!! */ - return GL_FALSE; - } else if (!(psp = (__DRIscreenPrivate *)pDRIScreen->private)) { - /* ERROR!!! */ - return GL_FALSE; - } - - modes = gc->driContext.mode; - - if ( modes == NULL ) { - /* ERROR!!! */ - return GL_FALSE; - } - - xmutex_lock(psp->mutex); - - pdraw = __driMesaFindDrawable(psp->drawHash, draw); - if (!pdraw) { - /* Allocate a new drawable */ - pdraw = (__DRIdrawable *)Xmalloc(sizeof(__DRIdrawable)); - if (!pdraw) { - /* ERROR!!! */ - xmutex_unlock(psp->mutex); - return GL_FALSE; - } - - /* Create a new drawable */ - pdraw->private = driMesaCreateNewDrawable(dpy, modes, draw, pdraw, - GLX_WINDOW_BIT, - empty_attribute_list); - if (!pdraw->private) { - /* ERROR!!! */ - Xfree(pdraw); - xmutex_unlock(psp->mutex); - return GL_FALSE; - } - - /* Add pdraw to drawable list */ - if (!__driMesaAddDrawable(psp->drawHash, pdraw)) { - /* ERROR!!! */ - (*pdraw->destroyDrawable)(dpy, pdraw->private); - Xfree(pdraw); - xmutex_unlock(psp->mutex); - return GL_FALSE; - } - } - - pdp = (__DRIdrawablePrivate *)pdraw->private; - pcp = (__DRIcontextPrivate *)gc->driContext.private; - - if (pdp->surface_id == 0) - { - /* Surface got destroyed. Try to create a new one. */ - - driMesaCreateSurface(dpy, scrn, pdp); - } - - unbind_context(pcp); - - /* Bind the drawable to the context */ - pcp->driDrawablePriv = pdp; - pcp->prev = NULL; - pcp->next = pdp->driContextPriv; - pdp->driContextPriv = pcp; - pdp->refcount++; - - /* And the physical surface to the physical context */ - if (pcp->surface_id != pdp->surface_id) - { - pcp->surface_id = 0; - - /* Attaching the drawable sets the default viewport. But we don't - want to catch that call to glViewport in our wrappers. */ - unwrap_context(pcp); - - if (pdp->surface_id == 0) - CGLClearDrawable(pcp->ctx); - else if (xp_attach_gl_context(pcp->ctx, pdp->surface_id) == Success) - pcp->surface_id = pdp->surface_id; - else - fprintf(stderr, "failed to bind to surface\n"); - - wrap_context(pcp); - - pcp->pending_clear = FALSE; - pcp->pending_update = FALSE; - } - else if (pcp->pending_clear) - { - CGLClearDrawable(pcp->ctx); - pcp->pending_clear = FALSE; - } - - /* Activate the CGL context and remember which thread it's current for. */ - CGLSetCurrentContext(pcp->ctx); - pcp->thread_id = xthread_self(); - - xmutex_unlock(psp->mutex); - return GL_TRUE; -} - -/*****************************************************************/ - -static xp_client_id -get_client_id(void) -{ - static xp_client_id id; - - if (id == 0) - { - if (xp_init(XP_IN_BACKGROUND) != Success - || xp_get_client_id(&id) != Success) - { - return 0; - } - } - - return id; -} - -static void driMesaCreateSurface(Display *dpy, int scrn, - __DRIdrawablePrivate *pdp) -{ - xp_client_id client_id; - unsigned int key[2]; - - pdp->surface_id = 0; - pdp->uid = 0; - - client_id = get_client_id(); - if (client_id == 0) - return; - - if (XAppleDRICreateSurface(dpy, scrn, pdp->draw, - client_id, key, &pdp->uid)) - { - xp_import_surface(key, &pdp->surface_id); - } -} - -/** - * This is called via __DRIscreenRec's createNewDrawable pointer. - */ -static void *driMesaCreateNewDrawable(__DRInativeDisplay *dpy, - const __GLcontextModes *modes, - __DRIid draw, - __DRIdrawable *pdraw, - int renderType, - const int *attrs) -{ - __DRIscreen * const pDRIScreen = __glXFindDRIScreen(dpy, modes->screen); - __DRIscreenPrivate *psp; - __DRIdrawablePrivate *pdp; - - - pdraw->private = NULL; - - /* Since pbuffers are not yet supported, no drawable attributes are - * supported either. - */ - (void) attrs; - - if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { - return NULL; - } - - pdp = (__DRIdrawablePrivate *)Xmalloc(sizeof(__DRIdrawablePrivate)); - if (!pdp) { - return NULL; - } - - pdp->draw = draw; - pdp->refcount = 0; - pdp->surface_id = 0; - pdp->uid = 0; - pdp->destroyed = FALSE; - - psp = (__DRIscreenPrivate *)pDRIScreen->private; - pdp->driScreenPriv = psp; - pdp->driContextPriv = NULL; - - driMesaCreateSurface(dpy, modes->screen, pdp); - if (pdp->surface_id == 0) { - Xfree(pdp); - return NULL; - } - - pdraw->private = pdp; - pdraw->destroyDrawable = driMesaDestroyDrawable; - pdraw->swapBuffers = driMesaSwapBuffers; /* called by glXSwapBuffers() */ - -#if 0 - /* We don't support these yet. */ - if ( driCompareGLXAPIVersion( 20030317 ) >= 0 ) { - pdraw->getSBC = driGetSBC; - pdraw->waitForSBC = driWaitForSBC; - pdraw->waitForMSC = driWaitForMSC; - pdraw->swapBuffersMSC = driSwapBuffersMSC; - pdraw->frameTracking = NULL; - pdraw->queryFrameTracking = driQueryFrameTracking; - - /* This special default value is replaced with the configured - * default value when the drawable is first bound to a direct - * rendering context. */ - pdraw->swap_interval = (unsigned)-1; - } -#endif - - return (void *) pdp; -} - -static __DRIdrawable *driMesaGetDrawable(__DRInativeDisplay *dpy, - GLXDrawable draw, - void *screenPrivate) -{ - __DRIscreenPrivate *psp = (__DRIscreenPrivate *) screenPrivate; - __DRIdrawable *dri_draw; - - xmutex_lock(psp->mutex); - - /* - ** Make sure this routine returns NULL if the drawable is not bound - ** to a direct rendering context! - */ - dri_draw = __driMesaFindDrawable(psp->drawHash, draw); - - xmutex_unlock(psp->mutex); - return dri_draw; -} - -static void driMesaSwapBuffers(__DRInativeDisplay *dpy, void *drawPrivate) -{ - __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *) drawPrivate; - __DRIcontextPrivate *pcp; - xthread_t self = xthread_self(); - static Bool warned; - - xmutex_lock(pdp->driScreenPriv->mutex); - - /* FIXME: this is sub-optimal, since we may not always find a context - bound to the given drawable on this thread. */ - - for (pcp = pdp->driContextPriv; pcp != NULL; pcp = pcp->next) - { - if (pcp->thread_id == self || pcp->thread_id == 0) - break; - } - - if (pcp != NULL) - { - CGLFlushDrawable(pcp->ctx); - } - else - { - if (!warned) { - fprintf(stderr, "glXSwapBuffers: no context for this drawable\n"); - warned = TRUE; - } - } - - xmutex_unlock(pdp->driScreenPriv->mutex); -} - -/* pdp->mutex is held. */ -static void driMesaDestroyDrawable(__DRInativeDisplay *dpy, void *drawPrivate) -{ - __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)drawPrivate; - - if (pdp) { - unbind_drawable(pdp); - if (pdp->surface_id != 0) { - xp_destroy_surface(pdp->surface_id); - pdp->surface_id = 0; - } - if (!pdp->destroyed) { - /* don't try to destroy an already destroyed surface. */ - XAppleDRIDestroySurface(dpy, pdp->driScreenPriv->myNum, pdp->draw); - } - Xfree(pdp); - } -} - -/*****************************************************************/ - -static CGLPixelFormatObj -driCreatePixelFormat(Display *dpy, __DRIscreenPrivate *psp, - XVisualInfo *visinfo, __GLXvisualConfig *config) -{ - int i; - CGLPixelFormatAttribute attr[64]; // currently uses max of 30 - CGLPixelFormatObj result; - long n_formats; - - i = 0; - - if (!config->rgba) - return NULL; - - if (config->stereo) - attr[i++] = kCGLPFAStereo; - - if (config->doubleBuffer) - attr[i++] = kCGLPFADoubleBuffer; - - attr[i++] = kCGLPFAColorSize; - attr[i++] = config->redSize + config->greenSize + config->blueSize; - attr[i++] = kCGLPFAAlphaSize; - attr[i++] = 1; /* FIXME: ignoring config->alphaSize which is always 0 */ - - if (config->accumRedSize + config->accumGreenSize - + config->accumBlueSize + config->accumAlphaSize > 0) - { - attr[i++] = kCGLPFAAccumSize; - attr[i++] = (config->accumRedSize + config->accumGreenSize - + config->accumBlueSize + config->accumAlphaSize); - } - - if (config->depthSize > 0) { - attr[i++] = kCGLPFADepthSize; - attr[i++] = config->depthSize; - } - - if (config->stencilSize > 0) { - attr[i++] = kCGLPFAStencilSize; - attr[i++] = config->stencilSize; - } - - if (config->auxBuffers > 0) { - attr[i++] = kCGLPFAAuxBuffers; - attr[i++] = config->auxBuffers; - } - - /* FIXME: things we don't handle: color/alpha masks, level, - visualrating, transparentFoo */ - - attr[i++] = 0; - - result = NULL; - CGLChoosePixelFormat(attr, &result, &n_formats); - - return result; -} - -static void *driMesaCreateContext(Display *dpy, XVisualInfo *vis, void *shared, - __DRIcontext *pctx) -{ - __DRIscreen *pDRIScreen; - __DRIcontextPrivate *pcp; - __DRIcontextPrivate *pshare = (__DRIcontextPrivate *)shared; - __DRIscreenPrivate *psp; - int i; - - if (!(pDRIScreen = __glXFindDRIScreen(dpy, vis->screen))) { - /* ERROR!!! */ - return NULL; - } else if (!(psp = (__DRIscreenPrivate *)pDRIScreen->private)) { - /* ERROR!!! */ - return NULL; - } - - /* Create the hash table */ - if (!psp->drawHash) { - xmutex_lock(psp->mutex); - if (!psp->drawHash) - psp->drawHash = x_hash_table_new(NULL, NULL, NULL, NULL); - xmutex_unlock(psp->mutex); - } - - pcp = (__DRIcontextPrivate *)Xmalloc(sizeof(__DRIcontextPrivate)); - if (!pcp) { - return NULL; - } - - pcp->display = dpy; - pcp->driScreenPriv = psp; - pcp->driDrawablePriv = NULL; - - pcp->ctx = NULL; - pcp->surface_id = 0; - - pcp->pending_clear = FALSE; - pcp->pending_update = FALSE; - - pcp->ctx = NULL; - for (i = 0; pcp->ctx == NULL && i < psp->numVisuals; i++) { - if (psp->visuals[i].vid == vis->visualid) { - CGLCreateContext(psp->visuals[i].pixel_format, - pshare ? pshare->ctx : NULL, &pcp->ctx); - } - } - - if (!pcp->ctx) { - Xfree(pcp); - return NULL; - } - - pctx->destroyContext = driMesaDestroyContext; - pctx->bindContext = driMesaBindContext; - pctx->unbindContext = driMesaUnbindContext; - - wrap_context(pcp); - - xmutex_lock(psp->mutex); - __driMesaGarbageCollectDrawables(pcp->driScreenPriv->drawHash); - xmutex_unlock(psp->mutex); - - return pcp; -} - -static void driMesaDestroyContext(__DRInativeDisplay *dpy, int scrn, - void *contextPrivate) -{ - __DRIcontextPrivate *pcp = (__DRIcontextPrivate *) contextPrivate; - - if (pcp) { - xmutex_lock(pcp->driScreenPriv->mutex); - unbind_context(pcp); - __driMesaGarbageCollectDrawables(pcp->driScreenPriv->drawHash); - xmutex_unlock(pcp->driScreenPriv->mutex); - CGLDestroyContext(pcp->ctx); - Xfree(pcp); - } -} - -/*****************************************************************/ - -static void *driMesaCreateScreen(__DRInativeDisplay *dpy, int scrn, - __DRIscreen *psc, int numConfigs, - __GLXvisualConfig *config) -{ - int directCapable, i, n; - __DRIscreenPrivate *psp; - XVisualInfo visTmpl, *visinfo; - - if (!XAppleDRIQueryDirectRenderingCapable(dpy, scrn, &directCapable)) { - return NULL; - } - - if (!directCapable) { - return NULL; - } - - psp = (__DRIscreenPrivate *)Xmalloc(sizeof(__DRIscreenPrivate)); - if (!psp) { - return NULL; - } - - psp->mutex = xmutex_malloc(); - if (psp->mutex != NULL) { - xmutex_init (psp->mutex); - xmutex_set_name (psp->mutex, "AppleDRI"); - } - psp->display = dpy; - psp->myNum = scrn; - -#if 0 - if (!XAppleDRIAuthConnection(dpy, scrn, magic)) { - Xfree(psp); - (void)XAppleDRICloseConnection(dpy, scrn); - return NULL; - } -#endif - - /* - * Allocate space for an array of visual records and initialize them. - */ - psp->visuals = (__DRIvisualPrivate *)Xmalloc(numConfigs * - sizeof(__DRIvisualPrivate)); - if (!psp->visuals) { - Xfree(psp); - return NULL; - } - - visTmpl.screen = scrn; - visinfo = XGetVisualInfo(dpy, VisualScreenMask, &visTmpl, &n); - if (n != numConfigs) { - Xfree(psp); - return NULL; - } - - psp->numVisuals = 0; - for (i = 0; i < numConfigs; i++, config++) { - psp->visuals[psp->numVisuals].vid = visinfo[i].visualid; - psp->visuals[psp->numVisuals].pixel_format = - driCreatePixelFormat(dpy, psp, &visinfo[i], config); - if (psp->visuals[psp->numVisuals].pixel_format != NULL) { - psp->numVisuals++; - } - } - - XFree(visinfo); - - if (psp->numVisuals == 0) { - /* Couldn't create any pixel formats. */ - Xfree(psp->visuals); - Xfree(psp); - return NULL; - } - - /* Initialize the drawHash when the first context is created */ - psp->drawHash = NULL; - - psc->destroyScreen = driMesaDestroyScreen; - psc->createContext = driMesaCreateContext; - psc->createNewDrawable = driMesaCreateNewDrawable; - psc->getDrawable = driMesaGetDrawable; - - return (void *)psp; -} - -static void driMesaDestroyScreen(__DRInativeDisplay *dpy, int scrn, - void *screenPrivate) -{ - __DRIscreenPrivate *psp = (__DRIscreenPrivate *) screenPrivate; - - if (psp) { - //FIXME resetDriver ? - Xfree(psp->visuals); - Xfree(psp); - } -} - -/* Note: definitely can't make any X protocol requests here. */ -static void driAppleSurfaceNotify(Display *dpy, unsigned int uid, int kind) -{ - __DRIscreenPrivate *psp; - __DRIdrawablePrivate *pdp; - __DRIcontextPrivate *pcp; - - /* locks psp->mutex if successful. */ - if (driMesaFindDrawableByUID(dpy, uid, &psp, &pdp)) - { - xthread_t self = xthread_self(); - - switch (kind) - { - Bool all_safe; - - case AppleDRISurfaceNotifyDestroyed: - xp_destroy_surface(pdp->surface_id); - pdp->surface_id = 0; - - for (pcp = pdp->driContextPriv; pcp != NULL; pcp = pcp->next) - { - pcp->surface_id = 0; - - if (pcp->thread_id == self || pcp->thread_id == 0) { - CGLClearDrawable(pcp->ctx); - pcp->pending_clear = FALSE; - } else - pcp->pending_clear = TRUE; - } - break; - - case AppleDRISurfaceNotifyChanged: - all_safe = TRUE; - for (pcp = pdp->driContextPriv; pcp != NULL; pcp = pcp->next) - { - if (pcp->thread_id != 0 && pcp->thread_id != self) { - all_safe = FALSE; - break; - } - } - for (pcp = pdp->driContextPriv; pcp != NULL; pcp = pcp->next) - { - if (all_safe) { - xp_update_gl_context(pcp->ctx); - pcp->pending_update = FALSE; - } else - pcp->pending_update = TRUE; - } - break; - } - - xmutex_unlock(psp->mutex); - } -} - -/** - * Entrypoint function used to create a new driver-private screen structure. - * - * \param dpy Display pointer. - * \param scrn Index of the screen. - * \param psc DRI screen data (not driver private) - * \param numConfigs Number of visual configs pointed to by \c configs. - * \param config Array of GLXvisualConfigs exported by the 2D driver. - * - * \deprecated - * In dynamically linked drivers, this function has been replaced by - * \c __driCreateNewScreen. - */ -void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, - int numConfigs, __GLXvisualConfig *config) -{ - static int here_before; - - if (!here_before) - { - XAppleDRISetSurfaceNotifyHandler(driAppleSurfaceNotify); - here_before = True; - } - - return driMesaCreateScreen(dpy, scrn, psc, numConfigs, config); -} - -void __driRegisterExtensions(void) -{ -} - -__private_extern__ void XAppleDRIUseIndirectDispatch(void) -{ - CGLSetCurrentContext(XAppleDRIGetIndirectContext()); -} - -/*****************************************************************/ - -/* - * Currently (Mac OS X 10.3) the only way we have of regaining control - * from threads calling GL and nothing else is by patching the dispatch - * table of the CGLContext, so that glViewport, glFlush and glFinish - * call us back. - * - * Since glNewList and glEndList overwrite the entire dispatch table we - * also need to patch those so we can restore the others. - * - * WARNING: This is not expected to work on future OS releases. - */ - -#define WRAP_CGL(context, vec, fun) \ - do { \ - (context)->disp.vec = (context)->ctx->disp.vec; \ - (context)->ctx->disp.vec = (fun); \ - } while (0) - -#define UNWRAP_CGL(context, vec) \ - do { \ - (context)->ctx->disp.vec = (context)->disp.vec; \ - } while (0) - -#define WRAP_BOILERPLATE \ - GLXContext gc; \ - __DRIcontextPrivate *pcp; \ - gc = __glXGetCurrentContext(); \ - if (gc == NULL || !gc->isDirect) return; \ - pcp = (__DRIcontextPrivate *) gc->driContext.private; \ - if (pcp == NULL) return; - -static void viewport_callback(GLIContext ctx, GLint x, GLint y, - GLsizei width, GLsizei height) -{ - WRAP_BOILERPLATE - - xmutex_lock(pcp->driScreenPriv->mutex); - update_context(pcp); - xmutex_unlock(pcp->driScreenPriv->mutex); - - (*pcp->disp.viewport)(ctx, x, y, width, height); -} - -static void new_list_callback(GLIContext ctx, GLuint list, GLenum mode) -{ - WRAP_BOILERPLATE - - unwrap_context(pcp); - (*pcp->ctx->disp.new_list)(ctx, list, mode); - wrap_context(pcp); -} - -static void end_list_callback(GLIContext ctx) -{ - WRAP_BOILERPLATE - - unwrap_context(pcp); - (*pcp->ctx->disp.end_list)(ctx); - wrap_context(pcp); -} - -static void unwrap_context(__DRIcontextPrivate *pcp) -{ - UNWRAP_CGL(pcp, viewport); - UNWRAP_CGL(pcp, new_list); - UNWRAP_CGL(pcp, end_list); -} - -static void wrap_context(__DRIcontextPrivate *pcp) -{ - WRAP_CGL(pcp, new_list, new_list_callback); - WRAP_CGL(pcp, end_list, end_list_callback); - WRAP_CGL(pcp, viewport, viewport_callback); -} - -#endif /* GLX_DIRECT_RENDERING */ diff --git a/nx-X11/lib/GL/apple/dri_driver.h b/nx-X11/lib/GL/apple/dri_driver.h deleted file mode 100644 index 84965786f..000000000 --- a/nx-X11/lib/GL/apple/dri_driver.h +++ /dev/null @@ -1,188 +0,0 @@ -/* $XFree86: xc/lib/GL/apple/dri_driver.h,v 1.1 2003/06/30 01:45:10 torrey Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -Copyright (c) 2002 Apple Computer, 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, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Kevin E. Martin - * Brian Paul - */ - -#ifndef _DRI_DRIVER_H_ -#define _DRI_DRIVER_H_ - -#include "Xplugin.h" -#include "Xthreads.h" -#include -#include -#include - -#ifdef GLX_DIRECT_RENDERING - -typedef struct __DRIdisplayPrivateRec __DRIdisplayPrivate; -typedef struct __DRIscreenPrivateRec __DRIscreenPrivate; -typedef struct __DRIvisualPrivateRec __DRIvisualPrivate; -typedef struct __DRIcontextPrivateRec __DRIcontextPrivate; -typedef struct __DRIdrawablePrivateRec __DRIdrawablePrivate; - -#endif /* GLX_DIRECT_RENDERING */ - -#define DRI_MESA_VALIDATE_DRAWABLE_INFO(dpy,scrn,pDrawPriv) \ - do { \ - if (*(pDrawPriv->pStamp) != pDrawPriv->lastStamp) { \ - driMesaUpdateDrawableInfo(dpy,scrn,pDrawPriv); \ - } \ - } while (0) - -struct __DRIdrawablePrivateRec { - /* - ** X's drawable ID associated with this private drawable. - */ - GLXDrawable draw; - - /* - ** Reference count for number of context's currently bound to this - ** drawable. Once the refcount reaches 0, the drawable can be - ** destroyed. This behavior will change with GLX 1.3. - */ - int refcount; - - xp_surface_id surface_id; - unsigned int uid; - - /* - ** Pointer to contexts to which this drawable is currently bound. - */ - __DRIcontextPrivate *driContextPriv; - - /* - ** Pointer to screen on which this drawable was created. - */ - __DRIscreenPrivate *driScreenPriv; - - /* - ** Set when the drawable on the server is known to have gone away - */ - unsigned int destroyed :1; -}; - -struct __DRIcontextPrivateRec { - /* - ** Other contexts bound to the same drawable. - */ - __DRIcontextPrivate *next, *prev; - - /* - ** Kernel context handle used to access the device lock. - */ - XID contextID; - - CGLContextObj ctx; - - /* - ** Set when attached - */ - xp_surface_id surface_id; - xthread_t thread_id; - - /* - ** This context's display pointer. - */ - Display *display; - - /* - ** Pointer to drawable currently bound to this context. - */ - __DRIdrawablePrivate *driDrawablePriv; - - /* - ** Pointer to screen on which this context was created. - */ - __DRIscreenPrivate *driScreenPriv; - - /* - ** wrapped CGL vectors - */ - struct { - void (*viewport)(GLIContext ctx, GLint x, GLint y, - GLsizei width, GLsizei height); - void (*new_list)(GLIContext ctx, GLuint list, GLenum mode); - void (*end_list)(GLIContext ctx); - } disp; - - unsigned int pending_update :1; - unsigned int pending_clear :1; -}; - -struct __DRIvisualPrivateRec { - /* - ** X's visual ID associated with this private visual. - */ - VisualID vid; - - /* - ** CGL object representing the visual - */ - CGLPixelFormatObj pixel_format; -}; - -struct __DRIscreenPrivateRec { - /* - ** Display for this screen - */ - Display *display; - - /* - ** Mutex for this screen - */ - xmutex_t mutex; - - /* - ** Current screen's number - */ - int myNum; - - /* - ** Core rendering library's visuals associated with the current - ** screen. - */ - __DRIvisualPrivate *visuals; - int numVisuals; - - /* - ** Hash table to hold the drawable information for this screen. - */ - void *drawHash; -}; - - -extern void driMesaUpdateDrawableInfo(Display *dpy, int scrn, - __DRIdrawablePrivate *pdp); - - -#endif /* _DRI_DRIVER_H_ */ diff --git a/nx-X11/lib/GL/apple/dri_glx.c b/nx-X11/lib/GL/apple/dri_glx.c deleted file mode 100644 index c2adc868f..000000000 --- a/nx-X11/lib/GL/apple/dri_glx.c +++ /dev/null @@ -1,265 +0,0 @@ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -Copyright (c) 2002 Apple Computer, Inc. -Copyright (c) 2004 Torrey T. Lyons -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ -/* $XFree86: xc/lib/GL/apple/dri_glx.c,v 1.2 2004/04/21 04:59:40 torrey Exp $ */ - -/* - * Authors: - * Kevin E. Martin - * Brian Paul - * - */ - -#ifdef GLX_DIRECT_RENDERING - -#include -#include -#include -#include "extutil.h" -#include "glxclient.h" -#include "appledri.h" -#include -#include "dri_glx.h" -#include -#include - - -/* Apple OpenGL "driver" information. */ -static const char *__driAppleDriverName = "apple"; -static const int __driAppleDriverMajor = 1; -static const int __driAppleDriverMinor = 0; -static const int __driAppleDriverPatch = 0; - - -/* - * printf wrappers - */ - -static void InfoMessageF(const char *f, ...) -{ - va_list args; - const char *env; - - if ((env = getenv("LIBGL_DEBUG")) && strstr(env, "verbose")) { - fprintf(stderr, "libGL: "); - va_start(args, f); - vfprintf(stderr, f, args); - va_end(args); - } -} - -static void ErrorMessageF(const char *f, ...) -{ - va_list args; - - if (getenv("LIBGL_DEBUG")) { - fprintf(stderr, "libGL error: "); - va_start(args, f); - vfprintf(stderr, f, args); - va_end(args); - } -} - - -/* - * Given a display pointer and screen number, determine the name of - * the DRI driver for the screen. (I.e. "r128", "tdfx", etc). - * Return True for success, False for failure. - */ -static Bool GetDriverName(Display *dpy, int scrNum, char **driverName) -{ - int directCapable; - - *driverName = NULL; - - if (!XAppleDRIQueryDirectRenderingCapable(dpy, scrNum, &directCapable)) { - ErrorMessageF("XAppleDRIQueryDirectRenderingCapable failed\n"); - return False; - } - if (!directCapable) { - ErrorMessageF("XAppleDRIQueryDirectRenderingCapable returned false\n"); - return False; - } - - *driverName = (char *) __driAppleDriverName; - - InfoMessageF("XF86DRIGetClientDriverName: %d.%d.%d %s (screen %d)\n", - __driAppleDriverMajor, __driAppleDriverMinor, - __driAppleDriverPatch, *driverName, scrNum); - - return True; -} - - -/* - * Exported function for querying the DRI driver for a given screen. - * - * The returned char pointer points to a static array that will be - * overwritten by subsequent calls. - */ -const char *glXGetScreenDriver (Display *dpy, int scrNum) { - static char ret[32]; - char *driverName; - if (GetDriverName(dpy, scrNum, &driverName)) { - int len; - if (!driverName) - return NULL; - len = strlen (driverName); - if (len >= 31) - return NULL; - memcpy (ret, driverName, len+1); - Xfree(driverName); - return ret; - } - return NULL; -} - - -/* - * Exported function for obtaining a driver's option list (UTF-8 encoded XML). - * - * The returned char pointer points directly into the driver. Therefore - * it should be treated as a constant. - * - * If the driver was not found or does not support configuration NULL is - * returned. - * - * Note: In a standard GLX imlementation the driver remains opened after - * this function returns. - */ -const char *glXGetDriverConfig(const char *driverName) { - /* the apple stub driver does not support configuration */ - return NULL; -} - - -static void driDestroyDisplay(Display *dpy, void *private) -{ - __DRIdisplayPrivate *pdpyp = (__DRIdisplayPrivate *)private; - - if (pdpyp) { - Xfree(pdpyp->libraryHandles); - Xfree(pdpyp); - } -} - - -void *driCreateDisplay(Display *dpy, __DRIdisplay *pdisp) -{ - const int numScreens = ScreenCount(dpy); - __DRIdisplayPrivate *pdpyp; - int eventBase, errorBase; - int major, minor, patch; - int scrn; - - /* Initialize these fields to NULL in case we fail. - * If we don't do this we may later get segfaults trying to free random - * addresses when the display is closed. - */ - pdisp->private = NULL; - pdisp->destroyDisplay = NULL; - pdisp->createScreen = NULL; - - if (!XAppleDRIQueryExtension(dpy, &eventBase, &errorBase)) { - return NULL; - } - - if (!XAppleDRIQueryVersion(dpy, &major, &minor, &patch)) { - return NULL; - } - - pdpyp = (__DRIdisplayPrivate *)Xmalloc(sizeof(__DRIdisplayPrivate)); - if (!pdpyp) { - return NULL; - } - - pdpyp->driMajor = major; - pdpyp->driMinor = minor; - pdpyp->driPatch = patch; - - pdisp->destroyDisplay = driDestroyDisplay; - - /* allocate array of pointers to createScreen funcs */ - pdisp->createScreen = (CreateScreenFunc *) Xmalloc(numScreens * sizeof(void *)); - if (!pdisp->createScreen) - return NULL; - - /* allocate array of pointers to createScreen funcs */ - pdisp->createNewScreen = (CreateNewScreenFunc *) Xmalloc(numScreens * sizeof(void *)); - if (!pdisp->createNewScreen) { - Xfree(pdisp->createScreen); - Xfree(pdpyp); - return NULL; - } - - /* allocate array of library handles */ - pdpyp->libraryHandles = (void **) Xmalloc(numScreens * sizeof(void*)); - if (!pdpyp->libraryHandles) { - Xfree(pdisp->createNewScreen); - Xfree(pdisp->createScreen); - Xfree(pdpyp); - return NULL; - } - - /* we'll statically bind to the __driCreateScreen function */ - for (scrn = 0; scrn < numScreens; scrn++) { - pdisp->createScreen[scrn] = __driCreateScreen; - pdisp->createNewScreen[scrn] = NULL; - pdpyp->libraryHandles[scrn] = NULL; - } - - return (void *)pdpyp; -} - - -/* -** Here we'll query the DRI driver for each screen and let each -** driver register its GL extension functions. We only have to -** do this once. But it MUST be done before we create any contexts -** (i.e. before any dispatch tables are created) and before -** glXGetProcAddressARB() returns. -** -** Currently called by glXGetProcAddress(), __glXInitialize(), and -** __glXNewIndirectAPI(). -*/ -void -__glXRegisterExtensions(void) -{ - static GLboolean alreadyCalled = GL_FALSE; - - if (alreadyCalled) { - return; - } - - __driRegisterExtensions (); - - alreadyCalled = GL_TRUE; -} - - -#endif /* GLX_DIRECT_RENDERING */ diff --git a/nx-X11/lib/GL/apple/dri_glx.h b/nx-X11/lib/GL/apple/dri_glx.h deleted file mode 100644 index 6d01b35a5..000000000 --- a/nx-X11/lib/GL/apple/dri_glx.h +++ /dev/null @@ -1,67 +0,0 @@ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -Copyright (c) 2002 Apple Computer, 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, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ -/* $XFree86$ */ - -/* - * Authors: - * Kevin E. Martin - * Brian Paul - * - */ - -#ifndef _DRI_GLX_H_ -#define _DRI_GLX_H_ - -#ifdef GLX_DIRECT_RENDERING - -struct __DRIdisplayPrivateRec { - /* - ** XFree86-DRI version information - */ - int driMajor; - int driMinor; - int driPatch; - - /* - ** Array of library handles [indexed by screen number] - */ - void **libraryHandles; -}; - -typedef struct __DRIdisplayPrivateRec __DRIdisplayPrivate; -typedef struct __DRIscreenPrivateRec __DRIscreenPrivate; -typedef struct __DRIvisualPrivateRec __DRIvisualPrivate; -typedef struct __DRIcontextPrivateRec __DRIcontextPrivate; -typedef struct __DRIdrawablePrivateRec __DRIdrawablePrivate; - -extern void *__driCreateScreen (Display *dpy, int scrn, __DRIscreen *psc, - int numConfigs, __GLXvisualConfig *config); -extern void __driRegisterExtensions (void); - -#endif /* GLX_DIRECT_RENDERING */ -#endif /* _DRI_GLX_H_ */ diff --git a/nx-X11/lib/GL/dri/drm/Imakefile b/nx-X11/lib/GL/dri/drm/Imakefile deleted file mode 100644 index cfc4247dd..000000000 --- a/nx-X11/lib/GL/dri/drm/Imakefile +++ /dev/null @@ -1,54 +0,0 @@ -XCOMM $XdotOrg: xc/lib/GL/dri/drm/Imakefile,v 1.6 2005/12/01 02:15:37 ajax Exp $ -XCOMM $XFree86: xc/lib/GL/dri/drm/Imakefile,v 1.22 2003/09/28 20:15:00 alanh Exp $ - -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) -#define DoExtraLib SharedLibGlx -#define DoDebugLib DebugLibGlx -#define DoProfileLib ProfileLibGlx - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - - DEFINES = $(ALLOC_DEFINES) - INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) \ - -I$(XF86OSSRC)/$(OS_SUBDIR)/drm \ - -I$(DRMSRCDIR)/$(OS_SUBDIR)-core \ - -I$(DRMSRCDIR)/$(OS_SUBDIR2)-core \ - -I$(XF86OSSRC) -I$(DRMSRCDIR)/shared-core - SRCS = xf86drm.c xf86drmHash.c xf86drmRandom.c xf86drmSL.c - OBJS = xf86drm.o xf86drmHash.o xf86drmRandom.o xf86drmSL.o - -#if defined(LinuxArchitecture) -OS_SUBDIR = linux -OS_SUBDIR2 = linux -OS_SUBDIR3 = shared-core -#endif -#if defined(FreeBSDArchitecture) || defined(BSDOSArchitecture) || \ - defined(NetBSDArchitecture) || defined(OpenBSDArchitecture) -OS_SUBDIR = bsd -OS_SUBDIR2 = linux -OS_SUBDIR3 = shared-core -#endif - -LIBDRM_DIR = ../../../../extras/drm/libdrm - -LinkSourceFile(xf86drm.c,$(LIBDRM_DIR)) - -LinkSourceFile(xf86drmHash.c,$(LIBDRM_DIR)) -LinkSourceFile(xf86drmRandom.c,$(LIBDRM_DIR)) -LinkSourceFile(xf86drmSL.c,$(LIBDRM_DIR)) - -LinkSourceFile(drm.h,$(LIBDRM_DIR)/../shared-core) - -#include - -LibraryObjectRule() - -SubdirLibraryRule($(OBJS)) -NormalLintTarget($(SRCS)) - -DependTarget() - -InstallDriverSDKNonExecFile(drm.h,$(DRIVERSDKINCLUDEDIR)) diff --git a/nx-X11/lib/GL/mesa/drivers/dri/Imakefile b/nx-X11/lib/GL/mesa/drivers/dri/Imakefile deleted file mode 100644 index eba13848b..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/Imakefile +++ /dev/null @@ -1,21 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/Imakefile,v 1.18 2001/03/23 19:18:38 dawes Exp $ - -#ifdef DriDrivers - -#define IHaveSubdirs -#define PassCDebugFlags - -DRI_DRIVERS = DriDrivers - -#if BuildDevelDRIDrivers -DEVEL_DRI_DRIVERS = DevelDRIDrivers -#endif - -SUBDIRS = common $(DRI_DRIVERS) $(DEVEL_DRI_DRIVERS) - -MakeSubdirs($(SUBDIRS)) -DependSubdirs($(SUBDIRS)) - -DependTarget() - -#endif diff --git a/nx-X11/lib/GL/mesa/drivers/dri/ffb/Imakefile b/nx-X11/lib/GL/mesa/drivers/dri/ffb/Imakefile deleted file mode 100644 index 7d98c1912..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/ffb/Imakefile +++ /dev/null @@ -1,77 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/ffb/Imakefile,v 1.15 2002/02/23 00:45:48 dawes Exp $ - -#include - -#if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) -#define DoExtraLib SharedLibGlx -#define DoDebugLib DebugLibGlx -#define DoProfileLib ProfileLibGlx -#else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC -#define DoExtrasLib NO -#define DoDebugLib NO -#define DoProfileLib NO -#endif - -#define MesaDrvCommonBuildDir ../common/ -#include "../common/Imakefile.inc" -#include "../../../array_cache/Imakefile.inc" -#include "../../../main/Imakefile.inc" -#include "../../../math/Imakefile.inc" -#include "../../../shader/Imakefile.inc" -#include "../../../shader/grammar/Imakefile.inc" -#include "../../../shader/slang/Imakefile.inc" -#include "../../../shader/slang/library/Imakefile.inc" -#include "../../../swrast/Imakefile.inc" -#include "../../../swrast_setup/Imakefile.inc" -#include "../../../tnl/Imakefile.inc" -#include "../../../tnl_dd/Imakefile.inc" -#include "../../../Imakefile.inc" -#if defined(i386Architecture) && MesaUseX86Asm -#include "../../../x86/Imakefile.inc" -#endif -#ifdef SparcArchitecture -#include "../../../sparc/Imakefile.inc" -#endif -#define NeedToLinkMesaSrc -#include "Imakefile.inc" - - DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES) - INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) \ - -I$(XF86DRIVERSRC)/sunffb - - DRMOBJS = $(GLXLIBSRC)/dri/drm/xf86drm.o \ - $(GLXLIBSRC)/dri/drm/xf86drmHash.o \ - $(GLXLIBSRC)/dri/drm/xf86drmRandom.o \ - $(GLXLIBSRC)/dri/drm/xf86drmSL.o - - SRCS = $(FFBSRCS) - OBJS = $(DRMOBJS) $(COREMESAOBJS) \ - $(MESA_ASM_OBJS) $(COMMONOBJS) $(FFBOBJS) - -REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) $(EXPATLIB) - -#include - -LibraryObjectRule() - -SubdirLibraryRule($(FFBOBJS)) -NormalLintTarget($(SRCS)) - -#if !GlxUseBuiltInDRIDriver -LIBNAME = ffb_dri.so -SharedDriModuleTarget($(LIBNAME),DONE $(OBJS),$(OBJS)) -InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) - -#ifdef GlxSoProf -SOPROF_LIBNAME = _ffb_dri_p -NormalDepLibraryTarget($(SOPROF_LIBNAME),DONE $(OBJS),$(OBJS)) -InstallLibrary($(SOPROF_LIBNAME),$(MODULEDIR)/dri) -#endif -#endif - -DependTarget() - diff --git a/nx-X11/lib/GL/mesa/drivers/dri/ffb/Imakefile.inc b/nx-X11/lib/GL/mesa/drivers/dri/ffb/Imakefile.inc deleted file mode 100644 index 3ef08a64a..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/ffb/Imakefile.inc +++ /dev/null @@ -1,151 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/ffb/Imakefile.inc,v 1.3 2002/02/22 21:32:58 dawes Exp $ - -#ifndef MesaDrvSrcDir -#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri -#endif - -MESADRVSRCDIR = MesaDrvSrcDir - -#ifndef MesaDrvFfbBuildDir -#define MesaDrvFfbBuildDir /**/ -#endif -MESADRVFFBBUILDDIR = MesaDrvFfbBuildDir - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - -#if BuildXF86DRI - DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=ByteOrder -DIN_DRI_DRIVER - DRI_INCLUDES = -I$(GLXLIBSRC)/dri \ - -I$(XINCLUDESRC) \ - -I$(GLXLIBSRC)/glx \ - -I$(GLXLIBSRC)/include \ - -I$(SERVERSRC)/GL/dri \ - -I$(XF86OSSRC) \ - -I$(DRMSRCDIR)/shared-core \ - -I$(GLXLIBSRC)/dri/drm -#endif - -MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \ - -I$(MESASRCDIR)/src/mesa/main \ - -I$(MESASRCDIR)/src/mesa/glapi \ - -I$(MESASRCDIR)/src/mesa/shader \ - -I$(MESASRCDIR)/include \ - -I$(MESADRVSRCDIR)/common \ - -I$(MESADRVSRCDIR)/ffb - X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) - - FFBSRCS = $(MESADRVFFBBUILDDIR)ffb_bitmap.c \ - $(MESADRVFFBBUILDDIR)ffb_clear.c \ - $(MESADRVFFBBUILDDIR)ffb_dd.c \ - $(MESADRVFFBBUILDDIR)ffb_depth.c \ - /* $(MESADRVFFBBUILDDIR)ffb_fog.c */ \ - $(MESADRVFFBBUILDDIR)ffb_lines.c \ - $(MESADRVFFBBUILDDIR)ffb_points.c \ - $(MESADRVFFBBUILDDIR)ffb_span.c \ - $(MESADRVFFBBUILDDIR)ffb_state.c \ - $(MESADRVFFBBUILDDIR)ffb_stencil.c \ - $(MESADRVFFBBUILDDIR)ffb_tex.c \ - $(MESADRVFFBBUILDDIR)ffb_tris.c \ - $(MESADRVFFBBUILDDIR)ffb_vb.c \ - $(MESADRVFFBBUILDDIR)ffb_xmesa.c - - FFBOBJS = $(MESADRVFFBBUILDDIR)ffb_bitmap.o \ - $(MESADRVFFBBUILDDIR)ffb_clear.o \ - $(MESADRVFFBBUILDDIR)ffb_dd.o \ - $(MESADRVFFBBUILDDIR)ffb_depth.o \ - /* $(MESADRVFFBBUILDDIR)ffb_fog.o */ \ - $(MESADRVFFBBUILDDIR)ffb_lines.o \ - $(MESADRVFFBBUILDDIR)ffb_points.o \ - $(MESADRVFFBBUILDDIR)ffb_span.o \ - $(MESADRVFFBBUILDDIR)ffb_state.o \ - $(MESADRVFFBBUILDDIR)ffb_stencil.o \ - $(MESADRVFFBBUILDDIR)ffb_tex.o \ - $(MESADRVFFBBUILDDIR)ffb_tris.o \ - $(MESADRVFFBBUILDDIR)ffb_vb.o \ - $(MESADRVFFBBUILDDIR)ffb_xmesa.o - - FFBUOBJS = $(MESADRVFFBBUILDDIR)unshared/ffb_bitmap.o \ - $(MESADRVFFBBUILDDIR)unshared/ffb_clear.o \ - $(MESADRVFFBBUILDDIR)unshared/ffb_dd.o \ - $(MESADRVFFBBUILDDIR)unshared/ffb_depth.o \ - /* $(MESADRVFFBBUILDDIR)unshared/ffb_fog.o */ \ - $(MESADRVFFBBUILDDIR)unshared/ffb_lines.o \ - $(MESADRVFFBBUILDDIR)unshared/ffb_points.o \ - $(MESADRVFFBBUILDDIR)unshared/ffb_span.o \ - $(MESADRVFFBBUILDDIR)unshared/ffb_state.o \ - $(MESADRVFFBBUILDDIR)unshared/ffb_stencil.o \ - $(MESADRVFFBBUILDDIR)unshared/ffb_tex.o \ - $(MESADRVFFBBUILDDIR)unshared/ffb_tris.o \ - $(MESADRVFFBBUILDDIR)unshared/ffb_vb.o \ - $(MESADRVFFBBUILDDIR)unshared/ffb_xmesa.o - - FFBDOBJS = $(MESADRVFFBBUILDDIR)debugger/ffb_bitmap.o \ - $(MESADRVFFBBUILDDIR)debugger/ffb_clear.o \ - $(MESADRVFFBBUILDDIR)debugger/ffb_dd.o \ - $(MESADRVFFBBUILDDIR)debugger/ffb_depth.o \ - /* $(MESADRVFFBBUILDDIR)debugger/ffb_fog.o */ \ - $(MESADRVFFBBUILDDIR)debugger/ffb_lines.o \ - $(MESADRVFFBBUILDDIR)debugger/ffb_points.o \ - $(MESADRVFFBBUILDDIR)debugger/ffb_span.o \ - $(MESADRVFFBBUILDDIR)debugger/ffb_state.o \ - $(MESADRVFFBBUILDDIR)debugger/ffb_stencil.o \ - $(MESADRVFFBBUILDDIR)debugger/ffb_tex.o \ - $(MESADRVFFBBUILDDIR)debugger/ffb_tris.o \ - $(MESADRVFFBBUILDDIR)debugger/ffb_vb.o \ - $(MESADRVFFBBUILDDIR)debugger/ffb_xmesa.o - - FFBPOBJS = $(MESADRVFFBBUILDDIR)profiled/ffb_bitmap.o \ - $(MESADRVFFBBUILDDIR)profiled/ffb_clear.o \ - $(MESADRVFFBBUILDDIR)profiled/ffb_dd.o \ - $(MESADRVFFBBUILDDIR)profiled/ffb_depth.o \ - /* $(MESADRVFFBBUILDDIR)profiled/ffb_fog.o */ \ - $(MESADRVFFBBUILDDIR)profiled/ffb_lines.o \ - $(MESADRVFFBBUILDDIR)profiled/ffb_points.o \ - $(MESADRVFFBBUILDDIR)profiled/ffb_span.o \ - $(MESADRVFFBBUILDDIR)profiled/ffb_state.o \ - $(MESADRVFFBBUILDDIR)profiled/ffb_stencil.o \ - $(MESADRVFFBBUILDDIR)profiled/ffb_tex.o \ - $(MESADRVFFBBUILDDIR)profiled/ffb_tris.o \ - $(MESADRVFFBBUILDDIR)profiled/ffb_vb.o \ - $(MESADRVFFBBUILDDIR)profiled/ffb_xmesa.o - -#ifdef NeedToLinkMesaSrc -LinkSourceFile(ffb_bitmap.c, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_bitmap.h, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_clear.c, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_clear.h, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_context.h, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_dd.c, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_dd.h, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_depth.c, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_depth.h, $(MESADRVSRCDIR)/ffb) -/* LinkSourceFile(ffb_fog.c, $(MESADRVSRCDIR)/ffb) */ -LinkSourceFile(ffb_fifo.h, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_lines.c, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_lines.h, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_linetmp.h, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_lock.h, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_points.c, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_points.h, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_pointtmp.h, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_rendertmp.h, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_span.c, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_span.h, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_state.c, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_state.h, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_stencil.c, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_stencil.h, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_tex.c, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_tex.h, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_tris.c, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_tris.h, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_tritmp.h, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_vb.c, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_vb.h, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_vbtmp.h, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_vtxfmt.h, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_xmesa.c, $(MESADRVSRCDIR)/ffb) -LinkSourceFile(ffb_xmesa.h, $(MESADRVSRCDIR)/ffb) -#endif diff --git a/nx-X11/lib/GL/mesa/drivers/dri/gamma/Imakefile b/nx-X11/lib/GL/mesa/drivers/dri/gamma/Imakefile deleted file mode 100644 index 490f8ccec..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/gamma/Imakefile +++ /dev/null @@ -1,77 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/gamma/Imakefile,v 1.25 2002/02/23 00:45:49 dawes Exp $ - -#include - -#if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) -#define DoExtraLib SharedLibGlx -#define DoDebugLib DebugLibGlx -#define DoProfileLib ProfileLibGlx -#else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC -#define DoExtrasLib NO -#define DoDebugLib NO -#define DoProfileLib NO -#endif - -#define MesaDrvCommonBuildDir ../common/ -#include "../common/Imakefile.inc" -#include "../../../array_cache/Imakefile.inc" -#include "../../../main/Imakefile.inc" -#include "../../../math/Imakefile.inc" -#include "../../../shader/Imakefile.inc" -#include "../../../shader/grammar/Imakefile.inc" -#include "../../../shader/slang/Imakefile.inc" -#include "../../../shader/slang/library/Imakefile.inc" -#include "../../../swrast/Imakefile.inc" -#include "../../../swrast_setup/Imakefile.inc" -#include "../../../tnl/Imakefile.inc" -#include "../../../tnl_dd/Imakefile.inc" -#include "../../../Imakefile.inc" -#if defined(i386Architecture) && MesaUseX86Asm -#include "../../../x86/Imakefile.inc" -#endif -#ifdef SparcArchitecture -#include "../../../sparc/Imakefile.inc" -#endif -#define NeedToLinkMesaSrc -#include "Imakefile.inc" - - - DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES) - INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) - - DRMOBJS = $(GLXLIBSRC)/dri/drm/xf86drm.o \ - $(GLXLIBSRC)/dri/drm/xf86drmHash.o \ - $(GLXLIBSRC)/dri/drm/xf86drmRandom.o \ - $(GLXLIBSRC)/dri/drm/xf86drmSL.o - - SRCS = $(GAMMASRCS) - OBJS = $(DRMOBJS) $(COREMESAOBJS) \ - $(MESA_ASM_OBJS) $(COMMONOBJS) $(GAMMAOBJS) - -REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) $(EXPATLIB) - -#include - -LibraryObjectRule() - -SubdirLibraryRule($(GAMMAOBJS)) -NormalLintTarget($(SRCS)) - -#if !GlxUseBuiltInDRIDriver -LIBNAME = gamma_dri.so -SharedDriModuleTarget($(LIBNAME),DONE $(OBJS),$(OBJS)) -InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) - -#ifdef GlxSoProf -SOPROF_LIBNAME = _gamma_dri_p -NormalDepLibraryTarget($(SOPROF_LIBNAME),DONE $(OBJS),$(OBJS)) -InstallLibrary($(SOPROF_LIBNAME),$(MODULEDIR)/dri) -#endif -#endif - -DependTarget() - diff --git a/nx-X11/lib/GL/mesa/drivers/dri/gamma/Imakefile.inc b/nx-X11/lib/GL/mesa/drivers/dri/gamma/Imakefile.inc deleted file mode 100644 index e42cc5ce6..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/gamma/Imakefile.inc +++ /dev/null @@ -1,140 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/gamma/Imakefile.inc,v 1.2 2001/05/02 15:06:03 dawes Exp $ - -#ifndef MesaDrvSrcDir -#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri -#endif - -MESADRVSRCDIR = MesaDrvSrcDir - -#ifndef MesaDrvGammaBuildDir -#define MesaDrvGammaBuildDir /**/ -#endif -MESADRVGAMMABUILDDIR = MesaDrvGammaBuildDir - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - -#if BuildXF86DRI - DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=ByteOrder -DIN_DRI_DRIVER - DRI_INCLUDES = -I$(GLXLIBSRC)/dri \ - -I$(XINCLUDESRC) \ - -I$(GLXLIBSRC)/glx \ - -I$(GLXLIBSRC)/include \ - -I$(SERVERSRC)/GL/dri \ - -I$(XF86OSSRC) \ - -I$(DRMSRCDIR)/shared-core \ - -I$(XF86DRIVERSRC)/glint \ - -I$(GLXLIBSRC)/dri/drm -#endif - -MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \ - -I$(MESASRCDIR)/src/mesa/main \ - -I$(MESASRCDIR)/src/mesa/glapi \ - -I$(MESASRCDIR)/src/mesa/shader \ - -I$(MESASRCDIR)/include \ - -I$(MESADRVSRCDIR)/common \ - -I$(MESADRVSRCDIR)/gamma - X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) - - - GAMMASRCS = $(MESADRVGAMMABUILDDIR)gamma_context.c \ - $(MESADRVGAMMABUILDDIR)gamma_dd.c \ - $(MESADRVGAMMABUILDDIR)gamma_inithw.c \ - $(MESADRVGAMMABUILDDIR)gamma_lock.c \ - $(MESADRVGAMMABUILDDIR)gamma_render.c \ - $(MESADRVGAMMABUILDDIR)gamma_screen.c \ - $(MESADRVGAMMABUILDDIR)gamma_span.c \ - $(MESADRVGAMMABUILDDIR)gamma_state.c \ - $(MESADRVGAMMABUILDDIR)gamma_tex.c \ - $(MESADRVGAMMABUILDDIR)gamma_texmem.c \ - $(MESADRVGAMMABUILDDIR)gamma_texstate.c \ - $(MESADRVGAMMABUILDDIR)gamma_tris.c \ - $(MESADRVGAMMABUILDDIR)gamma_vb.c \ - $(MESADRVGAMMABUILDDIR)gamma_xmesa.c - - GAMMAOBJS = $(MESADRVGAMMABUILDDIR)gamma_context.o \ - $(MESADRVGAMMABUILDDIR)gamma_dd.o \ - $(MESADRVGAMMABUILDDIR)gamma_inithw.o \ - $(MESADRVGAMMABUILDDIR)gamma_lock.o \ - $(MESADRVGAMMABUILDDIR)gamma_render.o \ - $(MESADRVGAMMABUILDDIR)gamma_screen.o \ - $(MESADRVGAMMABUILDDIR)gamma_span.o \ - $(MESADRVGAMMABUILDDIR)gamma_state.o \ - $(MESADRVGAMMABUILDDIR)gamma_tex.o \ - $(MESADRVGAMMABUILDDIR)gamma_texmem.o \ - $(MESADRVGAMMABUILDDIR)gamma_texstate.o \ - $(MESADRVGAMMABUILDDIR)gamma_tris.o \ - $(MESADRVGAMMABUILDDIR)gamma_vb.o \ - $(MESADRVGAMMABUILDDIR)gamma_xmesa.o - - GAMMAUOBJS = $(MESADRVGAMMABUILDDIR)unshared/gamma_context.o \ - $(MESADRVGAMMABUILDDIR)unshared/gamma_dd.o \ - $(MESADRVGAMMABUILDDIR)unshared/gamma_inithw.o \ - $(MESADRVGAMMABUILDDIR)unshared/gamma_lock.o \ - $(MESADRVGAMMABUILDDIR)unshared/gamma_render.o \ - $(MESADRVGAMMABUILDDIR)unshared/gamma_screen.o \ - $(MESADRVGAMMABUILDDIR)unshared/gamma_span.o \ - $(MESADRVGAMMABUILDDIR)unshared/gamma_state.o \ - $(MESADRVGAMMABUILDDIR)unshared/gamma_tex.o \ - $(MESADRVGAMMABUILDDIR)unshared/gamma_texmem.o \ - $(MESADRVGAMMABUILDDIR)unshared/gamma_texstate.o \ - $(MESADRVGAMMABUILDDIR)unshared/gamma_tris.o \ - $(MESADRVGAMMABUILDDIR)unshared/gamma_vb.o \ - $(MESADRVGAMMABUILDDIR)unshared/gamma_xmesa.o - - GAMMADOBJS = $(MESADRVGAMMABUILDDIR)debugger/gamma_context.o \ - $(MESADRVGAMMABUILDDIR)debugger/gamma_dd.o \ - $(MESADRVGAMMABUILDDIR)debugger/gamma_inithw.o \ - $(MESADRVGAMMABUILDDIR)debugger/gamma_lock.o \ - $(MESADRVGAMMABUILDDIR)debugger/gamma_render.o \ - $(MESADRVGAMMABUILDDIR)debugger/gamma_screen.o \ - $(MESADRVGAMMABUILDDIR)debugger/gamma_span.o \ - $(MESADRVGAMMABUILDDIR)debugger/gamma_state.o \ - $(MESADRVGAMMABUILDDIR)debugger/gamma_tex.o \ - $(MESADRVGAMMABUILDDIR)debugger/gamma_texmem.o \ - $(MESADRVGAMMABUILDDIR)debugger/gamma_texstate.o \ - $(MESADRVGAMMABUILDDIR)debugger/gamma_tris.o \ - $(MESADRVGAMMABUILDDIR)debugger/gamma_vb.o \ - $(MESADRVGAMMABUILDDIR)debugger/gamma_xmesa.o - - GAMMAPOBJS = $(MESADRVGAMMABUILDDIR)profiled/gamma_context.o \ - $(MESADRVGAMMABUILDDIR)profiled/gamma_dd.o \ - $(MESADRVGAMMABUILDDIR)profiled/gamma_inithw.o \ - $(MESADRVGAMMABUILDDIR)profiled/gamma_lock.o \ - $(MESADRVGAMMABUILDDIR)profiled/gamma_render.o \ - $(MESADRVGAMMABUILDDIR)profiled/gamma_screen.o \ - $(MESADRVGAMMABUILDDIR)profiled/gamma_span.o \ - $(MESADRVGAMMABUILDDIR)profiled/gamma_state.o \ - $(MESADRVGAMMABUILDDIR)profiled/gamma_tex.o \ - $(MESADRVGAMMABUILDDIR)profiled/gamma_texmem.o \ - $(MESADRVGAMMABUILDDIR)profiled/gamma_texstate.o \ - $(MESADRVGAMMABUILDDIR)profiled/gamma_tris.o \ - $(MESADRVGAMMABUILDDIR)profiled/gamma_vb.o \ - $(MESADRVGAMMABUILDDIR)profiled/gamma_xmesa.o - -#ifdef NeedToLinkMesaSrc -LinkSourceFile(gamma_context.c, $(MESADRVSRCDIR)/gamma) -LinkSourceFile(gamma_context.h, $(MESADRVSRCDIR)/gamma) -LinkSourceFile(gamma_client.h, $(MESADRVSRCDIR)/gamma) -LinkSourceFile(gamma_dd.c, $(MESADRVSRCDIR)/gamma) -LinkSourceFile(gamma_inithw.c, $(MESADRVSRCDIR)/gamma) -LinkSourceFile(gamma_lock.c, $(MESADRVSRCDIR)/gamma) -LinkSourceFile(gamma_lock.h, $(MESADRVSRCDIR)/gamma) -LinkSourceFile(gamma_macros.h, $(MESADRVSRCDIR)/gamma) -LinkSourceFile(gamma_render.c, $(MESADRVSRCDIR)/gamma) -LinkSourceFile(gamma_regs.h, $(MESADRVSRCDIR)/gamma) -LinkSourceFile(gamma_screen.c, $(MESADRVSRCDIR)/gamma) -LinkSourceFile(gamma_screen.h, $(MESADRVSRCDIR)/gamma) -LinkSourceFile(gamma_span.c, $(MESADRVSRCDIR)/gamma) -LinkSourceFile(gamma_state.c, $(MESADRVSRCDIR)/gamma) -LinkSourceFile(gamma_tex.c, $(MESADRVSRCDIR)/gamma) -LinkSourceFile(gamma_texmem.c, $(MESADRVSRCDIR)/gamma) -LinkSourceFile(gamma_texstate.c, $(MESADRVSRCDIR)/gamma) -LinkSourceFile(gamma_tris.c, $(MESADRVSRCDIR)/gamma) -LinkSourceFile(gamma_tris.h, $(MESADRVSRCDIR)/gamma) -LinkSourceFile(gamma_tritmp.h, $(MESADRVSRCDIR)/gamma) -LinkSourceFile(gamma_vb.c, $(MESADRVSRCDIR)/gamma) -LinkSourceFile(gamma_vb.h, $(MESADRVSRCDIR)/gamma) -LinkSourceFile(gamma_xmesa.c, $(MESADRVSRCDIR)/gamma) -#endif diff --git a/nx-X11/lib/GL/mesa/drivers/dri/i810/Imakefile b/nx-X11/lib/GL/mesa/drivers/dri/i810/Imakefile deleted file mode 100644 index 5d16f0108..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/i810/Imakefile +++ /dev/null @@ -1,77 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/i810/Imakefile,v 1.23tsi Exp $ - -#include - -#if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) -#define DoExtraLib SharedLibGlx -#define DoDebugLib DebugLibGlx -#define DoProfileLib ProfileLibGlx -#else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC -#define DoExtrasLib NO -#define DoDebugLib NO -#define DoProfileLib NO -#endif - -#define MesaDrvCommonBuildDir ../common/ -#include "../common/Imakefile.inc" -#include "../../../array_cache/Imakefile.inc" -#include "../../../main/Imakefile.inc" -#include "../../../math/Imakefile.inc" -#include "../../../shader/Imakefile.inc" -#include "../../../shader/grammar/Imakefile.inc" -#include "../../../shader/slang/Imakefile.inc" -#include "../../../shader/slang/library/Imakefile.inc" -#include "../../../swrast/Imakefile.inc" -#include "../../../swrast_setup/Imakefile.inc" -#include "../../../tnl/Imakefile.inc" -#include "../../../tnl_dd/Imakefile.inc" -#include "../../../Imakefile.inc" -#if defined(i386Architecture) && MesaUseX86Asm -#include "../../../x86/Imakefile.inc" -#endif -#ifdef SparcArchitecture -#include "../../../sparc/Imakefile.inc" -#endif -#define NeedToLinkMesaSrc -#include "Imakefile.inc" - - DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES) - - INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) - - DRMOBJS = $(GLXLIBSRC)/dri/drm/xf86drm.o \ - $(GLXLIBSRC)/dri/drm/xf86drmHash.o \ - $(GLXLIBSRC)/dri/drm/xf86drmRandom.o \ - $(GLXLIBSRC)/dri/drm/xf86drmSL.o - - SRCS = $(I810SRCS) - OBJS = $(DRMOBJS) $(COREMESAOBJS) \ - $(MESA_ASM_OBJS) $(COMMONOBJS) $(I810OBJS) - -REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) $(EXPATLIB) - -#include - -LibraryObjectRule() - -SubdirLibraryRule($(I810OBJS)) -NormalLintTarget($(SRCS)) - -#if !GlxUseBuiltInDRIDriver -LIBNAME = i810_dri.so -SharedDriModuleTarget($(LIBNAME),DONE $(OBJS),$(OBJS)) -InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) - -#ifdef GlxSoProf -SOPROF_LIBNAME = _i810_dri_p -NormalDepLibraryTarget($(SOPROF_LIBNAME),DONE $(OBJS),$(OBJS)) -InstallLibrary($(SOPROF_LIBNAME),$(MODULEDIR)/dri) -#endif -#endif - -DependTarget() - diff --git a/nx-X11/lib/GL/mesa/drivers/dri/i810/Imakefile.inc b/nx-X11/lib/GL/mesa/drivers/dri/i810/Imakefile.inc deleted file mode 100644 index f540da75b..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/i810/Imakefile.inc +++ /dev/null @@ -1,121 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/i810/Imakefile.inc,v 1.2 2001/05/02 15:06:03 dawes Exp $ - -#ifndef MesaDrvSrcDir -#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri -#endif - -MESADRVSRCDIR = MesaDrvSrcDir - -#ifndef MesaDrvI810BuildDir -#define MesaDrvI810BuildDir /**/ -#endif -MESADRVI810BUILDDIR = MesaDrvI810BuildDir - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - -#if BuildXF86DRI - DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=ByteOrder -DUSE_NEW_INTERFACE -DIN_DRI_DRIVER - DRI_INCLUDES = -I$(GLXLIBSRC)/dri \ - -I$(XINCLUDESRC) \ - -I$(GLXLIBSRC)/glx \ - -I$(GLXLIBSRC)/include \ - -I$(SERVERSRC)/GL/dri \ - -I$(XF86OSSRC) \ - -I$(DRMSRCDIR)/shared-core \ - -I$(XF86DRIVERSRC)/i810 \ - -I$(GLXLIBSRC)/dri/drm -#endif - -MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \ - -I$(MESASRCDIR)/src/mesa/main \ - -I$(MESASRCDIR)/src/mesa/glapi \ - -I$(MESASRCDIR)/src/mesa/shader \ - -I$(MESASRCDIR)/include \ - -I$(MESADRVSRCDIR)/common \ - -I$(MESADRVSRCDIR)/i810 - X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) - - I810SRCS = $(MESADRVI810BUILDDIR)i810context.c \ - $(MESADRVI810BUILDDIR)i810ioctl.c \ - $(MESADRVI810BUILDDIR)i810render.c \ - $(MESADRVI810BUILDDIR)i810screen.c \ - $(MESADRVI810BUILDDIR)i810span.c \ - $(MESADRVI810BUILDDIR)i810state.c \ - $(MESADRVI810BUILDDIR)i810tex.c \ - $(MESADRVI810BUILDDIR)i810texmem.c \ - $(MESADRVI810BUILDDIR)i810texstate.c \ - $(MESADRVI810BUILDDIR)i810tris.c \ - $(MESADRVI810BUILDDIR)i810vb.c - - I810OBJS = $(MESADRVI810BUILDDIR)i810context.o \ - $(MESADRVI810BUILDDIR)i810ioctl.o \ - $(MESADRVI810BUILDDIR)i810render.o \ - $(MESADRVI810BUILDDIR)i810screen.o \ - $(MESADRVI810BUILDDIR)i810span.o \ - $(MESADRVI810BUILDDIR)i810state.o \ - $(MESADRVI810BUILDDIR)i810tex.o \ - $(MESADRVI810BUILDDIR)i810texmem.o \ - $(MESADRVI810BUILDDIR)i810texstate.o \ - $(MESADRVI810BUILDDIR)i810tris.o \ - $(MESADRVI810BUILDDIR)i810vb.o - - I810UOBJS = $(MESADRVI810BUILDDIR)unshared/i810context.o \ - $(MESADRVI810BUILDDIR)unshared/i810ioctl.o \ - $(MESADRVI810BUILDDIR)unshared/i810render.o \ - $(MESADRVI810BUILDDIR)unshared/i810screen.o \ - $(MESADRVI810BUILDDIR)unshared/i810span.o \ - $(MESADRVI810BUILDDIR)unshared/i810state.o \ - $(MESADRVI810BUILDDIR)unshared/i810tex.o \ - $(MESADRVI810BUILDDIR)unshared/i810texmem.o \ - $(MESADRVI810BUILDDIR)unshared/i810texstate.o \ - $(MESADRVI810BUILDDIR)unshared/i810tris.o \ - $(MESADRVI810BUILDDIR)unshared/i810vb.o - - I810DOBJS = $(MESADRVI810BUILDDIR)debugger/i810context.o \ - $(MESADRVI810BUILDDIR)debugger/i810ioctl.o \ - $(MESADRVI810BUILDDIR)debugger/i810render.o \ - $(MESADRVI810BUILDDIR)debugger/i810screen.o \ - $(MESADRVI810BUILDDIR)debugger/i810span.o \ - $(MESADRVI810BUILDDIR)debugger/i810state.o \ - $(MESADRVI810BUILDDIR)debugger/i810tex.o \ - $(MESADRVI810BUILDDIR)debugger/i810texmem.o \ - $(MESADRVI810BUILDDIR)debugger/i810texstate.o \ - $(MESADRVI810BUILDDIR)debugger/i810tris.o \ - $(MESADRVI810BUILDDIR)debugger/i810vb.o - - I810POBJS = $(MESADRVI810BUILDDIR)profiled/i810context.o \ - $(MESADRVI810BUILDDIR)profiled/i810ioctl.o \ - $(MESADRVI810BUILDDIR)profiled/i810render.o \ - $(MESADRVI810BUILDDIR)profiled/i810screen.o \ - $(MESADRVI810BUILDDIR)profiled/i810span.o \ - $(MESADRVI810BUILDDIR)profiled/i810state.o \ - $(MESADRVI810BUILDDIR)profiled/i810tex.o \ - $(MESADRVI810BUILDDIR)profiled/i810texmem.o \ - $(MESADRVI810BUILDDIR)profiled/i810texstate.o \ - $(MESADRVI810BUILDDIR)profiled/i810tris.o \ - $(MESADRVI810BUILDDIR)profiled/i810vb.o - -#ifdef NeedToLinkMesaSrc -LinkSourceFile(i810_3d_reg.h, $(MESADRVSRCDIR)/i810) -LinkSourceFile(i810context.c, $(MESADRVSRCDIR)/i810) -LinkSourceFile(i810context.h, $(MESADRVSRCDIR)/i810) -LinkSourceFile(i810ioctl.c, $(MESADRVSRCDIR)/i810) -LinkSourceFile(i810ioctl.h, $(MESADRVSRCDIR)/i810) -LinkSourceFile(i810render.c, $(MESADRVSRCDIR)/i810) -LinkSourceFile(i810screen.c, $(MESADRVSRCDIR)/i810) -LinkSourceFile(i810screen.h, $(MESADRVSRCDIR)/i810) -LinkSourceFile(i810span.c, $(MESADRVSRCDIR)/i810) -LinkSourceFile(i810span.h, $(MESADRVSRCDIR)/i810) -LinkSourceFile(i810state.c, $(MESADRVSRCDIR)/i810) -LinkSourceFile(i810state.h, $(MESADRVSRCDIR)/i810) -LinkSourceFile(i810tex.c, $(MESADRVSRCDIR)/i810) -LinkSourceFile(i810tex.h, $(MESADRVSRCDIR)/i810) -LinkSourceFile(i810texmem.c, $(MESADRVSRCDIR)/i810) -LinkSourceFile(i810texstate.c, $(MESADRVSRCDIR)/i810) -LinkSourceFile(i810tris.c, $(MESADRVSRCDIR)/i810) -LinkSourceFile(i810tris.h, $(MESADRVSRCDIR)/i810) -LinkSourceFile(i810vb.c, $(MESADRVSRCDIR)/i810) -LinkSourceFile(i810vb.h, $(MESADRVSRCDIR)/i810) -#endif diff --git a/nx-X11/lib/GL/mesa/drivers/dri/i915/Imakefile b/nx-X11/lib/GL/mesa/drivers/dri/i915/Imakefile deleted file mode 100644 index 6aba077ba..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/i915/Imakefile +++ /dev/null @@ -1,72 +0,0 @@ -#include - -#if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) -#define DoExtraLib SharedLibGlx -#define DoDebugLib DebugLibGlx -#define DoProfileLib ProfileLibGlx -#else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC -#define DoExtrasLib NO -#define DoDebugLib NO -#define DoProfileLib NO -#endif - -#define MesaDrvCommonBuildDir ../common/ -#include "../common/Imakefile.inc" -#include "../../../array_cache/Imakefile.inc" -#include "../../../main/Imakefile.inc" -#include "../../../math/Imakefile.inc" -#include "../../../shader/Imakefile.inc" -#include "../../../shader/grammar/Imakefile.inc" -#include "../../../shader/slang/Imakefile.inc" -#include "../../../shader/slang/library/Imakefile.inc" -#include "../../../swrast/Imakefile.inc" -#include "../../../swrast_setup/Imakefile.inc" -#include "../../../tnl/Imakefile.inc" -#include "../../../tnl_dd/Imakefile.inc" -#include "../../../Imakefile.inc" -#if defined(i386Architecture) && MesaUseX86Asm -#include "../../../x86/Imakefile.inc" -#endif -#define NeedToLinkMesaSrc -#include "Imakefile.inc" - - DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES) - - INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) - - DRMOBJS = $(GLXLIBSRC)/dri/drm/xf86drm.o \ - $(GLXLIBSRC)/dri/drm/xf86drmHash.o \ - $(GLXLIBSRC)/dri/drm/xf86drmRandom.o \ - $(GLXLIBSRC)/dri/drm/xf86drmSL.o - - SRCS = $(I915SRCS) - OBJS = $(DRMOBJS) $(COREMESAOBJS) \ - $(MESA_ASM_OBJS) $(COMMONOBJS) $(I915OBJS) - -REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) $(EXPATLIB) - -#include - -LibraryObjectRule() - -SubdirLibraryRule($(I915OBJS)) -NormalLintTarget($(SRCS)) - -#if !GlxUseBuiltInDRIDriver -LIBNAME = i915_dri.so -SharedDriModuleTarget($(LIBNAME),DONE $(OBJS),$(OBJS)) -InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) - -#ifdef GlxSoProf -SOPROF_LIBNAME = _i915_dri_p -NormalDepLibraryTarget($(SOPROF_LIBNAME),DONE $(OBJS),$(OBJS)) -InstallLibrary($(SOPROF_LIBNAME),$(MODULEDIR)/dri) -#endif -#endif - -DependTarget() - diff --git a/nx-X11/lib/GL/mesa/drivers/dri/i915/Imakefile.inc b/nx-X11/lib/GL/mesa/drivers/dri/i915/Imakefile.inc deleted file mode 100644 index 56e7e3d93..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/i915/Imakefile.inc +++ /dev/null @@ -1,140 +0,0 @@ -#ifndef MesaDrvSrcDir -#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri -#endif - -MESADRVSRCDIR = MesaDrvSrcDir - -#ifndef MesaDrvI915BuildDir -#define MesaDrvI915BuildDir /**/ -#endif -MESADRVI915BUILDDIR = MesaDrvI915BuildDir - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - -#if BuildXF86DRI - DRI_DEFINES = GlxDefines -DIN_DRI_DRIVER - DRI_INCLUDES = -I$(GLXLIBSRC)/dri \ - -I$(XINCLUDESRC) \ - -I$(GLXLIBSRC)/glx \ - -I$(GLXLIBSRC)/include \ - -I$(SERVERSRC)/GL/dri \ - -I$(XF86OSSRC) \ - -I$(DRMSRCDIR)/shared-core \ - -I$(XF86DRIVERSRC)/i810 \ - -I$(GLXLIBSRC)/dri/drm -#endif - -MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \ - -I$(MESASRCDIR)/src/mesa/main \ - -I$(MESASRCDIR)/src/mesa/glapi \ - -I$(MESASRCDIR)/src/mesa/shader \ - -I$(MESASRCDIR)/include \ - -I$(MESADRVSRCDIR)/common - X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) - - I915SRCS = $(MESADRVI915BUILDDIR)i830_metaops.c \ - $(MESADRVI915BUILDDIR)i830_context.c \ - $(MESADRVI915BUILDDIR)i830_state.c \ - $(MESADRVI915BUILDDIR)i830_tex.c \ - $(MESADRVI915BUILDDIR)i830_texstate.c \ - $(MESADRVI915BUILDDIR)i830_texblend.c \ - $(MESADRVI915BUILDDIR)i830_vtbl.c \ - $(MESADRVI915BUILDDIR)i915_metaops.c \ - $(MESADRVI915BUILDDIR)i915_context.c \ - $(MESADRVI915BUILDDIR)i915_debug.c \ - $(MESADRVI915BUILDDIR)i915_fragprog.c \ - $(MESADRVI915BUILDDIR)i915_state.c \ - $(MESADRVI915BUILDDIR)i915_tex.c \ - $(MESADRVI915BUILDDIR)i915_texprog.c \ - $(MESADRVI915BUILDDIR)i915_texstate.c \ - $(MESADRVI915BUILDDIR)i915_program.c \ - $(MESADRVI915BUILDDIR)i915_vtbl.c \ - $(MESADRVI915BUILDDIR)intel_batchbuffer.c \ - $(MESADRVI915BUILDDIR)intel_context.c \ - $(MESADRVI915BUILDDIR)intel_ioctl.c \ - $(MESADRVI915BUILDDIR)intel_pixel.c \ - $(MESADRVI915BUILDDIR)intel_render.c \ - $(MESADRVI915BUILDDIR)intel_screen.c \ - $(MESADRVI915BUILDDIR)intel_span.c \ - $(MESADRVI915BUILDDIR)intel_state.c \ - $(MESADRVI915BUILDDIR)intel_tex.c \ - $(MESADRVI915BUILDDIR)intel_tris.c - - - - I915OBJS = $(MESADRVI915BUILDDIR)i830_metaops.o \ - $(MESADRVI915BUILDDIR)i830_context.o \ - $(MESADRVI915BUILDDIR)i830_state.o \ - $(MESADRVI915BUILDDIR)i830_tex.o \ - $(MESADRVI915BUILDDIR)i830_texstate.o \ - $(MESADRVI915BUILDDIR)i830_texblend.o \ - $(MESADRVI915BUILDDIR)i830_vtbl.o \ - $(MESADRVI915BUILDDIR)i915_metaops.o \ - $(MESADRVI915BUILDDIR)i915_context.o \ - $(MESADRVI915BUILDDIR)i915_debug.o \ - $(MESADRVI915BUILDDIR)i915_fragprog.o \ - $(MESADRVI915BUILDDIR)i915_state.o \ - $(MESADRVI915BUILDDIR)i915_tex.o \ - $(MESADRVI915BUILDDIR)i915_texprog.o \ - $(MESADRVI915BUILDDIR)i915_texstate.o \ - $(MESADRVI915BUILDDIR)i915_program.o \ - $(MESADRVI915BUILDDIR)i915_vtbl.o \ - $(MESADRVI915BUILDDIR)intel_batchbuffer.o \ - $(MESADRVI915BUILDDIR)intel_context.o \ - $(MESADRVI915BUILDDIR)intel_ioctl.o \ - $(MESADRVI915BUILDDIR)intel_pixel.o \ - $(MESADRVI915BUILDDIR)intel_render.o \ - $(MESADRVI915BUILDDIR)intel_screen.o \ - $(MESADRVI915BUILDDIR)intel_span.o \ - $(MESADRVI915BUILDDIR)intel_state.o \ - $(MESADRVI915BUILDDIR)intel_tex.o \ - $(MESADRVI915BUILDDIR)intel_tris.o - - I915UOBJS = - I915DOBJS = - I915POBJS = - -#ifdef NeedToLinkMesaSrc -LinkSourceFile(i830_metaops.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(i830_context.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(i830_context.h, $(MESADRVSRCDIR)/i915) -LinkSourceFile(i830_state.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(i830_reg.h, $(MESADRVSRCDIR)/i915) -LinkSourceFile(i830_tex.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(i830_texstate.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(i830_texblend.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(i830_vtbl.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(i915_metaops.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(i915_context.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(i915_context.h, $(MESADRVSRCDIR)/i915) -LinkSourceFile(i915_debug.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(i915_fragprog.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(i915_state.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(i915_tex.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(i915_texprog.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(i915_texstate.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(i915_program.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(i915_program.h, $(MESADRVSRCDIR)/i915) -LinkSourceFile(i915_reg.h, $(MESADRVSRCDIR)/i915) -LinkSourceFile(i915_vtbl.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(intel_batchbuffer.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(intel_batchbuffer.h, $(MESADRVSRCDIR)/i915) -LinkSourceFile(intel_context.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(intel_context.h, $(MESADRVSRCDIR)/i915) -LinkSourceFile(intel_ioctl.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(intel_ioctl.h, $(MESADRVSRCDIR)/i915) -LinkSourceFile(intel_pixel.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(intel_reg.h, $(MESADRVSRCDIR)/i915) -LinkSourceFile(intel_render.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(intel_screen.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(intel_screen.h, $(MESADRVSRCDIR)/i915) -LinkSourceFile(intel_span.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(intel_span.h, $(MESADRVSRCDIR)/i915) -LinkSourceFile(intel_state.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(intel_tex.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(intel_tex.h, $(MESADRVSRCDIR)/i915) -LinkSourceFile(intel_tris.c, $(MESADRVSRCDIR)/i915) -LinkSourceFile(intel_tris.h, $(MESADRVSRCDIR)/i915) -#endif diff --git a/nx-X11/lib/GL/mesa/drivers/dri/mach64/Imakefile b/nx-X11/lib/GL/mesa/drivers/dri/mach64/Imakefile deleted file mode 100644 index 342ffd248..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/mach64/Imakefile +++ /dev/null @@ -1,77 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/mach64/Imakefile,v 1.23tsi Exp $ - -#include - -#if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) -#define DoExtraLib SharedLibGlx -#define DoDebugLib DebugLibGlx -#define DoProfileLib ProfileLibGlx -#else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC -#define DoExtrasLib NO -#define DoDebugLib NO -#define DoProfileLib NO -#endif - -#define MesaDrvCommonBuildDir ../common/ -#include "../common/Imakefile.inc" -#include "../../../array_cache/Imakefile.inc" -#include "../../../main/Imakefile.inc" -#include "../../../math/Imakefile.inc" -#include "../../../shader/Imakefile.inc" -#include "../../../shader/grammar/Imakefile.inc" -#include "../../../shader/slang/Imakefile.inc" -#include "../../../shader/slang/library/Imakefile.inc" -#include "../../../swrast/Imakefile.inc" -#include "../../../swrast_setup/Imakefile.inc" -#include "../../../tnl/Imakefile.inc" -#include "../../../tnl_dd/Imakefile.inc" -#include "../../../Imakefile.inc" -#if defined(i386Architecture) && MesaUseX86Asm -#include "../../../x86/Imakefile.inc" -#endif -#ifdef SparcArchitecture -#include "../../../sparc/Imakefile.inc" -#endif -#define NeedToLinkMesaSrc -#include "Imakefile.inc" - - DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES) - - INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) - - DRMOBJS = $(GLXLIBSRC)/dri/drm/xf86drm.o \ - $(GLXLIBSRC)/dri/drm/xf86drmHash.o \ - $(GLXLIBSRC)/dri/drm/xf86drmRandom.o \ - $(GLXLIBSRC)/dri/drm/xf86drmSL.o - - SRCS = $(Mach64SRCS) - OBJS = $(DRMOBJS) $(COREMESAOBJS) \ - $(MESA_ASM_OBJS) $(COMMONOBJS) $(Mach64OBJS) - -REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) $(EXPATLIB) - -#include - -LibraryObjectRule() - -SubdirLibraryRule($(Mach64OBJS)) -NormalLintTarget($(SRCS)) - -#if !GlxUseBuiltInDRIDriver -LIBNAME = mach64_dri.so -SharedDriModuleTarget($(LIBNAME),DONE $(OBJS),$(OBJS)) -InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) - -#ifdef GlxSoProf -SOPROF_LIBNAME = _mach64_dri_p -NormalDepLibraryTarget($(SOPROF_LIBNAME),DONE $(OBJS),$(OBJS)) -InstallLibrary($(SOPROF_LIBNAME),$(MODULEDIR)/dri) -#endif -#endif - -DependTarget() - diff --git a/nx-X11/lib/GL/mesa/drivers/dri/mach64/Imakefile.inc b/nx-X11/lib/GL/mesa/drivers/dri/mach64/Imakefile.inc deleted file mode 100644 index b0074f170..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/mach64/Imakefile.inc +++ /dev/null @@ -1,131 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/mach64/Imakefile.inc,v 1.2 2001/05/02 15:06:03 dawes Exp $ - -#ifndef MesaDrvSrcDir -#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri -#endif - -MESADRVSRCDIR = MesaDrvSrcDir - -#ifndef MesaDrvMach64BuildDir -#define MesaDrvMach64BuildDir /**/ -#endif -MESADRVMach64BUILDDIR = MesaDrvMach64BuildDir - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - -#if BuildXF86DRI - DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=ByteOrder -DUSE_NEW_INTERFACE -DIN_DRI_DRIVER - DRI_INCLUDES = -I$(GLXLIBSRC)/dri \ - -I$(XINCLUDESRC) \ - -I$(GLXLIBSRC)/glx \ - -I$(GLXLIBSRC)/include \ - -I$(SERVERSRC)/GL/dri \ - -I$(XF86OSSRC) \ - -I$(DRMSRCDIR)/shared-core/ \ - -I$(XF86DRIVERSRC)/ati \ - -I$(GLXLIBSRC)/dri/drm -#endif - -MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \ - -I$(MESASRCDIR)/src/mesa/main \ - -I$(MESASRCDIR)/src/mesa/glapi \ - -I$(MESASRCDIR)/include \ - -I$(MESADRVSRCDIR)/common \ - -I$(MESADRVSRCDIR)/mach64 - X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) - - Mach64SRCS = $(MESADRVMach64BUILDDIR)mach64_context.c \ - $(MESADRVMach64BUILDDIR)mach64_dd.c \ - $(MESADRVMach64BUILDDIR)mach64_ioctl.c \ - $(MESADRVMach64BUILDDIR)mach64_lock.c \ - $(MESADRVMach64BUILDDIR)mach64_screen.c \ - $(MESADRVMach64BUILDDIR)mach64_span.c \ - $(MESADRVMach64BUILDDIR)mach64_state.c \ - $(MESADRVMach64BUILDDIR)mach64_tex.c \ - $(MESADRVMach64BUILDDIR)mach64_texmem.c \ - $(MESADRVMach64BUILDDIR)mach64_texstate.c \ - $(MESADRVMach64BUILDDIR)mach64_tris.c \ - $(MESADRVMach64BUILDDIR)mach64_vb.c - - Mach64OBJS = $(MESADRVMach64BUILDDIR)mach64_context.o \ - $(MESADRVMach64BUILDDIR)mach64_dd.o \ - $(MESADRVMach64BUILDDIR)mach64_ioctl.o \ - $(MESADRVMach64BUILDDIR)mach64_lock.o \ - $(MESADRVMach64BUILDDIR)mach64_screen.o \ - $(MESADRVMach64BUILDDIR)mach64_span.o \ - $(MESADRVMach64BUILDDIR)mach64_state.o \ - $(MESADRVMach64BUILDDIR)mach64_tex.o \ - $(MESADRVMach64BUILDDIR)mach64_texmem.o \ - $(MESADRVMach64BUILDDIR)mach64_texstate.o \ - $(MESADRVMach64BUILDDIR)mach64_tris.o \ - $(MESADRVMach64BUILDDIR)mach64_vb.o - - Mach64UOBJS = $(MESADRVMach64BUILDDIR)unshared/mach64_context.o \ - $(MESADRVMach64BUILDDIR)unshared/mach64_dd.o \ - $(MESADRVMach64BUILDDIR)unshared/mach64_ioctl.o \ - $(MESADRVMach64BUILDDIR)unshared/mach64_lock.o \ - $(MESADRVMach64BUILDDIR)unshared/mach64_screen.o \ - $(MESADRVMach64BUILDDIR)unshared/mach64_span.o \ - $(MESADRVMach64BUILDDIR)unshared/mach64_state.o \ - $(MESADRVMach64BUILDDIR)unshared/mach64_tex.o \ - $(MESADRVMach64BUILDDIR)unshared/mach64_texmem.o \ - $(MESADRVMach64BUILDDIR)unshared/mach64_texstate.o \ - $(MESADRVMach64BUILDDIR)unshared/mach64_tris.o \ - $(MESADRVMach64BUILDDIR)unshared/mach64_vb.o - - Mach64DOBJS = $(MESADRVMach64BUILDDIR)debugger/mach64_context.o \ - $(MESADRVMach64BUILDDIR)debugger/mach64_dd.o \ - $(MESADRVMach64BUILDDIR)debugger/mach64_ioctl.o \ - $(MESADRVMach64BUILDDIR)debugger/mach64_lock.o \ - $(MESADRVMach64BUILDDIR)debugger/mach64_screen.o \ - $(MESADRVMach64BUILDDIR)debugger/mach64_span.o \ - $(MESADRVMach64BUILDDIR)debugger/mach64_state.o \ - $(MESADRVMach64BUILDDIR)debugger/mach64_tex.o \ - $(MESADRVMach64BUILDDIR)debugger/mach64_texmem.o \ - $(MESADRVMach64BUILDDIR)debugger/mach64_texstate.o \ - $(MESADRVMach64BUILDDIR)debugger/mach64_tris.o \ - $(MESADRVMach64BUILDDIR)debugger/mach64_vb.o - - Mach64POBJS = $(MESADRVMach64BUILDDIR)profiled/mach64_context.o \ - $(MESADRVMach64BUILDDIR)profiled/mach64_dd.o \ - $(MESADRVMach64BUILDDIR)profiled/mach64_ioctl.o \ - $(MESADRVMach64BUILDDIR)profiled/mach64_lock.o \ - $(MESADRVMach64BUILDDIR)profiled/mach64_screen.o \ - $(MESADRVMach64BUILDDIR)profiled/mach64_span.o \ - $(MESADRVMach64BUILDDIR)profiled/mach64_state.o \ - $(MESADRVMach64BUILDDIR)profiled/mach64_tex.o \ - $(MESADRVMach64BUILDDIR)profiled/mach64_texmem.o \ - $(MESADRVMach64BUILDDIR)profiled/mach64_texstate.o \ - $(MESADRVMach64BUILDDIR)profiled/mach64_tris.o \ - $(MESADRVMach64BUILDDIR)profiled/mach64_vb.o - -#ifdef NeedToLinkMesaSrc -LinkSourceFile(mach64_reg.h, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_context.c, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_context.h, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_dd.c, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_dd.h, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_ioctl.c, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_ioctl.h, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_lock.c, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_lock.h, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_native_vb.c, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_native_vbtmp.h, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_screen.c, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_screen.h, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_span.c, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_span.h, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_state.c, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_state.h, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_tex.c, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_tex.h, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_texmem.c, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_texstate.c, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_tris.c, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_tris.h, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_vb.c, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_vb.h, $(MESADRVSRCDIR)/mach64) -LinkSourceFile(mach64_vbtmp.h, $(MESADRVSRCDIR)/mach64) -#endif diff --git a/nx-X11/lib/GL/mesa/drivers/dri/mga/Imakefile b/nx-X11/lib/GL/mesa/drivers/dri/mga/Imakefile deleted file mode 100644 index 5df7b681d..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/mga/Imakefile +++ /dev/null @@ -1,78 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/mga/Imakefile,v 1.22 2002/02/23 00:45:50 dawes Exp $ - -#include - -#if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) -#define DoExtraLib SharedLibGlx -#define DoDebugLib DebugLibGlx -#define DoProfileLib ProfileLibGlx -#else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC -#define DoExtrasLib NO -#define DoDebugLib NO -#define DoProfileLib NO -#endif - -#define MesaDrvCommonBuildDir ../common/ -#include "../common/Imakefile.inc" -#include "../../../array_cache/Imakefile.inc" -#include "../../../main/Imakefile.inc" -#include "../../../math/Imakefile.inc" -#include "../../../shader/Imakefile.inc" -#include "../../../shader/grammar/Imakefile.inc" -#include "../../../shader/slang/Imakefile.inc" -#include "../../../shader/slang/library/Imakefile.inc" -#include "../../../swrast/Imakefile.inc" -#include "../../../swrast_setup/Imakefile.inc" -#include "../../../tnl/Imakefile.inc" -#include "../../../tnl_dd/Imakefile.inc" -#include "../../../Imakefile.inc" -#if defined(i386Architecture) && MesaUseX86Asm -#include "../../../x86/Imakefile.inc" -#endif -#ifdef SparcArchitecture -#include "../../../sparc/Imakefile.inc" -#endif -#define NeedToLinkMesaSrc -#include "Imakefile.inc" - - - - DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES) - INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) - - DRMOBJS = $(GLXLIBSRC)/dri/drm/xf86drm.o \ - $(GLXLIBSRC)/dri/drm/xf86drmHash.o \ - $(GLXLIBSRC)/dri/drm/xf86drmRandom.o \ - $(GLXLIBSRC)/dri/drm/xf86drmSL.o - - SRCS = $(MGASRCS) - OBJS = $(DRMOBJS) $(COREMESAOBJS) \ - $(MESA_ASM_OBJS) $(COMMONOBJS) $(MGAOBJS) - -REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) $(EXPATLIB) - -#include - -LibraryObjectRule() - -SubdirLibraryRule($(MGAOBJS)) -NormalLintTarget($(SRCS)) - -#if !GlxUseBuiltInDRIDriver -LIBNAME = mga_dri.so -SharedDriModuleTarget($(LIBNAME),DONE $(OBJS),$(OBJS)) -InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) - -#ifdef GlxSoProf -SOPROF_LIBNAME = _mga_dri_p -NormalDepLibraryTarget($(SOPROF_LIBNAME),DONE $(OBJS),$(OBJS)) -InstallLibrary($(SOPROF_LIBNAME),$(MODULEDIR)/dri) -#endif -#endif - -DependTarget() - diff --git a/nx-X11/lib/GL/mesa/drivers/dri/mga/Imakefile.inc b/nx-X11/lib/GL/mesa/drivers/dri/mga/Imakefile.inc deleted file mode 100644 index a21278779..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/mga/Imakefile.inc +++ /dev/null @@ -1,135 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/mga/Imakefile.inc,v 1.2 2001/05/02 15:06:03 dawes Exp $ - -#ifndef MesaDrvSrcDir -#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/src/drv -#endif - -MESADRVSRCDIR = MesaDrvSrcDir - -#ifndef MesaDrvMgaBuildDir -#define MesaDrvMgaBuildDir /**/ -#endif -MESADRVMGABUILDDIR = MesaDrvMgaBuildDir - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - -#if BuildXF86DRI - DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=ByteOrder -DUSE_NEW_INTERFACE -DIN_DRI_DRIVER - DRI_INCLUDES = -I$(GLXLIBSRC)/dri \ - -I$(XINCLUDESRC) \ - -I$(GLXLIBSRC)/glx \ - -I$(GLXLIBSRC)/include \ - -I$(SERVERSRC)/GL/dri \ - -I$(XF86OSSRC) \ - -I$(DRMSRCDIR)/shared-core \ - -I$(XF86DRIVERSRC)/mga \ - -I$(GLXLIBSRC)/dri/drm -#endif - -MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \ - -I$(MESASRCDIR)/src/mesa/main \ - -I$(MESASRCDIR)/src/mesa/glapi \ - -I$(MESASRCDIR)/src/mesa/shader \ - -I$(MESASRCDIR)/include \ - -I$(MESADRVSRCDIR)/common \ - -I$(MESADRVSRCDIR)/mga - X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) - - MGASRCS = $(MESADRVMGABUILDDIR)mgadd.c \ - $(MESADRVMGABUILDDIR)mgarender.c \ - $(MESADRVMGABUILDDIR)mgaioctl.c \ - $(MESADRVMGABUILDDIR)mgapixel.c \ - $(MESADRVMGABUILDDIR)mgaspan.c \ - $(MESADRVMGABUILDDIR)mgastate.c \ - $(MESADRVMGABUILDDIR)mgatex.c \ - $(MESADRVMGABUILDDIR)mga_texcombine.c \ - $(MESADRVMGABUILDDIR)mgatexmem.c \ - $(MESADRVMGABUILDDIR)mga_texstate.c \ - $(MESADRVMGABUILDDIR)mgatris.c \ - $(MESADRVMGABUILDDIR)mgavb.c \ - $(MESADRVMGABUILDDIR)mga_xmesa.c \ - - MGAOBJS = $(MESADRVMGABUILDDIR)mgadd.o \ - $(MESADRVMGABUILDDIR)mgarender.o \ - $(MESADRVMGABUILDDIR)mgaioctl.o \ - $(MESADRVMGABUILDDIR)mgapixel.o \ - $(MESADRVMGABUILDDIR)mgaspan.o \ - $(MESADRVMGABUILDDIR)mgastate.o \ - $(MESADRVMGABUILDDIR)mgatex.o \ - $(MESADRVMGABUILDDIR)mga_texcombine.o \ - $(MESADRVMGABUILDDIR)mgatexmem.o \ - $(MESADRVMGABUILDDIR)mga_texstate.o \ - $(MESADRVMGABUILDDIR)mgatris.o \ - $(MESADRVMGABUILDDIR)mgavb.o \ - $(MESADRVMGABUILDDIR)mga_xmesa.o - - MGAUOBJS = $(MESADRVMGABUILDDIR)unshared/mgadd.o \ - $(MESADRVMGABUILDDIR)unshared/mgarender.o \ - $(MESADRVMGABUILDDIR)unshared/mgaioctl.o \ - $(MESADRVMGABUILDDIR)unshared/mgapixel.o \ - $(MESADRVMGABUILDDIR)unshared/mgaspan.o \ - $(MESADRVMGABUILDDIR)unshared/mgastate.o \ - $(MESADRVMGABUILDDIR)unshared/mgatex.o \ - $(MESADRVMGABUILDDIR)unshared/mga_texcombine.o \ - $(MESADRVMGABUILDDIR)unshared/mgatexmem.o \ - $(MESADRVMGABUILDDIR)unshared/mga_texstate.o \ - $(MESADRVMGABUILDDIR)unshared/mgatris.o \ - $(MESADRVMGABUILDDIR)unshared/mgavb.o \ - $(MESADRVMGABUILDDIR)unshared/mga_xmesa.o - - MGADOBJS = $(MESADRVMGABUILDDIR)debugger/mgadd.o \ - $(MESADRVMGABUILDDIR)debugger/mgarender.o \ - $(MESADRVMGABUILDDIR)debugger/mgaioctl.o \ - $(MESADRVMGABUILDDIR)debugger/mgapixel.o \ - $(MESADRVMGABUILDDIR)debugger/mgaspan.o \ - $(MESADRVMGABUILDDIR)debugger/mgastate.o \ - $(MESADRVMGABUILDDIR)debugger/mgatex.o \ - $(MESADRVMGABUILDDIR)debugger/mga_texcombine.o \ - $(MESADRVMGABUILDDIR)debugger/mgatexmem.o \ - $(MESADRVMGABUILDDIR)debugger/mga_texstate.o \ - $(MESADRVMGABUILDDIR)debugger/mgatris.o \ - $(MESADRVMGABUILDDIR)debugger/mgavb.o \ - $(MESADRVMGABUILDDIR)debugger/mga_xmesa.o - - MGAPOBJS = $(MESADRVMGABUILDDIR)profiled/mgadd.o \ - $(MESADRVMGABUILDDIR)profiled/mgarender.o \ - $(MESADRVMGABUILDDIR)profiled/mgaioctl.o \ - $(MESADRVMGABUILDDIR)profiled/mgapixel.o \ - $(MESADRVMGABUILDDIR)profiled/mgaspan.o \ - $(MESADRVMGABUILDDIR)profiled/mgastate.o \ - $(MESADRVMGABUILDDIR)profiled/mgatex.o \ - $(MESADRVMGABUILDDIR)profiled/mga_texcombine.o \ - $(MESADRVMGABUILDDIR)profiled/mgatexmem.o \ - $(MESADRVMGABUILDDIR)profiled/mga_texstate.o \ - $(MESADRVMGABUILDDIR)profiled/mgatris.o \ - $(MESADRVMGABUILDDIR)profiled/mgavb.o \ - $(MESADRVMGABUILDDIR)profiled/mga_xmesa.o - -#ifdef NeedToLinkMesaSrc -LinkSourceFile(mgacontext.h, $(MESADRVSRCDIR)/mga) -LinkSourceFile(mgadd.c, $(MESADRVSRCDIR)/mga) -LinkSourceFile(mgadd.h, $(MESADRVSRCDIR)/mga) -LinkSourceFile(mgaioctl.c, $(MESADRVSRCDIR)/mga) -LinkSourceFile(mgaioctl.h, $(MESADRVSRCDIR)/mga) -LinkSourceFile(mgapixel.c, $(MESADRVSRCDIR)/mga) -LinkSourceFile(mgapixel.h, $(MESADRVSRCDIR)/mga) -LinkSourceFile(mgarender.c, $(MESADRVSRCDIR)/mga) -LinkSourceFile(mgaregs.h, $(MESADRVSRCDIR)/mga) -LinkSourceFile(mgaspan.c, $(MESADRVSRCDIR)/mga) -LinkSourceFile(mgaspan.h, $(MESADRVSRCDIR)/mga) -LinkSourceFile(mgastate.c, $(MESADRVSRCDIR)/mga) -LinkSourceFile(mgastate.h, $(MESADRVSRCDIR)/mga) -LinkSourceFile(mgatex.c, $(MESADRVSRCDIR)/mga) -LinkSourceFile(mgatex.h, $(MESADRVSRCDIR)/mga) -LinkSourceFile(mga_texcombine.c, $(MESADRVSRCDIR)/mga) -LinkSourceFile(mgatexmem.c, $(MESADRVSRCDIR)/mga) -LinkSourceFile(mga_texstate.c, $(MESADRVSRCDIR)/mga) -LinkSourceFile(mgatris.c, $(MESADRVSRCDIR)/mga) -LinkSourceFile(mgatris.h, $(MESADRVSRCDIR)/mga) -LinkSourceFile(mgavb.c, $(MESADRVSRCDIR)/mga) -LinkSourceFile(mgavb.h, $(MESADRVSRCDIR)/mga) -LinkSourceFile(mga_xmesa.c, $(MESADRVSRCDIR)/mga) -LinkSourceFile(mga_xmesa.h, $(MESADRVSRCDIR)/mga) -#endif diff --git a/nx-X11/lib/GL/mesa/drivers/dri/r128/Imakefile b/nx-X11/lib/GL/mesa/drivers/dri/r128/Imakefile deleted file mode 100644 index d7ad07895..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/r128/Imakefile +++ /dev/null @@ -1,77 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r128/Imakefile,v 1.19 2002/02/23 00:45:50 dawes Exp $ - -#include - -#if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) -#define DoExtraLib SharedLibGlx -#define DoDebugLib DebugLibGlx -#define DoProfileLib ProfileLibGlx -#else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC -#define DoExtrasLib NO -#define DoDebugLib NO -#define DoProfileLib NO -#endif - -#define MesaDrvCommonBuildDir ../common/ -#include "../common/Imakefile.inc" -#include "../../../array_cache/Imakefile.inc" -#include "../../../main/Imakefile.inc" -#include "../../../math/Imakefile.inc" -#include "../../../shader/Imakefile.inc" -#include "../../../shader/grammar/Imakefile.inc" -#include "../../../shader/slang/Imakefile.inc" -#include "../../../shader/slang/library/Imakefile.inc" -#include "../../../swrast/Imakefile.inc" -#include "../../../swrast_setup/Imakefile.inc" -#include "../../../tnl/Imakefile.inc" -#include "../../../tnl_dd/Imakefile.inc" -#include "../../../Imakefile.inc" -#if defined(i386Architecture) && MesaUseX86Asm -#include "../../../x86/Imakefile.inc" -#endif -#ifdef SparcArchitecture -#include "../../../sparc/Imakefile.inc" -#endif -#define NeedToLinkMesaSrc -#include "Imakefile.inc" - - - DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES) - INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) - - DRMOBJS = $(GLXLIBSRC)/dri/drm/xf86drm.o \ - $(GLXLIBSRC)/dri/drm/xf86drmHash.o \ - $(GLXLIBSRC)/dri/drm/xf86drmRandom.o \ - $(GLXLIBSRC)/dri/drm/xf86drmSL.o - - SRCS = $(R128SRCS) - OBJS = $(DRMOBJS) $(COREMESAOBJS) \ - $(MESA_ASM_OBJS) $(COMMONOBJS) $(R128OBJS) - -REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) $(EXPATLIB) - -#include - -LibraryObjectRule() - -SubdirLibraryRule($(R128OBJS)) -NormalLintTarget($(SRCS)) - -#if !GlxUseBuiltInDRIDriver -LIBNAME = r128_dri.so -SharedDriModuleTarget($(LIBNAME),DONE $(OBJS),$(OBJS)) -InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) - -#ifdef GlxSoProf -SOPROF_LIBNAME = _r128_dri_p -NormalDepLibraryTarget($(SOPROF_LIBNAME),DONE $(OBJS),$(OBJS)) -InstallLibrary($(SOPROF_LIBNAME),$(MODULEDIR)/dri) -#endif -#endif - -DependTarget() - diff --git a/nx-X11/lib/GL/mesa/drivers/dri/r128/Imakefile.inc b/nx-X11/lib/GL/mesa/drivers/dri/r128/Imakefile.inc deleted file mode 100644 index 35d7761e8..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/r128/Imakefile.inc +++ /dev/null @@ -1,123 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r128/Imakefile.inc,v 1.3 2001/05/02 15:06:04 dawes Exp $ - -#ifndef MesaDrvSrcDir -#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri -#endif - -MESADRVSRCDIR = MesaDrvSrcDir - -#ifndef MesaDrvR128BuildDir -#define MesaDrvR128BuildDir /**/ -#endif -MESADRVR128BUILDDIR = MesaDrvR128BuildDir - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - -#if BuildXF86DRI - DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=ByteOrder -DUSE_NEW_INTERFACE -DIN_DRI_DRIVER - DRI_INCLUDES = -I$(GLXLIBSRC)/dri \ - -I$(XINCLUDESRC) \ - -I$(GLXLIBSRC)/glx \ - -I$(GLXLIBSRC)/include \ - -I$(SERVERSRC)/GL/dri \ - -I$(XF86OSSRC) \ - -I$(XF86COMSRC) \ - -I$(DRMSRCDIR)/shared-core \ - -I$(XF86DRIVERSRC)/ati \ - -I$(GLXLIBSRC)/dri/drm -#endif - -MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \ - -I$(MESASRCDIR)/src/mesa/main \ - -I$(MESASRCDIR)/src/mesa/glapi \ - -I$(MESASRCDIR)/src/mesa/shader \ - -I$(MESASRCDIR)/include \ - -I$(MESADRVSRCDIR)/common \ - -I$(MESADRVSRCDIR)/r128 - X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) - - R128SRCS = $(MESADRVR128BUILDDIR)r128_context.c \ - $(MESADRVR128BUILDDIR)r128_dd.c \ - $(MESADRVR128BUILDDIR)r128_ioctl.c \ - $(MESADRVR128BUILDDIR)r128_lock.c \ - $(MESADRVR128BUILDDIR)r128_screen.c \ - $(MESADRVR128BUILDDIR)r128_span.c \ - $(MESADRVR128BUILDDIR)r128_state.c \ - $(MESADRVR128BUILDDIR)r128_tex.c \ - $(MESADRVR128BUILDDIR)r128_texmem.c \ - $(MESADRVR128BUILDDIR)r128_texstate.c \ - $(MESADRVR128BUILDDIR)r128_tris.c - - R128OBJS = $(MESADRVR128BUILDDIR)r128_context.o \ - $(MESADRVR128BUILDDIR)r128_dd.o \ - $(MESADRVR128BUILDDIR)r128_ioctl.o \ - $(MESADRVR128BUILDDIR)r128_lock.o \ - $(MESADRVR128BUILDDIR)r128_screen.o \ - $(MESADRVR128BUILDDIR)r128_span.o \ - $(MESADRVR128BUILDDIR)r128_state.o \ - $(MESADRVR128BUILDDIR)r128_tex.o \ - $(MESADRVR128BUILDDIR)r128_texmem.o \ - $(MESADRVR128BUILDDIR)r128_texstate.o \ - $(MESADRVR128BUILDDIR)r128_tris.o - - R128UOBJS = $(MESADRVR128BUILDDIR)unshared/r128_context.o \ - $(MESADRVR128BUILDDIR)unshared/r128_dd.o \ - $(MESADRVR128BUILDDIR)unshared/r128_ioctl.o \ - $(MESADRVR128BUILDDIR)unshared/r128_lock.o \ - $(MESADRVR128BUILDDIR)unshared/r128_screen.o \ - $(MESADRVR128BUILDDIR)unshared/r128_span.o \ - $(MESADRVR128BUILDDIR)unshared/r128_state.o \ - $(MESADRVR128BUILDDIR)unshared/r128_tex.o \ - $(MESADRVR128BUILDDIR)unshared/r128_texmem.o \ - $(MESADRVR128BUILDDIR)unshared/r128_texstate.o \ - $(MESADRVR128BUILDDIR)unshared/r128_tris.o - - R128DOBJS = $(MESADRVR128BUILDDIR)debugger/r128_context.o \ - $(MESADRVR128BUILDDIR)debugger/r128_dd.o \ - $(MESADRVR128BUILDDIR)debugger/r128_ioctl.o \ - $(MESADRVR128BUILDDIR)debugger/r128_lock.o \ - $(MESADRVR128BUILDDIR)debugger/r128_screen.o \ - $(MESADRVR128BUILDDIR)debugger/r128_span.o \ - $(MESADRVR128BUILDDIR)debugger/r128_state.o \ - $(MESADRVR128BUILDDIR)debugger/r128_tex.o \ - $(MESADRVR128BUILDDIR)debugger/r128_texmem.o \ - $(MESADRVR128BUILDDIR)debugger/r128_texstate.o \ - $(MESADRVR128BUILDDIR)debugger/r128_tris.o - - R128POBJS = $(MESADRVR128BUILDDIR)profiled/r128_context.o \ - $(MESADRVR128BUILDDIR)profiled/r128_dd.o \ - $(MESADRVR128BUILDDIR)profiled/r128_ioctl.o \ - $(MESADRVR128BUILDDIR)profiled/r128_lock.o \ - $(MESADRVR128BUILDDIR)profiled/r128_screen.o \ - $(MESADRVR128BUILDDIR)profiled/r128_span.o \ - $(MESADRVR128BUILDDIR)profiled/r128_state.o \ - $(MESADRVR128BUILDDIR)profiled/r128_tex.o \ - $(MESADRVR128BUILDDIR)profiled/r128_texmem.o \ - $(MESADRVR128BUILDDIR)profiled/r128_texstate.o \ - $(MESADRVR128BUILDDIR)profiled/r128_tris.o - -#ifdef NeedToLinkMesaSrc -LinkSourceFile(r128_context.c, $(MESADRVSRCDIR)/r128) -LinkSourceFile(r128_context.h, $(MESADRVSRCDIR)/r128) -LinkSourceFile(r128_dd.c, $(MESADRVSRCDIR)/r128) -LinkSourceFile(r128_dd.h, $(MESADRVSRCDIR)/r128) -LinkSourceFile(r128_ioctl.c, $(MESADRVSRCDIR)/r128) -LinkSourceFile(r128_ioctl.h, $(MESADRVSRCDIR)/r128) -LinkSourceFile(r128_lock.c, $(MESADRVSRCDIR)/r128) -LinkSourceFile(r128_lock.h, $(MESADRVSRCDIR)/r128) -LinkSourceFile(r128_screen.c, $(MESADRVSRCDIR)/r128) -LinkSourceFile(r128_screen.h, $(MESADRVSRCDIR)/r128) -LinkSourceFile(r128_span.c, $(MESADRVSRCDIR)/r128) -LinkSourceFile(r128_span.h, $(MESADRVSRCDIR)/r128) -LinkSourceFile(r128_state.c, $(MESADRVSRCDIR)/r128) -LinkSourceFile(r128_state.h, $(MESADRVSRCDIR)/r128) -LinkSourceFile(r128_tex.c, $(MESADRVSRCDIR)/r128) -LinkSourceFile(r128_tex.h, $(MESADRVSRCDIR)/r128) -LinkSourceFile(r128_texmem.c, $(MESADRVSRCDIR)/r128) -LinkSourceFile(r128_texobj.h, $(MESADRVSRCDIR)/r128) -LinkSourceFile(r128_texstate.c, $(MESADRVSRCDIR)/r128) -LinkSourceFile(r128_tris.c, $(MESADRVSRCDIR)/r128) -LinkSourceFile(r128_tris.h, $(MESADRVSRCDIR)/r128) -#endif diff --git a/nx-X11/lib/GL/mesa/drivers/dri/r200/Imakefile b/nx-X11/lib/GL/mesa/drivers/dri/r200/Imakefile deleted file mode 100644 index 5f8bb3846..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/r200/Imakefile +++ /dev/null @@ -1,78 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r200/Imakefile,v 1.9 2002/02/23 00:45:50 dawes Exp $ - -#include - -#if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) -#define DoExtraLib SharedLibGlx -#define DoDebugLib DebugLibGlx -#define DoProfileLib ProfileLibGlx -#else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC -#define DoExtrasLib NO -#define DoDebugLib NO -#define DoProfileLib NO -#endif - -#define MesaDrvCommonBuildDir ../common/ -#include "../common/Imakefile.inc" -#include "../../../array_cache/Imakefile.inc" -#include "../../../main/Imakefile.inc" -#include "../../../math/Imakefile.inc" -#include "../../../shader/Imakefile.inc" -#include "../../../shader/grammar/Imakefile.inc" -#include "../../../shader/slang/Imakefile.inc" -#include "../../../shader/slang/library/Imakefile.inc" -#include "../../../swrast/Imakefile.inc" -#include "../../../swrast_setup/Imakefile.inc" -#include "../../../tnl/Imakefile.inc" -#include "../../../tnl_dd/Imakefile.inc" -#include "../../../Imakefile.inc" -#if defined(i386Architecture) && MesaUseX86Asm -#include "../../../x86/Imakefile.inc" -#endif -#ifdef SparcArchitecture -#include "../../../sparc/Imakefile.inc" -#endif -#define NeedToLinkMesaSrc -#include "Imakefile.inc" - - DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES) - INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) - - DRMOBJS = $(GLXLIBSRC)/dri/drm/xf86drm.o \ - $(GLXLIBSRC)/dri/drm/xf86drmHash.o \ - $(GLXLIBSRC)/dri/drm/xf86drmRandom.o \ - $(GLXLIBSRC)/dri/drm/xf86drmSL.o - - SRCS = $(R200SRCS) - OBJS = $(DRMOBJS) $(COREMESAOBJS) \ - $(MESA_ASM_OBJS) $(COMMONOBJS) $(R200OBJS) - -REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) $(EXPATLIB) - -#include - -LibraryObjectRule() - -SubdirLibraryRule($(R200OBJS)) -NormalLintTarget($(SRCS)) - -ObjectFromAsmSource(r200_vtxtmp_x86, NullParameter) - -#if !GlxUseBuiltInDRIDriver -LIBNAME = r200_dri.so -SharedDriModuleTarget($(LIBNAME),DONE $(OBJS),$(OBJS)) -InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) - -#ifdef GlxSoProf -SOPROF_LIBNAME = _r200_dri_p -NormalDepLibraryTarget($(SOPROF_LIBNAME),DONE $(OBJS),$(OBJS)) -InstallLibrary($(SOPROF_LIBNAME),$(MODULEDIR)/dri) -#endif -#endif - -DependTarget() - diff --git a/nx-X11/lib/GL/mesa/drivers/dri/r200/Imakefile.inc b/nx-X11/lib/GL/mesa/drivers/dri/r200/Imakefile.inc deleted file mode 100644 index fa635e4ba..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/r200/Imakefile.inc +++ /dev/null @@ -1,200 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r200/Imakefile.inc,v 1.2 2001/05/02 15:06:04 dawes Exp $ - -#ifndef MesaDrvSrcDir -#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri -#endif - -MESADRVSRCDIR = MesaDrvSrcDir - -#ifndef MesaDrvR200BuildDir -#define MesaDrvR200BuildDir /**/ -#endif -MESADRVR200BUILDDIR = MesaDrvR200BuildDir - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - -#if BuildXF86DRI - DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=ByteOrder -DUSE_NEW_INTERFACE -DIN_DRI_DRIVER - DRI_INCLUDES = -I$(GLXLIBSRC)/dri \ - -I$(XINCLUDESRC) \ - -I$(GLXLIBSRC)/glx \ - -I$(GLXLIBSRC)/include \ - -I$(SERVERSRC)/GL/dri \ - -I$(XF86COMSRC) \ - -I$(XF86OSSRC) \ - -I$(DRMSRCDIR)/shared-core \ - -I$(XF86DRIVERSRC)/ati \ - -I$(GLXLIBSRC)/dri/drm -#endif - -MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \ - -I$(MESASRCDIR)/src/mesa/main \ - -I$(MESASRCDIR)/src/mesa/glapi \ - -I$(MESASRCDIR)/src/mesa/shader \ - -I$(MESASRCDIR)/include \ - -I$(MESADRVSRCDIR)/common \ - -I$(MESADRVSRCDIR)/r200 \ - -I$(MESADRVSRCDIR)/radeon/server - X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) - - R200SRCS = $(MESADRVR200BUILDDIR)r200_context.c \ - $(MESADRVR200BUILDDIR)r200_sanity.c \ - $(MESADRVR200BUILDDIR)r200_state.c \ - $(MESADRVR200BUILDDIR)r200_state_init.c \ - $(MESADRVR200BUILDDIR)r200_swtcl.c \ - $(MESADRVR200BUILDDIR)r200_cmdbuf.c \ - $(MESADRVR200BUILDDIR)r200_ioctl.c \ - $(MESADRVR200BUILDDIR)r200_lock.c \ - $(MESADRVR200BUILDDIR)r200_maos.c \ - $(MESADRVR200BUILDDIR)r200_pixel.c \ - $(MESADRVR200BUILDDIR)r200_screen.c \ - $(MESADRVR200BUILDDIR)r200_span.c \ - $(MESADRVR200BUILDDIR)r200_tcl.c \ - $(MESADRVR200BUILDDIR)r200_tex.c \ - $(MESADRVR200BUILDDIR)r200_texmem.c \ - $(MESADRVR200BUILDDIR)r200_texstate.c \ - $(MESADRVR200BUILDDIR)r200_vtxfmt.c \ - $(MESADRVR200BUILDDIR)r200_vtxfmt_x86.c \ - $(MESADRVR200BUILDDIR)r200_vtxtmp_x86.S \ - $(MESADRVR200BUILDDIR)r200_vtxfmt_sse.c \ - $(MESADRVR200BUILDDIR)r200_vtxfmt_c.c - - R200OBJS = $(MESADRVR200BUILDDIR)r200_context.o \ - $(MESADRVR200BUILDDIR)r200_sanity.o \ - $(MESADRVR200BUILDDIR)r200_state.o \ - $(MESADRVR200BUILDDIR)r200_state_init.o \ - $(MESADRVR200BUILDDIR)r200_swtcl.o \ - $(MESADRVR200BUILDDIR)r200_cmdbuf.o \ - $(MESADRVR200BUILDDIR)r200_ioctl.o \ - $(MESADRVR200BUILDDIR)r200_lock.o \ - $(MESADRVR200BUILDDIR)r200_maos.o \ - $(MESADRVR200BUILDDIR)r200_pixel.o \ - $(MESADRVR200BUILDDIR)r200_screen.o \ - $(MESADRVR200BUILDDIR)r200_span.o \ - $(MESADRVR200BUILDDIR)r200_tcl.o \ - $(MESADRVR200BUILDDIR)r200_tex.o \ - $(MESADRVR200BUILDDIR)r200_texmem.o \ - $(MESADRVR200BUILDDIR)r200_texstate.o \ - $(MESADRVR200BUILDDIR)r200_vtxfmt.o \ - $(MESADRVR200BUILDDIR)r200_vtxfmt_c.o - -#ifdef i386Architecture - R200OBJS += $(MESADRVR200BUILDDIR)r200_vtxfmt_x86.o \ - $(MESADRVR200BUILDDIR)r200_vtxtmp_x86.o \ - $(MESADRVR200BUILDDIR)r200_vtxfmt_sse.o -#endif - - R200UOBJS = $(MESADRVR200BUILDDIR)unshared/r200_context.o \ - $(MESADRVR200BUILDDIR)unshared/r200_sanity.o \ - $(MESADRVR200BUILDDIR)unshared/r200_cmdbuf.o \ - $(MESADRVR200BUILDDIR)unshared/r200_ioctl.o \ - $(MESADRVR200BUILDDIR)unshared/r200_lock.o \ - $(MESADRVR200BUILDDIR)unshared/r200_maos.o \ - $(MESADRVR200BUILDDIR)unshared/r200_pixel.o \ - $(MESADRVR200BUILDDIR)unshared/r200_screen.o \ - $(MESADRVR200BUILDDIR)unshared/r200_span.o \ - $(MESADRVR200BUILDDIR)unshared/r200_state.o \ - $(MESADRVR200BUILDDIR)unshared/r200_state_init.o \ - $(MESADRVR200BUILDDIR)unshared/r200_swtcl.o \ - $(MESADRVR200BUILDDIR)unshared/r200_tcl.o \ - $(MESADRVR200BUILDDIR)unshared/r200_tex.o \ - $(MESADRVR200BUILDDIR)unshared/r200_texmem.o \ - $(MESADRVR200BUILDDIR)unshared/r200_texstate.o \ - $(MESADRVR200BUILDDIR)unshared/r200_vtxfmt.o \ - $(MESADRVR200BUILDDIR)unshared/r200_vtxfmt_c.o - -#ifdef i386Architecture - R200UOBJS += $(MESADRVR200BUILDDIR)unshared/r200_vtxfmt_x86.o \ - $(MESADRVR200BUILDDIR)unshared/r200_vtxtmp_x86.o \ - $(MESADRVR200BUILDDIR)unshared/r200_vtxfmt_sse.o -#endif - - R200DOBJS = $(MESADRVR200BUILDDIR)debugger/r200_context.o \ - $(MESADRVR200BUILDDIR)debugger/r200_sanity.o \ - $(MESADRVR200BUILDDIR)debugger/r200_cmdbuf.o \ - $(MESADRVR200BUILDDIR)debugger/r200_ioctl.o \ - $(MESADRVR200BUILDDIR)debugger/r200_lock.o \ - $(MESADRVR200BUILDDIR)debugger/r200_maos.o \ - $(MESADRVR200BUILDDIR)debugger/r200_pixel.o \ - $(MESADRVR200BUILDDIR)debugger/r200_screen.o \ - $(MESADRVR200BUILDDIR)debugger/r200_span.o \ - $(MESADRVR200BUILDDIR)debugger/r200_state.o \ - $(MESADRVR200BUILDDIR)debugger/r200_state_init.o \ - $(MESADRVR200BUILDDIR)debugger/r200_swtcl.o \ - $(MESADRVR200BUILDDIR)debugger/r200_tcl.o \ - $(MESADRVR200BUILDDIR)debugger/r200_tex.o \ - $(MESADRVR200BUILDDIR)debugger/r200_texmem.o \ - $(MESADRVR200BUILDDIR)debugger/r200_texstate.o \ - $(MESADRVR200BUILDDIR)debugger/r200_vtxfmt.o \ - $(MESADRVR200BUILDDIR)debugger/r200_vtxfmt_c.o - -#ifdef i386Architecture - R200DOBJS += $(MESADRVR200BUILDDIR)debugger/r200_vtxfmt_x86.o \ - $(MESADRVR200BUILDDIR)debugger/r200_vtxtmp_x86.o \ - $(MESADRVR200BUILDDIR)debugger/r200_vtxfmt_sse.o -#endif - - R200POBJS = $(MESADRVR200BUILDDIR)profiled/r200_context.o \ - $(MESADRVR200BUILDDIR)profiled/r200_sanity.o \ - $(MESADRVR200BUILDDIR)profiled/r200_cmdbuf.o \ - $(MESADRVR200BUILDDIR)profiled/r200_ioctl.o \ - $(MESADRVR200BUILDDIR)profiled/r200_lock.o \ - $(MESADRVR200BUILDDIR)profiled/r200_maos.o \ - $(MESADRVR200BUILDDIR)profiled/r200_pixel.o \ - $(MESADRVR200BUILDDIR)profiled/r200_screen.o \ - $(MESADRVR200BUILDDIR)profiled/r200_span.o \ - $(MESADRVR200BUILDDIR)profiled/r200_state.o \ - $(MESADRVR200BUILDDIR)profiled/r200_state_init.o \ - $(MESADRVR200BUILDDIR)profiled/r200_swtcl.o \ - $(MESADRVR200BUILDDIR)profiled/r200_tcl.o \ - $(MESADRVR200BUILDDIR)profiled/r200_tex.o \ - $(MESADRVR200BUILDDIR)profiled/r200_texmem.o \ - $(MESADRVR200BUILDDIR)profiled/r200_texstate.o \ - $(MESADRVR200BUILDDIR)profiled/r200_vtxfmt.o \ - $(MESADRVR200BUILDDIR)profiled/r200_vtxfmt_c.o - -#ifdef i386Architecture - R200POBJS += $(MESADRVR200BUILDDIR)profiled/r200_vtxfmt_x86.o \ - $(MESADRVR200BUILDDIR)profiled/r200_vtxtmp_x86.o \ - $(MESADRVR200BUILDDIR)profiled/r200_vtxfmt_sse.o -#endif - -#ifdef NeedToLinkMesaSrc -LinkSourceFile(r200_context.c, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_context.h, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_cmdbuf.c, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_ioctl.c, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_ioctl.h, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_lock.c, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_lock.h, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_maos.c, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_maos.h, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_pixel.c, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_pixel.h, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_reg.h, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_screen.c, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_screen.h, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_span.c, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_span.h, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_sanity.c, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_sanity.h, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_state.c, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_state.h, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_state_init.c, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_swtcl.c, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_swtcl.h, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_tcl.c, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_tcl.h, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_tex.c, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_tex.h, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_texmem.c, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_texstate.c, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_vtxfmt.c, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_vtxfmt.h, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_vtxfmt_c.c, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_vtxfmt_x86.c, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_vtxtmp_x86.S, $(MESADRVSRCDIR)/r200) -LinkSourceFile(r200_vtxfmt_sse.c, $(MESADRVSRCDIR)/r200) -#endif diff --git a/nx-X11/lib/GL/mesa/drivers/dri/radeon/Imakefile b/nx-X11/lib/GL/mesa/drivers/dri/radeon/Imakefile deleted file mode 100644 index 69d28b248..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/radeon/Imakefile +++ /dev/null @@ -1,78 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/radeon/Imakefile,v 1.9 2002/02/23 00:45:50 dawes Exp $ - -#include - -#if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) -#define DoExtraLib SharedLibGlx -#define DoDebugLib DebugLibGlx -#define DoProfileLib ProfileLibGlx -#else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC -#define DoExtrasLib NO -#define DoDebugLib NO -#define DoProfileLib NO -#endif - -#define MesaDrvCommonBuildDir ../common/ -#include "../common/Imakefile.inc" -#include "../../../array_cache/Imakefile.inc" -#include "../../../main/Imakefile.inc" -#include "../../../math/Imakefile.inc" -#include "../../../shader/Imakefile.inc" -#include "../../../shader/grammar/Imakefile.inc" -#include "../../../shader/slang/Imakefile.inc" -#include "../../../shader/slang/library/Imakefile.inc" -#include "../../../swrast/Imakefile.inc" -#include "../../../swrast_setup/Imakefile.inc" -#include "../../../tnl/Imakefile.inc" -#include "../../../tnl_dd/Imakefile.inc" -#include "../../../Imakefile.inc" -#if defined(i386Architecture) && MesaUseX86Asm -#include "../../../x86/Imakefile.inc" -#endif -#ifdef SparcArchitecture -#include "../../../sparc/Imakefile.inc" -#endif -#define NeedToLinkMesaSrc -#include "Imakefile.inc" - - DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES) - INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) - - DRMOBJS = $(GLXLIBSRC)/dri/drm/xf86drm.o \ - $(GLXLIBSRC)/dri/drm/xf86drmHash.o \ - $(GLXLIBSRC)/dri/drm/xf86drmRandom.o \ - $(GLXLIBSRC)/dri/drm/xf86drmSL.o - - SRCS = $(RADEONSRCS) - OBJS = $(DRMOBJS) $(COREMESAOBJS) \ - $(MESA_ASM_OBJS) $(COMMONOBJS) $(RADEONOBJS) - -REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) $(EXPATLIB) - -#include - -LibraryObjectRule() - -SubdirLibraryRule($(RADEONOBJS)) -NormalLintTarget($(SRCS)) - -ObjectFromAsmSource(radeon_vtxtmp_x86, NullParameter) - -#if !GlxUseBuiltInDRIDriver -LIBNAME = radeon_dri.so -SharedDriModuleTarget($(LIBNAME),DONE $(OBJS),$(OBJS)) -InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) - -#ifdef GlxSoProf -SOPROF_LIBNAME = _radeon_dri_p -NormalDepLibraryTarget($(SOPROF_LIBNAME),DONE $(OBJS),$(OBJS)) -InstallLibrary($(SOPROF_LIBNAME),$(MODULEDIR)/dri) -#endif -#endif - -DependTarget() - diff --git a/nx-X11/lib/GL/mesa/drivers/dri/radeon/Imakefile.inc b/nx-X11/lib/GL/mesa/drivers/dri/radeon/Imakefile.inc deleted file mode 100644 index 9c95c5463..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/radeon/Imakefile.inc +++ /dev/null @@ -1,193 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/radeon/Imakefile.inc,v 1.3 2002/02/22 21:45:00 dawes Exp $ - -#ifndef MesaDrvSrcDir -#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri -#endif - -MESADRVSRCDIR = MesaDrvSrcDir - -#ifndef MesaDrvRadeonBuildDir -#define MesaDrvRadeonBuildDir /**/ -#endif -MESADRVRADEONBUILDDIR = MesaDrvRadeonBuildDir - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - -#if BuildXF86DRI - DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=ByteOrder -DUSE_NEW_INTERFACE -DIN_DRI_DRIVER - DRI_INCLUDES = -I$(GLXLIBSRC)/dri \ - -I$(XINCLUDESRC) \ - -I$(GLXLIBSRC)/glx \ - -I$(GLXLIBSRC)/include \ - -I$(SERVERSRC)/GL/dri \ - -I$(XF86OSSRC) \ - -I$(XF86COMSRC) \ - -I$(DRMSRCDIR)/shared-core \ - -I$(XF86DRIVERSRC)/ati \ - -I$(GLXLIBSRC)/dri/drm -#endif - -MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \ - -I$(MESASRCDIR)/src/mesa/main \ - -I$(MESASRCDIR)/src/mesa/glapi \ - -I$(MESASRCDIR)/src/mesa/shader \ - -I$(MESASRCDIR)/include \ - -I$(MESADRVSRCDIR)/common \ - -I$(MESADRVSRCDIR)/radeon \ - -I$(MESADRVSRCDIR)/radeon/server - X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) - - RADEONSRCS = $(MESADRVRADEONBUILDDIR)radeon_context.c \ - $(MESADRVRADEONBUILDDIR)radeon_compat.c \ - $(MESADRVRADEONBUILDDIR)radeon_ioctl.c \ - $(MESADRVRADEONBUILDDIR)radeon_lock.c \ - $(MESADRVRADEONBUILDDIR)radeon_maos.c \ - $(MESADRVRADEONBUILDDIR)radeon_sanity.c \ - $(MESADRVRADEONBUILDDIR)radeon_screen.c \ - $(MESADRVRADEONBUILDDIR)radeon_span.c \ - $(MESADRVRADEONBUILDDIR)radeon_state.c \ - $(MESADRVRADEONBUILDDIR)radeon_state_init.c \ - $(MESADRVRADEONBUILDDIR)radeon_swtcl.c \ - $(MESADRVRADEONBUILDDIR)radeon_tcl.c \ - $(MESADRVRADEONBUILDDIR)radeon_tex.c \ - $(MESADRVRADEONBUILDDIR)radeon_texmem.c \ - $(MESADRVRADEONBUILDDIR)radeon_texstate.c \ - $(MESADRVRADEONBUILDDIR)radeon_vtxfmt.c \ - $(MESADRVRADEONBUILDDIR)radeon_vtxfmt_x86.c \ - $(MESADRVRADEONBUILDDIR)radeon_vtxtmp_x86.S \ - $(MESADRVRADEONBUILDDIR)radeon_vtxfmt_sse.c \ - $(MESADRVRADEONBUILDDIR)radeon_vtxfmt_c.c - - RADEONOBJS = $(MESADRVRADEONBUILDDIR)radeon_context.o \ - $(MESADRVRADEONBUILDDIR)radeon_compat.o \ - $(MESADRVRADEONBUILDDIR)radeon_ioctl.o \ - $(MESADRVRADEONBUILDDIR)radeon_lock.o \ - $(MESADRVRADEONBUILDDIR)radeon_maos.o \ - $(MESADRVRADEONBUILDDIR)radeon_sanity.o \ - $(MESADRVRADEONBUILDDIR)radeon_screen.o \ - $(MESADRVRADEONBUILDDIR)radeon_span.o \ - $(MESADRVRADEONBUILDDIR)radeon_state.o \ - $(MESADRVRADEONBUILDDIR)radeon_state_init.o \ - $(MESADRVRADEONBUILDDIR)radeon_swtcl.o \ - $(MESADRVRADEONBUILDDIR)radeon_tcl.o \ - $(MESADRVRADEONBUILDDIR)radeon_tex.o \ - $(MESADRVRADEONBUILDDIR)radeon_texmem.o \ - $(MESADRVRADEONBUILDDIR)radeon_texstate.o \ - $(MESADRVRADEONBUILDDIR)radeon_vtxfmt.o \ - $(MESADRVRADEONBUILDDIR)radeon_vtxfmt_c.o - -#ifdef i386Architecture - RADEONOBJS += $(MESADRVRADEONBUILDDIR)radeon_vtxfmt_x86.o \ - $(MESADRVRADEONBUILDDIR)radeon_vtxtmp_x86.o \ - $(MESADRVRADEONBUILDDIR)radeon_vtxfmt_sse.o -#endif - - RADEONUOBJS = $(MESADRVRADEONBUILDDIR)unshared/radeon_context.o \ - $(MESADRVRADEONBUILDDIR)unshared/radeon_compat.o \ - $(MESADRVRADEONBUILDDIR)unshared/radeon_ioctl.o \ - $(MESADRVRADEONBUILDDIR)unshared/radeon_lock.o \ - $(MESADRVRADEONBUILDDIR)unshared/radeon_maos.o \ - $(MESADRVRADEONBUILDDIR)unshared/radeon_sanity.o \ - $(MESADRVRADEONBUILDDIR)unshared/radeon_screen.o \ - $(MESADRVRADEONBUILDDIR)unshared/radeon_span.o \ - $(MESADRVRADEONBUILDDIR)unshared/radeon_state.o \ - $(MESADRVRADEONBUILDDIR)unshared/radeon_state_init.o \ - $(MESADRVRADEONBUILDDIR)unshared/radeon_swtcl.o \ - $(MESADRVRADEONBUILDDIR)unshared/radeon_tcl.o \ - $(MESADRVRADEONBUILDDIR)unshared/radeon_tex.o \ - $(MESADRVRADEONBUILDDIR)unshared/radeon_texmem.o \ - $(MESADRVRADEONBUILDDIR)unshared/radeon_texstate.o \ - $(MESADRVRADEONBUILDDIR)unshared/radeon_vtxfmt.o \ - $(MESADRVRADEONBUILDDIR)unshared/radeon_vtxfmt_c.o - -#ifdef i386Architecture - RADEONUOBJS += $(MESADRVRADEONBUILDDIR)unshared/radeon_vtxfmt_x86.o \ - $(MESADRVRADEONBUILDDIR)unshared/radeon_vtxtmp_x86.o \ - $(MESADRVRADEONBUILDDIR)unshared/radeon_vtxfmt_sse.o -#endif - - RADEONDOBJS = $(MESADRVRADEONBUILDDIR)debugger/radeon_context.o \ - $(MESADRVRADEONBUILDDIR)debugger/radeon_compat.o \ - $(MESADRVRADEONBUILDDIR)debugger/radeon_ioctl.o \ - $(MESADRVRADEONBUILDDIR)debugger/radeon_lock.o \ - $(MESADRVRADEONBUILDDIR)debugger/radeon_maos.o \ - $(MESADRVRADEONBUILDDIR)debugger/radeon_sanity.o \ - $(MESADRVRADEONBUILDDIR)debugger/radeon_screen.o \ - $(MESADRVRADEONBUILDDIR)debugger/radeon_span.o \ - $(MESADRVRADEONBUILDDIR)debugger/radeon_state.o \ - $(MESADRVRADEONBUILDDIR)debugger/radeon_state_init.o \ - $(MESADRVRADEONBUILDDIR)debugger/radeon_swtcl.o \ - $(MESADRVRADEONBUILDDIR)debugger/radeon_tcl.o \ - $(MESADRVRADEONBUILDDIR)debugger/radeon_tex.o \ - $(MESADRVRADEONBUILDDIR)debugger/radeon_texmem.o \ - $(MESADRVRADEONBUILDDIR)debugger/radeon_texstate.o \ - $(MESADRVRADEONBUILDDIR)debugger/radeon_vtxfmt.o \ - $(MESADRVRADEONBUILDDIR)debugger/radeon_vtxfmt_c.o - -#ifdef i386Architecture - RADEONDOBJS += $(MESADRVRADEONBUILDDIR)debugger/radeon_vtxfmt_x86.o \ - $(MESADRVRADEONBUILDDIR)debugger/radeon_vtxtmp_x86.o \ - $(MESADRVRADEONBUILDDIR)debugger/radeon_vtxfmt_sse.o -#endif - - RADEONPOBJS = $(MESADRVRADEONBUILDDIR)profiled/radeon_context.o \ - $(MESADRVRADEONBUILDDIR)profiled/radeon_compat.o \ - $(MESADRVRADEONBUILDDIR)profiled/radeon_ioctl.o \ - $(MESADRVRADEONBUILDDIR)profiled/radeon_lock.o \ - $(MESADRVRADEONBUILDDIR)profiled/radeon_maos.o \ - $(MESADRVRADEONBUILDDIR)profiled/radeon_sanity.o \ - $(MESADRVRADEONBUILDDIR)profiled/radeon_screen.o \ - $(MESADRVRADEONBUILDDIR)profiled/radeon_span.o \ - $(MESADRVRADEONBUILDDIR)profiled/radeon_state.o \ - $(MESADRVRADEONBUILDDIR)profiled/radeon_state_init.o \ - $(MESADRVRADEONBUILDDIR)profiled/radeon_swtcl.o \ - $(MESADRVRADEONBUILDDIR)profiled/radeon_tcl.o \ - $(MESADRVRADEONBUILDDIR)profiled/radeon_tex.o \ - $(MESADRVRADEONBUILDDIR)profiled/radeon_texmem.o \ - $(MESADRVRADEONBUILDDIR)profiled/radeon_texstate.o \ - $(MESADRVRADEONBUILDDIR)profiled/radeon_vtxfmt.o \ - $(MESADRVRADEONBUILDDIR)profiled/radeon_vtxfmt_c.o - -#ifdef i386Architecture - RADEONPOBJS += $(MESADRVRADEONBUILDDIR)profiled/radeon_vtxfmt_x86.o \ - $(MESADRVRADEONBUILDDIR)profiled/radeon_vtxtmp_x86.o \ - $(MESADRVRADEONBUILDDIR)profiled/radeon_vtxfmt_sse.o -#endif - -#ifdef NeedToLinkMesaSrc -LinkSourceFile(radeon_context.c, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_context.h, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_compat.c, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_ioctl.c, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_ioctl.h, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_lock.c, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_lock.h, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_maos.c, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_maos.h, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_maos_vbtmp.h, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_sanity.c, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_sanity.h, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_screen.c, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_screen.h, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_span.c, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_span.h, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_state.c, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_state.h, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_state_init.c, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_swtcl.c, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_swtcl.h, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_tcl.c, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_tcl.h, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_tex.c, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_tex.h, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_texmem.c, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_texstate.c, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_vtxfmt.c, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_vtxfmt.h, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_vtxfmt_c.c, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_vtxfmt_x86.c, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_vtxtmp_x86.S, $(MESADRVSRCDIR)/radeon) -LinkSourceFile(radeon_vtxfmt_sse.c, $(MESADRVSRCDIR)/radeon) -#endif diff --git a/nx-X11/lib/GL/mesa/drivers/dri/savage/Imakefile b/nx-X11/lib/GL/mesa/drivers/dri/savage/Imakefile deleted file mode 100644 index 8a8c8338b..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/savage/Imakefile +++ /dev/null @@ -1,78 +0,0 @@ -XCOMM $XFree86$ - -#include - -#if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) -#define DoExtraLib SharedLibGlx -#define DoDebugLib DebugLibGlx -#define DoProfileLib ProfileLibGlx -#else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC -#define DoExtrasLib NO -#define DoDebugLib NO -#define DoProfileLib NO -#endif - -#define MesaDrvCommonBuildDir ../common/ -#include "../common/Imakefile.inc" -#include "../../../array_cache/Imakefile.inc" -#include "../../../main/Imakefile.inc" -#include "../../../math/Imakefile.inc" -#include "../../../shader/Imakefile.inc" -#include "../../../shader/grammar/Imakefile.inc" -#include "../../../shader/slang/Imakefile.inc" -#include "../../../shader/slang/library/Imakefile.inc" -#include "../../../swrast/Imakefile.inc" -#include "../../../swrast_setup/Imakefile.inc" -#include "../../../tnl/Imakefile.inc" -#include "../../../tnl_dd/Imakefile.inc" -#include "../../../Imakefile.inc" -#if defined(i386Architecture) && MesaUseX86Asm -#include "../../../x86/Imakefile.inc" -#endif -#ifdef SparcArchitecture -#include "../../../sparc/Imakefile.inc" -#endif -#define NeedToLinkMesaSrc -#include "Imakefile.inc" - - - - DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES) - INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) - - DRMOBJS = $(GLXLIBSRC)/dri/drm/xf86drm.o \ - $(GLXLIBSRC)/dri/drm/xf86drmHash.o \ - $(GLXLIBSRC)/dri/drm/xf86drmRandom.o \ - $(GLXLIBSRC)/dri/drm/xf86drmSL.o - - SRCS = $(SAVAGESRCS) - OBJS = $(DRMOBJS) $(COREMESAOBJS) \ - $(MESA_ASM_OBJS) $(COMMONOBJS) $(SAVAGEOBJS) - -REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) $(EXPATLIB) - -#include - -LibraryObjectRule() - -SubdirLibraryRule($(SAVAGEOBJS)) -NormalLintTarget($(SRCS)) - -#if !GlxUseBuiltInDRIDriver -LIBNAME = savage_dri.so -SharedDriModuleTarget($(LIBNAME),DONE $(OBJS),$(OBJS)) -InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) - -#ifdef GlxSoProf -SOPROF_LIBNAME = _savage_dri_p -NormalDepLibraryTarget($(SOPROF_LIBNAME),DONE $(OBJS),$(OBJS)) -InstallLibrary($(SOPROF_LIBNAME),$(MODULEDIR)/dri) -#endif -#endif - -DependTarget() - diff --git a/nx-X11/lib/GL/mesa/drivers/dri/savage/Imakefile.inc b/nx-X11/lib/GL/mesa/drivers/dri/savage/Imakefile.inc deleted file mode 100644 index 4548f3d29..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/savage/Imakefile.inc +++ /dev/null @@ -1,105 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/mga/Imakefile.inc,v 1.2 2001/05/02 15:06:03 dawes Exp $ - -#ifndef MesaDrvSrcDir -#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/src/drv -#endif - -MESADRVSRCDIR = MesaDrvSrcDir - -#ifndef MesaDrvSavageBuildDir -#define MesaDrvSavageBuildDir /**/ -#endif -MESADRVSAVAGEBUILDDIR = MesaDrvSavageBuildDir - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - -#if BuildXF86DRI - DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=ByteOrder -DIN_DRI_DRIVER - DRI_INCLUDES = -I$(GLXLIBSRC)/dri \ - -I$(XINCLUDESRC) \ - -I$(GLXLIBSRC)/glx \ - -I$(GLXLIBSRC)/include \ - -I$(SERVERSRC)/GL/dri \ - -I$(XF86COMSRC) \ - -I$(XF86OSSRC) \ - -I$(DRMSRCDIR)/shared-core \ - -I$(XF86DRIVERSRC)/savage \ - -I$(GLXLIBSRC)/dri/drm -#endif - -MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \ - -I$(MESASRCDIR)/src/mesa/main \ - -I$(MESASRCDIR)/src/mesa/glapi \ - -I$(MESASRCDIR)/src/mesa/shader \ - -I$(MESASRCDIR)/include \ - -I$(MESADRVSRCDIR)/common \ - -I$(MESADRVSRCDIR)/savage - X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) - - SAVAGESRCS = $(MESADRVMGABUILDDIR)savagedd.c \ - $(MESADRVMGABUILDDIR)savageioctl.c \ - $(MESADRVMGABUILDDIR)savagerender.c \ - $(MESADRVMGABUILDDIR)savagespan.c \ - $(MESADRVMGABUILDDIR)savagestate.c \ - $(MESADRVMGABUILDDIR)savagetex.c \ - $(MESADRVMGABUILDDIR)savagetris.c \ - $(MESADRVMGABUILDDIR)savage_xmesa.c - - SAVAGEOBJS = $(MESADRVMGABUILDDIR)savagedd.o \ - $(MESADRVMGABUILDDIR)savageioctl.o \ - $(MESADRVMGABUILDDIR)savagerender.o \ - $(MESADRVMGABUILDDIR)savagespan.o \ - $(MESADRVMGABUILDDIR)savagestate.o \ - $(MESADRVMGABUILDDIR)savagetex.o \ - $(MESADRVMGABUILDDIR)savagetris.o \ - $(MESADRVMGABUILDDIR)savage_xmesa.o - - SAVAGEUOBJS = $(MESADRVMGABUILDDIR)unshared/savagedd.o \ - $(MESADRVMGABUILDDIR)unshared/savageioctl.o \ - $(MESADRVMGABUILDDIR)unshared/savagerender.o \ - $(MESADRVMGABUILDDIR)unshared/savagespan.o \ - $(MESADRVMGABUILDDIR)unshared/savagestate.o \ - $(MESADRVMGABUILDDIR)unshared/savagetex.o \ - $(MESADRVMGABUILDDIR)unshared/savagetris.o \ - $(MESADRVMGABUILDDIR)unshared/savage_xmesa.o - - SAVAGEDOBJS = $(MESADRVMGABUILDDIR)debugger/savagedd.o \ - $(MESADRVMGABUILDDIR)debugger/savageioctl.o \ - $(MESADRVMGABUILDDIR)debugger/savagerender.o \ - $(MESADRVMGABUILDDIR)debugger/savagespan.o \ - $(MESADRVMGABUILDDIR)debugger/savagestate.o \ - $(MESADRVMGABUILDDIR)debugger/savagetex.o \ - $(MESADRVMGABUILDDIR)debugger/savagetris.o \ - $(MESADRVMGABUILDDIR)debugger/savage_xmesa.o - - SAVAGEPOBJS = $(MESADRVMGABUILDDIR)profiled/savagedd.o \ - $(MESADRVMGABUILDDIR)profiled/savageioctl.o \ - $(MESADRVMGABUILDDIR)profiled/savagerender.o \ - $(MESADRVMGABUILDDIR)profiled/savagespan.o \ - $(MESADRVMGABUILDDIR)profiled/savagestate.o \ - $(MESADRVMGABUILDDIR)profiled/savagetex.o \ - $(MESADRVMGABUILDDIR)profiled/savagetris.o \ - $(MESADRVMGABUILDDIR)profiled/savage_xmesa.o - -#ifdef NeedToLinkMesaSrc -LinkSourceFile(savage_3d_reg.h, $(MESADRVSRCDIR)/savage) -LinkSourceFile(savage_bci.h, $(MESADRVSRCDIR)/savage) -LinkSourceFile(savagecontext.h, $(MESADRVSRCDIR)/savage) -LinkSourceFile(savagedd.c, $(MESADRVSRCDIR)/savage) -LinkSourceFile(savagedd.h, $(MESADRVSRCDIR)/savage) -LinkSourceFile(savage_init.h, $(MESADRVSRCDIR)/savage) -LinkSourceFile(savageioctl.c, $(MESADRVSRCDIR)/savage) -LinkSourceFile(savageioctl.h, $(MESADRVSRCDIR)/savage) -LinkSourceFile(savagerender.c, $(MESADRVSRCDIR)/savage) -LinkSourceFile(savagespan.c, $(MESADRVSRCDIR)/savage) -LinkSourceFile(savagespan.h, $(MESADRVSRCDIR)/savage) -LinkSourceFile(savagestate.c, $(MESADRVSRCDIR)/savage) -LinkSourceFile(savagestate.h, $(MESADRVSRCDIR)/savage) -LinkSourceFile(savagetex.c, $(MESADRVSRCDIR)/savage) -LinkSourceFile(savagetex.h, $(MESADRVSRCDIR)/savage) -LinkSourceFile(savagetris.c, $(MESADRVSRCDIR)/savage) -LinkSourceFile(savagetris.h, $(MESADRVSRCDIR)/savage) -LinkSourceFile(savage_xmesa.c, $(MESADRVSRCDIR)/savage) -#endif diff --git a/nx-X11/lib/GL/mesa/drivers/dri/sis/Imakefile b/nx-X11/lib/GL/mesa/drivers/dri/sis/Imakefile deleted file mode 100644 index c06601de1..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/sis/Imakefile +++ /dev/null @@ -1,80 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/sis/Imakefile,v 1.22 2002/11/25 14:04:52 eich Exp $ - -#include - -#if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) -#define DoExtraLib SharedLibGlx -#define DoDebugLib DebugLibGlx -#define DoProfileLib ProfileLibGlx -#else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC -#define DoExtrasLib NO -#define DoDebugLib NO -#define DoProfileLib NO -#endif - -#define MesaDrvCommonBuildDir ../common/ -#include "../common/Imakefile.inc" -#include "../../../array_cache/Imakefile.inc" -#include "../../../main/Imakefile.inc" -#include "../../../math/Imakefile.inc" -#include "../../../shader/Imakefile.inc" -#include "../../../shader/grammar/Imakefile.inc" -#include "../../../shader/slang/Imakefile.inc" -#include "../../../shader/slang/library/Imakefile.inc" -#include "../../../swrast/Imakefile.inc" -#include "../../../swrast_setup/Imakefile.inc" -#include "../../../tnl/Imakefile.inc" -#include "../../../tnl_dd/Imakefile.inc" -#include "../../../Imakefile.inc" -#if defined(i386Architecture) && MesaUseX86Asm -#include "../../../x86/Imakefile.inc" -#endif -#ifdef SparcArchitecture -#include "../../../sparc/Imakefile.inc" -#endif -#define NeedToLinkMesaSrc -#include "Imakefile.inc" - -XCOMM DEBUG_DEFINES = -DDEBUG_LOCKING -XCOMM DEBUG_DEFINES = -DSIS_DEBUG - - DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES) \ - $(DEBUG_DEFINES) - INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) - - DRMOBJS = $(GLXLIBSRC)/dri/drm/xf86drm.o \ - $(GLXLIBSRC)/dri/drm/xf86drmHash.o \ - $(GLXLIBSRC)/dri/drm/xf86drmRandom.o \ - $(GLXLIBSRC)/dri/drm/xf86drmSL.o - - SRCS = $(SISSRCS) - OBJS = $(DRMOBJS) $(COREMESAOBJS) \ - $(MESA_ASM_OBJS) $(COMMONOBJS) $(SISOBJS) - -REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) $(EXPATLIB) - -#include - -LibraryObjectRule() - -SubdirLibraryRule($(SISOBJS)) -NormalLintTarget($(SRCS)) - -#if !GlxUseBuiltInDRIDriver -LIBNAME = sis_dri.so -SharedDriModuleTarget($(LIBNAME),DONE $(OBJS),$(OBJS)) -InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) - -#ifdef GlxSoProf -SOPROF_LIBNAME = _sis_dri_p -NormalDepLibraryTarget($(SOPROF_LIBNAME),DONE $(OBJS),$(OBJS)) -InstallLibrary($(SOPROF_LIBNAME),$(MODULEDIR)/dri) -#endif -#endif - -DependTarget() - diff --git a/nx-X11/lib/GL/mesa/drivers/dri/sis/Imakefile.inc b/nx-X11/lib/GL/mesa/drivers/dri/sis/Imakefile.inc deleted file mode 100644 index 8aa776f08..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/sis/Imakefile.inc +++ /dev/null @@ -1,156 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/sis/Imakefile.inc,v 1.1 2001/03/23 19:18:43 dawes Exp $ - -#ifndef MesaDrvSrcDir -#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri -#endif - -MESADRVSRCDIR = MesaDrvSrcDir - -#ifndef MesaDrvSisBuildDir -#define MesaDrvSisBuildDir /**/ -#endif -MESADRVSISBUILDDIR = MesaDrvSisBuildDir - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - -#if BuildXF86DRI - DRI_DEFINES = GlxDefines $(SIS_DEFINES) -DX_BYTE_ORDER=$(X_BYTE_ORDER) -DIN_DRI_DRIVER - DRI_INCLUDES = -I$(GLXLIBSRC)/dri \ - -I$(XINCLUDESRC) \ - -I$(GLXLIBSRC)/glx \ - -I$(GLXLIBSRC)/include \ - -I$(SERVERSRC)/GL/dri \ - -I$(XF86OSSRC) \ - -I$(DRMSRCDIR)/shared-core \ - -I$(XF86DRIVERSRC)/sis \ - -I$(GLXLIBSRC)/dri/drm -#endif - -MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \ - -I$(MESASRCDIR)/src/mesa/main \ - -I$(MESASRCDIR)/src/mesa/glapi \ - -I$(MESASRCDIR)/src/mesa/shader \ - -I$(MESASRCDIR)/include \ - -I$(MESADRVSRCDIR)/common \ - -I$(MESADRVSRCDIR)/sis - X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) - -#if 0 - DEBUG_SRC = $(MESADRVSISBUILDDIR)sis_debug.c - DEBUG_OBJ = $(MESADRVSISBUILDDIR)sis_debug.o - DEBUG_UOBJ = $(MESADRVSISBUILDDIR)unshared/sis_debug.o - DEBUG_DOBJ = $(MESADRVSISBUILDDIR)debugger/sis_debug.o - DEBUG_POBJ = $(MESADRVSISBUILDDIR)profiled/sis_debug.o - DEBUG_DEFINES += -DSIS_DUMP -#ifdef NeedToLinkMesaSrc -LinkSourceFile(sis_debug.c, $(MESADRVSRCDIR)/sis) -#endif -#endif - - SISSRCS = $(MESADRVSISBUILDDIR)sis_alloc.c \ - $(MESADRVSISBUILDDIR)sis_dd.c \ - $(MESADRVSISBUILDDIR)sis_lock.c \ - $(MESADRVSISBUILDDIR)sis_context.c \ - $(MESADRVSISBUILDDIR)sis_fog.c \ - $(MESADRVSISBUILDDIR)sis_clear.c \ - $(MESADRVSISBUILDDIR)sis_screen.c \ - $(MESADRVSISBUILDDIR)sis_state.c \ - $(MESADRVSISBUILDDIR)sis_stencil.c \ - $(MESADRVSISBUILDDIR)sis_span.c \ - $(MESADRVSISBUILDDIR)sis_tex.c \ - $(MESADRVSISBUILDDIR)sis_texstate.c \ - $(MESADRVSISBUILDDIR)sis_tris.c \ - $(DEBUG_SRC) - - SISOBJS = $(MESADRVSISBUILDDIR)sis_alloc.o \ - $(MESADRVSISBUILDDIR)sis_dd.o \ - $(MESADRVSISBUILDDIR)sis_lock.o \ - $(MESADRVSISBUILDDIR)sis_context.o \ - $(MESADRVSISBUILDDIR)sis_fog.o \ - $(MESADRVSISBUILDDIR)sis_clear.o \ - $(MESADRVSISBUILDDIR)sis_screen.o \ - $(MESADRVSISBUILDDIR)sis_state.o \ - $(MESADRVSISBUILDDIR)sis_stencil.o \ - $(MESADRVSISBUILDDIR)sis_span.o \ - $(MESADRVSISBUILDDIR)sis_tex.o \ - $(MESADRVSISBUILDDIR)sis_texstate.o \ - $(MESADRVSISBUILDDIR)sis_tris.o \ - $(DEBUG_OBJ) - - SISUOBJS = $(MESADRVSISBUILDDIR)unshared/sis_alloc.o \ - $(MESADRVSISBUILDDIR)unshared/sis_dd.o \ - $(MESADRVSISBUILDDIR)unshared/sis_lock.o \ - $(MESADRVSISBUILDDIR)unshared/sis_context.o \ - $(MESADRVSISBUILDDIR)unshared/sis_fog.o \ - $(MESADRVSISBUILDDIR)unshared/sis_clear.o \ - $(MESADRVSISBUILDDIR)unshared/sis_screen.o \ - $(MESADRVSISBUILDDIR)unshared/sis_state.o \ - $(MESADRVSISBUILDDIR)unshared/sis_stencil.o \ - $(MESADRVSISBUILDDIR)unshared/sis_span.o \ - $(MESADRVSISBUILDDIR)unshared/sis_tex.o \ - $(MESADRVSISBUILDDIR)unshared/sis_texstate.o \ - $(MESADRVSISBUILDDIR)unshared/sis_tris.o \ - $(DEBUG_UOBJ) - - SISDOBJS = $(MESADRVSISBUILDDIR)debugger/sis_alloc.o \ - $(MESADRVSISBUILDDIR)debugger/sis_dd.o \ - $(MESADRVSISBUILDDIR)debugger/sis_lock.o \ - $(MESADRVSISBUILDDIR)debugger/sis_context.o \ - $(MESADRVSISBUILDDIR)debugger/sis_fog.o \ - $(MESADRVSISBUILDDIR)debugger/sis_clear.o \ - $(MESADRVSISBUILDDIR)debugger/sis_screen.o \ - $(MESADRVSISBUILDDIR)debugger/sis_state.o \ - $(MESADRVSISBUILDDIR)debugger/sis_stencil.o \ - $(MESADRVSISBUILDDIR)debugger/sis_span.o \ - $(MESADRVSISBUILDDIR)debugger/sis_tex.o \ - $(MESADRVSISBUILDDIR)debugger/sis_texstate.o \ - $(MESADRVSISBUILDDIR)debugger/sis_tris.o \ - $(DEBUG_DOBJ) - - SISPOBJS = $(MESADRVSISBUILDDIR)profiled/sis_alloc.o \ - $(MESADRVSISBUILDDIR)profiled/sis_dd.o \ - $(MESADRVSISBUILDDIR)profiled/sis_lock.o \ - $(MESADRVSISBUILDDIR)profiled/sis_context.o \ - $(MESADRVSISBUILDDIR)profiled/sis_fog.o \ - $(MESADRVSISBUILDDIR)profiled/sis_clear.o \ - $(MESADRVSISBUILDDIR)profiled/sis_screen.o \ - $(MESADRVSISBUILDDIR)profiled/sis_state.o \ - $(MESADRVSISBUILDDIR)profiled/sis_stencil.o \ - $(MESADRVSISBUILDDIR)profiled/sis_span.o \ - $(MESADRVSISBUILDDIR)profiled/sis_tex.o \ - $(MESADRVSISBUILDDIR)profiled/sis_texstate.o \ - $(MESADRVSISBUILDDIR)profiled/sis_tris.o \ - $(DEBUG_POBJ) - -#ifdef NeedToLinkMesaSrc -LinkSourceFile(sis_alloc.c, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_alloc.h, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_common2.h, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_context.h, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_dd.c, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_dd.h, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_debug.c, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_debug.h, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_lock.c, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_lock.h, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_context.c, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_fog.c, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_clear.c, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_reg.h, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_screen.c, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_screen.h, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_state.c, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_state.h, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_stencil.c, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_stencil.h, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_span.c, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_span.h, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_tex.c, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_tex.h, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_texstate.c, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_tris.c, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_tris.h, $(MESADRVSRCDIR)/sis) -LinkSourceFile(sis_tritmp.h, $(MESADRVSRCDIR)/sis) -#endif diff --git a/nx-X11/lib/GL/mesa/drivers/dri/tdfx/Imakefile b/nx-X11/lib/GL/mesa/drivers/dri/tdfx/Imakefile deleted file mode 100644 index 2e4c457e2..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/tdfx/Imakefile +++ /dev/null @@ -1,76 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/tdfx/Imakefile,v 1.30 2002/02/23 00:45:51 dawes Exp $ - -#include - -#if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) -#define DoExtraLib SharedLibGlx -#define DoDebugLib DebugLibGlx -#define DoProfileLib ProfileLibGlx -#else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC -#define DoExtrasLib NO -#define DoDebugLib NO -#define DoProfileLib NO -#endif - -#define MesaDrvCommonBuildDir ../common/ -#include "../common/Imakefile.inc" -#include "../../../array_cache/Imakefile.inc" -#include "../../../main/Imakefile.inc" -#include "../../../math/Imakefile.inc" -#include "../../../shader/Imakefile.inc" -#include "../../../shader/grammar/Imakefile.inc" -#include "../../../shader/slang/Imakefile.inc" -#include "../../../shader/slang/library/Imakefile.inc" -#include "../../../swrast/Imakefile.inc" -#include "../../../swrast_setup/Imakefile.inc" -#include "../../../tnl/Imakefile.inc" -#include "../../../tnl_dd/Imakefile.inc" -#include "../../../Imakefile.inc" -#if defined(i386Architecture) && MesaUseX86Asm -#include "../../../x86/Imakefile.inc" -#endif -#ifdef SparcArchitecture -#include "../../../sparc/Imakefile.inc" -#endif -#define NeedToLinkMesaSrc -#include "Imakefile.inc" - - DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES) - INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) - - DRMOBJS = $(GLXLIBSRC)/dri/drm/xf86drm.o \ - $(GLXLIBSRC)/dri/drm/xf86drmHash.o \ - $(GLXLIBSRC)/dri/drm/xf86drmRandom.o \ - $(GLXLIBSRC)/dri/drm/xf86drmSL.o - - SRCS = $(TDFXSRCS) - OBJS = $(DRMOBJS) $(COREMESAOBJS) \ - $(MESA_ASM_OBJS) $(TDFXOBJS) $(COMMONOBJS) - -REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) $(EXPATLIB) - -#include - -LibraryObjectRule() - -SubdirLibraryRule($(TDFXOBJS)) -NormalLintTarget($(SRCS)) - -#if !GlxUseBuiltInDRIDriver -LIBNAME = tdfx_dri.so -SharedDriModuleTarget($(LIBNAME),DONE $(OBJS),$(OBJS)) -InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) - -#ifdef GlxSoProf -SOPROF_LIBNAME = _tdfx_dri_p -NormalDepLibraryTarget($(SOPROF_LIBNAME),DONE $(OBJS),$(OBJS)) -InstallLibrary($(SOPROF_LIBNAME),$(MODULEDIR)/dri) -#endif -#endif - -DependTarget() - diff --git a/nx-X11/lib/GL/mesa/drivers/dri/tdfx/Imakefile.inc b/nx-X11/lib/GL/mesa/drivers/dri/tdfx/Imakefile.inc deleted file mode 100644 index 87d31fc31..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/tdfx/Imakefile.inc +++ /dev/null @@ -1,140 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/tdfx/Imakefile.inc,v 1.1 2001/03/23 19:18:44 dawes Exp $ - -#ifndef MesaDrvSrcDir -#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri -#endif - -MESADRVSRCDIR = MesaDrvSrcDir - -#ifndef MesaDrvTdfxBuildDir -#define MesaDrvTdfxBuildDir /**/ -#endif -MESADRVTDFXBUILDDIR = MesaDrvTdfxBuildDir - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - -#if BuildXF86DRI - DRI_DEFINES = GlxDefines -DX_BYTE_ORDER=ByteOrder -DUSE_NEW_INTERFACE -DIN_DRI_DRIVER - DRI_INCLUDES = -I$(GLXLIBSRC)/dri \ - -I$(XINCLUDESRC) \ - -I$(GLXLIBSRC)/glx \ - -I$(GLXLIBSRC)/include \ - -I$(SERVERSRC)/GL/dri \ - -I$(XF86OSSRC) \ - -I$(DRMSRCDIR)/shared-core \ - -I$(XF86DRIVERSRC)/tdfx \ - -I$(GLXLIBSRC)/dri/drm -#endif - -MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \ - -I$(MESASRCDIR)/src/mesa/main \ - -I$(MESASRCDIR)/src/mesa/glapi \ - -I$(MESASRCDIR)/src/mesa/shader \ - -I$(MESASRCDIR)/include \ - -I$(MESADRVSRCDIR)/common \ - -I$(MESADRVSRCDIR)/tdfx - X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) - - TDFXSRCS = $(MESADRVTDFXBUILDDIR)tdfx_context.c \ - $(MESADRVTDFXBUILDDIR)tdfx_dd.c \ - $(MESADRVTDFXBUILDDIR)tdfx_lock.c \ - $(MESADRVTDFXBUILDDIR)tdfx_pixels.c \ - $(MESADRVTDFXBUILDDIR)tdfx_render.c \ - $(MESADRVTDFXBUILDDIR)tdfx_screen.c \ - $(MESADRVTDFXBUILDDIR)tdfx_span.c \ - $(MESADRVTDFXBUILDDIR)tdfx_state.c \ - $(MESADRVTDFXBUILDDIR)tdfx_tex.c \ - $(MESADRVTDFXBUILDDIR)tdfx_texman.c \ - $(MESADRVTDFXBUILDDIR)tdfx_texstate.c \ - $(MESADRVTDFXBUILDDIR)tdfx_tris.c \ - $(MESADRVTDFXBUILDDIR)tdfx_vb.c - - TDFXOBJS = $(MESADRVTDFXBUILDDIR)tdfx_context.o \ - $(MESADRVTDFXBUILDDIR)tdfx_dd.o \ - $(MESADRVTDFXBUILDDIR)tdfx_lock.o \ - $(MESADRVTDFXBUILDDIR)tdfx_pixels.o \ - $(MESADRVTDFXBUILDDIR)tdfx_render.o \ - $(MESADRVTDFXBUILDDIR)tdfx_screen.o \ - $(MESADRVTDFXBUILDDIR)tdfx_span.o \ - $(MESADRVTDFXBUILDDIR)tdfx_state.o \ - $(MESADRVTDFXBUILDDIR)tdfx_tex.o \ - $(MESADRVTDFXBUILDDIR)tdfx_texman.o \ - $(MESADRVTDFXBUILDDIR)tdfx_texstate.o \ - $(MESADRVTDFXBUILDDIR)tdfx_tris.o \ - $(MESADRVTDFXBUILDDIR)tdfx_vb.o - - TDFXUOBJS = $(MESADRVTDFXBUILDDIR)unshared/tdfx_context.o \ - $(MESADRVTDFXBUILDDIR)unshared/tdfx_dd.o \ - $(MESADRVTDFXBUILDDIR)unshared/tdfx_lock.o \ - $(MESADRVTDFXBUILDDIR)unshared/tdfx_pixels.o \ - $(MESADRVTDFXBUILDDIR)unshared/tdfx_render.o \ - $(MESADRVTDFXBUILDDIR)unshared/tdfx_screen.o \ - $(MESADRVTDFXBUILDDIR)unshared/tdfx_span.o \ - $(MESADRVTDFXBUILDDIR)unshared/tdfx_state.o \ - $(MESADRVTDFXBUILDDIR)unshared/tdfx_tex.o \ - $(MESADRVTDFXBUILDDIR)unshared/tdfx_texman.o \ - $(MESADRVTDFXBUILDDIR)unshared/tdfx_texstate.o \ - $(MESADRVTDFXBUILDDIR)unshared/tdfx_tris.o \ - $(MESADRVTDFXBUILDDIR)unshared/tdfx_vb.o - - TDFXDOBJS = $(MESADRVTDFXBUILDDIR)debugger/tdfx_context.o \ - $(MESADRVTDFXBUILDDIR)debugger/tdfx_dd.o \ - $(MESADRVTDFXBUILDDIR)debugger/tdfx_lock.o \ - $(MESADRVTDFXBUILDDIR)debugger/tdfx_pixels.o \ - $(MESADRVTDFXBUILDDIR)debugger/tdfx_render.o \ - $(MESADRVTDFXBUILDDIR)debugger/tdfx_screen.o \ - $(MESADRVTDFXBUILDDIR)debugger/tdfx_span.o \ - $(MESADRVTDFXBUILDDIR)debugger/tdfx_state.o \ - $(MESADRVTDFXBUILDDIR)debugger/tdfx_tex.o \ - $(MESADRVTDFXBUILDDIR)debugger/tdfx_texman.o \ - $(MESADRVTDFXBUILDDIR)debugger/tdfx_texstate.o \ - $(MESADRVTDFXBUILDDIR)debugger/tdfx_tris.o \ - $(MESADRVTDFXBUILDDIR)debugger/tdfx_vb.o - - TDFXPOBJS = $(MESADRVTDFXBUILDDIR)profiled/tdfx_context.o \ - $(MESADRVTDFXBUILDDIR)profiled/tdfx_dd.o \ - $(MESADRVTDFXBUILDDIR)profiled/tdfx_lock.o \ - $(MESADRVTDFXBUILDDIR)profiled/tdfx_pixels.o \ - $(MESADRVTDFXBUILDDIR)profiled/tdfx_render.o \ - $(MESADRVTDFXBUILDDIR)profiled/tdfx_screen.o \ - $(MESADRVTDFXBUILDDIR)profiled/tdfx_span.o \ - $(MESADRVTDFXBUILDDIR)profiled/tdfx_state.o \ - $(MESADRVTDFXBUILDDIR)profiled/tdfx_tex.o \ - $(MESADRVTDFXBUILDDIR)profiled/tdfx_texman.o \ - $(MESADRVTDFXBUILDDIR)profiled/tdfx_texstate.o \ - $(MESADRVTDFXBUILDDIR)profiled/tdfx_tris.o \ - $(MESADRVTDFXBUILDDIR)profiled/tdfx_vb.o - -#ifdef NeedToLinkMesaSrc -LinkSourceFile(dri_glide.h, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_context.c, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_context.h, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_dd.c, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_dd.h, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_glide.h, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_lock.c, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_lock.h, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_pixels.c, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_pixels.h, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_render.c, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_render.h, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_screen.c, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_screen.h, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_span.c, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_span.h, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_state.c, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_state.h, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_tex.c, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_tex.h, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_texman.c, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_texman.h, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_texstate.c, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_texstate.h, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_tris.c, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_tris.h, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_vb.c, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_vb.h, $(MESADRVSRCDIR)/tdfx) -LinkSourceFile(tdfx_vbtmp.h, $(MESADRVSRCDIR)/tdfx) -#endif diff --git a/nx-X11/lib/GL/mesa/drivers/dri/unichrome/Imakefile b/nx-X11/lib/GL/mesa/drivers/dri/unichrome/Imakefile deleted file mode 100644 index 273e2ca6f..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/unichrome/Imakefile +++ /dev/null @@ -1,80 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/via/Imakefile,v 1.22 2002/11/25 14:04:52 eich Exp $ - -#include - -#if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) -#define DoExtraLib SharedLibGlx -#define DoDebugLib DebugLibGlx -#define DoProfileLib ProfileLibGlx -#else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC -#define DoExtrasLib NO -#define DoDebugLib NO -#define DoProfileLib NO -#endif - -#define MesaDrvCommonBuildDir ../common/ -#include "../common/Imakefile.inc" -#include "../../../array_cache/Imakefile.inc" -#include "../../../main/Imakefile.inc" -#include "../../../math/Imakefile.inc" -#include "../../../shader/Imakefile.inc" -#include "../../../shader/grammar/Imakefile.inc" -#include "../../../shader/slang/Imakefile.inc" -#include "../../../shader/slang/library/Imakefile.inc" -#include "../../../swrast/Imakefile.inc" -#include "../../../swrast_setup/Imakefile.inc" -#include "../../../tnl/Imakefile.inc" -#include "../../../tnl_dd/Imakefile.inc" -#include "../../../Imakefile.inc" -#if defined(i386Architecture) && MesaUseX86Asm -#include "../../../x86/Imakefile.inc" -#endif -#ifdef SparcArchitecture -#include "../../../sparc/Imakefile.inc" -#endif -#define NeedToLinkMesaSrc -#include "Imakefile.inc" - -XCOMM DEBUG_DEFINES = -DDEBUG_LOCKING -XCOMM DEBUG_DEFINES = -DVIA_DEBUG - - DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES) \ - $(DEBUG_DEFINES) - INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) - - DRMOBJS = $(GLXLIBSRC)/dri/drm/xf86drm.o \ - $(GLXLIBSRC)/dri/drm/xf86drmHash.o \ - $(GLXLIBSRC)/dri/drm/xf86drmRandom.o \ - $(GLXLIBSRC)/dri/drm/xf86drmSL.o - - SRCS = $(VIASRCS) - OBJS = $(DRMOBJS) $(COREMESAOBJS) \ - $(MESA_ASM_OBJS) $(COMMONOBJS) $(VIAOBJS) - -REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) $(EXPATLIB) - -#include - -LibraryObjectRule() - -SubdirLibraryRule($(VIAOBJS)) -NormalLintTarget($(SRCS)) - -#if !GlxUseBuiltInDRIDriver -LIBNAME = unichrome_dri.so -SharedDriModuleTarget($(LIBNAME),DONE $(OBJS),$(OBJS)) -InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) - -#ifdef GlxSoProf -SOPROF_LIBNAME = _unichrome_dri_p -NormalDepLibraryTarget($(SOPROF_LIBNAME),DONE $(OBJS),$(OBJS)) -InstallLibrary($(SOPROF_LIBNAME),$(MODULEDIR)/dri) -#endif -#endif - -DependTarget() - diff --git a/nx-X11/lib/GL/mesa/drivers/dri/unichrome/Imakefile.inc b/nx-X11/lib/GL/mesa/drivers/dri/unichrome/Imakefile.inc deleted file mode 100644 index 02916ee93..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/unichrome/Imakefile.inc +++ /dev/null @@ -1,123 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/via/Imakefile.inc,v 1.1 2001/03/23 19:18:43 dawes Exp $ - -#ifndef MesaDrvSrcDir -#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri -#endif - -MESADRVSRCDIR = MesaDrvSrcDir - -#ifndef MesaDrvViaBuildDir -#define MesaDrvViaBuildDir /**/ -#endif -MESADRVVIABUILDDIR = MesaDrvViaBuildDir - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - -#if BuildXF86DRI - DRI_DEFINES = GlxDefines $(VIA_DEFINES) -DX_BYTE_ORDER=$(X_BYTE_ORDER) -DIN_DRI_DRIVER - DRI_INCLUDES = -I$(GLXLIBSRC)/dri \ - -I$(XINCLUDESRC) \ - -I$(GLXLIBSRC)/glx \ - -I$(GLXLIBSRC)/include \ - -I$(SERVERSRC)/GL/dri \ - -I$(XF86COMSRC) \ - -I$(XF86OSSRC) \ - -I$(DRMSRCDIR)/shared-core \ - -I$(XF86DRIVERSRC)/via \ - -I$(GLXLIBSRC)/dri/drm -#endif - -MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \ - -I$(MESASRCDIR)/src/mesa/main \ - -I$(MESASRCDIR)/src/mesa/glapi \ - -I$(MESASRCDIR)/src/mesa/shader \ - -I$(MESASRCDIR)/include \ - -I$(MESADRVSRCDIR)/common \ - -I$(MESADRVSRCDIR)/unichrome - X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) - - - VIASRCS = $(MESADRVVIABUILDDIR)via_context.c \ - $(MESADRVVIABUILDDIR)via_fb.c \ - $(MESADRVVIABUILDDIR)via_ioctl.c \ - $(MESADRVVIABUILDDIR)via_memcpy.c \ - $(MESADRVVIABUILDDIR)via_render.c \ - $(MESADRVVIABUILDDIR)via_screen.c \ - $(MESADRVVIABUILDDIR)via_span.c \ - $(MESADRVVIABUILDDIR)via_state.c \ - $(MESADRVVIABUILDDIR)via_tex.c \ - $(MESADRVVIABUILDDIR)via_texcombine.c \ - $(MESADRVVIABUILDDIR)via_tris.c - - VIAOBJS =$(MESADRVVIABUILDDIR)via_context.o \ - $(MESADRVVIABUILDDIR)via_fb.o \ - $(MESADRVVIABUILDDIR)via_ioctl.o \ - $(MESADRVVIABUILDDIR)via_memcpy.o \ - $(MESADRVVIABUILDDIR)via_render.o \ - $(MESADRVVIABUILDDIR)via_screen.o \ - $(MESADRVVIABUILDDIR)via_span.o \ - $(MESADRVVIABUILDDIR)via_state.o \ - $(MESADRVVIABUILDDIR)via_tex.o \ - $(MESADRVVIABUILDDIR)via_texcombine.o \ - $(MESADRVVIABUILDDIR)via_tris.o - - VIAUOBJS =$(MESADRVVIABUILDDIR)/unshared/via_context.o \ - $(MESADRVVIABUILDDIR)/unshared/via_fb.o \ - $(MESADRVVIABUILDDIR)/unshared/via_ioctl.o \ - $(MESADRVVIABUILDDIR)/unshared/via_memcpy.o \ - $(MESADRVVIABUILDDIR)/unshared/via_render.o \ - $(MESADRVVIABUILDDIR)/unshared/via_screen.o \ - $(MESADRVVIABUILDDIR)/unshared/via_span.o \ - $(MESADRVVIABUILDDIR)/unshared/via_state.o \ - $(MESADRVVIABUILDDIR)/unshared/via_tex.o \ - $(MESADRVVIABUILDDIR)/unshared/via_texcombine.o \ - $(MESADRVVIABUILDDIR)/unshared/via_tris.o - - VIADOBJS =$(MESADRVVIABUILDDIR)/debugger/via_context.o \ - $(MESADRVVIABUILDDIR)/debugger/via_fb.o \ - $(MESADRVVIABUILDDIR)/debugger/via_ioctl.o \ - $(MESADRVVIABUILDDIR)/debugger/via_memcpy.o \ - $(MESADRVVIABUILDDIR)/debugger/via_render.o \ - $(MESADRVVIABUILDDIR)/debugger/via_screen.o \ - $(MESADRVVIABUILDDIR)/debugger/via_span.o \ - $(MESADRVVIABUILDDIR)/debugger/via_state.o \ - $(MESADRVVIABUILDDIR)/debugger/via_tex.o \ - $(MESADRVVIABUILDDIR)/debugger/via_texcombine.o \ - $(MESADRVVIABUILDDIR)/debugger/via_tris.o - - VIAPOBJS =$(MESADRVVIABUILDDIR)/profiled/via_context.o \ - $(MESADRVVIABUILDDIR)/profiled/via_fb.o \ - $(MESADRVVIABUILDDIR)/profiled/via_ioctl.o \ - $(MESADRVVIABUILDDIR)/profiled/via_memcpy.o \ - $(MESADRVVIABUILDDIR)/profiled/via_render.o \ - $(MESADRVVIABUILDDIR)/profiled/via_screen.o \ - $(MESADRVVIABUILDDIR)/profiled/via_span.o \ - $(MESADRVVIABUILDDIR)/profiled/via_state.o \ - $(MESADRVVIABUILDDIR)/profiled/via_tex.o \ - $(MESADRVVIABUILDDIR)/profiled/via_texcombine.o \ - $(MESADRVVIABUILDDIR)/profiled/via_tris.o - -#ifdef NeedToLinkMesaSrc -LinkSourceFile(via_3d_reg.h, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_context.c, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_context.h, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_fb.c, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_fb.h, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_ioctl.c, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_ioctl.h, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_memcpy.c, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_render.c, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_screen.c, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_screen.h, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_span.c, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_span.h, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_state.c, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_state.h, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_tex.c, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_texcombine.c, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_tex.h, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_tris.c, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_tris.h, $(MESADRVSRCDIR)/unichrome) -#endif diff --git a/nx-X11/lib/GL/mesa/drivers/dri/via/Imakefile b/nx-X11/lib/GL/mesa/drivers/dri/via/Imakefile deleted file mode 100644 index f92da2401..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/via/Imakefile +++ /dev/null @@ -1,80 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/via/Imakefile,v 1.22 2002/11/25 14:04:52 eich Exp $ - -#include - -#if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) -#define DoExtraLib SharedLibGlx -#define DoDebugLib DebugLibGlx -#define DoProfileLib ProfileLibGlx -#else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC -#define DoExtrasLib NO -#define DoDebugLib NO -#define DoProfileLib NO -#endif - -#define MesaDrvCommonBuildDir ../common/ -#include "../common/Imakefile.inc" -#include "../../../array_cache/Imakefile.inc" -#include "../../../main/Imakefile.inc" -#include "../../../math/Imakefile.inc" -#include "../../../shader/Imakefile.inc" -#include "../../../shader/grammar/Imakefile.inc" -#include "../../../shader/slang/Imakefile.inc" -#include "../../../shader/slang/library/Imakefile.inc" -#include "../../../swrast/Imakefile.inc" -#include "../../../swrast_setup/Imakefile.inc" -#include "../../../tnl/Imakefile.inc" -#include "../../../tnl_dd/Imakefile.inc" -#include "../../../Imakefile.inc" -#if defined(i386Architecture) && MesaUseX86Asm -#include "../../../x86/Imakefile.inc" -#endif -#ifdef SparcArchitecture -#include "../../../sparc/Imakefile.inc" -#endif -#define NeedToLinkMesaSrc -#include "Imakefile.inc" - -XCOMM DEBUG_DEFINES = -DDEBUG_LOCKING -XCOMM DEBUG_DEFINES = -DVIA_DEBUG - - DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES) \ - $(DEBUG_DEFINES) - INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) - - DRMOBJS = $(GLXLIBSRC)/dri/drm/xf86drm.o \ - $(GLXLIBSRC)/dri/drm/xf86drmHash.o \ - $(GLXLIBSRC)/dri/drm/xf86drmRandom.o \ - $(GLXLIBSRC)/dri/drm/xf86drmSL.o - - SRCS = $(VIASRCS) - OBJS = $(DRMOBJS) $(COREMESAOBJS) \ - $(MESA_ASM_OBJS) $(COMMONOBJS) $(VIAOBJS) - -REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) $(XONLYLIB) $(EXPATLIB) - -#include - -LibraryObjectRule() - -SubdirLibraryRule($(VIAOBJS)) -NormalLintTarget($(SRCS)) - -#if !GlxUseBuiltInDRIDriver -LIBNAME = via_dri.so -SharedDriModuleTarget($(LIBNAME),DONE $(OBJS),$(OBJS)) -InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) - -#ifdef GlxSoProf -SOPROF_LIBNAME = _via_dri_p -NormalDepLibraryTarget($(SOPROF_LIBNAME),DONE $(OBJS),$(OBJS)) -InstallLibrary($(SOPROF_LIBNAME),$(MODULEDIR)/dri) -#endif -#endif - -DependTarget() - diff --git a/nx-X11/lib/GL/mesa/drivers/dri/via/Imakefile.inc b/nx-X11/lib/GL/mesa/drivers/dri/via/Imakefile.inc deleted file mode 100644 index 9cfe68a75..000000000 --- a/nx-X11/lib/GL/mesa/drivers/dri/via/Imakefile.inc +++ /dev/null @@ -1,158 +0,0 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/via/Imakefile.inc,v 1.1 2001/03/23 19:18:43 dawes Exp $ - -#ifndef MesaDrvSrcDir -#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri -#endif - -MESADRVSRCDIR = MesaDrvSrcDir - -#ifndef MesaDrvViaBuildDir -#define MesaDrvViaBuildDir /**/ -#endif -MESADRVVIABUILDDIR = MesaDrvViaBuildDir - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - -#if BuildXF86DRI - DRI_DEFINES = GlxDefines $(VIA_DEFINES) -DX_BYTE_ORDER=$(X_BYTE_ORDER) -DIN_DRI_DRIVER - DRI_INCLUDES = -I$(GLXLIBSRC)/dri \ - -I$(XINCLUDESRC) \ - -I$(GLXLIBSRC)/glx \ - -I$(GLXLIBSRC)/include \ - -I$(SERVERSRC)/GL/dri \ - -I$(XF86OSSRC) \ - -I$(DRMSRCDIR)/shared-core \ - -I$(XF86DRIVERSRC)/via \ - -I$(GLXLIBSRC)/dri/drm -#endif - -MESA_INCLUDES = -I$(MESASRCDIR)/src/mesa \ - -I$(MESASRCDIR)/src/mesa/main \ - -I$(MESASRCDIR)/src/mesa/glapi \ - -I$(MESASRCDIR)/src/mesa/shader \ - -I$(MESASRCDIR)/include \ - -I$(MESADRVSRCDIR)/common \ - -I$(MESADRVSRCDIR)/unichrome - X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) - -#if 0 - DEBUG_SRC = $(MESADRVVIABUILDDIR)via_debug.c - DEBUG_OBJ = $(MESADRVVIABUILDDIR)via_debug.o - DEBUG_UOBJ = $(MESADRVVIABUILDDIR)unshared/via_debug.o - DEBUG_DOBJ = $(MESADRVVIABUILDDIR)debugger/via_debug.o - DEBUG_POBJ = $(MESADRVVIABUILDDIR)profiled/via_debug.o - DEBUG_DEFINES += -DVIA_DUMP -#ifdef NeedToLinkMesaSrc -LinkSourceFile(via_debug.c, $(MESADRVSRCDIR)/unichrome) -#endif -#endif - - VIASRCS = $(MESADRVVIABUILDDIR)via_context.c \ - $(MESADRVVIABUILDDIR)via_fb.c \ - $(MESADRVVIABUILDDIR)via_ioctl.c \ - $(MESADRVVIABUILDDIR)via_render.c \ - $(MESADRVVIABUILDDIR)via_screen.c \ - $(MESADRVVIABUILDDIR)via_span.c \ - $(MESADRVVIABUILDDIR)via_state.c \ - $(MESADRVVIABUILDDIR)via_tex.c \ - $(MESADRVVIABUILDDIR)via_texmem.c \ - $(MESADRVVIABUILDDIR)via_texstate.c \ - $(MESADRVVIABUILDDIR)via_tris.c \ - $(MESADRVVIABUILDDIR)via_vb.c \ - $(MESADRVVIABUILDDIR)xf86drmVIA.c \ - $(DEBUG_SRC) - - VIAOBJS =$(MESADRVVIABUILDDIR)via_context.o \ - $(MESADRVVIABUILDDIR)via_fb.o \ - $(MESADRVVIABUILDDIR)via_ioctl.o \ - $(MESADRVVIABUILDDIR)via_render.o \ - $(MESADRVVIABUILDDIR)via_screen.o \ - $(MESADRVVIABUILDDIR)via_span.o \ - $(MESADRVVIABUILDDIR)via_state.o \ - $(MESADRVVIABUILDDIR)via_tex.o \ - $(MESADRVVIABUILDDIR)via_texmem.o \ - $(MESADRVVIABUILDDIR)via_texstate.o \ - $(MESADRVVIABUILDDIR)via_tris.o \ - $(MESADRVVIABUILDDIR)via_vb.o \ - $(MESADRVVIABUILDDIR)xf86drmVIA.o \ - $(DEBUG_OBJ) - - - VIAUOBJS =$(MESADRVVIABUILDDIR)/unshared/via_context.o \ - $(MESADRVVIABUILDDIR)/unshared/via_fb.o \ - $(MESADRVVIABUILDDIR)/unshared/via_ioctl.o \ - $(MESADRVVIABUILDDIR)/unshared/via_render.o \ - $(MESADRVVIABUILDDIR)/unshared/via_screen.o \ - $(MESADRVVIABUILDDIR)/unshared/via_span.o \ - $(MESADRVVIABUILDDIR)/unshared/via_state.o \ - $(MESADRVVIABUILDDIR)/unshared/via_tex.o \ - $(MESADRVVIABUILDDIR)/unshared/via_texmem.o \ - $(MESADRVVIABUILDDIR)/unshared/via_texstate.o \ - $(MESADRVVIABUILDDIR)/unshared/via_tris.o \ - $(MESADRVVIABUILDDIR)/unshared/via_vb.o \ - $(MESADRVVIABUILDDIR)/unshared/xf86drmVIA.o \ - $(DEBUG_UOBJ) - - VIADOBJS =$(MESADRVVIABUILDDIR)/debugger/via_context.o \ - $(MESADRVVIABUILDDIR)/debugger/via_fb.o \ - $(MESADRVVIABUILDDIR)/debugger/via_ioctl.o \ - $(MESADRVVIABUILDDIR)/debugger/via_render.o \ - $(MESADRVVIABUILDDIR)/debugger/via_screen.o \ - $(MESADRVVIABUILDDIR)/debugger/via_span.o \ - $(MESADRVVIABUILDDIR)/debugger/via_state.o \ - $(MESADRVVIABUILDDIR)/debugger/via_tex.o \ - $(MESADRVVIABUILDDIR)/debugger/via_texmem.o \ - $(MESADRVVIABUILDDIR)/debugger/via_texstate.o \ - $(MESADRVVIABUILDDIR)/debugger/via_tris.o \ - $(MESADRVVIABUILDDIR)/debugger/via_vb.o \ - $(MESADRVVIABUILDDIR)/debugger/xf86drmVIA.o \ - $(DEBUG_DOBJ) - - VIAPOBJS =$(MESADRVVIABUILDDIR)/profiled/via_context.o \ - $(MESADRVVIABUILDDIR)/profiled/via_fb.o \ - $(MESADRVVIABUILDDIR)/profiled/via_ioctl.o \ - $(MESADRVVIABUILDDIR)/profiled/via_render.o \ - $(MESADRVVIABUILDDIR)/profiled/via_screen.o \ - $(MESADRVVIABUILDDIR)/profiled/via_span.o \ - $(MESADRVVIABUILDDIR)/profiled/via_state.o \ - $(MESADRVVIABUILDDIR)/profiled/via_tex.o \ - $(MESADRVVIABUILDDIR)/profiled/via_texmem.o \ - $(MESADRVVIABUILDDIR)/profiled/via_texstate.o \ - $(MESADRVVIABUILDDIR)/profiled/via_tris.o \ - $(MESADRVVIABUILDDIR)/profiled/via_vb.o \ - $(MESADRVVIABUILDDIR)/profiled/xf86drmVIA.o \ - $(DEBUG_POBJ) - -#ifdef NeedToLinkMesaSrc -LinkSourceFile(via_3d_reg.h, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_context.c, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_dd_tritmp.h, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_dd_vbtmp.h, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_dmatmp.h, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_dri.h, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_fb.c, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_fb.h, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_ioctl.c, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_ioctl.h, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_render.c, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_screen.c, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_screen.h, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_span.c, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_span.h, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_state.c, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_state.h, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_tex.c, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_tex.h, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_texmem.c, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_texstate.c, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_tris.c, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_tris.h, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_vb.c, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_vb_cliptmp.h, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_vb.h, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(via_vb_rendertmp.h, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(xf86drmVIA.c, $(MESADRVSRCDIR)/unichrome) -LinkSourceFile(xf86drmVIA.h, $(MESADRVSRCDIR)/unichrome) -#endif diff --git a/nx-X11/lib/GLU/GLU-def.cpp b/nx-X11/lib/GLU/GLU-def.cpp deleted file mode 100644 index 75997430d..000000000 --- a/nx-X11/lib/GLU/GLU-def.cpp +++ /dev/null @@ -1,166 +0,0 @@ -LIBRARY GLU -VERSION LIBRARY_VERSION -EXPORTS - -bezierPatchDelete -bezierPatchDeleteList -bezierPatchDraw -bezierPatchEval -bezierPatchEvalNormal -bezierPatchInsert -bezierPatchListDraw -bezierPatchMake -bezierPatchMake2 -bezierPatchPrint -bezierPatchPrintList -bezierPatchMeshBeginStrip -bezierPatchMeshDelDeg -bezierPatchMeshDelete -bezierPatchMeshDraw -bezierPatchMeshEndStrip -bezierPatchMeshEval -bezierPatchMeshInsertUV -bezierPatchMeshListCollect -bezierPatchMeshListDelDeg -bezierPatchMeshListDelete -bezierPatchMeshListDraw -bezierPatchMeshListEval -bezierPatchMeshListInsert -bezierPatchMeshListNumTriangles -bezierPatchMeshListPrint -bezierPatchMeshListReverse -bezierPatchMeshListTotalStrips -bezierPatchMeshListTotalVert -bezierPatchMeshMake -bezierPatchMeshMake2 -bezierPatchMeshNumTriangles -bezierPatchMeshPrint -bezierPatchMeshPutPatch -drawStrips -gluBeginCurve -gluBeginSurface -gluBeginTrim -gluDeleteNurbsRenderer -gluDeleteNurbsTessellatorEXT -gluEndCurve -gluEndSurface -gluEndTrim -gluGetNurbsProperty -gluLoadSamplingMatrices -gluNewNurbsRenderer -gluNurbsCallback -gluNurbsCallbackData -gluNurbsCallbackDataEXT -gluNurbsCurve -gluNurbsProperty -gluNurbsSurface -gluPwlCurve -glu_LOD_eval_list -__gl_dictListDelete -__gl_dictListDeleteDict -__gl_dictListInsertBefore -__gl_dictListNewDict -__gl_dictListSearch -__gl_edgeEval -__gl_edgeIntersect -__gl_edgeSign -__gl_transEval -__gl_transSign -__gl_vertCCW -__gl_vertLeq -__gl_memInit -__gl_meshAddEdgeVertex -; __gl_meshCheckMesh -__gl_meshConnect -__gl_meshDelete -__gl_meshDeleteMesh -__gl_meshMakeEdge -__gl_meshNewMesh -__gl_meshSplice -__gl_meshSplitEdge -__gl_meshUnion -__gl_meshZapFace -__gl_projectPolygon -__gl_pqHeapDelete -__gl_pqHeapDeletePriorityQ -__gl_pqHeapExtractMin -__gl_pqHeapInit -__gl_pqHeapInsert -__gl_pqHeapNewPriorityQ -__gl_pqSortDelete -__gl_pqSortDeletePriorityQ -__gl_pqSortExtractMin -__gl_pqSortInit -__gl_pqSortInsert -__gl_pqSortIsEmpty -__gl_pqSortMinimum -__gl_pqSortNewPriorityQ -__gl_renderBoundary -__gl_renderCache -__gl_renderMesh -__gl_computeInterior -__gl_noBeginData -__gl_noCombineData -__gl_noEdgeFlagData -__gl_noEndData -__gl_noErrorData -__gl_noVertexData -gluBeginPolygon -; gluDeleteMesh -gluDeleteTess -gluEndPolygon -gluGetTessProperty -gluNewTess -gluNextContour -gluTessBeginContour -gluTessBeginPolygon -gluTessCallback -gluTessEndContour -gluTessEndPolygon -gluTessNormal -gluTessProperty -gluTessVertex -__gl_meshDiscardExterior -__gl_meshSetWindingNumber -__gl_meshTessellateInterior -__gl_meshTessellateMonoRegion -gluErrorString -; __glNURBSErrorString -; __glTessErrorString -; bitmapBuild2DMipmaps -; fastBuild2DMipmaps -gluBuild1DMipmapLevels -gluBuild1DMipmaps -gluBuild2DMipmapLevels -gluBuild2DMipmaps -gluBuild3DMipmapLevels -gluBuild3DMipmaps -gluScaleImage -gluScaleImage3D -; __gluInvertMatrixd -; __gluMakeIdentityd -; __gluMakeIdentityf -; __gluMultMatricesd -; __gluMultMatrixVecd -gluLookAt -gluOrtho2D -gluPerspective -gluPickMatrix -gluProject -gluUnProject -gluUnProject4 -gluCylinder -gluDeleteQuadric -gluDisk -gluNewQuadric -gluPartialDisk -gluQuadricCallback -gluQuadricDrawStyle -gluQuadricNormals -gluQuadricOrientation -gluQuadricTexture -gluSphere -gluCheckExtension -gluGetString - -/* $XFree86$ */ diff --git a/nx-X11/lib/GLU/Imakefile b/nx-X11/lib/GLU/Imakefile deleted file mode 100644 index 5e6ae3139..000000000 --- a/nx-X11/lib/GLU/Imakefile +++ /dev/null @@ -1,133 +0,0 @@ -XCOMM $XFree86: xc/lib/GLU/Imakefile,v 1.5 2001/06/05 23:03:20 dawes Exp $ - -XCOMM License Applicability. Except to the extent portions of this file are -XCOMM made subject to an alternative license as permitted in the SGI Free -XCOMM Software License B, Version 1.1 (the "License"), the contents of this -XCOMM file are subject only to the provisions of the License. You may not use -XCOMM this file except in compliance with the License. You may obtain a copy -XCOMM of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -XCOMM Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -XCOMM -XCOMM http://oss.sgi.com/projects/FreeB -XCOMM -XCOMM Note that, as provided in the License, the Software is distributed on an -XCOMM "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -XCOMM DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -XCOMM CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -XCOMM PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -XCOMM -XCOMM Original Code. The Original Code is: OpenGL Sample Implementation, -XCOMM Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -XCOMM Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -XCOMM Copyright in any portions created by third parties is as indicated -XCOMM elsewhere herein. All Rights Reserved. -XCOMM -XCOMM Additional Notice Provisions: The application programming interfaces -XCOMM established by SGI in conjunction with the Original Code are The -XCOMM OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -XCOMM April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -XCOMM 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -XCOMM Window System(R) (Version 1.3), released October 19, 1998. This software -XCOMM was created using the OpenGL(R) version 1.2.1 Sample Implementation -XCOMM published by SGI, but has not been independently verified as being -XCOMM compliant with the OpenGL(R) version 1.2.1 Specification. -XCOMM - -#define IHaveSubdirs - -#define DoNormalLib NormalLibGlu -#define DoSharedLib SharedLibGlu -#define DoDebugLib DebugLibGlu -#define DoProfileLib ProfileLibGlu -#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' - -LIBNAME = GLU -SOREV = $(SOGLUREV) - -#define CplusplusSource - -#ifdef SharedGLUReqs -REQUIREDLIBS = SharedGLUReqs -#endif - -#ifndef SeparateSharedCompile -#define SeparateSharedCompile YES -#endif -#if NormalLibGlu && SharedLibGlu && SeparateSharedCompile -STATIC_OBJSDIR = unshared/ -#endif - -SUBDIRS = \ - include \ - libutil \ - libtess \ - libnurbs/internals \ - libnurbs/interface \ - libnurbs/nurbtess - - SHARED_OBJS = libutil/?*.o libtess/?*.o \ - libnurbs/internals/?*.o \ - libnurbs/interface/?*.o \ - libnurbs/nurbtess/?*.o - - STATIC_OBJS = libutil/$(STATIC_OBJSDIR)?*.o libtess/$(STATIC_OBJSDIR)?*.o \ - libnurbs/internals/$(STATIC_OBJSDIR)?*.o \ - libnurbs/interface/$(STATIC_OBJSDIR)?*.o \ - libnurbs/nurbtess/$(STATIC_OBJSDIR)?*.o - - DEBUG_OBJS = libutil/debugger/?*.o libtess/debugger/?*.o \ - libnurbs/internals/debugger/?*.o \ - libnurbs/interface/debugger/?*.o \ - libnurbs/nurbtess/debugger/?*.o - - PROFILE_OBJS = libutil/profiled/?*.o libtess/profiled/?*.o \ - libnurbs/internals/profiled/?*.o \ - libnurbs/interface/profiled/?*.o \ - libnurbs/nurbtess/profiled/?*.o - - DONES = libutil/DONE libtess/DONE \ - libnurbs/internals/DONE \ - libnurbs/interface/DONE \ - libnurbs/nurbtess/DONE - -#if HasParallelMake -MakeMutex($(SUBDIRS) $(DONES)) -#endif - -#if HasGnuMake || HasBsdMake -$(DONES): $(SUBDIRS) -#endif - -#include - -#undef _LinkBuildLibrary -#define _LinkBuildLibrary(lib) LinkBuildLibrary(lib) - -#if NormalLibGlu -NormalDepLibraryTarget($(LIBNAME),$(SUBDIRS) $(DONES),$(STATIC_OBJS)) -InstallLibrary($(LIBNAME),$(USRLIBDIR)) -#endif - -#if SharedLibGlu -#ifdef SharedDepCplusplusLibraryTarget -SharedDepCplusplusLibraryTarget($(LIBNAME),$(SOREV),$(SUBDIRS) $(DONES),$(SHARED_OBJS),.,.) -#else -SharedDepLibraryTarget($(LIBNAME),$(SOREV),$(SUBDIRS) $(DONES),$(SHARED_OBJS),.,.) -#endif -InstallSharedLibrary($(LIBNAME),$(SOREV),$(SHLIBDIR)) -#endif - -#if DebugLibGlu -DebuggedDepLibraryTarget($(LIBNAME),$(SUBDIRS) $(DONES),$(DEBUG_OBJS)) -InstallLibrary($(LIBNAME)_d,$(USRLIBDIR)) -#endif /* DebugLibGlu */ - -#if ProfileLibGlu -ProfiledDepLibraryTarget($(LIBNAME),$(SUBDIRS) $(DONES),$(PROFILE_OBJS)) -InstallLibrary($(LIBNAME)_p,$(USRLIBDIR)) -#endif /* ProfileLibGlu */ - - -ForceSubdirs($(SUBDIRS)) -DependSubdirs($(SUBDIRS)) - diff --git a/nx-X11/lib/GLU/include/Imakefile b/nx-X11/lib/GLU/include/Imakefile deleted file mode 100644 index 68f1b1b06..000000000 --- a/nx-X11/lib/GLU/include/Imakefile +++ /dev/null @@ -1,38 +0,0 @@ -XCOMM $XFree86$ - -XCOMM License Applicability. Except to the extent portions of this file are -XCOMM made subject to an alternative license as permitted in the SGI Free -XCOMM Software License B, Version 1.1 (the "License"), the contents of this -XCOMM file are subject only to the provisions of the License. You may not use -XCOMM this file except in compliance with the License. You may obtain a copy -XCOMM of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -XCOMM Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -XCOMM -XCOMM http://oss.sgi.com/projects/FreeB -XCOMM -XCOMM Note that, as provided in the License, the Software is distributed on an -XCOMM "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -XCOMM DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -XCOMM CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -XCOMM PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -XCOMM -XCOMM Original Code. The Original Code is: OpenGL Sample Implementation, -XCOMM Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -XCOMM Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -XCOMM Copyright in any portions created by third parties is as indicated -XCOMM elsewhere herein. All Rights Reserved. -XCOMM -XCOMM Additional Notice Provisions: The application programming interfaces -XCOMM established by SGI in conjunction with the Original Code are The -XCOMM OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -XCOMM April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -XCOMM 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -XCOMM Window System(R) (Version 1.3), released October 19, 1998. This software -XCOMM was created using the OpenGL(R) version 1.2.1 Sample Implementation -XCOMM published by SGI, but has not been independently verified as being -XCOMM compliant with the OpenGL(R) version 1.2.1 Specification. -XCOMM - -GLUSRCDIR = $(OGLSAMPLESRCDIR)/main/gfx/lib/glu - -LinkSourceFile(gluos.h, $(GLUSRCDIR)/include) diff --git a/nx-X11/lib/GLU/libnurbs/interface/Imakefile b/nx-X11/lib/GLU/libnurbs/interface/Imakefile deleted file mode 100644 index a56489f68..000000000 --- a/nx-X11/lib/GLU/libnurbs/interface/Imakefile +++ /dev/null @@ -1,107 +0,0 @@ -XCOMM $XFree86: xc/lib/GLU/libnurbs/interface/Imakefile,v 1.2 2001/01/15 22:25:09 dawes Exp $ - -XCOMM License Applicability. Except to the extent portions of this file are -XCOMM made subject to an alternative license as permitted in the SGI Free -XCOMM Software License B, Version 1.1 (the "License"), the contents of this -XCOMM file are subject only to the provisions of the License. You may not use -XCOMM this file except in compliance with the License. You may obtain a copy -XCOMM of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -XCOMM Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -XCOMM -XCOMM http://oss.sgi.com/projects/FreeB -XCOMM -XCOMM Note that, as provided in the License, the Software is distributed on an -XCOMM "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -XCOMM DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -XCOMM CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -XCOMM PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -XCOMM -XCOMM Original Code. The Original Code is: OpenGL Sample Implementation, -XCOMM Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -XCOMM Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -XCOMM Copyright in any portions created by third parties is as indicated -XCOMM elsewhere herein. All Rights Reserved. -XCOMM -XCOMM Additional Notice Provisions: The application programming interfaces -XCOMM established by SGI in conjunction with the Original Code are The -XCOMM OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -XCOMM April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -XCOMM 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -XCOMM Window System(R) (Version 1.3), released October 19, 1998. This software -XCOMM was created using the OpenGL(R) version 1.2.1 Sample Implementation -XCOMM published by SGI, but has not been independently verified as being -XCOMM compliant with the OpenGL(R) version 1.2.1 Specification. -XCOMM - -#define DoNormalLib NormalLibGlu -#define DoSharedLib SharedLibGlu -#define DoDebugLib DebugLibGlu -#define DoProfileLib ProfileLibGlu - -#define CplusplusSource - -#include - -SRCS = \ - bezierEval.cc \ - bezierPatch.cc \ - bezierPatchMesh.cc \ - glcurveval.cc \ - glinterface.cc \ - glrenderer.cc \ - glsurfeval.cc \ - incurveeval.cc \ - insurfeval.cc - -OBJS = \ - bezierEval.o \ - bezierPatch.o \ - bezierPatchMesh.o \ - glcurveval.o \ - glinterface.o \ - glrenderer.o \ - glsurfeval.o \ - incurveeval.o \ - insurfeval.o - -INCLUDES = \ - -I. \ - -I../internals \ - -I../nurbtess \ - -I../../include \ - -I$(TOP)/include \ - -I$(TOP)/include/GL - -DEFINES = \ - -DLIBRARYBUILD \ - -DNDEBUG - -LibraryObjectRule() - -SubdirLibraryRule($(OBJS)) -NormalLintTarget($(SRCS)) - -GLUSRCDIR = $(OGLSAMPLESRCDIR)/main/gfx/lib/glu - -LinkSourceFile(bezierEval.cc, $(GLUSRCDIR)/libnurbs/interface) -LinkSourceFile(bezierPatch.cc, $(GLUSRCDIR)/libnurbs/interface) -LinkSourceFile(bezierPatchMesh.cc, $(GLUSRCDIR)/libnurbs/interface) -LinkSourceFile(glcurveval.cc, $(GLUSRCDIR)/libnurbs/interface) -LinkSourceFile(glinterface.cc, $(GLUSRCDIR)/libnurbs/interface) -LinkSourceFile(glrenderer.cc, $(GLUSRCDIR)/libnurbs/interface) -LinkSourceFile(glsurfeval.cc, $(GLUSRCDIR)/libnurbs/interface) -LinkSourceFile(incurveeval.cc, $(GLUSRCDIR)/libnurbs/interface) -LinkSourceFile(insurfeval.cc, $(GLUSRCDIR)/libnurbs/interface) - -LinkSourceFile(bezierEval.h, $(GLUSRCDIR)/libnurbs/interface) -LinkSourceFile(bezierPatch.h, $(GLUSRCDIR)/libnurbs/interface) -LinkSourceFile(bezierPatchMesh.h, $(GLUSRCDIR)/libnurbs/interface) -LinkSourceFile(glcurveval.h, $(GLUSRCDIR)/libnurbs/interface) -LinkSourceFile(glimports.h, $(GLUSRCDIR)/libnurbs/interface) -LinkSourceFile(glrenderer.h, $(GLUSRCDIR)/libnurbs/interface) -LinkSourceFile(glsurfeval.h, $(GLUSRCDIR)/libnurbs/interface) -LinkSourceFile(mystdio.h, $(GLUSRCDIR)/libnurbs/interface) -LinkSourceFile(mystdlib.h, $(GLUSRCDIR)/libnurbs/interface) - -DependTarget() -CleanTarget() diff --git a/nx-X11/lib/GLU/libnurbs/internals/Imakefile b/nx-X11/lib/GLU/libnurbs/internals/Imakefile deleted file mode 100644 index 5706b03f7..000000000 --- a/nx-X11/lib/GLU/libnurbs/internals/Imakefile +++ /dev/null @@ -1,269 +0,0 @@ -XCOMM $XFree86: xc/lib/GLU/libnurbs/internals/Imakefile,v 1.11tsi Exp $ - -XCOMM License Applicability. Except to the extent portions of this file are -XCOMM made subject to an alternative license as permitted in the SGI Free -XCOMM Software License B, Version 1.1 (the "License"), the contents of this -XCOMM file are subject only to the provisions of the License. You may not use -XCOMM this file except in compliance with the License. You may obtain a copy -XCOMM of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -XCOMM Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -XCOMM -XCOMM http://oss.sgi.com/projects/FreeB -XCOMM -XCOMM Note that, as provided in the License, the Software is distributed on an -XCOMM "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -XCOMM DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -XCOMM CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -XCOMM PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -XCOMM -XCOMM Original Code. The Original Code is: OpenGL Sample Implementation, -XCOMM Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -XCOMM Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -XCOMM Copyright in any portions created by third parties is as indicated -XCOMM elsewhere herein. All Rights Reserved. -XCOMM -XCOMM Additional Notice Provisions: The application programming interfaces -XCOMM established by SGI in conjunction with the Original Code are The -XCOMM OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -XCOMM April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -XCOMM 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -XCOMM Window System(R) (Version 1.3), released October 19, 1998. This software -XCOMM was created using the OpenGL(R) version 1.2.1 Sample Implementation -XCOMM published by SGI, but has not been independently verified as being -XCOMM compliant with the OpenGL(R) version 1.2.1 Specification. -XCOMM - -#define DoNormalLib NormalLibGlu -#define DoSharedLib SharedLibGlu -#define DoDebugLib DebugLibGlu -#define DoProfileLib ProfileLibGlu - -#define CplusplusSource - -#include - -SRCS = \ - arc.cc \ - arcsorter.cc \ - arctess.cc \ - backend.cc \ - basiccrveval.cc \ - basicsurfeval.cc \ - bin.cc \ - bufpool.cc \ - cachingeval.cc \ - ccw.cc \ - coveandtiler.cc \ - curve.cc \ - curvelist.cc \ - curvesub.cc \ - dataTransform.cc \ - displaylist.cc \ - flist.cc \ - flistsorter.cc \ - hull.cc \ - intersect.cc \ - knotvector.cc \ - mapdesc.cc \ - mapdescv.cc \ - maplist.cc \ - mesher.cc \ - monoTriangulationBackend.cc \ - monotonizer.cc \ - mycode.cc \ - nurbsinterfac.cc \ - nurbstess.cc \ - patch.cc \ - patchlist.cc \ - quilt.cc \ - reader.cc \ - renderhints.cc \ - slicer.cc \ - sorter.cc \ - splitarcs.cc \ - subdivider.cc \ - tobezier.cc \ - trimline.cc \ - trimregion.cc \ - trimvertpool.cc \ - uarray.cc \ - varray.cc - -OBJS = \ - arc.o \ - arcsorter.o \ - arctess.o \ - backend.o \ - basiccrveval.o \ - basicsurfeval.o \ - bin.o \ - bufpool.o \ - cachingeval.o \ - ccw.o \ - coveandtiler.o \ - curve.o \ - curvelist.o \ - curvesub.o \ - dataTransform.o \ - displaylist.o \ - flist.o \ - flistsorter.o \ - hull.o \ - intersect.o \ - knotvector.o \ - mapdesc.o \ - mapdescv.o \ - maplist.o \ - mesher.o \ - monoTriangulationBackend.o \ - monotonizer.o \ - mycode.o \ - nurbsinterfac.o \ - nurbstess.o \ - patch.o \ - patchlist.o \ - quilt.o \ - reader.o \ - renderhints.o \ - slicer.o \ - sorter.o \ - splitarcs.o \ - subdivider.o \ - tobezier.o \ - trimline.o \ - trimregion.o \ - trimvertpool.o \ - uarray.o \ - varray.o - -INCLUDES = \ - -I../nurbtess \ - -I../../libutil \ - -I../../include \ - -I$(TOP)/include \ - -I$(TOP)/include/GL - -#if defined(SGIArchitecture) -OSDEFINES = -D_SCO_DS -#elif SystemV4 || defined(LynxOSArchitecture) || defined(OS2Architecture) -OSDEFINES = -DNEEDCEILF -#elif defined(DarwinArchitecture) -# if OSMajorVersion <= 5 -OSDEFINES = -DNEEDCEILF -# endif -#elif defined(LinuxArchitecture) && (LinuxCLibMajorVersion < 6) -OSDEFINES = -DNEEDCEILF -#else -OSDEFINES = -D_EXTENSIONS_ -#endif - -DEFINES = $(OSDEFINES) -DLIBRARYBUILD -DNDEBUG - -LibraryObjectRule() - -SubdirLibraryRule($(OBJS)) -NormalLintTarget($(SRCS)) - -GLUSRCDIR = $(OGLSAMPLESRCDIR)/main/gfx/lib/glu - -LinkSourceFile(arc.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(arcsorter.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(arctess.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(backend.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(basiccrveval.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(basicsurfeval.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(bin.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(bufpool.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(cachingeval.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(ccw.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(coveandtiler.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(curve.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(curvelist.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(curvesub.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(dataTransform.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(displaylist.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(flist.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(flistsorter.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(hull.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(intersect.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(knotvector.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(mapdesc.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(mapdescv.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(maplist.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(mesher.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(monoTriangulationBackend.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(monotonizer.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(mycode.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(nurbsinterfac.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(nurbstess.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(patch.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(patchlist.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(quilt.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(reader.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(renderhints.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(slicer.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(sorter.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(splitarcs.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(subdivider.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(tobezier.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(trimline.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(trimregion.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(trimvertpool.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(uarray.cc, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(varray.cc, $(GLUSRCDIR)/libnurbs/internals) - -LinkSourceFile(arc.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(arcsorter.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(arctess.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(backend.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(basiccrveval.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(basicsurfeval.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(bezierarc.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(bin.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(bufpool.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(cachingeval.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(coveandtiler.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(curve.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(curvelist.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(dataTransform.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(defines.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(displaylist.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(displaymode.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(flist.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(flistsorter.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(gridline.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(gridtrimvertex.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(gridvertex.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(hull.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(jarcloc.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(knotvector.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(mapdesc.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(maplist.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(mesher.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(monotonizer.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(myassert.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(mymath.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(mysetjmp.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(mystring.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(nurbsconsts.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(nurbstess.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(patch.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(patchlist.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(pwlarc.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(quilt.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(reader.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(renderhints.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(simplemath.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(slicer.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(sorter.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(subdivider.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(trimline.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(trimregion.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(trimvertex.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(trimvertpool.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(types.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(uarray.h, $(GLUSRCDIR)/libnurbs/internals) -LinkSourceFile(varray.h, $(GLUSRCDIR)/libnurbs/internals) - -DependTarget() -CleanTarget() diff --git a/nx-X11/lib/GLU/libnurbs/nurbtess/Imakefile b/nx-X11/lib/GLU/libnurbs/nurbtess/Imakefile deleted file mode 100644 index 43b0266a1..000000000 --- a/nx-X11/lib/GLU/libnurbs/nurbtess/Imakefile +++ /dev/null @@ -1,150 +0,0 @@ -XCOMM $XFree86: xc/lib/GLU/libnurbs/nurbtess/Imakefile,v 1.2 2001/01/15 22:25:10 dawes Exp $ - -XCOMM License Applicability. Except to the extent portions of this file are -XCOMM made subject to an alternative license as permitted in the SGI Free -XCOMM Software License B, Version 1.1 (the "License"), the contents of this -XCOMM file are subject only to the provisions of the License. You may not use -XCOMM this file except in compliance with the License. You may obtain a copy -XCOMM of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -XCOMM Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -XCOMM -XCOMM http://oss.sgi.com/projects/FreeB -XCOMM -XCOMM Note that, as provided in the License, the Software is distributed on an -XCOMM "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -XCOMM DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -XCOMM CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -XCOMM PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -XCOMM -XCOMM Original Code. The Original Code is: OpenGL Sample Implementation, -XCOMM Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -XCOMM Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -XCOMM Copyright in any portions created by third parties is as indicated -XCOMM elsewhere herein. All Rights Reserved. -XCOMM -XCOMM Additional Notice Provisions: The application programming interfaces -XCOMM established by SGI in conjunction with the Original Code are The -XCOMM OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -XCOMM April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -XCOMM 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -XCOMM Window System(R) (Version 1.3), released October 19, 1998. This software -XCOMM was created using the OpenGL(R) version 1.2.1 Sample Implementation -XCOMM published by SGI, but has not been independently verified as being -XCOMM compliant with the OpenGL(R) version 1.2.1 Specification. -XCOMM - -#define DoNormalLib NormalLibGlu -#define DoSharedLib SharedLibGlu -#define DoDebugLib DebugLibGlu -#define DoProfileLib ProfileLibGlu - -#define CplusplusSource - -#include - -SRCS = \ - directedLine.cc \ - gridWrap.cc \ - monoChain.cc \ - monoTriangulation.cc \ - partitionX.cc \ - partitionY.cc \ - polyDBG.cc \ - polyUtil.cc \ - primitiveStream.cc \ - quicksort.cc \ - rectBlock.cc \ - sampleComp.cc \ - sampleCompBot.cc \ - sampleCompRight.cc \ - sampleCompTop.cc \ - sampleMonoPoly.cc \ - sampledLine.cc \ - searchTree.cc \ - monoPolyPart.cc - -OBJS = \ - directedLine.o \ - gridWrap.o \ - monoChain.o \ - monoTriangulation.o \ - partitionX.o \ - partitionY.o \ - polyDBG.o \ - polyUtil.o \ - primitiveStream.o \ - quicksort.o \ - rectBlock.o \ - sampleComp.o \ - sampleCompBot.o \ - sampleCompRight.o \ - sampleCompTop.o \ - sampleMonoPoly.o \ - sampledLine.o \ - searchTree.o \ - monoPolyPart.o - -INCLUDES = \ - -I../internals \ - -I../../include \ - -I$(TOP)/include \ - -I$(TOP)/include/GL - -DEFINES = \ - -DLIBRARYBUILD \ - -DNDEBUG - -LibraryObjectRule() - -SubdirLibraryRule($(OBJS)) -NormalLintTarget($(SRCS)) - -GLUSRCDIR = $(OGLSAMPLESRCDIR)/main/gfx/lib/glu - -LinkSourceFile(directedLine.cc, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(gridWrap.cc, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(monoChain.cc, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(monoTriangulation.cc, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(partitionX.cc, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(partitionY.cc, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(polyDBG.cc, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(polyUtil.cc, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(primitiveStream.cc, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(quicksort.cc, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(rectBlock.cc, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(sampleComp.cc, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(sampleCompBot.cc, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(sampleCompRight.cc, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(sampleCompTop.cc, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(sampleMonoPoly.cc, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(sampledLine.cc, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(searchTree.cc, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(monoPolyPart.cc, $(GLUSRCDIR)/libnurbs/nurbtess) - -LinkSourceFile(definitions.h, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(directedLine.h, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(glimports.h, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(gridWrap.h, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(monoChain.h, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(monoPolyPart.h, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(monoTriangulation.h, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(mystdio.h, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(mystdlib.h, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(partitionX.h, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(partitionY.h, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(polyDBG.h, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(polyUtil.h, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(primitiveStream.h, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(quicksort.h, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(rectBlock.h, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(sampleComp.h, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(sampleCompBot.h, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(sampleCompRight.h, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(sampleCompTop.h, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(sampleMonoPoly.h, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(sampledLine.h, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(searchTree.h, $(GLUSRCDIR)/libnurbs/nurbtess) -LinkSourceFile(zlassert.h, $(GLUSRCDIR)/libnurbs/nurbtess) - -DependTarget() -CleanTarget() diff --git a/nx-X11/lib/GLU/libtess/Imakefile b/nx-X11/lib/GLU/libtess/Imakefile deleted file mode 100644 index 4b50cb549..000000000 --- a/nx-X11/lib/GLU/libtess/Imakefile +++ /dev/null @@ -1,109 +0,0 @@ -XCOMM $XFree86: xc/lib/GLU/libtess/Imakefile,v 1.1 2001/01/15 22:18:06 dawes Exp $ - -XCOMM License Applicability. Except to the extent portions of this file are -XCOMM made subject to an alternative license as permitted in the SGI Free -XCOMM Software License B, Version 1.1 (the "License"), the contents of this -XCOMM file are subject only to the provisions of the License. You may not use -XCOMM this file except in compliance with the License. You may obtain a copy -XCOMM of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -XCOMM Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -XCOMM -XCOMM http://oss.sgi.com/projects/FreeB -XCOMM -XCOMM Note that, as provided in the License, the Software is distributed on an -XCOMM "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -XCOMM DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -XCOMM CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -XCOMM PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -XCOMM -XCOMM Original Code. The Original Code is: OpenGL Sample Implementation, -XCOMM Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -XCOMM Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -XCOMM Copyright in any portions created by third parties is as indicated -XCOMM elsewhere herein. All Rights Reserved. -XCOMM -XCOMM Additional Notice Provisions: The application programming interfaces -XCOMM established by SGI in conjunction with the Original Code are The -XCOMM OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -XCOMM April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -XCOMM 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -XCOMM Window System(R) (Version 1.3), released October 19, 1998. This software -XCOMM was created using the OpenGL(R) version 1.2.1 Sample Implementation -XCOMM published by SGI, but has not been independently verified as being -XCOMM compliant with the OpenGL(R) version 1.2.1 Specification. -XCOMM - -#define DoNormalLib NormalLibGlu -#define DoSharedLib SharedLibGlu -#define DoDebugLib DebugLibGlu -#define DoProfileLib ProfileLibGlu - -#include - -SRCS = \ - dict.c \ - geom.c \ - memalloc.c \ - mesh.c \ - normal.c \ - priorityq.c \ - render.c \ - sweep.c \ - tess.c \ - tessmono.c - -OBJS = \ - dict.o \ - geom.o \ - memalloc.o \ - mesh.o \ - normal.o \ - priorityq.o \ - render.o \ - sweep.o \ - tess.o \ - tessmono.o - -INCLUDES = \ - -I../include \ - -I$(TOP)/include \ - -I$(TOP)/include/GL - -DEFINES = \ - -DNDEBUG - -LibraryObjectRule() - -SubdirLibraryRule($(OBJS)) -NormalLintTarget($(SRCS)) - -GLUSRCDIR = $(OGLSAMPLESRCDIR)/main/gfx/lib/glu - -LinkSourceFile(dict.c, $(GLUSRCDIR)/libtess) -LinkSourceFile(geom.c, $(GLUSRCDIR)/libtess) -LinkSourceFile(memalloc.c, $(GLUSRCDIR)/libtess) -LinkSourceFile(mesh.c, $(GLUSRCDIR)/libtess) -LinkSourceFile(normal.c, $(GLUSRCDIR)/libtess) -LinkSourceFile(priorityq-heap.c, $(GLUSRCDIR)/libtess) -LinkSourceFile(priorityq.c, $(GLUSRCDIR)/libtess) -LinkSourceFile(render.c, $(GLUSRCDIR)/libtess) -LinkSourceFile(sweep.c, $(GLUSRCDIR)/libtess) -LinkSourceFile(tess.c, $(GLUSRCDIR)/libtess) -LinkSourceFile(tessmono.c, $(GLUSRCDIR)/libtess) - -LinkSourceFile(dict-list.h, $(GLUSRCDIR)/libtess) -LinkSourceFile(dict.h, $(GLUSRCDIR)/libtess) -LinkSourceFile(geom.h, $(GLUSRCDIR)/libtess) -LinkSourceFile(memalloc.h, $(GLUSRCDIR)/libtess) -LinkSourceFile(mesh.h, $(GLUSRCDIR)/libtess) -LinkSourceFile(normal.h, $(GLUSRCDIR)/libtess) -LinkSourceFile(priorityq-heap.h, $(GLUSRCDIR)/libtess) -LinkSourceFile(priorityq-sort.h, $(GLUSRCDIR)/libtess) -LinkSourceFile(priorityq.h, $(GLUSRCDIR)/libtess) -LinkSourceFile(render.h, $(GLUSRCDIR)/libtess) -LinkSourceFile(sweep.h, $(GLUSRCDIR)/libtess) -LinkSourceFile(tess.h, $(GLUSRCDIR)/libtess) -LinkSourceFile(tessmono.h, $(GLUSRCDIR)/libtess) - -DependTarget() -CleanTarget() diff --git a/nx-X11/lib/GLU/libutil/Imakefile b/nx-X11/lib/GLU/libutil/Imakefile deleted file mode 100644 index 393fa96ff..000000000 --- a/nx-X11/lib/GLU/libutil/Imakefile +++ /dev/null @@ -1,84 +0,0 @@ -XCOMM $XFree86: xc/lib/GLU/libutil/Imakefile,v 1.1 2001/01/15 22:18:08 dawes Exp $ - -XCOMM License Applicability. Except to the extent portions of this file are -XCOMM made subject to an alternative license as permitted in the SGI Free -XCOMM Software License B, Version 1.1 (the "License"), the contents of this -XCOMM file are subject only to the provisions of the License. You may not use -XCOMM this file except in compliance with the License. You may obtain a copy -XCOMM of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -XCOMM Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -XCOMM -XCOMM http://oss.sgi.com/projects/FreeB -XCOMM -XCOMM Note that, as provided in the License, the Software is distributed on an -XCOMM "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -XCOMM DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -XCOMM CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -XCOMM PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -XCOMM -XCOMM Original Code. The Original Code is: OpenGL Sample Implementation, -XCOMM Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -XCOMM Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -XCOMM Copyright in any portions created by third parties is as indicated -XCOMM elsewhere herein. All Rights Reserved. -XCOMM -XCOMM Additional Notice Provisions: The application programming interfaces -XCOMM established by SGI in conjunction with the Original Code are The -XCOMM OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -XCOMM April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -XCOMM 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -XCOMM Window System(R) (Version 1.3), released October 19, 1998. This software -XCOMM was created using the OpenGL(R) version 1.2.1 Sample Implementation -XCOMM published by SGI, but has not been independently verified as being -XCOMM compliant with the OpenGL(R) version 1.2.1 Specification. -XCOMM - -#define DoNormalLib NormalLibGlu -#define DoSharedLib SharedLibGlu -#define DoDebugLib DebugLibGlu -#define DoProfileLib ProfileLibGlu - -#include - -SRCS = \ - error.c \ - glue.c \ - mipmap.c \ - project.c \ - quad.c \ - registry.c - -OBJS = \ - error.o \ - glue.o \ - mipmap.o \ - project.o \ - quad.o \ - registry.o - -INCLUDES = \ - -I../include \ - -I$(TOP)/include \ - -I$(TOP)/include/GL - -DEFINES = \ - -DNDEBUG - -LibraryObjectRule() - -SubdirLibraryRule($(OBJS)) -NormalLintTarget($(SRCS)) - -GLUSRCDIR = $(OGLSAMPLESRCDIR)/main/gfx/lib/glu - -LinkSourceFile(error.c, $(GLUSRCDIR)/libutil) -LinkSourceFile(glue.c, $(GLUSRCDIR)/libutil) -LinkSourceFile(mipmap.c, $(GLUSRCDIR)/libutil) -LinkSourceFile(project.c, $(GLUSRCDIR)/libutil) -LinkSourceFile(quad.c, $(GLUSRCDIR)/libutil) -LinkSourceFile(registry.c, $(GLUSRCDIR)/libutil) - -LinkSourceFile(gluint.h, $(GLUSRCDIR)/libutil) - -DependTarget() -CleanTarget() diff --git a/nx-X11/lib/GLw/GLwM1DrawA.c b/nx-X11/lib/GLw/GLwM1DrawA.c deleted file mode 100644 index 4301c817f..000000000 --- a/nx-X11/lib/GLw/GLwM1DrawA.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (c) Copyright 1993, Silicon Graphics, Inc. - * ALL RIGHTS RESERVED - * 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, and that - * the name of Silicon Graphics, Inc. not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. - * - * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" - * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR - * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON - * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, - * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY - * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, - * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF - * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN - * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE - * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. - * - * - * US Government Users Restricted Rights - * Use, duplication, or disclosure by the Government is subject to - * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph - * (c)(1)(ii) of the Rights in Technical Data and Computer Software - * clause at DFARS 252.227-7013 and/or in similar or successor - * clauses in the FAR or the DOD or NASA FAR Supplement. - * Unpublished-- rights reserved under the copyright laws of the - * United States. Contractor/manufacturer is Silicon Graphics, - * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. - * - * OpenGL(TM) is a trademark of Silicon Graphics, Inc. - */ -/* $XFree86$ */ - -#define __GLX_MOTIF 1 - -#define XmVERSION 1 -#define XmREVISION 2 -#define XmVersion (XmVERSION * 1000 + XmREVISION) -#define XmVERSION_STRING "GLwDrawingArea fake M*tif 1.X" -#define XmUPDATE_LEVEL 0 - -/* Include our fake Motif headers */ -#include "GLwXm/Xm.h" -#include "GLwXm/PrimitiveP.h" - -#define __GLX_INCLUDE_XM_H -#define __GLX_INCLUDE_PRIMITIVE_P_H - -#include "GLwDrawA.c" diff --git a/nx-X11/lib/GLw/GLwM2DrawA.c b/nx-X11/lib/GLw/GLwM2DrawA.c deleted file mode 100644 index bd93260f9..000000000 --- a/nx-X11/lib/GLw/GLwM2DrawA.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (c) Copyright 1993, Silicon Graphics, Inc. - * ALL RIGHTS RESERVED - * 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, and that - * the name of Silicon Graphics, Inc. not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. - * - * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" - * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR - * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON - * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, - * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY - * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, - * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF - * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN - * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE - * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. - * - * - * US Government Users Restricted Rights - * Use, duplication, or disclosure by the Government is subject to - * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph - * (c)(1)(ii) of the Rights in Technical Data and Computer Software - * clause at DFARS 252.227-7013 and/or in similar or successor - * clauses in the FAR or the DOD or NASA FAR Supplement. - * Unpublished-- rights reserved under the copyright laws of the - * United States. Contractor/manufacturer is Silicon Graphics, - * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. - * - * OpenGL(TM) is a trademark of Silicon Graphics, Inc. - */ -/* $XFree86$ */ - -#define __GLX_MOTIF 2 - -#define XmVERSION 2 -#define XmREVISION 0 -#define XmVersion (XmVERSION * 1000 + XmREVISION) -#define XmVERSION_STRING "GLwDrawingArea fake M*tif 2.X" -#define XmUPDATE_LEVEL 0 - -/* Include our fake Motif headers */ -#include "GLwXm/Xm.h" -#include "GLwXm/PrimitiveP.h" - -#define __GLX_INCLUDE_XM_H -#define __GLX_INCLUDE_PRIMITIVE_P_H - -#include "GLwDrawA.c" diff --git a/nx-X11/lib/GLw/GLwXm/PrimitiveP.h b/nx-X11/lib/GLw/GLwXm/PrimitiveP.h deleted file mode 100644 index d38d0d165..000000000 --- a/nx-X11/lib/GLw/GLwXm/PrimitiveP.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2000 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$ */ - -/* - * This file is a fake Motif(TM) header intended to allow the compilation of - * libGLw without having a real Motif. Do not use this file to compile any - * application because it declares only a small subset of the API! - */ - -#ifndef GLWXM_PRIMITIVE_P_H -#define GLWXM_PRIMITIVE_P_H - -#include "GLwXm/XmP.h" - -/* primitive instance part */ -typedef struct { - Pixel foreground; - Dimension shadow_thickness; - Pixel top_shadow_color; - Pixmap top_shadow_pixmap; - Pixel bottom_shadow_color; - Pixmap bottom_shadow_pixmap; - Dimension highlight_thickness; - Pixel highlight_color; - Pixmap highlight_pixmap; - XtCallbackList help_callback; - XtPointer user_data; - Boolean traversal_on; - Boolean highlight_on_enter; - Boolean have_traversal; - unsigned char unit_type; - XmNavigationType navigation_type; - Boolean highlight_drawn; - Boolean highlighted; - GC highlight_GC; - GC top_shadow_GC; - GC bottom_shadow_GC; -#if XmVERSION > 1 - XtCallbackList convert_callback; - XtCallbackList popup_handler_callback; - XmDirection layout_direction; -#endif -} XmPrimitivePart; - -/* primitive class part */ -typedef struct { - XtWidgetProc border_highlight; - XtWidgetProc border_unhighlight; - String translations; - XtActionProc arm_and_activate; - XmSyntheticResource *syn_resources; - int num_syn_resources; - XtPointer extension; -} XmPrimitiveClassPart; - -/* class record */ -typedef struct _XmPrimitiveClassRec { - CoreClassPart core_class; - XmPrimitiveClassPart primitive_class; -} XmPrimitiveClassRec; - -/* declare class record */ -extern XmPrimitiveClassRec xmPrimitiveClassRec; - -#endif /* GLWXM_PRIMITIVE_P_H */ diff --git a/nx-X11/lib/GLw/GLwXm/Xm.h b/nx-X11/lib/GLw/GLwXm/Xm.h deleted file mode 100644 index f344eec50..000000000 --- a/nx-X11/lib/GLw/GLwXm/Xm.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2000 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$ */ - -/* - * This file is a fake Motif(TM) header intended to allow the compilation of - * libGLw without having a real Motif. Do not use this file to compile any - * application because it declares only a small subset of the API! - */ - -#ifndef GLWXM_H -#define GLWXM_H - -#include -#include -#include -#include "GLwXm/XmStrDefs.h" - -enum { - XmATTACH_NONE, - XmATTACH_FORM, - XmATTACH_OPPOSITE_FORM, - XmATTACH_WIDGET, - XmATTACH_OPPOSITE_WIDGET, - XmATTACH_POSITION, - XmATTACH_SELF -}; - -enum { - XmCR_NONE, - XmCR_HELP, - XmCR_VALUE_CHANGED, - XmCR_INCREMENT, - XmCR_DECREMENT, - XmCR_PAGE_INCREMENT, - XmCR_PAGE_DECREMENT, - XmCR_TO_TOP, - XmCR_TO_BOTTOM, - XmCR_DRAG, - XmCR_ACTIVATE, - XmCR_ARM, - XmCR_DISARM, - XmCR_DUMMY13, - XmCR_DUMMY14, - XmCR_DUMMY15, - XmCR_MAP, - XmCR_UNMAP, - XmCR_FOCUS, - XmCR_LOSING_FOCUS, - XmCR_MODIFYING_TEXT_VALUE, - XmCR_MOVING_INSERT_CURSOR, - XmCR_EXECUTE, - XmCR_SINGLE_SELECT, - XmCR_MULTIPLE_SELECT, - XmCR_EXTENDED_SELECT, - XmCR_BROWSE_SELECT, - XmCR_DEFAULT_ACTION, - XmCR_CLIPBOARD_DATA_REQUEST, - XmCR_CLIPBOARD_DATA_DELETE, - XmCR_CASCADING, - XmCR_OK, - XmCR_CANCEL, - XmCR_DUMMY33, - XmCR_APPLY, - XmCR_NO_MATCH, - XmCR_COMMAND_ENTERED, - XmCR_COMMAND_CHANGED, - XmCR_EXPOSE, - XmCR_RESIZE, - XmCR_INPUT, - XmCR_GAIN_PRIMARY, - XmCR_LOSE_PRIMARY, - XmCR_CREATE, - XmCR_TEAR_OFF_ACTIVATE, - XmCR_TEAR_OFF_DEACTIVATE, - XmCR_OBSCURED_TRAVERSAL, -#if XmVERSION < 2 - XmCR_PROTOCOLS -#else - XmCR_FOCUS_MOVED, - XmCR_DUMMY48, - XmCR_DUMMY49, - XmCR_DUMMY50, - XmCR_DUMMY51, - XmCR_DUMMY52, - XmCR_DUMMY53, - XmCR_REPOST, - XmCR_COLLAPSED, - XmCR_EXPANDED, - XmCR_SELECT, - XmCR_DRAG_START, - XmCR_NO_FONT, - XmCR_NO_RENDITION, - XmCR_POST, - XmCR_SPIN_NEXT, - XmCR_SPIN_PRIOR, - XmCR_SPIN_FIRST, - XmCR_SPIN_LAST, - XmCR_PAGE_SCROLLER_INCREMENT, - XmCR_PAGE_SCROLLER_DECREMENT, - XmCR_MAJOR_TAB, - XmCR_MINOR_TAB, - XmCR_PROTOCOLS = 6666 -#endif -}; - -typedef unsigned char XmDirection; - -typedef struct { - int reason; - XEvent *event; - Window window; -} XmDrawingAreaCallbackStruct; - -#define XmUNSPECIFIED_PIXMAP 2 - -typedef unsigned char XmNavigationType; - -#endif /* GLWXM_H */ diff --git a/nx-X11/lib/GLw/GLwXm/XmP.h b/nx-X11/lib/GLw/GLwXm/XmP.h deleted file mode 100644 index d54cbc37f..000000000 --- a/nx-X11/lib/GLw/GLwXm/XmP.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2000 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$ */ - -/* - * This file is a fake Motif(TM) header intended to allow the compilation of - * libGLw without having a real Motif. Do not use this file to compile any - * application because it declares only a small subset of the API! - */ - -#ifndef GLWXM_P_H -#define GLWXM_P_H - -#include "GLwXm/Xm.h" -#include - -#define XmInheritBorderHighlight ((XtWidgetProc) _XtInherit) -#define XmInheritBorderUnhighlight ((XtWidgetProc) _XtInherit) - -void _XmBackgroundColorDefault(Widget widget, int offset, XrmValue *value); -void _XmForegroundColorDefault(Widget widget, int offset, XrmValue *value); -void _XmHighlightColorDefault(Widget widget, int offset, XrmValue *value); -void _XmPrimitiveHighlightPixmapDefault(Widget widget, int offset, - XrmValue *value); - -typedef enum { - XmSYNTHETIC_NONE, - XmSYNTHETIC_LOAD -} XmImportOperator; - -typedef void (*XmExportProc)(Widget, int, XtArgVal *); - -typedef XmImportOperator (*XmImportProc)(Widget, int, XtArgVal*); - -typedef struct _XmSyntheticResource { - String resource_name; - Cardinal resource_size; - Cardinal resource_offset; - XmExportProc export_proc; - XmImportProc import_proc; -} XmSyntheticResource; - -#endif /* GLWXM_P_H */ diff --git a/nx-X11/lib/GLw/GLwXm/XmStrDefs.h b/nx-X11/lib/GLw/GLwXm/XmStrDefs.h deleted file mode 100644 index 1e42c5ec4..000000000 --- a/nx-X11/lib/GLw/GLwXm/XmStrDefs.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2000 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$ */ - -/* - * This file is a fake Motif(TM) header intended to allow the compilation of - * libGLw without having a real Motif. Do not use this file to compile any - * application because it declares only a small subset of the API! - */ - -#ifndef GLWXM_STRDEFS_H -#define GLWXM_STRDEFS_H - -#ifndef _XmConst -#define _XmConst /**/ -#endif - -#ifdef XMSTRINGDEFINES - -#define XmCBackgroundPixmap "BackgroundPixmap" -#define XmRBackgroundPixmap "BackgroundPixmap" -#define XmRBooleanDimension "BooleanDimension" -#define XmNbottomAttachment "bottomAttachment" -#define XmNbottomWidget "bottomWidget" -#define XmCForegroundThreshold "ForegroundThreshold" -#define XmNforegroundThreshold "foregroundThreshold" -#define XmCHighlightColor "HighlightColor" -#define XmNhighlightColor "highlightColor" -#define XmCHighlightOnEnter "HighlightOnEnter" -#define XmNhighlightOnEnter "highlightOnEnter" -#define XmCHighlightThickness "HighlightThickness" -#define XmNhighlightThickness "highlightThickness" -#define XmCHighlightPixmap "HighlightPixmap" -#define XmNhighlightPixmap "highlightPixmap" -#define XmRHighlightPixmap "HighlightPixmap" -#define XmRHorizontalDimension "HorizontalDimension" -#define XmNleftAttachment "leftAttachment" -#define XmNrightAttachment "rightAttachment" -#define XmRStringDirection "StringDirection" -#define XmNtopAttachment "topAttachment" -#define XmCTraversalOn "TraversalOn" -#define XmNtraversalOn "traversalOn" -#define XmRXmBackgroundPixmap "XmBackgroundPixmap" - -#else /* XMSTRINGDEFINES */ - -extern _XmConst char _XmStrings[]; - -#define XmCBackgroundPixmap ((char *)&_XmStrings[299]) -#define XmRBackgroundPixmap ((char *)&_XmStrings[10844]) -#define XmRBooleanDimension ((char *)&_XmStrings[10872]) -#define XmNbottomAttachment ((char *)&_XmStrings[5017]) -#define XmNbottomWidget ((char *)&_XmStrings[5099]) -#define XmCHighlightColor ((char *)&_XmStrings[1844]) -#define XmNhighlightColor ((char *)&_XmStrings[6996]) -#define XmCHighlightOnEnter ((char *)&_XmStrings[1859]) -#define XmNhighlightOnEnter ((char *)&_XmStrings[7011]) -#define XmCHighlightThickness ((char *)&_XmStrings[1892]) -#define XmNhighlightThickness ((char *)&_XmStrings[7044]) -#define XmCForegroundThreshold ((char *)&_XmStrings[1808]) -#define XmNforegroundThreshold ((char *)&_XmStrings[6914]) -#define XmCHighlightPixmap ((char *)&_XmStrings[1876]) -#define XmNhighlightPixmap ((char *)&_XmStrings[7028]) -#define XmRHighlightPixmap ((char *)&_XmStrings[11299]) -#define XmRHorizontalDimension ((char *)&_XmStrings[11315]) -#define XmNleftAttachment ((char *)&_XmStrings[7523]) -#define XmNrightAttachment ((char *)&_XmStrings[9077]) -#define XmRStringDirection ((char *)&_XmStrings[11981]) -#define XmNtopAttachment ((char *)&_XmStrings[10165]) -#define XmCTraversalOn ((char *)&_XmStrings[4318]) -#define XmNtraversalOn ((char *)&_XmStrings[10361]) -#define XmRXmBackgroundPixmap ((char *)&_XmStrings[12210]) - -#endif /* XMSTRINGDEFINES */ - -/* copy Xt constant definitions */ -#include - -#define XmCBackground XtCBackground -#define XmNbackground XtNbackground -#define XmNbackgroundPixmap XtNbackgroundPixmap -#define XmCBoolean XtCBoolean -#define XmRBoolean XtRBoolean -#define XmRCallProc XtRCallProc -#define XmCForeground XtCForeground -#define XmNforeground XtNforeground -#define XmRImmediate XtRImmediate -#define XmRPixel XtRPixel -#define XmCPixmap XtCPixmap -#define XmNpixmap XtNpixmap -#define XmRPixmap XtRPixmap -#define XmRPrimHighlightPixmap XmRHighlightPixmap -#define XmRString XtRString -#define XmRStringArray XtRStringArray -#define XmRStringTable XtRStringTable - -#endif /* GLWXM_STRDEFS_H */ diff --git a/nx-X11/lib/GLw/Imakefile b/nx-X11/lib/GLw/Imakefile deleted file mode 100644 index 3eb0503fe..000000000 --- a/nx-X11/lib/GLw/Imakefile +++ /dev/null @@ -1,87 +0,0 @@ -XCOMM $XdotOrg: xc/lib/GLw/Imakefile,v 1.2 2005/08/24 16:27:26 alanc Exp $ -/* - * Copyright (c) 2000 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. - */ - -XCOMM $XFree86: xc/lib/GLw/Imakefile,v 1.3 2002/04/06 18:24:46 tsi Exp $ - -XCOMM -XCOMM Imakefile for GLw library - lots of modifications for XFree86 by -XCOMM Carlos A. M. dos Santos -XCOMM - -XCOMM Uncomment this and set the correct values if your Motif installation -XCOMM is out of the standard X tree and your Imake configuration is not -XCOMM correct (unfortunatelly, a common mistake). - -XCOMM MOTIF_INCLUDES = -I/usr/local/include -XCOMM MOTIF_LDFLAGS = -L/usr/local/lib - -#define DoNormalLib NormalLibGLw -#define DoSharedLib SharedLibGLw -#define DoDebugLib DebugLibGLw -#define DoProfileLib ProfileLibGLw - -#define HasSharedData NO -#define LibName GLw -#define SoRev SOGLWREV -#define IncSubdir GL - -#ifdef SharedGLwReqs -REQUIREDLIBS = SharedGLwReqs -#else -REQUIREDLIBS = $(LDPRELIBS) $(XTOOLLIB) $(XLIB) -#endif - -DEFINES = - -#if GLwUseXmStubs -SHAREDCODEDEF = SharedCodeDef -DUSE_XM_STUBS -#endif - -GLWSRCDIR = $(OGLSAMPLESRCDIR)/main/gfx/lib/glw - -INCLUDES = $(MOTIF_INCLUDES) -I. - -LOCAL_LDFLAGS = $(MOTIF_LDFLAGS) - -LINTLIBS = $(LINTXLIB) $(LINTXTOOL) - -HEADERS = GLwDrawA.h GLwDrawAP.h GLwMDrawA.h GLwMDrawAP.h -SRCS = GLwDrawA.c GLwM1DrawA.c GLwM2DrawA.c GLwDAUtil.c -OBJS = GLwDrawA.o GLwM1DrawA.o GLwM2DrawA.o GLwDAUtil.o - -#include - -LinkSourceFile(GLwDAUtil.c,$(GLWSRCDIR)) -LinkSourceFile(GLwDrawA.c,$(GLWSRCDIR)) -LinkSourceFile(GLwMDrawA.c,$(GLWSRCDIR)) -LinkSourceFile(GLwDrawA.h,$(GLWSRCDIR)) -LinkSourceFile(GLwDrawAP.h,$(GLWSRCDIR)) -LinkSourceFile(GLwMDrawA.h,$(GLWSRCDIR)) -LinkSourceFile(GLwMDrawAP.h,$(GLWSRCDIR)) - -DependTarget() diff --git a/nx-X11/lib/GLw/README.html b/nx-X11/lib/GLw/README.html deleted file mode 100644 index 973ba9cf0..000000000 --- a/nx-X11/lib/GLw/README.html +++ /dev/null @@ -1,242 +0,0 @@ - - - -GL widgets for Xt/Motif - XFree86 implementation - - - - - - -

GL widgets for Xt/Motif

-

XFree86 implementation

-

by Carlos A. M. dos Santos
casantos@cpmet.ufpel.tche.br

- -
- -

1. Introduction

-

-This directory contains the source code for SGI's OpenGL Xt/Motif(TM) widgets, -slightly modified to generate both Motif 1.x and 2.x versions of -the widget even if Motif is not available, as in the XFree86 distribution of -the X Window System. This code is based on that distributed by Silicon -Graphics as part of it's OpenGL Sample Implementation, not on the modified version -distributed with Mesa. - - -

2. Installation

-

-This code is intended to be compiled as part of the normal XFree86 building -process, under the xc/lib/GLw directory. To compile the library out of the X -source tree, follow instructions below. - -

2.1. Requirements

-

-Gzip and tar are needed to extract the files from the distribution archive. Tar is -a standard UNIX utility but if you don't have it use GNU tar, available in -source form at ftp://ftp.gnu.org/pub/gnu/. Gzip is not -a standard UNIX utility, though available in many systems. You may obtain it -(also source form) at the same FTP server as GNU tar. - -

-You need xmkmf and imake too. Depending on your operating system you may need -to install some kind of X Window System development kit, so check the vendor -documentation first. I was told that some UNIX systems don't have imake: -report this as a bug (to your vendor, not me). - -

-Of course you will need a C compiler. - -

2.2. Steps

-

-

    -
  1. Extract the source code from the distribution archive. -

    - - gzip -dc GLw.tar.gz | tar xf - - -

    -

  2. Go to the surce code directory and generate the makefile. -

    - - cd GLw
    - xmkmf -
    -

    For LessTif, use "mxmkmf" instead of "xmkmf". Imake support - is much better in recent versions of LessTif (since late july 2000). - If your Motif or OpenGL libraries and/or include files are installed in - non-standard locations (some UNIX vendors seem to be very creative :-) - then edit the file named Imakefile, remove the leading XCOMM of the - lines containing MOTIF_INCLUDES and MOTIF_LDFLAGS and set the - appropriate values. -

    -

  3. Compile the code with -

    - - make includes
    - make standalone -
    -

    -

  4. Install the library and manual pages with -

    - - make install
    - make install.man -
    -

    -

  5. Optionally, you may compile two test programs: xmdemo and xtdemo. You need OpenGL - (or Mesa) for both and Motif (or LessTif) for xmdemo. There are four - extra make targers for these programs: demos, stand-demos, stand-xmdemo - and stand-xtdemo. You may use them with: -

    - - make stand-demos
    - ./xmdemo - ./xtdemo -
    -

- -

2.3. Creating a shared library

-

-By default only a static library is created because most of the UNIX loaders, -if not all, complain about unresolved symbols even if the application doesn't -use the modules in which such symbols are referenced. However, if your system -supports libraries with weak symbols (e.g. Solaris, FreeBSD and Linux) it is -possible to fool the loader. All you have to do is edit the Imakefile, -changing "#define SharedLibGLw" and "#define GLwUseXmStubs" to YES, then -repeat the compilation process starting from step 2 in the previous section. - -

2.4. Problems

-

-If you have trouble, ask for help in the XFree86 "xperts" mailing list. Look -at http://www.xfree86.org for -instructions on how to subscribe. In desperation, send an email to casantos@cpmet.ufpel.tche.br. - -

-PLEASE DO NOT SEND ME EMAIL ASKING HOW TO INSTALL OR CONFIGURE YOUR OPERATING -SYSTEM, MODEM, NETWORK CARD, BREAD TOASTER, COFEE MAKER OR WHATEVER ELSE! - - -

3. Copyrights

-

-Most of the code is covered by the following license terms: -

-

-License Applicability. Except to the extent portions of this file are -made subject to an alternative license as permitted in the SGI Free -Software License B, Version 1.1 (the "License"), the contents of this -file are subject only to the provisions of the License. You may not use -this file except in compliance with the License. You may obtain a copy -of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -

-http://oss.sgi.com/projects/FreeB -

-Note that, as provided in the License, the Software is distributed on an -"AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -

-Original Code. The Original Code is: OpenGL Sample Implementation, -Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -Inc. The Original Code is Copyright © 1991-2000 Silicon Graphics, Inc. -Copyright in any portions created by third parties is as indicated -elsewhere herein. All Rights Reserved. -

-Additional Notice Provisions: The application programming interfaces -established by SGI in conjunction with the Original Code are The -OpenGL® Graphics System: A Specification (Version 1.2.1), released -April 1, 1999; The OpenGL® Graphics System Utility Library (Version -1.3), released November 4, 1998; and OpenGL® Graphics with the X -Window System® (Version 1.3), released October 19, 1998. This software -was created using the OpenGL® version 1.2.1 Sample Implementation -published by SGI, but has not been independently verified as being -compliant with the OpenGL® version 1.2.1 Specification. -

- -

-The demonstration programs are covered by the following license terms: - -

-

-Copyright © Mark J. Kilgard, 1995, 1996. - -

-NOTICE: This source code distribution contains source code contained in -the book "Programming OpenGL for the X Window System" (ISBN: -0-201-48359-9) published by Addison-Wesley. The programs and associated -files contained in the distribution were developed by Mark J. Kilgard and -are Copyright 1994, 1995, 1996 by Mark J. Kilgard (unless otherwise -noted). The programs are not in the public domain, but they are freely -distributable without licensing fees. These programs are provided without -guarantee or warrantee expressed or implied. -

- -

-The files contained in directory GLwXm are fake Motif headers, covered by -the XFree86 license, they permit us to generate both Motif 1.x and 2.x -versions of the widget without having Motif. Notice that they are NOT part of -a standard Motif distribution and shall not be used to compile any other code. - - -

4. Thanks

- -

-Many thanks to Silicon Graphics and Mark J. Kilgard for making their -software free. - - -

5. No thanks

- -
-

- -THIS SECTION CONTAINS MY PERSONAL OPINIONS AND -DOESN'T REPRESENT AN OFFICIAL POSITION OF THE XFree86 PROJECT. - -

- -

-The first incarnation of this version of libGLw used eight header files from -LessTif, four for each Motif version. -LessTif is covered by the GNU Library General Public License (LGPL) whose -terms are not compatible with the XFree86 licensing policy. Since the -copyright holder of LessTif is the Free Software -Foundation (FSF), I asked Richard Stallman, president of FSF and so called -"leader of the Free Software movement", permission to redistribute a copy of -those eight headers under XFree86 terms, still maintaining the FSF copyright. - -

-Observe that I was not asking him to change the license of LessTif as a whole, -but only to allow me to distribute copies of some header files containing -function prototypes, variable declarations and data type definitions. Even so, -Stallman said no because the files contained "more than 6000 lines of code". -Which code? The LessTif headers are mostly copies of the Motif ones and don't -contain any original GNU "code"! I can't still imagine a reason for Stallman's -negative answer except for paranoia. He seems to ignore what Motif is and -that LessTif's API is simply a copy of Motif's one. - -

-After spending some time, I made my own headers, that became much smaller than -the previous ones because I included only a subset of the Motif API and merged -everything into four files: 417 lines instead 6000. Humm, perhaps I should be -grateful to Sallman too :-). - - -

6. Trademarks

- -

-

    -
  • OpenGL is a trademark of Silicon Graphics, Inc. -
  • Motif is a trademark of the Open Group. -
- -
- - - diff --git a/nx-X11/lib/GLw/README.txt b/nx-X11/lib/GLw/README.txt deleted file mode 100644 index 4892f1e78..000000000 --- a/nx-X11/lib/GLw/README.txt +++ /dev/null @@ -1,199 +0,0 @@ - GL widgets for Xt/Motif - - XFree86 implementation - - by Carlos A. M. dos Santos - casantos@cpmet.ufpel.tche.br - - ------------------------------------------------------------------------ - -1. Introduction - -This directory contains the source code for SGI's OpenGL Xt/Motif(TM) -widgets, slightly modified to generate both Motif 1.x and 2.x versions of -the widget even if Motif is not available, as in the XFree86 distribution of -the X Window System. This code is based on that distributed by Silicon -Graphics as part of it's OpenGL Sample Implementation, not on the modified -version distributed with Mesa. - -2. Installation - -This code is intended to be compiled as part of the normal XFree86 building -process, under the xc/lib/GLw directory. To compile the library out of the X -source tree, follow instructions below. - -2.1. Requirements - -Gzip and tar are needed to extract the files from the distribution archive. -Tar is a standard UNIX utility but if you don't have it use GNU tar, -available in source form at ftp://ftp.gnu.org/pub/gnu/. Gzip is not a -standard UNIX utility, though available in many systems. You may obtain it -(also source form) at the same FTP server as GNU tar. - -You need xmkmf and imake too. Depending on your operating system you may -need to install some kind of X Window System development kit, so check the -vendor documentation first. I was told that some UNIX systems don't have -imake: report this as a bug (to your vendor, not me). - -Of course you will need a C compiler. - -2.2. Steps - - 1. Extract the source code from the distribution archive. - - gzip -dc GLw.tar.gz | tar xf - - - 2. Go to the surce code directory and generate the makefile. - - cd GLw - xmkmf - - For LessTif, use "mxmkmf" instead of "xmkmf". Imake support is much - better in recent versions of LessTif (since late july 2000). If your - Motif or OpenGL libraries and/or include files are installed in - non-standard locations (some UNIX vendors seem to be very creative :-) - then edit the file named Imakefile, remove the leading XCOMM of the - lines containing MOTIF_INCLUDES and MOTIF_LDFLAGS and set the - appropriate values. - - 3. Compile the code with - - make includes - make standalone - - 4. Install the library and manual pages with - - make install - make install.man - - 5. Optionally, you may compile two test programs: xmdemo and xtdemo. You - need OpenGL (or Mesa) for both and Motif (or LessTif) for xmdemo. There - are four extra make targers for these programs: demos, stand-demos, - stand-xmdemo and stand-xtdemo. You may use them with: - - make stand-demos - ./xmdemo ./xtdemo - -2.3. Creating a shared library - -By default only a static library is created because most of the UNIX -loaders, if not all, complain about unresolved symbols even if the -application doesn't use the modules in which such symbols are referenced. -However, if your system supports libraries with weak symbols (e.g. Solaris, -FreeBSD and Linux) it is possible to fool the loader. All you have to do is -edit the Imakefile, changing "#define SharedLibGLw" and "#define -GLwUseXmStubs" to YES, then repeat the compilation process starting from -step 2 in the previous section. - -2.4. Problems - -If you have trouble, ask for help in the XFree86 "xperts" mailing list. Look -at http://www.xfree86.org for instructions on how to subscribe. In -desperation, send an email to casantos@cpmet.ufpel.tche.br. - -PLEASE DO NOT SEND ME EMAIL ASKING HOW TO INSTALL OR CONFIGURE YOUR -OPERATING SYSTEM, MODEM, NETWORK CARD, BREAD TOASTER, COFEE MAKER OR -WHATEVER ELSE! - -3. Copyrights - -Most of the code is covered by the following license terms: - - License Applicability. Except to the extent portions of this file - are made subject to an alternative license as permitted in the SGI - Free Software License B, Version 1.1 (the "License"), the contents - of this file are subject only to the provisions of the License. - You may not use this file except in compliance with the License. - You may obtain a copy of the License at Silicon Graphics, Inc., - attn: Legal Services, 1600 Amphitheatre Parkway, Mountain View, CA - 94043-1351, or at: - - http://oss.sgi.com/projects/FreeB - - Note that, as provided in the License, the Software is distributed - on an "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND - CONDITIONS DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED - WARRANTIES AND CONDITIONS OF MERCHANTABILITY, SATISFACTORY - QUALITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - - Original Code. The Original Code is: OpenGL Sample Implementation, - Version 1.2.1, released January 26, 2000, developed by Silicon - Graphics, Inc. The Original Code is Copyright © 1991-2000 Silicon - Graphics, Inc. Copyright in any portions created by third parties - is as indicated elsewhere herein. All Rights Reserved. - - Additional Notice Provisions: The application programming - interfaces established by SGI in conjunction with the Original - Code are The OpenGL® Graphics System: A Specification (Version - 1.2.1), released April 1, 1999; The OpenGL® Graphics System - Utility Library (Version 1.3), released November 4, 1998; and - OpenGL® Graphics with the X Window System® (Version 1.3), released - October 19, 1998. This software was created using the OpenGL® - version 1.2.1 Sample Implementation published by SGI, but has not - been independently verified as being compliant with the OpenGL® - version 1.2.1 Specification. - -The demonstration programs are covered by the following license terms: - - Copyright © Mark J. Kilgard, 1995, 1996. - - NOTICE: This source code distribution contains source code - contained in the book "Programming OpenGL for the X Window System" - (ISBN: 0-201-48359-9) published by Addison-Wesley. The programs - and associated files contained in the distribution were developed - by Mark J. Kilgard and are Copyright 1994, 1995, 1996 by Mark J. - Kilgard (unless otherwise noted). The programs are not in the - public domain, but they are freely distributable without licensing - fees. These programs are provided without guarantee or warrantee - expressed or implied. - -The files contained in directory GLwXm are fake Motif headers, covered by -the XFree86 license, they permit us to generate both Motif 1.x and 2.x -versions of the widget without having Motif. Notice that they are NOT part -of a standard Motif distribution and shall not be used to compile any other -code. - -4. Thanks - -Many thanks to Silicon Graphics and Mark J. Kilgard for making their -software free. - -5. No thanks - - THIS SECTION CONTAINS MY PERSONAL OPINIONS AND DOESN'T REPRESENT - AN OFFICIAL POSITION OF THE XFree86 PROJECT. - -The first incarnation of this version of libGLw used eight header files from -LessTif, four for each Motif version. LessTif is covered by the GNU Library -General Public License (LGPL) whose terms are not compatible with the -XFree86 licensing policy. Since the copyright holder of LessTif is the Free -Software Foundation (FSF), I asked Richard Stallman, president of FSF and so -called "leader of the Free Software movement", permission to redistribute a -copy of those eight headers under XFree86 terms, still maintaining the FSF -copyright. - -Observe that I was not asking him to change the license of LessTif as a -whole, but only to allow me to distribute copies of some header files -containing function prototypes, variable declarations and data type -definitions. Even so, Stallman said no because the files contained "more -than 6000 lines of code". Which code? The LessTif headers are mostly copies -of the Motif ones and don't contain any original GNU "code"! I can't still -imagine a reason for Stallman's negative answer except for paranoia. He -seems to ignore what Motif is and that LessTif's API is simply a copy of -Motif's one. - -After spending some time, I made my own headers, that became much smaller -than the previous ones because I included only a subset of the Motif API and -merged everything into four files: 417 lines instead 6000. Humm, perhaps I -should be grateful to Sallman too :-). - -6. Trademarks - - * OpenGL is a trademark of Silicon Graphics, Inc. - * Motif is a trademark of the Open Group. - - ------------------------------------------------------------------------ - - - -$XFree86$ diff --git a/nx-X11/lib/ICE/ICE-def.cpp b/nx-X11/lib/ICE/ICE-def.cpp deleted file mode 100644 index cb9a27d7b..000000000 --- a/nx-X11/lib/ICE/ICE-def.cpp +++ /dev/null @@ -1,74 +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 - _IceTransGetHostname - _IceTransSetOption - _IceTransConnect - _IceTransClose - _IceTransOpenCOTSClient - _IceTransGetConnectionNumber - _IceTransRead - _IceTransWrite - -/* $Xorg: ICE-def.cpp,v 1.3 2000/08/21 16:42:31 coskrey Exp $ */ -/* $XFree86: xc/lib/ICE/ICE-def.cpp,v 1.4 2001/01/17 19:41:29 dawes Exp $ */ diff --git a/nx-X11/lib/ICE/ICE.h b/nx-X11/lib/ICE/ICE.h deleted file mode 100644 index e2924f1ab..000000000 --- a/nx-X11/lib/ICE/ICE.h +++ /dev/null @@ -1,102 +0,0 @@ -/* $Xorg: ICE.h,v 1.4 2001/02/09 02:03:26 xorgcvs Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/nx-X11/lib/ICE/ICEconn.h b/nx-X11/lib/ICE/ICEconn.h deleted file mode 100644 index cdfaccaea..000000000 --- a/nx-X11/lib/ICE/ICEconn.h +++ /dev/null @@ -1,251 +0,0 @@ -/* $Xorg: ICEconn.h,v 1.5 2001/02/09 02:03:26 xorgcvs Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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_ - -#include - -/* - * 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/nx-X11/lib/ICE/ICElib.h b/nx-X11/lib/ICE/ICElib.h deleted file mode 100644 index eb7a3aa32..000000000 --- a/nx-X11/lib/ICE/ICElib.h +++ /dev/null @@ -1,433 +0,0 @@ -/* $Xorg: ICElib.h,v 1.5 2001/02/09 02:03:26 xorgcvs Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.4 2001/12/14 19:53:35 dawes Exp $ */ - -#ifndef _ICELIB_H_ -#define _ICELIB_H_ - -#include -#include - -#define Bool int -#define Status int -#define True 1 -#define False 0 - -typedef void *IcePointer; - -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) ( - IceConn /* iceConn */, - IcePointer /* clientData */, - Bool /* opening */, - IcePointer * /* watchData */ -); - -typedef void (*IcePoProcessMsgProc) ( - IceConn /* iceConn */, - IcePointer /* clientData */, - int /* opcode */, - unsigned long /* length */, - Bool /* swap */, - IceReplyWaitInfo * /* replyWait */, - Bool * /* replyReadyRet */ -); - -typedef void (*IcePaProcessMsgProc) ( - IceConn /* iceConn */, - IcePointer /* clientData */, - int /* opcode */, - unsigned long /* length */, - Bool /* swap */ -); - -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) ( - IceConn /* iceConn */, - IcePointer * /* authStatePtr */, - Bool /* cleanUp */, - Bool /* swap */, - int /* authDataLen */, - IcePointer /* authData */, - int * /* replyDataLenRet */, - IcePointer * /* replyDataRet */, - char ** /* errorStringRet */ -); - -typedef IcePaAuthStatus (*IcePaAuthProc) ( - IceConn /* iceConn */, - IcePointer * /* authStatePtr */, - Bool /* swap */, - int /* authDataLen */, - IcePointer /* authData */, - int * /* replyDataLenRet */, - IcePointer * /* replyDataRet */, - char ** /* errorStringRet */ -); - -typedef Bool (*IceHostBasedAuthProc) ( - char * /* hostName */ -); - -typedef Status (*IceProtocolSetupProc) ( - IceConn /* iceConn */, - int /* majorVersion */, - int /* minorVersion */, - char * /* vendor */, - char * /* release */, - IcePointer * /* clientDataRet */, - char ** /* failureReasonRet */ -); - -typedef void (*IceProtocolActivateProc) ( - IceConn /* iceConn */, - IcePointer /* clientData */ -); - -typedef void (*IceIOErrorProc) ( - IceConn /* iceConn */ -); - -typedef void (*IcePingReplyProc) ( - IceConn /* iceConn */, - IcePointer /* clientData */ -); - -typedef void (*IceErrorHandler) ( - IceConn /* iceConn */, - Bool /* swap */, - int /* offendingMinorOpcode */, - unsigned long /* offendingSequence */, - int /* errorClass */, - int /* severity */, - IcePointer /* values */ -); - -typedef void (*IceIOErrorHandler) ( - IceConn /* iceConn */ -); - - -/* - * Function prototypes - */ - -_XFUNCPROTOBEGIN - -extern int IceRegisterForProtocolSetup ( - char * /* protocolName */, - char * /* vendor */, - char * /* release */, - int /* versionCount */, - IcePoVersionRec * /* versionRecs */, - int /* authCount */, - char ** /* authNames */, - IcePoAuthProc * /* authProcs */, - IceIOErrorProc /* IOErrorProc */ -); - -extern int IceRegisterForProtocolReply ( - char * /* protocolName */, - char * /* vendor */, - char * /* release */, - int /* versionCount */, - IcePaVersionRec * /* versionRecs */, - int /* authCount */, - char ** /* authNames */, - IcePaAuthProc * /* authProcs */, - IceHostBasedAuthProc /* hostBasedAuthProc */, - IceProtocolSetupProc /* protocolSetupProc */, - IceProtocolActivateProc /* protocolActivateProc */, - IceIOErrorProc /* IOErrorProc */ -); - -extern IceConn IceOpenConnection ( - char * /* networkIdsList */, - IcePointer /* context */, - Bool /* mustAuthenticate */, - int /* majorOpcodeCheck */, - int /* errorLength */, - char * /* errorStringRet */ -); - -extern IcePointer IceGetConnectionContext ( - IceConn /* iceConn */ -); - -extern Status IceListenForConnections ( - int * /* countRet */, - IceListenObj ** /* listenObjsRet */, - int /* errorLength */, - char * /* errorStringRet */ -); - -extern Status IceListenForWellKnownConnections ( - char * /* port */, - int * /* countRet */, - IceListenObj ** /* listenObjsRet */, - int /* errorLength */, - char * /* errorStringRet */ -); - -extern int IceGetListenConnectionNumber ( - IceListenObj /* listenObj */ -); - -extern char *IceGetListenConnectionString ( - IceListenObj /* listenObj */ -); - -extern char *IceComposeNetworkIdList ( - int /* count */, - IceListenObj * /* listenObjs */ -); - -extern void IceFreeListenObjs ( - int /* count */, - IceListenObj * /* listenObjs */ -); - -extern void IceSetHostBasedAuthProc ( - IceListenObj /* listenObj */, - IceHostBasedAuthProc /* hostBasedAuthProc */ -); - -extern IceConn IceAcceptConnection ( - IceListenObj /* listenObj */, - IceAcceptStatus * /* statusRet */ -); - -extern void IceSetShutdownNegotiation ( - IceConn /* iceConn */, - Bool /* negotiate */ -); - -extern Bool IceCheckShutdownNegotiation ( - IceConn /* iceConn */ -); - -extern IceCloseStatus IceCloseConnection ( - IceConn /* iceConn */ -); - -extern Status IceAddConnectionWatch ( - IceWatchProc /* watchProc */, - IcePointer /* clientData */ -); - -extern void IceRemoveConnectionWatch ( - IceWatchProc /* watchProc */, - IcePointer /* clientData */ -); - -extern IceProtocolSetupStatus IceProtocolSetup ( - IceConn /* iceConn */, - int /* myOpcode */, - IcePointer /* clientData */, - Bool /* mustAuthenticate */, - int * /* majorVersionRet */, - int * /* minorVersionRet */, - char ** /* vendorRet */, - char ** /* releaseRet */, - int /* errorLength */, - char * /* errorStringRet */ -); - -extern Status IceProtocolShutdown ( - IceConn /* iceConn */, - int /* majorOpcode */ -); - -extern IceProcessMessagesStatus IceProcessMessages ( - IceConn /* iceConn */, - IceReplyWaitInfo * /* replyWait */, - Bool * /* replyReadyRet */ -); - -extern Status IcePing ( - IceConn /* iceConn */, - IcePingReplyProc /* pingReplyProc */, - IcePointer /* clientData */ -); - -extern char *IceAllocScratch ( - IceConn /* iceConn */, - unsigned long /* size */ -); - -extern int IceFlush ( - IceConn /* iceConn */ -); - -extern int IceGetOutBufSize ( - IceConn /* iceConn */ -); - -extern int IceGetInBufSize ( - IceConn /* iceConn */ -); - -extern IceConnectStatus IceConnectionStatus ( - IceConn /* iceConn */ -); - -extern char *IceVendor ( - IceConn /* iceConn */ -); - -extern char *IceRelease ( - IceConn /* iceConn */ -); - -extern int IceProtocolVersion ( - IceConn /* iceConn */ -); - -extern int IceProtocolRevision ( - IceConn /* iceConn */ -); - -extern int IceConnectionNumber ( - IceConn /* iceConn */ -); - -extern char *IceConnectionString ( - IceConn /* iceConn */ -); - -extern unsigned long IceLastSentSequenceNumber ( - IceConn /* iceConn */ -); - -extern unsigned long IceLastReceivedSequenceNumber ( - IceConn /* iceConn */ -); - -extern Bool IceSwapping ( - IceConn /* iceConn */ -); - -extern IceErrorHandler IceSetErrorHandler ( - IceErrorHandler /* handler */ -); - -extern IceIOErrorHandler IceSetIOErrorHandler ( - IceIOErrorHandler /* handler */ -); - -extern char *IceGetPeerName ( - IceConn /* iceConn */ -); - -/* - * Multithread Routines - */ - -extern Status IceInitThreads ( - void -); - -extern void IceAppLockConn ( - IceConn /* iceConn */ -); - -extern void IceAppUnlockConn ( - IceConn /* iceConn */ -); - -_XFUNCPROTOEND - -#endif /* _ICELIB_H_ */ diff --git a/nx-X11/lib/ICE/ICElibint.h b/nx-X11/lib/ICE/ICElibint.h deleted file mode 100644 index fd84fdebf..000000000 --- a/nx-X11/lib/ICE/ICElibint.h +++ /dev/null @@ -1,537 +0,0 @@ -/* $Xorg: ICElibint.h,v 1.4 2001/02/09 02:03:26 xorgcvs Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/ICElibint.h,v 1.6 2001/12/14 19:53:35 dawes Exp $ */ - -#ifndef _ICELIBINT_H_ -#define _ICELIBINT_H_ - -#include -#include -#include -#include -#include -#include - -#include -#include - - -/* - * 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) ( - IceConn /* iceConn */, - int /* opcode */, - unsigned long /* length */, - Bool /* swap */, - IceReplyWaitInfo * /* replyWait */, - Bool * /* replyReadyRet */, - Bool * /* connectionClosedRet */ -); - -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, _end, _bail) \ -{ \ - CARD16 _len; \ - EXTRACT_CARD16 (_pBuf, _swap, _len); \ - _pBuf += _len + PAD32(2+_len); \ - if (_pBuf > _end) { \ - _bail; \ - } \ -} - -#define SKIP_LISTOF_STRING(_pBuf, _swap, _count, _end, _bail) \ -{ \ - int _i; \ - for (_i = 0; _i < _count; _i++) \ - SKIP_STRING (_pBuf, _swap, _end, _bail); \ -} - - - -/* - * 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 ( - IceConn /* iceConn */, - int /* offendingMajor */, - int /* offendingMinor */, - int /* severity */ -); - -extern void _IceErrorNoAuthentication ( - IceConn /* iceConn */, - int /* offendingMinor */ -); - -extern void _IceErrorNoVersion ( - IceConn /* iceConn */, - int /* offendingMinor */ -); - -extern void _IceErrorSetupFailed ( - IceConn /* iceConn */, - int /* offendingMinor */, - char * /* reason */ -); - -extern void _IceErrorAuthenticationRejected ( - IceConn /* iceConn */, - int /* offendingMinor */, - char * /* reason */ -); - -extern void _IceErrorAuthenticationFailed ( - IceConn /* iceConn */, - int /* offendingMinor */, - char * /* reason */ -); - -extern void _IceErrorProtocolDuplicate ( - IceConn /* iceConn */, - char * /* protocolName */ -); - -extern void _IceErrorMajorOpcodeDuplicate ( - IceConn /* iceConn */, - int /* majorOpcode */ -); - -extern void _IceErrorUnknownProtocol ( - IceConn /* iceConn */, - char * /* protocolName */ -); - -extern void _IceAddOpcodeMapping ( - IceConn /* iceConn */, - int /* hisOpcode */, - int /* myOpcode */ -); - -extern char *_IceGetPeerName ( - IceConn /* iceConn */ -); - -extern void _IceFreeConnection ( - IceConn /* iceConn */ -); - -extern void _IceAddReplyWait ( - IceConn /* iceConn */, - IceReplyWaitInfo * /* replyWait */ -); - -extern IceReplyWaitInfo *_IceSearchReplyWaits ( - IceConn /* iceConn */, - int /* majorOpcode */ -); - -extern void _IceSetReplyReady ( - IceConn /* iceConn */, - IceReplyWaitInfo * /* replyWait */ -); - -extern Bool _IceCheckReplyReady ( - IceConn /* iceConn */, - IceReplyWaitInfo * /* replyWait */ -); - -extern void _IceConnectionOpened ( - IceConn /* iceConn */ -); - -extern void _IceConnectionClosed ( - IceConn /* iceConn */ -); - -extern void _IceGetPoAuthData ( - char * /* protocol_name */, - char * /* address */, - char * /* auth_name */, - unsigned short * /* auth_data_length_ret */, - char ** /* auth_data_ret */ -); - -extern void _IceGetPaAuthData ( - char * /* protocol_name */, - char * /* address */, - char * /* auth_name */, - unsigned short * /* auth_data_length_ret */, - char ** /* auth_data_ret */ -); - -extern void _IceGetPoValidAuthIndices ( - char * /* protocol_name */, - char * /* address */, - int /* num_auth_names */, - char ** /* auth_names */, - int * /* num_indices_ret */, - int * /* indices_ret */ -); - -extern void _IceGetPaValidAuthIndices ( - char * /* protocol_name */, - char * /* address */, - int /* num_auth_names */, - char ** /* auth_names */, - int * /* num_indices_ret */, - int * /* indices_ret */ -); - -#endif /* _ICELIBINT_H_ */ diff --git a/nx-X11/lib/ICE/ICEmsg.h b/nx-X11/lib/ICE/ICEmsg.h deleted file mode 100644 index ddae02784..000000000 --- a/nx-X11/lib/ICE/ICEmsg.h +++ /dev/null @@ -1,295 +0,0 @@ -/* $Xorg: ICEmsg.h,v 1.4 2001/02/09 02:03:26 xorgcvs Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/ICEmsg.h,v 1.4 2001/12/20 19:40:59 tsi Exp $ */ - -#ifndef _ICEMSG_H_ -#define _ICEMSG_H_ - -#include - -#include - -_XFUNCPROTOBEGIN - -/* - * Function prototypes for internal ICElib functions - */ - -extern Status _IceRead ( - IceConn /* iceConn */, - unsigned long /* nbytes */, - char * /* ptr */ -); - -extern void _IceReadSkip ( - IceConn /* iceConn */, - unsigned long /* nbytes */ -); - -extern void _IceWrite ( - IceConn /* iceConn */, - unsigned long /* nbytes */, - char * /* ptr */ -); - - -extern void _IceErrorBadMinor ( - IceConn /* iceConn */, - int /* majorOpcode */, - int /* offendingMinor */, - int /* severity */ -); - -extern void _IceErrorBadState ( - IceConn /* iceConn */, - int /* majorOpcode */, - int /* offendingMinor */, - int /* severity */ -); - -extern void _IceErrorBadLength ( - IceConn /* iceConn */, - int /* majorOpcode */, - int /* offendingMinor */, - int /* severity */ -); - -extern void _IceErrorBadValue ( - IceConn /* iceConn */, - int /* majorOpcode */, - int /* offendingMinor */, - int /* offset */, - int /* length */, - IcePointer /* value */ -); - - -/* - * 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); \ -} - -_XFUNCPROTOEND - -#endif /* _ICEMSG_H_ */ diff --git a/nx-X11/lib/ICE/ICEproto.h b/nx-X11/lib/ICE/ICEproto.h deleted file mode 100644 index 9ca7c44ce..000000000 --- a/nx-X11/lib/ICE/ICEproto.h +++ /dev/null @@ -1,176 +0,0 @@ -/* $Xorg: ICEproto.h,v 1.5 2001/02/09 02:03:26 xorgcvs Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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_ - -#include - -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/nx-X11/lib/ICE/ICEutil.h b/nx-X11/lib/ICE/ICEutil.h deleted file mode 100644 index 8651d94eb..000000000 --- a/nx-X11/lib/ICE/ICEutil.h +++ /dev/null @@ -1,126 +0,0 @@ -/* $Xorg: ICEutil.h,v 1.5 2001/02/09 02:03:26 xorgcvs Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/ICEutil.h,v 1.4 2001/12/20 19:40:59 tsi Exp $ */ - -#ifndef _ICEUTIL_H_ -#define _ICEUTIL_H_ - -#include - -#include - -_XFUNCPROTOBEGIN - -/* - * 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 ( - void -); - -extern int IceLockAuthFile ( - char * /* file_name */, - int /* retries */, - int /* timeout */, - long /* dead */ -); - -extern void IceUnlockAuthFile ( - char * /* file_name */ -); - -extern IceAuthFileEntry *IceReadAuthFileEntry ( - FILE * /* auth_file */ -); - -extern void IceFreeAuthFileEntry ( - IceAuthFileEntry * /* auth */ -); - -extern Status IceWriteAuthFileEntry ( - FILE * /* auth_file */, - IceAuthFileEntry * /* auth */ -); - -extern IceAuthFileEntry *IceGetAuthFileEntry ( - char * /* protocol_name */, - char * /* network_id */, - char * /* auth_name */ -); - -extern char *IceGenerateMagicCookie ( - int /* len */ -); - -extern void IceSetPaAuthData ( - int /* numEntries */, - IceAuthDataEntry * /* entries */ -); - -_XFUNCPROTOEND - -#endif /* _ICEUTIL_H_ */ diff --git a/nx-X11/lib/ICE/Imakefile b/nx-X11/lib/ICE/Imakefile deleted file mode 100644 index 0dce0c7b4..000000000 --- a/nx-X11/lib/ICE/Imakefile +++ /dev/null @@ -1,92 +0,0 @@ -XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:44:11 cpqbld Exp $ - - - - -XCOMM $XFree86: xc/lib/ICE/Imakefile,v 3.5 2001/04/23 16:17:06 tsi 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 $(XTRANS_FAILDEFINES) -#else -CONN_DEFINES = $(CONNECTION_FLAGS) -DICE_t -DTRANS_CLIENT -DTRANS_SERVER $(XTRANS_FAILDEFINES) -#endif - -#if HasBSD44Sockets -SOCK_DEFINES = -DBSD44SOCKETS -#endif - -DEPEND_DEFINES = $(TRANS_INCLUDES) $(CONN_DEFINES) DependDefines - -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 - -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(shutdown,$(ICONFIGFILES),$(TRANS_INCLUDES) $(CONN_DEFINES)) -SpecialCLibObjectRule(transport,$(ICONFIGFILES),$(TRANS_INCLUDES) $(CONN_DEFINES) $(SOCK_DEFINES)) -LinkSourceFile(transport.c,$(TRANSCOMMSRC)) - -DependTarget() diff --git a/nx-X11/lib/ICE/accept.c b/nx-X11/lib/ICE/accept.c deleted file mode 100644 index df2b258c5..000000000 --- a/nx-X11/lib/ICE/accept.c +++ /dev/null @@ -1,188 +0,0 @@ -/* $Xorg: accept.c,v 1.4 2001/02/09 02:03:26 xorgcvs Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 -******************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "ICElibint.h" -#include - - -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/nx-X11/lib/ICE/authutil.c b/nx-X11/lib/ICE/authutil.c deleted file mode 100644 index 7b620732e..000000000 --- a/nx-X11/lib/ICE/authutil.c +++ /dev/null @@ -1,539 +0,0 @@ -/* $Xorg: authutil.c,v 1.5 2001/02/09 02:03:26 xorgcvs Exp $ */ -/* $XdotOrg: xc/lib/ICE/authutil.c,v 1.4 2005/07/03 07:00:55 daniels Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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: authutil.c,v 3.9 2002/05/31 18:45:41 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "ICElibint.h" -#include -#include -#include -#include - -#include -#define Time_t time_t -#ifdef __UNIXOS2__ -extern char* getenv(const char*); -#define link rename -#endif -#ifndef X_NOT_POSIX -#include -#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(__UNIXOS2__) -#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 __UNIXOS2__ - 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); - - data = malloc ((unsigned) len + 1); - - if (!data) - return (0); - - if (len != 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/nx-X11/lib/ICE/connect.c b/nx-X11/lib/ICE/connect.c deleted file mode 100644 index e06aa04bc..000000000 --- a/nx-X11/lib/ICE/connect.c +++ /dev/null @@ -1,543 +0,0 @@ -/* $Xorg: connect.c,v 1.4 2001/02/09 02:03:26 xorgcvs Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.9 2001/12/14 19:53:35 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "ICElibint.h" -#include -#include "globals.h" - -static XtransConnInfo ConnectToPeer(); - -#define Strstr strstr - -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 *) calloc (1, 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) - { - /* - * 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/nx-X11/lib/ICE/error.c b/nx-X11/lib/ICE/error.c deleted file mode 100644 index 49b164bcc..000000000 --- a/nx-X11/lib/ICE/error.c +++ /dev/null @@ -1,641 +0,0 @@ -/* $Xorg: error.c,v 1.4 2001/02/09 02:03:26 xorgcvs Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.5 2001/10/28 03:32:28 tsi Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "ICElibint.h" -#include - -#include - - -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 = %ld, errno = %d\n", - (long)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/nx-X11/lib/ICE/getauth.c b/nx-X11/lib/ICE/getauth.c deleted file mode 100644 index 73fcd8aec..000000000 --- a/nx-X11/lib/ICE/getauth.c +++ /dev/null @@ -1,274 +0,0 @@ -/* $Xorg: getauth.c,v 1.4 2001/02/09 02:03:26 xorgcvs Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/getauth.c,v 1.2 2001/10/28 03:32:28 tsi Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "ICElibint.h" -#include - -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 = NULL; - 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/nx-X11/lib/ICE/globals.h b/nx-X11/lib/ICE/globals.h deleted file mode 100644 index 0532f5565..000000000 --- a/nx-X11/lib/ICE/globals.h +++ /dev/null @@ -1,64 +0,0 @@ -/* $Xorg: globals.h,v 1.4 2001/02/09 02:03:26 xorgcvs Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.4 2001/12/14 19:53:35 dawes Exp $ */ - -extern void _IceDefaultErrorHandler (); -extern void _IceDefaultIOErrorHandler (); - -extern IcePoAuthStatus _IcePoMagicCookie1Proc (); -extern IcePaAuthStatus _IcePaMagicCookie1Proc (); - -extern void _IceProcessCoreMessage (); - -#ifndef __UNIXOS2__ -IceConn _IceConnectionObjs[256]; -char *_IceConnectionStrings[256]; -_IceProtocol _IceProtocols[255]; -#else -IceConn _IceConnectionObjs[256] = {0}; -char *_IceConnectionStrings[256] = {0}; -_IceProtocol _IceProtocols[255] = {0}; -#endif -int _IceConnectionCount = 0; - -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/nx-X11/lib/ICE/iceauth.c b/nx-X11/lib/ICE/iceauth.c deleted file mode 100644 index 01c73ced3..000000000 --- a/nx-X11/lib/ICE/iceauth.c +++ /dev/null @@ -1,278 +0,0 @@ -/* $Xorg: iceauth.c,v 1.4 2001/02/09 02:03:26 xorgcvs Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.5 2001/12/14 19:53:36 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "ICElibint.h" -#include - -#include -#define Time_t time_t - -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 __UNIXOS2__ - 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/nx-X11/lib/ICE/listen.c b/nx-X11/lib/ICE/listen.c deleted file mode 100644 index 7708cfe02..000000000 --- a/nx-X11/lib/ICE/listen.c +++ /dev/null @@ -1,283 +0,0 @@ -/* $Xorg: listen.c,v 1.5 2001/02/09 02:03:26 xorgcvs Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 -******************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "ICElibint.h" -#include -#include - - -Status -IceListenForConnections (countRet, listenObjsRet, errorLength, errorStringRet) - -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 (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/nx-X11/lib/ICE/listenwk.c b/nx-X11/lib/ICE/listenwk.c deleted file mode 100644 index f97aa44af..000000000 --- a/nx-X11/lib/ICE/listenwk.c +++ /dev/null @@ -1,161 +0,0 @@ -/* $Xorg: listenwk.c,v 1.5 2001/02/09 02:03:26 xorgcvs Exp $ */ - -/* - -Copyright 1996, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.3 2001/01/17 19:41:29 dawes Exp $ */ - - -/* Author: Ralph Mor, X Consortium */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "ICElibint.h" -#include -#include - - -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/nx-X11/lib/ICE/locking.c b/nx-X11/lib/ICE/locking.c deleted file mode 100644 index 510803030..000000000 --- a/nx-X11/lib/ICE/locking.c +++ /dev/null @@ -1,67 +0,0 @@ -/* $Xorg: locking.c,v 1.4 2001/02/09 02:03:26 xorgcvs Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 -******************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#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/nx-X11/lib/ICE/misc.c b/nx-X11/lib/ICE/misc.c deleted file mode 100644 index a6e91c65a..000000000 --- a/nx-X11/lib/ICE/misc.c +++ /dev/null @@ -1,630 +0,0 @@ -/* $Xorg: misc.c,v 1.4 2001/02/09 02:03:26 xorgcvs Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.3 2001/01/17 19:41:29 dawes Exp $ */ - -#ifdef WIN32 -#define _WILLWINSOCK_ -#endif -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "ICElibint.h" -#include -#include -#ifdef WIN32 -#include -#include -#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) -{ - return (_IceTransGetPeerNetworkId (iceConn->trans_conn)); -} - - -char * -_IceGetPeerName (IceConn iceConn) -{ - return (IceGetPeerName(iceConn)); -} diff --git a/nx-X11/lib/ICE/ping.c b/nx-X11/lib/ICE/ping.c deleted file mode 100644 index 45329b6f5..000000000 --- a/nx-X11/lib/ICE/ping.c +++ /dev/null @@ -1,66 +0,0 @@ -/* $Xorg: ping.c,v 1.4 2001/02/09 02:03:26 xorgcvs Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 -******************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#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/nx-X11/lib/ICE/process.c b/nx-X11/lib/ICE/process.c deleted file mode 100644 index 2a97dcbe8..000000000 --- a/nx-X11/lib/ICE/process.c +++ /dev/null @@ -1,2548 +0,0 @@ -/* $Xorg: process.c,v 1.4 2001/02/09 02:03:26 xorgcvs Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.9tsi Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "ICElibint.h" - -#include /* sprintf */ - -/* - * Check for bad length - */ - -#define CHECK_SIZE_MATCH(_iceConn, _opcode, _expected_len, _actual_len, _severity, _return) \ - if ((((_actual_len) - SIZEOF (iceMsg)) >> 3) != _expected_len) \ - { \ - _IceErrorBadLength (_iceConn, 0, _opcode, _severity); \ - return (_return); \ - } - -#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); \ - } - -#define BAIL_STRING(_iceConn, _opcode, _pStart) {\ - _IceErrorBadLength (_iceConn, 0, _opcode, IceFatalToConnection);\ - 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, IceProcessMessagesIOError); - - 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". - * - * Also, when two hosts communicate over an ICE connection and use - * different major opcodes for a subprotocol, it is impossible - * to use message replies unless we translate opcodes before - * comparing them. - */ - - { - int op; - - if (header->majorOpcode == 0) - { - op = 0; - } - else - { - int idx = header->majorOpcode - iceConn->his_min_opcode; - op = iceConn->process_msg_info[idx].my_opcode; - } - useThisReplyWait = _IceSearchReplyWaits (iceConn, op); - } - } - - 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 = 0; - 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 = NULL; - char *pData, *pStart, *pEnd; - 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; - pEnd = pStart + (length << 3); - - SKIP_STRING (pData, swap, pEnd, - BAIL_STRING(iceConn, ICE_ConnectionSetup, - pStart)); /* vendor */ - SKIP_STRING (pData, swap, pEnd, - BAIL_STRING(iceConn, ICE_ConnectionSetup, - pStart)); /* release */ - SKIP_LISTOF_STRING (pData, swap, (int) message->authCount, pEnd, - BAIL_STRING(iceConn, ICE_ConnectionSetup, - pStart)); /* 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 = 0; - - 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 = NULL, *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, *pEnd; - Bool replyReady; - -#if 0 /* No-op */ - CHECK_AT_LEAST_SIZE (iceConn, ICE_ConnectionReply, - length, SIZEOF (iceConnectionReplyMsg), IceFatalToConnection); -#endif - - IceReadCompleteMessage (iceConn, SIZEOF (iceConnectionReplyMsg), - iceConnectionReplyMsg, message, pStart); - - if (!IceValidIO (iceConn)) - { - IceDisposeCompleteMessage (iceConn, pStart); - return (0); - } - - pData = pStart; - pEnd = pStart + (length << 3); - - SKIP_STRING (pData, swap, pEnd, - BAIL_STRING (iceConn, ICE_ConnectionReply, - pStart)); /* vendor */ - SKIP_STRING (pData, swap, pEnd, - BAIL_STRING (iceConn, ICE_ConnectionReply, - pStart)); /* 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 = NULL; - char *protocolName; - char *pData, *pStart, *pEnd; - 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; - pEnd = pStart + (length << 3); - - SKIP_STRING (pData, swap, pEnd, - BAIL_STRING(iceConn, ICE_ProtocolSetup, - pStart)); /* proto name */ - SKIP_STRING (pData, swap, pEnd, - BAIL_STRING(iceConn, ICE_ProtocolSetup, - pStart)); /* vendor */ - SKIP_STRING (pData, swap, pEnd, - BAIL_STRING(iceConn, ICE_ProtocolSetup, - pStart)); /* release */ - SKIP_LISTOF_STRING (pData, swap, (int) message->authCount, pEnd, - BAIL_STRING(iceConn, ICE_ProtocolSetup, - pStart)); /* 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, *pEnd; - Bool replyReady; - -#if 0 /* No-op */ - CHECK_AT_LEAST_SIZE (iceConn, ICE_ProtocolReply, - length, SIZEOF (iceProtocolReplyMsg), IceFatalToProtocol); -#endif - - IceReadCompleteMessage (iceConn, SIZEOF (iceProtocolReplyMsg), - iceProtocolReplyMsg, message, pStart); - - if (!IceValidIO (iceConn)) - { - IceDisposeCompleteMessage (iceConn, pStart); - return (0); - } - - pData = pStart; - pEnd = pStart + (length << 3); - - SKIP_STRING (pData, swap, pEnd, - BAIL_STRING(iceConn, ICE_ProtocolReply, - pStart)); /* vendor */ - SKIP_STRING (pData, swap, pEnd, - BAIL_STRING(iceConn, ICE_ProtocolReply, - pStart)); /* 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, 0); - - PingReply (iceConn); - - return (0); -} - - - -static int -ProcessPingReply (iceConn, length) - -IceConn iceConn; -unsigned long length; - -{ - CHECK_SIZE_MATCH (iceConn, ICE_PingReply, - length, SIZEOF (icePingReplyMsg), IceFatalToConnection, 0); - - 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, 0); - - 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, 0); - - 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; -} - diff --git a/nx-X11/lib/ICE/protosetup.c b/nx-X11/lib/ICE/protosetup.c deleted file mode 100644 index 7a21e2e1d..000000000 --- a/nx-X11/lib/ICE/protosetup.c +++ /dev/null @@ -1,293 +0,0 @@ -/* $Xorg: protosetup.c,v 1.4 2001/02/09 02:03:26 xorgcvs Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/protosetup.c,v 1.2 2001/10/28 03:32:28 tsi Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#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 = NULL; - 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/nx-X11/lib/ICE/register.c b/nx-X11/lib/ICE/register.c deleted file mode 100644 index 20e60dfdf..000000000 --- a/nx-X11/lib/ICE/register.c +++ /dev/null @@ -1,256 +0,0 @@ -/* $Xorg: register.c,v 1.4 2001/02/09 02:03:26 xorgcvs Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 -******************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#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/nx-X11/lib/ICE/replywait.c b/nx-X11/lib/ICE/replywait.c deleted file mode 100644 index e00eb9285..000000000 --- a/nx-X11/lib/ICE/replywait.c +++ /dev/null @@ -1,161 +0,0 @@ -/* $Xorg: replywait.c,v 1.4 2001/02/09 02:03:26 xorgcvs Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 -******************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#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/nx-X11/lib/ICE/setauth.c b/nx-X11/lib/ICE/setauth.c deleted file mode 100644 index 4fd77182a..000000000 --- a/nx-X11/lib/ICE/setauth.c +++ /dev/null @@ -1,121 +0,0 @@ -/* $Xorg: setauth.c,v 1.4 2001/02/09 02:03:26 xorgcvs Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.4 2001/12/14 19:53:36 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "ICElibint.h" -#include - - -/* - * 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 __UNIXOS2__ -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/nx-X11/lib/ICE/shutdown.c b/nx-X11/lib/ICE/shutdown.c deleted file mode 100644 index 5c957c7bb..000000000 --- a/nx-X11/lib/ICE/shutdown.c +++ /dev/null @@ -1,330 +0,0 @@ -/* $Xorg: shutdown.c,v 1.4 2001/02/09 02:03:26 xorgcvs Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/shutdown.c,v 3.3 2001/08/01 00:44:37 tsi Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "ICElibint.h" -#include - - -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/nx-X11/lib/ICE/watch.c b/nx-X11/lib/ICE/watch.c deleted file mode 100644 index ec90d78e4..000000000 --- a/nx-X11/lib/ICE/watch.c +++ /dev/null @@ -1,206 +0,0 @@ -/* $Xorg: watch.c,v 1.4 2001/02/09 02:03:26 xorgcvs Exp $ */ -/****************************************************************************** - - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 -******************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#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/nx-X11/lib/SM/Imakefile b/nx-X11/lib/SM/Imakefile deleted file mode 100644 index d2687bb64..000000000 --- a/nx-X11/lib/SM/Imakefile +++ /dev/null @@ -1,56 +0,0 @@ -XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:44:28 cpqbld Exp $ - - - - -XCOMM $XFree86: xc/lib/SM/Imakefile,v 1.3 2001/01/17 19:41:31 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 - -#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) DependDefines - -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 - -SpecialCLibObjectRule(sm_manager,$(ICONFIGFILES),$(TRANS_INCLUDES) $(CONN_DEFINES)) -SpecialCLibObjectRule(sm_genid,$(ICONFIGFILES),$(TRANS_INCLUDES) $(CONN_DEFINES)) - -DependTarget() diff --git a/nx-X11/lib/SM/SM-def.cpp b/nx-X11/lib/SM/SM-def.cpp deleted file mode 100644 index 9a59704e2..000000000 --- a/nx-X11/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 -/* $Xorg: SM-def.cpp,v 1.3 2000/08/17 19:44:28 cpqbld Exp $ */ diff --git a/nx-X11/lib/SM/SM.h b/nx-X11/lib/SM/SM.h deleted file mode 100644 index 0621b4918..000000000 --- a/nx-X11/lib/SM/SM.h +++ /dev/null @@ -1,130 +0,0 @@ -/* $Xorg: SM.h,v 1.4 2001/02/09 02:03:30 xorgcvs Exp $ */ - -/* - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/nx-X11/lib/SM/SMlib.h b/nx-X11/lib/SM/SMlib.h deleted file mode 100644 index 92418c148..000000000 --- a/nx-X11/lib/SM/SMlib.h +++ /dev/null @@ -1,545 +0,0 @@ -/* $Xorg: SMlib.h,v 1.4 2001/02/09 02:03:30 xorgcvs Exp $ */ - -/* - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 -#include - - -/* - * 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) ( - SmcConn /* smcConn */, - SmPointer /* clientData */, - int /* saveType */, - Bool /* shutdown */, - int /* interactStyle */, - Bool /* fast */ -); - -typedef void (*SmcSaveYourselfPhase2Proc) ( - SmcConn /* smcConn */, - SmPointer /* clientData */ -); - -typedef void (*SmcInteractProc) ( - SmcConn /* smcConn */, - SmPointer /* clientData */ -); - -typedef void (*SmcDieProc) ( - SmcConn /* smcConn */, - SmPointer /* clientData */ -); - -typedef void (*SmcShutdownCancelledProc) ( - SmcConn /* smcConn */, - SmPointer /* clientData */ -); - -typedef void (*SmcSaveCompleteProc) ( - SmcConn /* smcConn */, - SmPointer /* clientData */ -); - -typedef void (*SmcPropReplyProc) ( - SmcConn /* smcConn */, - SmPointer /* clientData */, - int /* numProps */, - SmProp ** /* props */ -); - - -/* - * 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) ( - SmsConn /* smsConn */, - SmPointer /* managerData */, - char * /* previousId */ -); - -typedef void (*SmsInteractRequestProc) ( - SmsConn /* smsConn */, - SmPointer /* managerData */, - int /* dialogType */ -); - -typedef void (*SmsInteractDoneProc) ( - SmsConn /* smsConn */, - SmPointer /* managerData */, - Bool /* cancelShutdown */ -); - -typedef void (*SmsSaveYourselfRequestProc) ( - SmsConn /* smsConn */, - SmPointer /* managerData */, - int /* saveType */, - Bool /* shutdown */, - int /* interactStyle */, - Bool /* fast */, - Bool /* global */ -); - -typedef void (*SmsSaveYourselfPhase2RequestProc) ( - SmsConn /* smsConn */, - SmPointer /* managerData */ -); - -typedef void (*SmsSaveYourselfDoneProc) ( - SmsConn /* smsConn */, - SmPointer /* managerData */, - Bool /* success */ -); - -typedef void (*SmsCloseConnectionProc) ( - SmsConn /* smsConn */, - SmPointer /* managerData */, - int /* count */, - char ** /* reasonMsgs */ -); - -typedef void (*SmsSetPropertiesProc) ( - SmsConn /* smsConn */, - SmPointer /* managerData */, - int /* numProps */, - SmProp ** /* props */ -); - -typedef void (*SmsDeletePropertiesProc) ( - SmsConn /* smsConn */, - SmPointer /* managerData */, - int /* numProps */, - char ** /* propNames */ -); - -typedef void (*SmsGetPropertiesProc) ( - SmsConn /* smsConn */, - SmPointer /* managerData */ -); - - -/* - * 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) ( - SmsConn /* smsConn */, - SmPointer /* managerData */, - unsigned long * /* maskRet */, - SmsCallbacks * /* callbacksRet */, - char ** /* failureReasonRet */ -); - - - -/* - * Error handlers - */ - -typedef void (*SmcErrorHandler) ( - SmcConn /* smcConn */, - Bool /* swap */, - int /* offendingMinorOpcode */, - unsigned long /* offendingSequence */, - int /* errorClass */, - int /* severity */, - SmPointer /* values */ -); - -typedef void (*SmsErrorHandler) ( - SmsConn /* smsConn */, - Bool /* swap */, - int /* offendingMinorOpcode */, - unsigned long /* offendingSequence */, - int /* errorClass */, - int /* severity */, - SmPointer /* values */ -); - - - -/* - * Function Prototypes - */ - -_XFUNCPROTOBEGIN - -extern SmcConn SmcOpenConnection ( - char * /* networkIdsList */, - SmPointer /* context */, - int /* xsmpMajorRev */, - int /* xsmpMinorRev */, - unsigned long /* mask */, - SmcCallbacks * /* callbacks */, - char * /* previousId */, - char ** /* clientIdRet */, - int /* errorLength */, - char * /* errorStringRet */ -); - -extern SmcCloseStatus SmcCloseConnection ( - SmcConn /* smcConn */, - int /* count */, - char ** /* reasonMsgs */ -); - -extern void SmcModifyCallbacks ( - SmcConn /* smcConn */, - unsigned long /* mask */, - SmcCallbacks * /* callbacks */ -); - -extern void SmcSetProperties ( - SmcConn /* smcConn */, - int /* numProps */, - SmProp ** /* props */ -); - -extern void SmcDeleteProperties ( - SmcConn /* smcConn */, - int /* numProps */, - char ** /* propNames */ -); - -extern Status SmcGetProperties ( - SmcConn /* smcConn */, - SmcPropReplyProc /* propReplyProc */, - SmPointer /* clientData */ -); - -extern Status SmcInteractRequest ( - SmcConn /* smcConn */, - int /* dialogType */, - SmcInteractProc /* interactProc */, - SmPointer /* clientData */ -); - -extern void SmcInteractDone ( - SmcConn /* smcConn */, - Bool /* cancelShutdown */ -); - -extern void SmcRequestSaveYourself ( - SmcConn /* smcConn */, - int /* saveType */, - Bool /* shutdown */, - int /* interactStyle */, - Bool /* fast */, - Bool /* global */ -); - -extern Status SmcRequestSaveYourselfPhase2 ( - SmcConn /* smcConn */, - SmcSaveYourselfPhase2Proc /* saveYourselfPhase2Proc */, - SmPointer /* clientData */ -); - -extern void SmcSaveYourselfDone ( - SmcConn /* smcConn */, - Bool /* success */ -); - -extern int SmcProtocolVersion ( - SmcConn /* smcConn */ -); - -extern int SmcProtocolRevision ( - SmcConn /* smcConn */ -); - -extern char *SmcVendor ( - SmcConn /* smcConn */ -); - -extern char *SmcRelease ( - SmcConn /* smcConn */ -); - -extern char *SmcClientID ( - SmcConn /* smcConn */ -); - -extern IceConn SmcGetIceConnection ( - SmcConn /* smcConn */ -); - -extern Status SmsInitialize ( - char * /* vendor */, - char * /* release */, - SmsNewClientProc /* newClientProc */, - SmPointer /* managerData */, - IceHostBasedAuthProc /* hostBasedAuthProc */, - int /* errorLength */, - char * /* errorStringRet */ -); - -extern char *SmsClientHostName ( - SmsConn /* smsConn */ -); - -extern char *SmsGenerateClientID ( - SmsConn /* smsConn */ -); - -extern Status SmsRegisterClientReply ( - SmsConn /* smsConn */, - char * /* clientId */ -); - -extern void SmsSaveYourself ( - SmsConn /* smsConn */, - int /* saveType */, - Bool /* shutdown */, - int /* interactStyle */, - Bool /* fast */ -); - -extern void SmsSaveYourselfPhase2 ( - SmsConn /* smsConn */ -); - -extern void SmsInteract ( - SmsConn /* smsConn */ -); - -extern void SmsDie ( - SmsConn /* smsConn */ -); - -extern void SmsSaveComplete ( - SmsConn /* smsConn */ -); - -extern void SmsShutdownCancelled ( - SmsConn /* smsConn */ -); - -extern void SmsReturnProperties ( - SmsConn /* smsConn */, - int /* numProps */, - SmProp ** /* props */ -); - -extern void SmsCleanUp ( - SmsConn /* smsConn */ -); - -extern int SmsProtocolVersion ( - SmsConn /* smsConn */ -); - -extern int SmsProtocolRevision ( - SmsConn /* smsConn */ -); - -extern char *SmsClientID ( - SmsConn /* smsConn */ -); - -extern IceConn SmsGetIceConnection ( - SmsConn /* smsConn */ -); - -extern SmcErrorHandler SmcSetErrorHandler ( - SmcErrorHandler /* handler */ -); - -extern SmsErrorHandler SmsSetErrorHandler ( - SmsErrorHandler /* handler */ -); - -extern void SmFreeProperty ( - SmProp * /* prop */ -); - -extern void SmFreeReasons ( - int /* count */, - char ** /* reasonMsgs */ -); - -_XFUNCPROTOEND - -#endif /* _SMLIB_H_ */ diff --git a/nx-X11/lib/SM/SMlibint.h b/nx-X11/lib/SM/SMlibint.h deleted file mode 100644 index e9fa9cd96..000000000 --- a/nx-X11/lib/SM/SMlibint.h +++ /dev/null @@ -1,517 +0,0 @@ -/* $Xorg: SMlibint.h,v 1.4 2001/02/09 02:03:30 xorgcvs Exp $ */ - -/* - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/SMlibint.h,v 1.3 2001/07/29 05:01:11 tsi Exp $ */ - -/* - * Author: Ralph Mor, X Consortium - */ - -#ifndef _SMLIBINT_H_ -#define _SMLIBINT_H_ - -#include -#include -#include -#include -#include -#include - -#include - -#ifndef NULL -#include -#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/nx-X11/lib/SM/SMproto.h b/nx-X11/lib/SM/SMproto.h deleted file mode 100644 index f60ab3e4a..000000000 --- a/nx-X11/lib/SM/SMproto.h +++ /dev/null @@ -1,208 +0,0 @@ -/* $Xorg: SMproto.h,v 1.5 2001/02/09 02:03:30 xorgcvs Exp $ */ - -/* - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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_ - -#include - -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/nx-X11/lib/SM/globals.h b/nx-X11/lib/SM/globals.h deleted file mode 100644 index 2f26a78e9..000000000 --- a/nx-X11/lib/SM/globals.h +++ /dev/null @@ -1,68 +0,0 @@ -/* $Xorg: globals.h,v 1.4 2001/02/09 02:03:30 xorgcvs Exp $ */ - -/* - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.4 2001/12/14 19:53:55 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 __UNIXOS2__ -SmsNewClientProc _SmsNewClientProc; -SmPointer _SmsNewClientData; -#else -SmsNewClientProc _SmsNewClientProc = 0; -SmPointer _SmsNewClientData = 0; -#endif - -SmcErrorHandler _SmcErrorHandler = _SmcDefaultErrorHandler; -SmsErrorHandler _SmsErrorHandler = _SmsDefaultErrorHandler; diff --git a/nx-X11/lib/SM/sm_auth.c b/nx-X11/lib/SM/sm_auth.c deleted file mode 100644 index 9acd371ce..000000000 --- a/nx-X11/lib/SM/sm_auth.c +++ /dev/null @@ -1,48 +0,0 @@ -/* $Xorg: sm_auth.c,v 1.4 2001/02/09 02:03:30 xorgcvs Exp $ */ - -/* - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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$ */ - -/* - * Author: Ralph Mor, X Consortium - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "SMlibint.h" - -#ifdef __UNIXOS2__ -static char dummy; -#endif - -/* - * For now, SMlib just supports MIT-MAGIC-COOKIE-1 (defined in ICElib). - */ - - diff --git a/nx-X11/lib/SM/sm_client.c b/nx-X11/lib/SM/sm_client.c deleted file mode 100644 index 499be5e3d..000000000 --- a/nx-X11/lib/SM/sm_client.c +++ /dev/null @@ -1,633 +0,0 @@ -/* $Xorg: sm_client.c,v 1.4 2001/02/09 02:03:30 xorgcvs Exp $ */ - -/* - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#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); - - previousId = NULL; - - STORE_ARRAY8 (pData, 0, previousId); - - 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/nx-X11/lib/SM/sm_client.c.NX.original b/nx-X11/lib/SM/sm_client.c.NX.original deleted file mode 100644 index 499be5e3d..000000000 --- a/nx-X11/lib/SM/sm_client.c.NX.original +++ /dev/null @@ -1,633 +0,0 @@ -/* $Xorg: sm_client.c,v 1.4 2001/02/09 02:03:30 xorgcvs Exp $ */ - -/* - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#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); - - previousId = NULL; - - STORE_ARRAY8 (pData, 0, previousId); - - 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/nx-X11/lib/SM/sm_client.c.SM.original b/nx-X11/lib/SM/sm_client.c.SM.original deleted file mode 100644 index 02f9ccdf6..000000000 --- a/nx-X11/lib/SM/sm_client.c.SM.original +++ /dev/null @@ -1,631 +0,0 @@ -/* $Xorg: sm_client.c,v 1.4 2001/02/09 02:03:30 xorgcvs Exp $ */ - -/* - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#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/nx-X11/lib/SM/sm_error.c b/nx-X11/lib/SM/sm_error.c deleted file mode 100644 index 50a476e59..000000000 --- a/nx-X11/lib/SM/sm_error.c +++ /dev/null @@ -1,341 +0,0 @@ -/* $Xorg: sm_error.c,v 1.4 2001/02/09 02:03:30 xorgcvs Exp $ */ - -/* - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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_error.c,v 1.2 2001/10/28 03:32:29 tsi Exp $ */ - -/* - * Author: Ralph Mor, X Consortium - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "SMlibint.h" -#include - - - -/* - * 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 = %ld\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 = %ld\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/nx-X11/lib/SM/sm_genid.c b/nx-X11/lib/SM/sm_genid.c deleted file mode 100644 index 76e1350ab..000000000 --- a/nx-X11/lib/SM/sm_genid.c +++ /dev/null @@ -1,215 +0,0 @@ -/* $Xorg: sm_genid.c,v 1.4 2001/02/09 02:03:30 xorgcvs Exp $ */ -/* - -Copyright 1993, 1998 The Open Group -Copyright 2002 Sun Microsystems, 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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.17 2003/07/09 15:27:28 tsi Exp $ */ - -/* - * Author: Ralph Mor, X Consortium - */ - -#ifdef WIN32 -#define _WILLWINSOCK_ -#endif -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "SMlibint.h" -#ifdef XTHREADS -#include -#endif -#include - -#include -#define Time_t time_t - -#ifndef WIN32 - -#if defined(TCPCONN) || defined(STREAMSCONN) -#ifndef Lynx -#include -#else -#include -#endif -#include -#include -#define XOS_USE_NO_LOCKING -#define X_INCLUDE_NETDB_H -#include -#endif - -#else /* WIN32 */ - -#include -#include -#define X_INCLUDE_NETDB_H -#define XOS_USE_MTSAFE_NETDBAPI -#include - -#endif /* WIN32 */ - -#ifdef MNX_TCPCONN -#include - -#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; -{ -#if defined(TCPCONN) || defined(STREAMSCONN) - char hostname[256]; - char address[64]; - char temp[256]; - char *id; - static int sequence = 0; - - if (gethostname (hostname, sizeof (hostname))) - return (NULL); - - { - char* inet_addr; - char temp[4], *ptr1, *ptr2; - unsigned char decimal[4]; - int i, len; - struct in_addr *haddr = NULL; -#if defined(IPv6) && defined(AF_INET6) - struct addrinfo *ai, *first_ai; - if (getaddrinfo(hostname,NULL,NULL,&ai) != 0) - return NULL; - - for (first_ai = ai; ai != NULL; ai = ai->ai_next) { - if ( (ai->ai_family == AF_INET) || (ai->ai_family == AF_INET6) ) - break; - } - if (ai == NULL) { - freeaddrinfo(first_ai); - return NULL; - } - - if (ai->ai_family == AF_INET6) { - unsigned char *cp = (unsigned char *) &((struct sockaddr_in6 *)ai->ai_addr)->sin6_addr.s6_addr; - - address[0] = '6'; /* IPv6 address code */ - address[1] = '\0'; - - for (i = 0 ; i < 16 ; i++) { - strcat(address, hex_table[cp[i]]); - } - - } else { /* Fall through to IPv4 address handling */ - haddr = &((struct sockaddr_in *)ai->ai_addr)->sin_addr; -#else -#ifdef XTHREADS_NEEDS_BYNAMEPARAMS - _Xgethostbynameparams hparams; -#endif - struct hostent *hostp; - - if ((hostp = _XGethostbyname (hostname,hparams)) != NULL) - haddr = (struct in_addr *)(hostp->h_addr); - else - return NULL; -#endif - - inet_addr = inet_ntoa (*haddr); - 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]]); -#if defined(IPv6) && defined(AF_INET6) - } - freeaddrinfo(first_ai); -#endif - } - - sprintf (temp, "1%s%.13ld%.10ld%.4d", address, (long)time((Time_t*)0), - (long)getpid(), sequence); - - if (++sequence > 9999) - sequence = 0; - - if ((id = malloc (strlen (temp) + 1)) != NULL) - strcpy (id, temp); - - return (id); -#else - return (NULL); -#endif -} diff --git a/nx-X11/lib/SM/sm_manager.c b/nx-X11/lib/SM/sm_manager.c deleted file mode 100644 index 68cabcdce..000000000 --- a/nx-X11/lib/SM/sm_manager.c +++ /dev/null @@ -1,372 +0,0 @@ -/* $Xorg: sm_manager.c,v 1.4 2001/02/09 02:03:30 xorgcvs Exp $ */ - -/* - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "SMlibint.h" -#include - -#ifdef __UNIXWARE__ -#undef shutdown -#endif - - - -static Status -_SmsProtocolSetupProc (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); -} - - - - -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) - { - - 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); -} - - - -char * -SmsClientHostName (smsConn) - -SmsConn smsConn; - -{ - return (IceGetPeerName (smsConn->iceConn)); -} - - - -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/nx-X11/lib/SM/sm_misc.c b/nx-X11/lib/SM/sm_misc.c deleted file mode 100644 index 30c2c2d18..000000000 --- a/nx-X11/lib/SM/sm_misc.c +++ /dev/null @@ -1,217 +0,0 @@ -/* $Xorg: sm_misc.c,v 1.4 2001/02/09 02:03:30 xorgcvs Exp $ */ - -/* - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "SMlibint.h" -#include - -/* - * 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/nx-X11/lib/SM/sm_process.c b/nx-X11/lib/SM/sm_process.c deleted file mode 100644 index ab3ec0ba4..000000000 --- a/nx-X11/lib/SM/sm_process.c +++ /dev/null @@ -1,889 +0,0 @@ -/* $Xorg: sm_process.c,v 1.4 2001/02/09 02:03:30 xorgcvs Exp $ */ - -/* - -Copyright 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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$ */ - -/* - * Author: Ralph Mor, X Consortium - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#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); - -#if 0 /* No-op */ - CHECK_AT_LEAST_SIZE (iceConn, _SmcOpcode, opcode, - length, SIZEOF (smRegisterClientReplyMsg), IceFatalToProtocol); -#endif - - 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; - -#if 0 /* No-op */ - CHECK_AT_LEAST_SIZE (iceConn, _SmcOpcode, opcode, - length, SIZEOF (smPropertiesReplyMsg), IceFatalToProtocol); -#endif - - 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; - int idLen; - -#if 0 /* No-op */ - CHECK_AT_LEAST_SIZE (iceConn, _SmsOpcode, opcode, - length, SIZEOF (smRegisterClientMsg), IceFatalToProtocol); -#endif - - 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 (pData, swap, idLen, 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. - */ - - _IceErrorBadValue (smsConn->iceConn, _SmsOpcode, SM_RegisterClient, - 8, ARRAY8_BYTES (idLen), (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; - -#if 0 /* No-op */ - CHECK_AT_LEAST_SIZE (iceConn, _SmsOpcode, opcode, - length, SIZEOF (smCloseConnectionMsg), IceFatalToProtocol); -#endif - - 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; - -#if 0 /* No-op */ - CHECK_AT_LEAST_SIZE (iceConn, _SmsOpcode, opcode, - length, SIZEOF (smSetPropertiesMsg), IceFatalToProtocol); -#endif - - 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; - -#if 0 /* No-op */ - CHECK_AT_LEAST_SIZE (iceConn, _SmsOpcode, opcode, - length, SIZEOF (smDeletePropertiesMsg), IceFatalToProtocol); -#endif - - 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/nx-X11/lib/XTrap/Imakefile b/nx-X11/lib/XTrap/Imakefile deleted file mode 100644 index 54bfdd6dd..000000000 --- a/nx-X11/lib/XTrap/Imakefile +++ /dev/null @@ -1,30 +0,0 @@ -XCOMM $XFree86$ - -#define DoNormalLib NormalLibXTrap -#define DoSharedLib SharedLibXTrap -#define DoDebugLib DebugLibXTrap -#define DoProfileLib ProfileLibXTrap -#define LibName XTrap -#define SoRev SOXTRAPREV -#define LibHeaders NO - -#include - -#ifdef SharedXmuReqs -REQUIREDLIBS = SharedXmuReqs -#endif - -XCOMM wish this weren't necessary, but need xlib and xt internals... -INCLUDES=-I$(TOP)/include -I$(TOOLKITSRC) - - - SRCS = XECallBcks.c XEConTxt.c XEDsptch.c XEPrInfo.c \ - XERqsts.c XEStrMap.c XETrapInit.c XEWrappers.c - OBJS = XECallBcks.o XEConTxt.o XEDsptch.o XEPrInfo.o \ - XERqsts.o XEStrMap.o XETrapInit.o XEWrappers.o - -LINTLIBS = $(LINTXLIB) - -#include - -DependTarget() diff --git a/nx-X11/lib/XTrap/XECallBcks.c b/nx-X11/lib/XTrap/XECallBcks.c deleted file mode 100644 index fb1e0893e..000000000 --- a/nx-X11/lib/XTrap/XECallBcks.c +++ /dev/null @@ -1,175 +0,0 @@ -/* $XFree86$ */ -/***************************************************************************** -Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright 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. - -*****************************************************************************/ -/* - * - * CONTRIBUTORS: - * - * Dick Annicchiarico - * Robert Chesler - * Dan Coutu - * Gene Durso - * Marc Evans - * Alan Jamison - * Mark Henry - * Ken Miller - * - */ -/* - * This file contains XETrap Callback initilization routines. - * The callback data hang off of the TC and are freed as part of the - * XEFreeTC routine. - */ - -#include -#include -#include - -int XEAddRequestCB(XETC *tc, CARD8 req, void_function func, BYTE *data) -{ - if (!tc->values.req_cb) - { /* This is the first time for this particular TC, need to malloc */ - if ((tc->values.req_cb = - (XETrapCB *)XtCalloc(256L,sizeof(XETrapCB))) == NULL) - { - /* XtCalloc already reported the error */ - return(False); - } - } - tc->values.req_cb[req].func = func; - tc->values.req_cb[req].data = data; - - return(True); -} - -int XEAddRequestCBs(XETC *tc, ReqFlags req_flags, void_function func, - BYTE *data) -{ - int i; - int status = True; - - for (i=0; i<=255L; i++) - { - if (BitIsTrue(req_flags, i)) - { - status = XEAddRequestCB(tc, (CARD8)i, func, data); - } - } - return(status); -} - -int XEAddEventCB(XETC *tc, CARD8 evt, void_function func, BYTE *data) -{ - if (!tc->values.evt_cb) - { /* This is the first time for this particular TC, need to malloc */ - if ((tc->values.evt_cb = - (XETrapCB *)XtCalloc(XETrapCoreEvents,sizeof(XETrapCB))) == NULL) - { - /* XtCalloc already reported the error */ - return(False); - } - } - tc->values.evt_cb[evt].func = func; - tc->values.evt_cb[evt].data = data; - - return(True); -} - -int XEAddEventCBs(XETC *tc, EventFlags evt_flags, void_function func, - BYTE *data) -{ - int i; - int status = True; - - for (i=KeyPress; i<=MotionNotify; i++) - { - if (BitIsTrue(evt_flags, i)) - { - status = XEAddEventCB(tc, (CARD8)i, func, data); - } - } - return(status); -} - -void XERemoveRequestCB(XETC *tc, CARD8 req) -{ - if (!tc->values.req_cb) - { /* We gotta problem! CB struct not allocated! */ - return; - } - tc->values.req_cb[req].func = (void_function)NULL; - tc->values.req_cb[req].data = (BYTE *)NULL; - return; -} -void XERemoveRequestCBs(XETC *tc, ReqFlags req_flags) -{ - int i; - - for (i=0; i<=255L; i++) - { - if (BitIsTrue(req_flags, i)) - { - XERemoveRequestCB(tc, (CARD8)i); - } - } -} - -void XERemoveAllRequestCBs(XETC *tc) -{ - if (!tc->values.req_cb) - { /* We gotta problem! CB struct not allocated! */ - return; - } - XtFree((XtPointer)tc->values.req_cb); -} - -void XERemoveEventCB(XETC *tc, CARD8 evt) -{ - if (!tc->values.evt_cb) - { /* We gotta problem! CB struct not allocated! */ - return; - } - tc->values.evt_cb[evt].func = (void_function)NULL; - tc->values.evt_cb[evt].data = (BYTE *)NULL; - return; -} - -void XERemoveEventCBs(XETC *tc, EventFlags evt_flags) -{ - int i; - - for (i=KeyPress; i<=MotionNotify; i++) - { - if (BitIsTrue(evt_flags, i)) - { - XERemoveEventCB(tc, (CARD8)i); - } - } -} - -void XERemoveAllEventCBs(XETC *tc) -{ - if (!tc->values.evt_cb) - { /* We gotta problem! CB struct not allocated! */ - return; - } - XtFree((XtPointer)tc->values.evt_cb); -} diff --git a/nx-X11/lib/XTrap/XEConTxt.c b/nx-X11/lib/XTrap/XEConTxt.c deleted file mode 100644 index 7da96894b..000000000 --- a/nx-X11/lib/XTrap/XEConTxt.c +++ /dev/null @@ -1,589 +0,0 @@ -/* $XFree86: xc/lib/XTrap/XEConTxt.c,v 1.1 2001/11/02 23:29:27 dawes Exp $ */ -/***************************************************************************** -Copyright 1987, 1988, 1989, 1990, 1991, 1994 by Digital Equipment Corp., -Maynard, MA - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright 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. - -*****************************************************************************/ -/* - * - * CONTRIBUTORS: - * - * Dick Annicchiarico - * Robert Chesler - * Dan Coutu - * Gene Durso - * Marc Evans - * Alan Jamison - * Mark Henry - * Ken Miller - * - */ - -#define NEED_REPLIES -#define NEED_EVENTS - - -#include -#include - -#ifndef TRUE -# define TRUE 1L -#endif -#ifndef FALSE -# define FALSE 0L -#endif - -extern char *extensionData; - -static XETC TC; - -/* - * This function is used to create a new XTrap context structure. The new - * context is initialized to a hard coded default, then modified by the - * valuemask and values passed in by the caller. - */ - -XETC *XECreateTC(Display *dpy, CARD32 valuemask, XETCValues *value) -{ - static Bool firsttime = True; - register XETC *tc = &TC; - register XETC *last_tc; - XETrapGetAvailRep rep; - - /* If this is the first time here, then initialize the default TC */ - if (firsttime == True) - { - firsttime = False; - /* The first Trap Context is the Template (default) TC */ - (void)memset(tc,0L,sizeof(tc)); - tc->eventBase = 0x7FFFFFFFL; - tc->errorBase = 0x7FFFFFFFL; - tc->values.v.max_pkt_size = 0x7FFFL; - } - - /* Position to the end of the list */ - for (;tc->next != NULL; tc = tc->next); - - /* Allocate memory for the new context */ - last_tc = tc; /* save the address of the last on the list */ - if ((tc = (tc->next = (XETC *)XtMalloc(sizeof(*tc)))) == NULL) - { /* No memory to build TC, XtMalloc has already reported the error */ - return(NULL); - } - - /* Use the original TC as the template to start from */ - (void)memcpy(tc,&TC,sizeof(TC)); - tc->next = NULL; - tc->dpy = dpy; - tc->xmax_size = XMaxRequestSize(tc->dpy); - - /* Initialize Extension */ - if (!XETrapQueryExtension(dpy,&(tc->eventBase),&(tc->errorBase), - &(tc->extOpcode))) - { - char *params = XTrapExtName; - unsigned int num_params = 1L; - XtWarningMsg("CantLoadExt", "XECreateTC", "XTrapToolkitError", - "Can't load %s extension", ¶ms, &num_params); - (void)XtFree((XtPointer)tc); - last_tc->next = NULL; /* Clear now nonexistant forward pointer */ - return(NULL); - } - - /* Allocate memory for the XLIB transport */ - if ((tc->xbuff = (BYTE *)XtMalloc(tc->xmax_size * sizeof(CARD32) + - SIZEOF(XETrapHeader))) == NULL) - { /* No memory to build TC, XtMalloc has already reported the error */ - (void)XtFree((XtPointer)tc); /* free the allocated TC */ - last_tc->next = NULL; /* Clear now nonexistant forward pointer */ - return(NULL); - } - - /* Decide on a protocol version to communicate with */ - /* would *like* to use XEGetVersionRequest() but it's broken in V3.1 */ - if (XEGetAvailableRequest(tc,&rep) == True) - { - /* stow the protocol number */ - switch (rep.xtrap_protocol) - { - /* known acceptable protocols */ - case 31: - case XETrapProtocol: - tc->protocol = rep.xtrap_protocol; - break; - /* all else */ - default: /* stay backwards compatible */ - tc->protocol = 31; - break; - } - /* TC to contain *oldest* release/version/revision */ - if (XETrapGetAvailRelease(&rep) <= XETrapRelease) - { - tc->release = XETrapGetAvailRelease(&rep); - if (XETrapGetAvailVersion(&rep) <= XETrapVersion) - { - tc->version = XETrapGetAvailVersion(&rep); - tc->revision = (XETrapGetAvailRevision(&rep) <= XETrapRevision ? - XETrapGetAvailRevision(&rep) : XETrapRevision); - } - else - { - tc->version = XETrapVersion; - tc->revision = XETrapRevision; - } - } - else - { - tc->release = XETrapRelease; - tc->version = XETrapVersion; - tc->revision = XETrapRevision; - } - } - else - { /* We can't seem to communicate with the extension! */ - char *params = XTrapExtName; - unsigned int num_params = 1L; - XtWarningMsg("CantComm", "XECreateTC", "XTrapToolkitError", - "Can't communicate with extension %s", ¶ms, &num_params); - (void)XtFree((XtPointer)tc->xbuff);/* de-allocate memory just alloc'd */ - (void)XtFree((XtPointer)tc); /* free the allocated TC */ - last_tc->next = NULL; /* Clear now nonexistant forward pointer */ - return(NULL); - } - - /* Assign the context values the caller provided */ - (void)XEChangeTC(tc, valuemask, value); - - return (tc); -} - - -static int CheckChangeBits(XETrapFlags *dest, XETrapFlags *src, INT32 bit) -{ - int chg_flag = False; - - if (!(BitIsFalse(dest->valid,bit) && BitIsFalse(src->valid,bit)) || - !(BitIsTrue(dest->valid,bit) && BitIsTrue(src->valid,bit))) - { - BitCopy(dest->valid, src->valid, bit); - chg_flag = True; - } - if (!(BitIsFalse(dest->data,bit) && BitIsFalse(src->data,bit)) || - !(BitIsTrue(dest->data,bit) && BitIsTrue(src->data,bit))) - { - BitCopy(dest->data, src->data, bit); - chg_flag = True; - } - return(chg_flag); -} - -/* - * This function is called to change one or more parameters used to define - * a context in which XTrap is or will be running. - */ -int XEChangeTC(XETC *tc, CARD32 mask, XETCValues *values) -{ - int status = True; - register XETCValues *tval = &(tc->values); - register int i; - - if (mask & TCStatistics) - { /* Statistics need changing */ - if(CheckChangeBits(&(tval->v.flags), &(values->v.flags), - XETrapStatistics)) - { - tc->dirty |= TCStatistics; - } - } - if (mask & TCRequests) - { /* Requests need changing */ - CheckChangeBits(&(tval->v.flags), &(values->v.flags), XETrapRequest); - for (i=0; i<256L; i++) - { - XETrapSetCfgFlagReq(tval, i, BitValue(values->v.flags.req,i)); - } - tc->dirty |= TCRequests; - } - if (mask & TCEvents) - { /* Events need changing */ - CheckChangeBits(&(tval->v.flags), &(values->v.flags), XETrapEvent); - for (i=KeyPress; i<=MotionNotify; i++) - { - XETrapSetCfgFlagEvt(tval, i, BitValue(values->v.flags.event,i)); - } - tc->dirty |= TCEvents; - } - if (mask & TCMaxPacket) - { /* MaxPacket needs changing */ - CheckChangeBits(&(tval->v.flags), &(values->v.flags), XETrapMaxPacket); - XETrapSetCfgMaxPktSize(tval, values->v.max_pkt_size); - tc->dirty |= TCMaxPacket; - } - if (mask & TCCmdKey) - { /* CmdKey needs changing */ - CheckChangeBits(&(tval->v.flags), &(values->v.flags), XETrapCmd); - tval->v.cmd_key = values->v.cmd_key; - CheckChangeBits(&(tval->v.flags), &(values->v.flags), XETrapCmdKeyMod); - tc->dirty |= TCCmdKey; - } - if (mask & TCTimeStamps) - { /* TimeStamps needs changing */ - if (CheckChangeBits(&(tval->v.flags), &(values->v.flags), XETrapTimestamp)) - { - tc->dirty |= TCTimeStamps; - } - BitCopy(tval->tc_flags, values->tc_flags, XETCDeltaTimes); - } - if (mask & TCWinXY) - { /* Window XY's need changing */ - if (CheckChangeBits(&(tval->v.flags), &(values->v.flags), XETrapWinXY)) - { - tc->dirty |= TCWinXY; - } - } - if (mask & TCCursor) - { /* Window XY's need changing */ - if (CheckChangeBits(&(tval->v.flags), &(values->v.flags),XETrapCursor)) - { - tc->dirty |= TCCursor; - } - } - if (mask & TCXInput) - { /* XInput flag needs changing */ - if (CheckChangeBits(&(tval->v.flags), &(values->v.flags),XETrapXInput)) - { - tc->dirty |= TCXInput; - } - } - if (mask & TCColorReplies) - { /* ColorReplies flag needs changing */ - if (CheckChangeBits(&(tval->v.flags), &(values->v.flags), - XETrapColorReplies)) - { - tc->dirty |= TCColorReplies; - } - } - if (mask & TCGrabServer ) - { /* GrabServer flag needs changing */ - if (CheckChangeBits(&(tval->v.flags), &(values->v.flags), - XETrapGrabServer )) - { - tc->dirty |= TCGrabServer; - } - } - if (XETrapGetTCFlagTrapActive(tc)) - { - status = XEFlushConfig(tc); - } -#ifdef VMS - sys$setast(True); /* Make sure AST's are enabled */ -#endif /* VMS */ - return(status); -} - - -void XEFreeTC(XETC *tc) -{ - register XETC *list = &TC; - - if (tc) - { - while(list->next != NULL) - { - if (list->next == tc) - list->next = list->next->next; /* Got it, remove from list */ - else - list = list->next; /* Update the list pointer */ - } - if (tc->values.req_cb) - { - XtFree((XtPointer)tc->values.req_cb); - } - if (tc->values.evt_cb) - { - XtFree((XtPointer)tc->values.evt_cb); - } - if (tc->xbuff != NULL) - { - XtFree((XtPointer)tc->xbuff); - } - - XtFree((XtPointer)tc); - if (extensionData) - { - XtFree(extensionData); - } - } - return; -} - -/* The following are Convenience routines for setting values within - * the Trap Context. These are analogous to the GC's Convenience - * Functions such as XSetState & XSetForeground - */ -int XETrapSetMaxPacket(XETC *tc, Bool set_flag, CARD16 size) -{ - XETCValues tcv; - int status = True; - - (void)memset((char *)&tcv,0L,sizeof(tcv)); - XETrapSetCfgFlagMaxPacket(&tcv, valid, True); - XETrapSetCfgFlagMaxPacket(&tcv, data, set_flag); - XETrapSetCfgMaxPktSize(&tcv, size); - status = XEChangeTC(tc, TCMaxPacket, &tcv); - return(status); -} -int XETrapSetCommandKey(XETC *tc, Bool set_flag, KeySym cmd_key, Bool mod_flag) -{ - XETCValues tcv; - int status = True; - KeyCode cmd_keycode; - - (void)memset((char *)&tcv,0L,sizeof(tcv)); - XETrapSetCfgFlagCmd(&tcv, valid, True); - XETrapSetCfgFlagCmd(&tcv, data, set_flag); - if (set_flag == True) - { - XETrapSetCfgFlagCmdKeyMod(&tcv, valid, True); - XETrapSetCfgFlagCmdKeyMod(&tcv, data, mod_flag); - if (!(cmd_keycode = XKeysymToKeycode(XETrapGetDpy(tc), cmd_key))) - { - status = False; - } - else - { - XETrapSetCfgCmdKey(&tcv, cmd_keycode); - } - } - else - { /* Clear command key */ - XETrapSetCfgFlagCmdKeyMod(&tcv, valid, True); - XETrapSetCfgFlagCmdKeyMod(&tcv, data, False); - XETrapSetCfgCmdKey(&tcv, 0); - } - if (status == True) - { - status = XEChangeTC(tc, TCCmdKey, &tcv); - } - return(status); -} - -int XETrapSetTimestamps(XETC *tc, Bool set_flag, Bool delta_flag) -{ - XETCValues tcv; - int status = True; - - (void)memset((char *)&tcv,0L,sizeof(tcv)); - XETrapSetCfgFlagTimestamp(&tcv, valid, True); - XETrapSetCfgFlagTimestamp(&tcv, data, set_flag); - XETrapSetValFlagDeltaTimes(&tcv, delta_flag); - status = XEChangeTC(tc, TCTimeStamps, &tcv); - return(status); -} - -int XETrapSetWinXY(XETC *tc, Bool set_flag) -{ - XETCValues tcv; - int status = True; - - (void)memset((char *)&tcv,0L,sizeof(tcv)); - XETrapSetCfgFlagWinXY(&tcv, valid, True); - XETrapSetCfgFlagWinXY(&tcv, data, set_flag); - status = XEChangeTC(tc, TCWinXY, &tcv); - return(status); -} - -int XETrapSetCursor(XETC *tc, Bool set_flag) -{ - XETCValues tcv; - int status = True; - - (void)memset((char *)&tcv,0L,sizeof(tcv)); - XETrapSetCfgFlagCursor(&tcv, valid, True); - XETrapSetCfgFlagCursor(&tcv, data, set_flag); - status = XEChangeTC(tc, TCCursor, &tcv); - return(status); -} - -int XETrapSetXInput(XETC *tc, Bool set_flag) -{ - XETCValues tcv; - int status = True; - - (void)memset((char *)&tcv,0L,sizeof(tcv)); - XETrapSetCfgFlagXInput(&tcv, valid, True); - XETrapSetCfgFlagXInput(&tcv, data, set_flag); - status = XEChangeTC(tc, TCXInput, &tcv); - return(status); -} - -int XETrapSetColorReplies(XETC *tc, Bool set_flag) -{ - XETCValues tcv; - int status = True; - - (void)memset((char *)&tcv,0L,sizeof(tcv)); - XETrapSetCfgFlagColorReplies(&tcv, valid, True); - XETrapSetCfgFlagColorReplies(&tcv, data, set_flag); - status = XEChangeTC(tc, TCColorReplies, &tcv); - return(status); -} - -int XETrapSetGrabServer(XETC *tc, Bool set_flag) -{ - XETCValues tcv; - int status = True; - - (void)memset((char *)&tcv,0L,sizeof(tcv)); - XETrapSetCfgFlagGrabServer(&tcv, valid, True); - XETrapSetCfgFlagGrabServer(&tcv, data, set_flag); - status = XEChangeTC(tc, TCGrabServer, &tcv); - return(status); -} - -int XETrapSetStatistics(XETC *tc, Bool set_flag) -{ - XETCValues tcv; - int status = True; - - (void)memset((char *)&tcv,0L,sizeof(tcv)); - XETrapSetCfgFlagStatistics(&tcv, valid, True); - XETrapSetCfgFlagStatistics(&tcv, data, set_flag); - status = XEChangeTC(tc, TCStatistics, &tcv); - return(status); -} - -int XETrapSetRequests(XETC *tc, Bool set_flag, ReqFlags requests) -{ - XETCValues tcv; - int status = True; - int i; - - (void)memset((char *)&tcv,0L,sizeof(tcv)); - XETrapSetCfgFlagRequest(&tcv, valid, True); - XETrapSetCfgFlagRequest(&tcv, data, set_flag); - for (i=0; i<256L; i++) - { - XETrapSetCfgFlagReq(&tcv, i, BitValue(requests, i)); - } - status = XEChangeTC(tc, TCRequests, &tcv); - return(status); -} - -int XETrapSetEvents(XETC *tc, Bool set_flag, EventFlags events) -{ - XETCValues tcv; - int status = True; - int i; - - (void)memset((char *)&tcv,0L,sizeof(tcv)); - XETrapSetCfgFlagEvent(&tcv, valid, True); - XETrapSetCfgFlagEvent(&tcv, data, set_flag); - for (i=KeyPress; i<=MotionNotify; i++) - { - XETrapSetCfgFlagEvt(&tcv, i, BitValue(events, i)); - } - status = XEChangeTC(tc, (CARD32)TCEvents, &tcv); - return(status); -} - -Bool XESetCmdGateState(XETC *tc, CARD8 type, Bool *gate_closed, - CARD8 *next_key, Bool *key_ignore) -{ - - *key_ignore = False; - if (XETrapGetTCFlagCmdKeyMod(tc,data) == True) - { - switch (type) - { - case KeyPress: - if (*next_key == XEKeyIsEcho) - { - break; - } - *gate_closed = True; - *next_key = XEKeyIsClear; - break; - - case KeyRelease: - if (*next_key == XEKeyIsEcho) - { - *next_key = XEKeyIsClear; - break; - } - if (*next_key == XEKeyIsClear) - { - *next_key = XEKeyIsEcho; - } - else - { /* it's XEKeyIsOther, so Clear it */ - *next_key = XEKeyIsClear; - } - *gate_closed = False; - *key_ignore = True; - break; - - default: break; - } - } - else - { - switch (type) - { - case KeyPress: - if (*next_key == XEKeyIsEcho) - { - *gate_closed = False; - break; - } - /* Open gate on cmd key release */ - if ((*next_key == XEKeyIsOther) && - *gate_closed == True) - { - break; - } - *gate_closed = True; - *next_key = XEKeyIsClear; - break; - - case KeyRelease: - if (*next_key == XEKeyIsClear) - { - *next_key = XEKeyIsEcho; - break; - } - - if (*next_key == XEKeyIsEcho) - { - *next_key = XEKeyIsClear; - break; - } - - *gate_closed = False; - *key_ignore = True; - *next_key = XEKeyIsClear; - break; - - default: - break; - } - } - - return(*gate_closed); -} diff --git a/nx-X11/lib/XTrap/XEDsptch.c b/nx-X11/lib/XTrap/XEDsptch.c deleted file mode 100644 index b50392638..000000000 --- a/nx-X11/lib/XTrap/XEDsptch.c +++ /dev/null @@ -1,111 +0,0 @@ -/* $XFree86$ */ -/***************************************************************************** -Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright 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. - -*****************************************************************************/ -/* - * - * CONTRIBUTORS: - * - * Dick Annicchiarico - * Robert Chesler - * Dan Coutu - * Gene Durso - * Marc Evans - * Alan Jamison - * Mark Henry - * Ken Miller - * - */ - -#include -#include -#include -#include - -static void XETrapDispatchCB(XETC *tc, XETrapDatum *pdatum) -{ - void_function pfunc = NULL; - BYTE *userp = NULL; - - /* Need to deal with Delta Timestamps here before calling client CB */ - if (XETrapGetTCFlagDeltaTimes(tc)) - { - CARD32 last_time = XETrapGetTCTime(tc); - if (XETrapHeaderIsEvent(&pdatum->hdr)) - { /* then we can play with the timestamps */ - pdatum->hdr.timestamp = - pdatum->u.event.u.keyButtonPointer.time; - } - else - { /* - * the current one from GetTimeInMillis is worthless - * as it's only updated during event instances (e.g. not - * wall clock). - */ - pdatum->hdr.timestamp = last_time; - } - if (!pdatum->hdr.timestamp) - { /* for dual monitor bug */ - pdatum->hdr.timestamp = last_time; - } - if (!last_time) - { /* first one! Prime it! */ - last_time = pdatum->hdr.timestamp; - } - tc->values.last_time = pdatum->hdr.timestamp; /* no macro! */ - if (pdatum->hdr.timestamp < last_time) - { /* for clock rollover */ - pdatum->hdr.timestamp = 0; - } - else - { /* the real delta */ - pdatum->hdr.timestamp = pdatum->hdr.timestamp - last_time; - } - } - /* Get the user supplied callback function */ - if (XETrapHeaderIsEvent(&pdatum->hdr)) - { - pfunc = tc->values.evt_cb[pdatum->u.event.u.u.type].func; - userp = tc->values.evt_cb[pdatum->u.event.u.u.type].data; - } - else if (XETrapHeaderIsRequest(&pdatum->hdr) || - XETrapHeaderIsReply(&pdatum->hdr)) - { - pfunc = tc->values.req_cb[pdatum->u.req.reqType].func; - userp = tc->values.req_cb[pdatum->u.req.reqType].data; - } - - /* If there is a callback then call it with the data */ - if (pfunc != NULL) - { - (*pfunc)(tc,pdatum,userp); - } -} - -Boolean XETrapDispatchXLib(XETrapDataEvent *event, XETC *tc) -{ - memcpy(&tc->xbuff[event->idx*sz_EventData], event->data, sz_EventData); - - if (event->detail == XETrapDataLast) - { - XETrapDispatchCB(tc, (XETrapDatum *)tc->xbuff); - } - return True; -} diff --git a/nx-X11/lib/XTrap/XEPrInfo.c b/nx-X11/lib/XTrap/XEPrInfo.c deleted file mode 100644 index 908ca3ad9..000000000 --- a/nx-X11/lib/XTrap/XEPrInfo.c +++ /dev/null @@ -1,274 +0,0 @@ -/* $XFree86$ */ -/***************************************************************************** -Copyright 1987, 1988, 1989, 1990, 1991, 1994 by Digital Equipment Corp., -Maynard, MA - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright 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 -#include -#include -#include - -#ifndef TRUE -# define TRUE 1L -#endif -#ifndef FALSE -# define FALSE 0L -#endif - -void XEPrintRelease( FILE *ofp, XETrapGetAvailRep *pavail) -{ - - fprintf(ofp,"\tRelease: %d.%d-%d\n", XETrapGetAvailRelease(pavail), - XETrapGetAvailVersion(pavail), XETrapGetAvailRevision(pavail)); -} -void XEPrintTkRelease( FILE *ofp, XETC *tc) -{ - fprintf(ofp,"\tRelease: %d.%d-%d\n", XEGetRelease(tc), XEGetVersion(tc), - XEGetRevision(tc)); -} - -void XEPrintPlatform( FILE *ofp, XETrapGetAvailRep *pavail) -{ - fprintf(ofp,"\tPlatform: %s (0x%02x)\n", - XEPlatformIDToString(XETrapGetAvailPFIdent(pavail)), - (int)XETrapGetAvailPFIdent(pavail)); -} - -void XEPrintAvailFlags( FILE *ofp, XETrapGetAvailRep *pavail) -{ - - CARD8 f[4L]; - - XETrapGetAvailFlags(pavail,f); - fprintf(ofp,"\tFlags: "); - if (XETrapGetAvailFlagTimestamp(pavail)) fputs("Timestamps ", ofp); - if (XETrapGetAvailFlagCmd(pavail)) fputs("CmdKey ", ofp); - if (XETrapGetAvailFlagCmdKeyMod(pavail)) fputs("CmdKeyMod ", ofp); - if (XETrapGetAvailFlagRequest(pavail)) fputs("Requests ", ofp); - if (XETrapGetAvailFlagEvent(pavail)) fputs("Events ", ofp); - if (XETrapGetAvailFlagMaxPacket(pavail)) fputs("MaxPkt ", ofp); - if (XETrapGetAvailFlagStatistics(pavail)) fputs("Statistics ", ofp); - if (XETrapGetAvailFlagWinXY(pavail)) fputs("WinXY ", ofp); - if (XETrapGetAvailFlagCursor(pavail)) fputs("Cursor ", ofp); - if (XETrapGetAvailFlagXInput(pavail)) fputs("XInput ", ofp); - if (XETrapGetAvailFlagVecEvt(pavail)) fputs("Vect_Evnts ", ofp); - if (XETrapGetAvailFlagColorReplies(pavail)) fputs("ColorRep ", ofp); - if (XETrapGetAvailFlagGrabServer(pavail)) fputs("GrabServer ", ofp); - fprintf(ofp," (0x%02x%02x%02x%02x)\n", f[0], f[1], f[2], f[3]); -} - -void XEPrintAvailPktSz( FILE *ofp, XETrapGetAvailRep *pavail) -{ - - fprintf(ofp,"\tMax Packet Size: %d\n", XETrapGetAvailMaxPktSize(pavail)); -} -void XEPrintStateFlags( FILE *ofp, XETrapGetCurRep *pcur) -{ - - CARD8 f[2]; - XETrapGetCurSFlags(pcur, f); - fputs("\tFlags: ",ofp); - if (BitIsTrue(f,XETrapTrapActive)) fputs("I/O Active ", ofp); - fprintf(ofp," (0x%02x%02x)\n", f[0], f[1]); -} - -void XEPrintMajOpcode( FILE *ofp, XETrapGetAvailRep *pavail) -{ - - fprintf(ofp,"\tMajor Opcode: %d\n", (int)XETrapGetAvailOpCode(pavail)); -} -void XEPrintCurXY( FILE *ofp, XETrapGetAvailRep *pavail) -{ - - fprintf(ofp,"\tCurrent (x,y): (%d,%d)\n", XETrapGetCurX(pavail), - XETrapGetCurY(pavail)); -} - -void XEPrintTkFlags( FILE *ofp, XETC *tc) -{ - - CARD8 f[2]; - XETrapGetTCLFlags(tc, f); - fputs("\tFlags: ",ofp); - if (XETrapGetTCFlagDeltaTimes(tc)) fputs("Delta Times ", ofp); - if (XETrapGetTCFlagTrapActive(tc)) fputs("Trap Active ", ofp); - fprintf(ofp," (0x%02x%02x)\n", f[0], f[1]); -} - -void XEPrintLastTime( FILE *ofp, XETC *tc) -{ - - fprintf(ofp,"\tLast Relative Time: %d\n", (int)XETrapGetTCTime(tc)); -} - -void XEPrintCfgFlags( FILE *ofp, XETrapGetCurRep *pcur) -{ - - CARD8 f[4L]; - - XETrapGetCurCFlags(pcur,data,f); - fprintf(ofp,"\tFlags: "); - if (XETrapGetCurFlagTimestamp(pcur,data)) fputs("Timestamps ", ofp); - if (XETrapGetCurFlagCmd(pcur,data)) fputs("CmdKey ", ofp); - if (XETrapGetCurFlagCmdKeyMod(pcur,data)) fputs("CmdKeyMod ", ofp); - if (XETrapGetCurFlagRequest(pcur,data)) fputs("Requests ", ofp); - if (XETrapGetCurFlagEvent(pcur,data)) fputs("Events ", ofp); - if (XETrapGetCurFlagMaxPacket(pcur,data)) fputs("MaxPkt ", ofp); - if (XETrapGetCurFlagStatistics(pcur,data)) fputs("Statistics ", ofp); - if (XETrapGetCurFlagWinXY(pcur,data)) fputs("WinXY ", ofp); - if (XETrapGetCurFlagCursor(pcur,data)) fputs("Cursor ", ofp); - if (XETrapGetCurFlagXInput(pcur,data)) fputs("XInput ", ofp); - if (XETrapGetCurFlagColorReplies(pcur,data)) fputs("ColorReplies ", ofp); - if (XETrapGetCurFlagGrabServer(pcur,data)) fputs("GrabServer ", ofp); - fprintf(ofp," (0x%02x%02x%02x%02x)\n", f[0], f[1], f[2], f[3]); -} - -void XEPrintRequests( FILE *ofp, XETrapGetCurRep *pcur) -{ - - long i; - fprintf(ofp,"\tX Requests: "); - for (i=0L; i<=XETrapMaxRequest-1; i++) - { /* Not using the macro cause we're doing things - * a byte at a time rather than a bit. - */ - fprintf(ofp,"%02x ", pcur->config.flags.req[i]); - if ((i+1L)%4L == 0L) - { - fprintf(ofp," "); - } - if ((i+1L)%16L == 0L) - { - fprintf(ofp,"\n\t\t "); - } - } - fprintf(ofp,"\n"); -} - -void XEPrintEvents( FILE *ofp, XETrapGetCurRep *pcur) -{ - - int i; - fprintf(ofp,"\tX Events: "); - for (i=0L; iconfig.flags.event[i]); - if ((i+1L)%4L == 0L) - { - fprintf(ofp," "); - } - if ((i+1L)%16L == 0L) - { - fprintf(ofp,"\n\t\t "); - } - } - fprintf(ofp,"\n"); -} - -void XEPrintCurPktSz( FILE *ofp, XETrapGetCurRep *pcur) -{ - - fprintf(ofp,"\tMax Packet Size: %d\n", XETrapGetCurMaxPktSize(pcur)); -} - -void XEPrintCmdKey( FILE *ofp, XETrapGetCurRep *pcur) -{ - - fprintf(ofp,"\tcmd_key: 0x%02x\n", XETrapGetCurCmdKey(pcur)); -} - -void XEPrintEvtStats( FILE *ofp, XETrapGetStatsRep *pstats, XETC *tc) -{ - - int i; - fprintf(ofp,"\tX Events:\n"); - for (i=0; i -#define NEED_REPLIES -#define NEED_EVENTS -#include -#else /* NO_DEC_BUG_FIX */ -#include -#define NEED_REPLIES -#define NEED_EVENTS -#include -#endif /* NO_DEC_BUG_FIX */ -/* the following's a hack to support V3.1 protocol */ -#if defined(__STDC__) && !defined(UNIXCPP) -#define GetOldReq(name, req, old_length) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\ - req->reqType = X_##name;\ - req->length = old_length>>2;\ - dpy->bufptr += old_length;\ - dpy->request++ - -#else /* non-ANSI C uses empty comment instead of "##" for token concat */ -#define GetOldReq(name, req, old_length) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ - req->reqType = X_/**/name;\ - req->length = old_length>>2;\ - dpy->bufptr += old_length;\ - dpy->request++ -#endif - -#ifndef vms -#include -#else /* vms */ -#define SyncHandle() \ - if (dpy->synchandler) (*dpy->synchandler)(dpy) -/* - * LockDisplay uses an undocumented feature in V5 of VMS that allows - * disabling ASTs without calling $SETAST. A bit is set in P1 space - * that disables a user mode AST from being delivered to this process. - * - */ -#define LockDisplay(dis) \ -{ globalref char ctl$gb_soft_ast_disable; \ - globalref char ctl$gb_lib_lock; \ - globalref short ctl$gw_soft_ast_lock_depth; \ - if ( ctl$gb_soft_ast_disable == 0 ) { \ - ctl$gb_soft_ast_disable = 1; \ - ctl$gb_lib_lock = 1; \ - ctl$gw_soft_ast_lock_depth = 1; \ - } \ - else ctl$gw_soft_ast_lock_depth++; \ -} - -/* - * UnlockDisplay clears the AST disable bit, then checks to see if an - * AST delivery attempt was made during the critical section. If so, - * reenable_ASTs is set, and $SETAST must be called to turn AST delivery - * back on. - * - * Note that it assumed that LockDisplay and UnlockDisplay appear in - * matched sets within a single routine. - */ -#define UnlockDisplay(dis) \ -{ globalref char ctl$gb_reenable_asts; \ - globalref char ctl$gb_soft_ast_disable; \ - globalref char ctl$gb_lib_lock; \ - globalref short ctl$gw_soft_ast_lock_depth; \ - if (!--ctl$gw_soft_ast_lock_depth) \ - if ( ctl$gb_lib_lock ) { \ - ctl$gb_lib_lock = 0; \ - ctl$gb_soft_ast_disable = 0; \ - if (ctl$gb_reenable_asts != 0) \ - sys$setast(1); \ - } \ -} - -#define WORD64ALIGN -#if defined(__STDC__) && !defined(UNIXCPP) -#define GetReq(name, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\ - _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 concat */ -#define GetReq(name, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\ - _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 -#endif /* vms */ - -#include -#include - -/* Returns the all important protocol number to be used. - * The only request guaranteed to be of the same request/reply - * size is XEGetVersionRequest. All others need the protocol - * number to determine how to communicate. - * Unfortunately, this was broken for V3.1 so GetAvailable will - * have to be used to determine the protocol version. - */ -int XEGetVersionRequest(XETC *tc, XETrapGetVersRep *ret) -{ - int status = True; - Display *dpy = tc->dpy; - CARD32 X_XTrapGet = tc->extOpcode; - xXTrapGetReq *reqptr; - xXTrapGetVersReply rep; - int numlongs = (SIZEOF(xXTrapGetVersReply) - - SIZEOF(xReply) + SIZEOF(CARD32) -1 ) / SIZEOF(CARD32); - LockDisplay(dpy); - GetReq(XTrapGet,reqptr); - reqptr->minor_opcode = XETrap_GetVersion; - reqptr->protocol = XETrapProtocol; - status = _XReply(dpy,(xReply *)&rep,numlongs,xTrue); - SyncHandle(); - UnlockDisplay(dpy); - memcpy((char *)ret,&(rep.data),sizeof(XETrapGetVersRep)); - return(status); -} - -int XEGetAvailableRequest(XETC *tc, XETrapGetAvailRep *ret) -{ - int status = True; - Display *dpy = tc->dpy; - CARD32 X_XTrapGet = tc->extOpcode; - xXTrapGetReq *reqptr; - xXTrapGetAvailReply rep; - int numlongs = (SIZEOF(xXTrapGetAvailReply) - - SIZEOF(xReply) + SIZEOF(CARD32) -1 ) / SIZEOF(CARD32); - LockDisplay(dpy); - GetReq(XTrapGet,reqptr); - reqptr->minor_opcode = XETrap_GetAvailable; - reqptr->protocol = XETrapProtocol; - status = _XReply(dpy,(xReply *)&rep,numlongs,xTrue); - SyncHandle(); - UnlockDisplay(dpy); - memcpy((char *)ret,&(rep.data),sizeof(XETrapGetAvailRep)); - return(status); -} - -/* should not be called directly by clients */ -static int XEConfigRequest(XETC *tc) -{ /* protocol changed between V3.1 and V3.2! */ - int status = True; - Display *dpy = tc->dpy; - CARD32 X_XTrapConfig = tc->extOpcode; - xXTrapConfigReq *reqptr; - if (tc->protocol == 31) - { /* hack to allocate the old request length */ - GetOldReq(XTrapConfig,reqptr,276); - } - else - { - GetReq(XTrapConfig,reqptr); - } - reqptr->minor_opcode = XETrap_Config; - - memcpy((char *)reqptr->config_flags_valid, - (char *)tc->values.v.flags.valid,4); - memcpy((char *)reqptr->config_flags_data, - (char *)tc->values.v.flags.data,4); - memcpy((char *)reqptr->config_flags_req, - (char *)tc->values.v.flags.req,XETrapMaxRequest); - memcpy((char *)reqptr->config_flags_event, - (char *)tc->values.v.flags.event,XETrapMaxEvent); - reqptr->config_max_pkt_size=tc->values.v.max_pkt_size; - reqptr->config_cmd_key=tc->values.v.cmd_key; - - XFlush(dpy); - SyncHandle(); - tc->dirty = 0L; /* Configuration is no longer dirty */ - return(status); -} - -/* Flush out any pending configuration */ -int XEFlushConfig(XETC *tc) -{ - return((tc->dirty) ? XEConfigRequest(tc) : True); -} -int XEResetRequest(XETC *tc) -{ - int status = True; - Display *dpy = tc->dpy; - CARD32 X_XTrap = tc->extOpcode; - xXTrapReq *reqptr; - status = XEFlushConfig(tc); /* Flushout any pending configuration first */ - if (status == True) - { - GetReq(XTrap,reqptr); - reqptr->minor_opcode = XETrap_Reset; - XFlush(dpy); - SyncHandle(); - } - return(status); -} - - -int XEGetLastInpTimeRequest(XETC *tc, XETrapGetLastInpTimeRep *ret) -{ /* this was broken in V3.1! */ - int status = True; - Display *dpy = tc->dpy; - CARD32 X_XTrap = tc->extOpcode; - xXTrapReq *reqptr; - xXTrapGetLITimReply rep; - int numlongs = (SIZEOF(xXTrapGetLITimReply) - - SIZEOF(xReply) + SIZEOF(CARD32) - 1) / SIZEOF(CARD32); - LockDisplay(dpy); - GetReq(XTrap,reqptr); - reqptr->minor_opcode = XETrap_GetLastInpTime; - status = _XReply(dpy,(xReply *)&rep,numlongs,xTrue); - SyncHandle(); - UnlockDisplay(dpy); - - ret->last_time=rep.data_last_time; - - return(status); -} - -int XEStartTrapRequest(XETC *tc) -{ - int status = True; - Display *dpy = tc->dpy; - CARD32 X_XTrap = tc->extOpcode; - xXTrapReq *reqptr; - status = XEFlushConfig(tc); /* Flushout any pending configuration first */ - if (status == True) - { - /* Add our event handler for the XLib transport */ - XETrapSetEventHandler(tc, XETrapData, XETrapDispatchXLib); - GetReq(XTrap,reqptr); - reqptr->minor_opcode = XETrap_StartTrap; - XFlush(dpy); - SyncHandle(); - BitTrue(tc->values.tc_flags, XETCTrapActive); - } - return(status); -} -int XEStopTrapRequest(XETC *tc) -{ - int status = True; - Display *dpy = tc->dpy; - CARD32 X_XTrap = tc->extOpcode; - xXTrapReq *reqptr; - status = XEFlushConfig(tc); /* Flushout any pending configuration first */ - if (status == True) - { - GetReq(XTrap,reqptr); - reqptr->minor_opcode = XETrap_StopTrap; - XFlush(dpy); - SyncHandle(); - BitFalse(tc->values.tc_flags, XETCTrapActive); - /* Remove our event handler for the XLib transport */ - XETrapSetEventHandler(tc, XETrapData, NULL); - } - - return(status); -} - -#ifndef _XINPUT -int XESimulateXEventRequest(XETC *tc, CARD8 type, CARD8 detail, - CARD16 x, CARD16 y, CARD8 screen) -{ - int status = True; - Display *dpy = tc->dpy; - CARD32 X_XTrapInput = tc->extOpcode; - xXTrapInputReq *reqptr; - status = XEFlushConfig(tc); /* Flushout any pending configuration first */ - if (status == True) - { /* write out the input event */ - GetReq(XTrapInput,reqptr); - reqptr->minor_opcode = XETrap_SimulateXEvent; - reqptr->input.type = type; - reqptr->input.detail = detail; - reqptr->input.x = x; - reqptr->input.y = y; - reqptr->input.screen = screen; - XFlush(dpy); - } - return(status); -} -#endif -int XEGetCurrentRequest(XETC *tc, XETrapGetCurRep *ret) -{ - int status = True; - Display *dpy = tc->dpy; - CARD32 X_XTrap = tc->extOpcode; - xXTrapReq *reqptr; - xXTrapGetCurReply rep; - int numlongs = (SIZEOF(xXTrapGetCurReply) - - SIZEOF(xReply) + SIZEOF(CARD32) -1 ) / SIZEOF(CARD32); - status = XEFlushConfig(tc); /* Flushout any pending configuration first */ - if (status == True) - { - LockDisplay(dpy); - GetReq(XTrap,reqptr); - reqptr->minor_opcode = XETrap_GetCurrent; - /* to support comm. w/ V3.1 extensions */ - if (tc->protocol == 31) - { - char tmp[284]; /* need space for the big *old* reply */ - numlongs = (284-sizeof(xReply)+sizeof(long)-1)/sizeof(long); - status = _XReply(dpy,(xReply *)tmp,numlongs,xTrue); - memcpy(&rep,tmp,sizeof(rep)); /* move just what's needed */ - } - else - { - status = _XReply(dpy,(xReply *)&rep,numlongs,xTrue); - } - SyncHandle(); - UnlockDisplay(dpy); - - memcpy((char *)ret->state_flags,rep.data_state_flags,2); - memcpy((char *)ret->config.flags.valid,rep.data_config_flags_valid,4); - memcpy((char *)ret->config.flags.data,rep.data_config_flags_data,4); - memcpy((char *)ret->config.flags.req,rep.data_config_flags_req, - XETrapMaxRequest); - memcpy((char *)ret->config.flags.event,rep.data_config_flags_event, - XETrapMaxEvent); - ret->config.max_pkt_size=rep.data_config_max_pkt_size; - ret->config.cmd_key=rep.data_config_cmd_key; - - } - return(status); -} - -int XEGetStatisticsRequest(XETC *tc, XETrapGetStatsRep *ret) -{ - int status = True; - Display *dpy = tc->dpy; - CARD32 X_XTrap = tc->extOpcode; - xXTrapReq *reqptr; - xXTrapGetStatsReply rep; - status = XEFlushConfig(tc); /* Flushout any pending configuration first */ - if (status == True) - { - LockDisplay(dpy); - GetReq(XTrap,reqptr); - reqptr->minor_opcode = XETrap_GetStatistics; - /* to support comm. w/ V3.1 extensions */ -#ifndef CRAY - if (tc->protocol == 31) - { /* this is the way we used to do it which breaks Cray's */ -#ifndef VECTORED_EVENTS - int numlongs = (1060-sizeof(xReply)+sizeof(long)-1)/sizeof(long); -#else - int numlongs = (1544-sizeof(xReply)+sizeof(long)-1)/sizeof(long); -#endif - status = _XReply(dpy,(xReply *)&rep,numlongs,xTrue); - if (status == True) - { /* need to shift it back into the data struct */ - xXTrapGetStatsReply tmp; - tmp = rep; - memcpy(&(rep.data),&(tmp.pad0), sizeof(rep.data)); - } - } - else -#endif /* CRAY */ - { /* this is the way we do it for V3.2 */ - int numbytes = SIZEOF(xXTrapGetStatsReply) - SIZEOF(xReply); - status = _XReply(dpy, (xReply *)&rep, 0, xFalse); - if (status == True) - { - status = _XRead(dpy, (char *)&rep.data, numbytes); - } - } - SyncHandle(); - UnlockDisplay(dpy); - memcpy(ret,&(rep.data),sizeof(XETrapGetStatsRep)); - } - return(status); -} diff --git a/nx-X11/lib/XTrap/XEStrMap.c b/nx-X11/lib/XTrap/XEStrMap.c deleted file mode 100644 index 2a97f13f4..000000000 --- a/nx-X11/lib/XTrap/XEStrMap.c +++ /dev/null @@ -1,284 +0,0 @@ -/* $XFree86: xc/lib/XTrap/XEStrMap.c,v 1.1 2001/11/02 23:29:27 dawes Exp $ */ -/***************************************************************************** -Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1994 by Digital Equipment Corp., -Maynard, MA - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright 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 -#include -#include -#include - -static char *eventName[] = { - "", "", - "KeyPress", "KeyRelease", "ButtonPress", - "ButtonRelease", "MotionNotify", "EnterNotify", - "LeaveNotify", "FocusIn", "FocusOut", - "KeymapNotify", "Expose", "GraphicsExpose", - "NoExpose", "VisibilityNotify", "CreateNotify", - "DestroyNotify", "UnmapNotify", "MapNotify", - "MapRequest", "ReparentNotify", "ConfigureNotify", - "ConfigureRequest", "GravityNotify", "ResizeRequest", - "CirculateNotify", "CirculateRequest", "PropertyNotify", - "SelectionClear", "SelectionRequest", "SelectionNotify", - "ColormapNotify", "ClientMessage", "MappingNotify", - "LASTEvent", -}; - -static char *requestName[] = { - "Invalid", - "X_CreateWindow", "X_ChangeWindowAttributes", - "X_GetWindowAttributes", "X_DestroyWindow", - "X_DestroySubwindows", "X_ChangeSaveSet", - "X_ReparentWindow", "X_MapWindow", - "X_MapSubwindows", "X_UnmapWindow", - "X_UnmapSubwindows", "X_ConfigureWindow", - "X_CirculateWindow", "X_GetGeometry", - "X_QueryTree", "X_InternAtom", - "X_GetAtomName", "X_ChangeProperty", - "X_DeleteProperty", "X_GetProperty", - "X_ListProperties", "X_SetSelectionOwner", - "X_GetSelectionOwner", "X_ConvertSelection", - "X_SendEvent", "X_GrabPointer", - "X_UngrabPointer", "X_GrabButton", - "X_UngrabButton", "X_ChangeActivePointerGrab", - "X_GrabKeyboard", "X_UngrabKeyboard", - "X_GrabKey", "X_UngrabKey", - "X_AllowEvents", "X_GrabServer", - "X_UngrabServer", "X_QueryPointer", - "X_GetMotionEvents", "X_TranslateCoords", - "X_WarpPointer", "X_SetInputFocus", - "X_GetInputFocus", "X_QueryKeymap", - "X_OpenFont", "X_CloseFont", - "X_QueryFont", "X_QueryTextExtents", - "X_ListFonts", "X_ListFontsWithInfo", - "X_SetFontPath", "X_GetFontPath", - "X_CreatePixmap", "X_FreePixmap", - "X_CreateGC", "X_ChangeGC", - "X_CopyGC", "X_SetDashes", - "X_SetClipRectangles", "X_FreeGC", - "X_ClearArea", "X_CopyArea", - "X_CopyPlane", "X_PolyPoint", - "X_PolyLine", "X_PolySegment", - "X_PolyRectangle", "X_PolyArc", - "X_FillPoly", "X_PolyFillRectangle", - "X_PolyFillArc", "X_PutImage", - "X_GetImage", "X_PolyText8", - "X_PolyText16", "X_ImageText8", - "X_ImageText16", "X_CreateColormap", - "X_FreeColormap", "X_CopyColormapAndFree", - "X_InstallColormap", "X_UninstallColormap", - "X_ListInstalledColormaps", "X_AllocColor", - "X_AllocNamedColor", "X_AllocColorCells", - "X_AllocColorPlanes", "X_FreeColors", - "X_StoreColors", "X_StoreNamedColor", - "X_QueryColors", "X_LookupColor", - "X_CreateCursor", "X_CreateGlyphCursor", - "X_FreeCursor", "X_RecolorCursorSize", - "X_QueryBestSize", "X_QueryExtension", - "X_ListExtensions", "X_ChangeKeyboardMapping", - "X_GetKeyboardMapping", "X_ChangeKeyboardControl", - "X_GetKeyboardControl", "X_Bell", - "X_ChangePointerControl", "X_GetPointerControl", - "X_SetScreenSaver", "X_GetScreenSaver", - "X_ChangeHosts", "X_ListHosts", - "X_SetAccessControl", "X_SetCloseDownMode", - "X_KillClient", "X_RotateProperties", - "X_ForceScreenSaver", "X_SetPointerMapping", - "X_GetPointerMapping", "X_SetModifierMapping", - "X_GetModifierMapping", "Invalid", - "Invalid", "Invalid", - "Invalid", "Invalid", - "Invalid", "Invalid", - "X_NoOperation", -}; - -typedef struct -{ - char *extName; - int extEvent; -} _extensionData; -_extensionData *extensionData; -int numExtension = -1; - -static struct _pf_tbl {CARD32 id; char *str;} pf_tbl[] = -{ - {PF_Apollo, "Apollo"}, - {PF_ATT, "ATT"}, - {PF_Cray1, "Cray1"}, - {PF_Cray2, "Cray2"}, - {PF_DECUltrix, "DECUltrix"}, - {PF_DECVMS, "DECVMS"}, - {PF_DECELN, "DECELN"}, - {PF_DECOSF1, "DECOSF1"}, - {PF_DECVT1000, "DECVT1000"}, - {PF_DECXTerm, "DECXTerm"}, - {PF_HP9000s800, "HP9000s800"}, - {PF_HP9000s300, "HP9000s300"}, - {PF_IBMAT, "IBMAT"}, - {PF_IBMRT, "IBMRT"}, - {PF_IBMPS2, "IBMPS2"}, - {PF_IBMRS, "IBMRS"}, - {PF_MacII, "MacII"}, - {PF_Pegasus, "Pegasus"}, - {PF_SGI, "SGI"}, - {PF_Sony, "Sony"}, - {PF_Sun3, "Sun3"}, - {PF_Sun386i, "Sun386i"}, - {PF_SunSparc, "SunSparc"}, - {PF_Other, "Other"} /* always the last one! */ -}; - -static char unknown[] = "unknown"; - -#define ASize(array) (sizeof(array)/sizeof((array)[0])) - -static INT16 _StringToID(register char *match, register char **strings, - INT16 nstrings) -{ - register INT16 id = nstrings; - - if (match && *match) - { while ((--id >= 0L) && (strcmp(match,strings[id]) != 0L)); } - else - { id = -1L; } - - return(id); -} -static void loadExtStrings(XETC *tc) -{ - char **extensionName=XListExtensions(tc->dpy,&numExtension); - if (numExtension) - { - int i; - extensionData = (_extensionData *)XtCalloc(numExtension, - sizeof(_extensionData)); - for (i = 0; i < numExtension; i++) - { /* Arrange extensions in opcode order */ - int opcode,event,error; - if (XQueryExtension(tc->dpy,extensionName[i],&opcode,&event, - &error)) - { - extensionData[opcode-128].extName = extensionName[i]; - extensionData[opcode-128].extEvent = event; - } - else - { /* This extension didn't load! Error! */ - extensionData[opcode-128].extName = "Invalid_Extension"; - } - } - XFreeExtensionList(extensionName); - } -} - -INT16 XEEventStringToID(register char *string) -{ - return(_StringToID(string,eventName,ASize(eventName))); -} - -INT16 XERequestStringToID(register char *string) -{ - return(_StringToID(string,requestName,ASize(requestName))); -} - -CARD32 XEPlatformStringToID(register char *string) -{ - struct _pf_tbl *ptr = &(pf_tbl[0]); - while(ptr->id != PF_Other) - { - if (!strncmp(ptr->str, string, strlen(ptr->str))) - { - return(ptr->id); - } - ptr++; - } - return((!strncmp(ptr->str,string,strlen(ptr->str))) ? ptr->id : -1L); -} - -char *XEEventIDToString(register CARD8 id, XETC *tc) -{ - int i; - if (id < ASize(eventName)) - return(eventName[id]); - /* either erroneous or an extension event */ - if (numExtension < 0) - { /* - * This is unfortunate, but necessary. The client - * program has requested the string identifier for - * an extension request/event. Since there's no Xlib - * equivalent for this, we have to query *all* the - * extensions looking for a match. Chances are - * if a client wants one, it'll want them all, - * so just go through and initialize the extension - * list once. - */ - loadExtStrings(tc); - } - /* Find id within extensionData */ - for (i=0; i=0 && extid < numExtension) ? - extensionData[extid].extName : unknown); -} - - -char *XERequestIDToString(register CARD8 id, XETC *tc) -{ - return((id < ASize(requestName)) ? requestName[id] : - XERequestIDToExtString(id,tc)); -} - -char *XEPlatformIDToString(register CARD32 id) -{ - struct _pf_tbl *ptr = &(pf_tbl[0]); - while((ptr->id != PF_Other) || (id == ptr->id)) - { - if (id == ptr->id) - { - return(ptr->str); - } - ptr++; - } - return(unknown); -} diff --git a/nx-X11/lib/XTrap/XETrapInit.c b/nx-X11/lib/XTrap/XETrapInit.c deleted file mode 100644 index a4a04310f..000000000 --- a/nx-X11/lib/XTrap/XETrapInit.c +++ /dev/null @@ -1,218 +0,0 @@ -/* $XFree86: xc/lib/XTrap/XETrapInit.c,v 1.2 2001/11/08 04:00:12 tsi Exp $ */ -/***************************************************************************** -Copyright 1987, 1988, 1989, 1990, 1991, 1992 by Digital Equipment Corp., -Maynard, MA - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright 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 NEED_EVENTS -#define NEED_REPLIES - -#include -#include -#include -#include -#include - -#ifndef XETrapNumberErrors -#define XETrapNumberErrors 0 -#endif - -#ifdef UWS40 -#define _XSetLastRequestRead _SetLastRequestRead -#endif -#ifndef vms -extern unsigned long _XSetLastRequestRead(Display *dpy, xGenericReply *rep); -#else -static unsigned long _XSetLastRequestRead(Display *dpy, xGenericReply *rep); -#endif - -static XExtensionInfo *xtrap_info = NULL; -static /* const */ char *xtrap_extension_name = XTrapExtName; - -#define XTrapCheckExtension(dpy,i,val) \ - XextCheckExtension(dpy, i, xtrap_extension_name, val) -#define XTrapSimpleCheckExtension(dpy,i) \ - XextSimpleCheckExtension(dpy, i, xtrap_extension_name) - -static XEXT_CLOSE_DISPLAY_PROTO(close_display); -static Bool wire_to_event(Display *dpy, XEvent *event, xEvent *wire_ev); -static Status event_to_wire(Display *dpy, XEvent *event, xEvent *wire_ev); - -#ifdef X11R3 -static int error_string(); -#else -static XEXT_ERROR_STRING_PROTO(error_string); -#endif -static /* const */ XExtensionHooks xtrap_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 */ - error_string /* error_string */ -}; - -static /* const */ char *xtrap_error_list[] = { - "BadTransport (I/O transport not available)", - "BadMailbox (Cannot connect/disconnect to mailbox)", - "BadIO (I/O error while reading/writing in extension)", - "BadHostname (Cannot locate requested host)", - "BadStatistics (Statistics not configured/available)", - "BadDevices (Devices not properly vectored)", - "BadSocket (Cannot connect to INTERNET socket)", - "BadScreen (Cannot send event to given screen)", - "BadSwapReq (Cannot trap extension requests for swapped client)", -}; - -static XEXT_GENERATE_FIND_DISPLAY (find_display, xtrap_info, - xtrap_extension_name, - &xtrap_extension_hooks, - XETrapNumberEvents, NULL) - -static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xtrap_info) - -static XEXT_GENERATE_ERROR_STRING (error_string, xtrap_extension_name, - XETrapNumErrors, xtrap_error_list) - -static Bool event_to_wire(Display *dpy, XEvent *libevent, xEvent *netevent) -{ - Bool status = False; - XExtDisplayInfo *info = find_display(dpy); - - XTrapCheckExtension(dpy,info,False); - - /* If we had more then one event */ -#if XETrapNumberErrors > 1 - switch((netevent->u.u.type & 0x7f) - info->codes->first_event) - { case XETrapData: -#endif - { - XETrapDataEvent *ev = (XETrapDataEvent *) libevent; - xETrapDataEvent *event = (xETrapDataEvent *) netevent; - - event->type = ev->type; - event->detail = ev->detail; - event->sequenceNumber = (ev->serial & 0xFFFF); - event->idx = ev->idx; - (void)memcpy(event->data,ev->data,sizeof(event->data)); - status = True; - } -#if XETrapNumberErrors > 1 - } -#endif - return(status); -} - -static Bool wire_to_event(Display *dpy, XEvent *libevent, xEvent *netevent) -{ - Bool status = False; - XExtDisplayInfo *info = find_display(dpy); - - XTrapCheckExtension(dpy,info,False); - - /* If we had more then one event */ -#if XETrapNumberErrors > 1 - switch((netevent->u.u.type & 0x7f) - info->codes->first_event) - { case XETrapData: -#endif - { - XETrapDataEvent *ev = (XETrapDataEvent *) libevent; - xETrapDataEvent *event = (xETrapDataEvent *) netevent; - - ev->type = event->type & 0x7F; - ev->detail = event->detail; - ev->serial = _XSetLastRequestRead(dpy,(xGenericReply *)netevent); - ev->synthetic = ((event->type & 0x80) != 0); - ev->display = dpy; - ev->idx = event->idx; - (void)memcpy(ev->data,event->data,sizeof(ev->data)); - status = True; - } -#if XETrapNumberErrors > 1 - } -#endif - return(status); -} - -/* - * XETrapQueryExtension - - * Returns True if the DEC-XTRAP extension is available - * on the given display. If the extension exists, the value of the - * first event code is stored into event_base and the value of the first - * error code is stored into error_base. - */ -Bool XETrapQueryExtension(Display *dpy,INT32 *event_base_return, - INT32 *error_base_return, INT32 *opcode_return) -{ - Bool status = True; - XExtDisplayInfo *info = find_display (dpy); - - if (XextHasExtension (info)) - { - *event_base_return = (INT32)(info->codes->first_event); - *error_base_return = (INT32)(info->codes->first_error); - *opcode_return = (INT32)(info->codes->major_opcode); - } - else - { - status = False; - } - return(status); -} - -#ifdef vms -/* Hard-coded since this didn't make it into XLibShr's xfer vector */ -/* From [.XLIBEL.SRC]XLibInt.c in VMS Source Pool */ -unsigned long _XSetLastRequestRead(Display *dpy, 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 - diff --git a/nx-X11/lib/XTrap/XEWrappers.c b/nx-X11/lib/XTrap/XEWrappers.c deleted file mode 100644 index 40b7e211e..000000000 --- a/nx-X11/lib/XTrap/XEWrappers.c +++ /dev/null @@ -1,325 +0,0 @@ -/* $XFree86$ */ -/***************************************************************************** -Copyright 1987, 1988, 1989, 1990, 1991, 1994 by Digital Equipment Corp., -Maynard, MA -X11R6 Changes Copyright (c) 1994 by Robert Chesler of Absol-Puter, Hudson, NH. - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright 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 AND ABSOL-PUTER DISCLAIM ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS, IN NO EVENT SHALL DIGITAL OR ABSOL-PUTER BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER -RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER 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 -#include -#include -#ifdef vms -#define IS_AT_OR_AFTER(t1, t2) (((t2).high > (t1).high) \ - || (((t2).high == (t1).high)&& ((t2).low >= (t1).low))) -typedef struct _vms_time { - unsigned long low; - unsigned long high; -}vms_time; /* from IntrinsicP.h */ -#ifdef VMSDW_V3 -typedef struct _ModToKeysymTable { - Modifiers mask; - int count; - int index; -} ModToKeysymTable; /* from TranslateI.h */ -typedef struct _ConverterRec **ConverterTable; /* from ConvertI.h */ -#include "libdef.h" -typedef struct _CallbackRec *CallbackList; /* from CallbackI.h */ -typedef struct _XtGrabRec *XtGrabList; /* from EventI.h */ -#include -#include -#else /* VMSDW_V3 */ -typedef struct _ModToKeysymTable { - Modifiers mask; - int count; - int index; -} ModToKeysymTable; /* from TranslateI.h */ -typedef struct _ConverterRec **ConverterTable; /* from ConvertI.h */ -#include "libdef.h" -#define NFDBITS (sizeof(fd_mask) * 8) -typedef long fd_mask; -#ifndef howmany -#define howmany(x, y) (((x)+((y)-1))/(y)) -#endif /* howmany */ -typedef struct Fd_set { - fd_mask fds_bits[howmany(256, NFDBITS)]; -} Fd_set; /* from fd.h */ -#include -#endif /* VMSDW_V3 */ -#else /* !vms */ -#include -#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))) -#endif /* vms */ - -/* The following has been lifted from NextEvent.c in X11R4 */ - -#ifndef NEEDS_NTPD_FIXUP -# ifdef sun -# 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*/ - - -/* The following code is required for the use of the XLIB transport of XTrap - * events. This is in line with what MIT wants to see proper extension - * implementations do, as compared to using one of the core input event masks. - */ - -Boolean (*XETrapGetEventHandler(XETC *tc, CARD32 id))(XETrapDataEvent *event, XETC *tc) -{ - return((id < XETrapNumberEvents) ? tc->eventFunc[id] : NULL); -} - -Boolean (*XETrapSetEventHandler(XETC *tc, CARD32 id, - Boolean (*pfunc)(XETrapDataEvent *event, XETC *tc)))(XETrapDataEvent *event, XETC *tc) -{ - register Boolean (*rfunc)(XETrapDataEvent *event, XETC *tc) = NULL; - - if (id < XETrapNumberEvents) - { - rfunc = XETrapGetEventHandler(tc,id); - tc->eventFunc[id] = pfunc; - } - return(rfunc); -} - -Boolean XETrapDispatchEvent(XEvent *pevent, XETC *tc) -{ - Boolean status = False; - register CARD32 id = pevent->type; - register CARD32 firstEvent = tc->eventBase; - register CARD32 lastEvent = tc->eventBase + XETrapNumberEvents - 1L; - - /* If it is our extension event, handle it specially, otherwise, pass - * it off to Xt. - */ - if (firstEvent != 0 && id >= firstEvent && id <= lastEvent) - { - /* We may be ignoring the event */ - if (tc->eventFunc[id - firstEvent] != NULL) - { - status = (*tc->eventFunc[id - firstEvent])((XETrapDataEvent*)pevent,tc); - } - } - else - { - status = XtDispatchEvent(pevent); - } - return(status); -} - -XtInputMask XETrapAppPending(XtAppContext app) -{ - TimerEventRec *te_ptr; -#ifndef VMS - struct timeval cur_time; -#else /* vms */ - vms_time cur_time; - long efnMask = 0L; - int status; -#endif /* vms */ - XtInputMask retmask = XtAppPending(app); /* Prime XtIMEvent */ - - retmask &= ~(XtIMTimer | XtIMAlternateInput); /* clear timer & input */ - /* Now test for timer */ - te_ptr = app->timerQueue; - while (te_ptr != NULL) - { -#ifndef vms - (void)gettimeofday(&cur_time, NULL); - FIXUP_TIMEVAL(cur_time); -#else - sys$gettim(&cur_time); -#endif /* vms */ - if (IS_AT_OR_AFTER(te_ptr->te_timer_value, cur_time)) - { /* this timer is due to fire */ - retmask |= XtIMTimer; - break; - } - te_ptr = te_ptr->te_next; - } - - /* Now test for alternate input */ -#ifndef vms - if (app->outstandingQueue != NULL) - { - retmask |= XtIMAlternateInput; - } -#else /* vms */ - if ((app->Input_EF_Mask != 0L) && ((status=SYS$READEF(1,&efnMask)) == 1)) - { /* we have input configured & retrieved the efn cluster 0 */ - efnMask &= app->Input_EF_Mask; /* mask out non-input */ - if (efnMask) /* any left? */ - { /* yes, an alt-input efn is set */ - retmask |= XtIMAlternateInput; - } - } -#endif /* vms */ - return(retmask); -} - -void XETrapAppMainLoop(XtAppContext app, XETC *tc) -{ - XEvent event; - XtInputMask imask; - - while (1) - { - imask = XETrapAppPending(app); - /* Check to see what's going on so that we don't block - * in either NextEvent or ProcessEvent since neither - * of these routines can correctly deal with XTrap Events - */ - if (imask & XtIMXEvent) - { - (void)XtAppNextEvent(app,&event); - (void)XETrapDispatchEvent(&event,tc); - } - else if (imask & (XtIMTimer | XtIMAlternateInput)) - { - XtAppProcessEvent(app, (XtIMTimer | XtIMAlternateInput)); - } - else - { /* Nothing going on, so we need to block */ - (void)XETrapWaitForSomething(app); - } - } -} - -int XETrapAppWhileLoop(XtAppContext app, XETC *tc, Bool *done) -{ - XEvent event; - XtInputMask imask; - int status = True; - - if(done) - { - while (!(*done)) - { - imask = XETrapAppPending(app); - /* Check to see what's going on so that we don't block - * in either NextEvent or ProcessEvent since neither - * of these routines can correctly deal with XTrap Events - */ - if (imask & XtIMXEvent) - { - (void)XtAppNextEvent(app, &event); - (void)XETrapDispatchEvent(&event,tc); - } - else if (imask & (XtIMTimer | XtIMAlternateInput)) - { - XtAppProcessEvent(app, (XtIMTimer | XtIMAlternateInput)); - } - else - { /* Nothing going on, so we need to block */ - (void)XETrapWaitForSomething(app); - } - } - } - else - { - status = False; - } - return(status); -} - -/* Wait for either Timer, Alternate Input, or an X Event to arrive */ -int XETrapWaitForSomething(XtAppContext app) -{ -#ifndef vms - return(_XtWaitForSomething(app, FALSE, FALSE, FALSE, FALSE, TRUE -#ifdef XTHREADS - , FALSE -#endif /* XTHREADS */ - , 0L)); -#else /* vms */ -#define IS_AFTER(t1,t2) (((t2).high > (t1).high) \ - ||(((t2).high == (t1).high)&& ((t2).low > (t1).low))) - long retval = 0L; - TimerEventRec *te_ptr; - vms_time cur_time,result_time; - int status = 0; - long quotient, remainder = 0; - int d; - - if (app->timerQueue!= NULL) - { /* check timeout queue */ - cur_time.low = cur_time.high = result_time.low = result_time.high = 0; - te_ptr = app->timerQueue; - sys$gettim(&cur_time); - if ((IS_AFTER(app->timerQueue->te_timer_value, cur_time)) && - (app->timerQueue->te_proc != 0)) - { /* it's fired! return! */ - return(0); - } - /* Jump through hoops to get the time specified in the queue into - * milliseconds - */ - status = lib$sub_times (&(te_ptr->te_timer_value.low), &cur_time, - &result_time); - /* - * See if this timer has expired. A timer is considered expired - * if it's value in the past (the NEGTIM case) or if there is - * less than one integral milli second before it would go off. - */ - - if (status == LIB$_NEGTIM || - (result_time.high == -1 && result_time.low > -10000)) - { /* We've got a timer and it's ready to fire! */ - return(0); - } - else if ((status & 1) == 1) - { - lib$ediv (&(10000), &result_time, "ient, &remainder); - quotient *= -1; /* flip the sign bit */ - - return(XMultiplexInput(app->count, &(app->list[0L]), - app->Input_EF_Mask, quotient, 0L, &retval)); - } - else - { - status = -1; - } - } - - return((status == -1 ? -1 : XMultiplexInput(app->count, &(app->list[0L]), - app->Input_EF_Mask, 0L, 0L, &retval))); -#endif /* vms */ -} diff --git a/nx-X11/lib/XTrap/XTrap-def.cpp b/nx-X11/lib/XTrap/XTrap-def.cpp deleted file mode 100644 index dc8a65a1a..000000000 --- a/nx-X11/lib/XTrap/XTrap-def.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* $XFree86$ */ -LIBRARY XTrap -VERSION LIBRARY_VERSION -EXPORTS - XEAddEventCB - XEAddEventCBs - XEAddRequestCB - XEAddRequestCBs - XERemoveAllEventCBs - XERemoveAllRequestCBs - XERemoveEventCB - XERemoveEventCBs - XERemoveRequestCB - XERemoveRequestCBs - XEChangeTC - XECreateTC - XEFreeTC - XESetCmdGateState - XETrapSetColorReplies - XETrapSetCommandKey - XETrapSetCursor - XETrapSetEvents - XETrapSetGrabServer - XETrapSetMaxPacket - XETrapSetRequests - XETrapSetStatistics - XETrapSetTimestamps - XETrapSetWinXY - XETrapSetXInput - XETrapDispatchXLib - XEPrintAvail - XEPrintAvailFlags - XEPrintAvailPktSz - XEPrintCfgFlags - XEPrintCmdKey - XEPrintCurPktSz - XEPrintCurXY - XEPrintCurrent - XEPrintEvents - XEPrintEvtStats - XEPrintLastTime - XEPrintMajOpcode - XEPrintPlatform - XEPrintRelease - XEPrintReqStats - XEPrintRequests - XEPrintStateFlags - XEPrintStatistics - XEPrintTkFlags - XEPrintTkRelease - XEPrintTkState - XEFlushConfig - XEGetAvailableRequest - XEGetCurrentRequest - XEGetLastInpTimeRequest - XEGetStatisticsRequest - XEGetVersionRequest - XEResetRequest - XESimulateXEventRequest - XEStartTrapRequest - XEStopTrapRequest - XEEventIDToString - XEEventStringToID - XEPlatformIDToString - XEPlatformStringToID - XERequestIDToExtString - XERequestIDToString - XERequestStringToID - XETrapQueryExtension - XETrapAppMainLoop - XETrapAppPending - XETrapAppWhileLoop - XETrapDispatchEvent - XETrapGetEventHandler - XETrapSetEventHandler - XETrapWaitForSomething diff --git a/nx-X11/lib/Xaw/Actions.c b/nx-X11/lib/Xaw/Actions.c deleted file mode 100644 index a65308b6a..000000000 --- a/nx-X11/lib/Xaw/Actions.c +++ /dev/null @@ -1,1139 +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.17 2003/03/25 04:18:10 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "Private.h" - -#ifdef __UNIXOS2__ -static char dummy; -#endif - -#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. - */ - - succed = True; - 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 LONG64 - 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 LONG64 - 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 LONG64 - c_8 = (long)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 LONG64 - 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 = ¶ms[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 LONG64 - 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 LONG64 - 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); - - 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 ((char *)((*(XawActionResList **)left)->widget_class) - - (char *)((*(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 ((char *)wc - (char *)((*(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 ((char *)((*(XawActionVarList **)left)->widget) - - (char *)((*(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 ((char *)widget - (char *)((*(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/nx-X11/lib/Xaw/AllWidgets.c b/nx-X11/lib/Xaw/AllWidgets.c deleted file mode 100644 index c943630b1..000000000 --- a/nx-X11/lib/Xaw/AllWidgets.c +++ /dev/null @@ -1,126 +0,0 @@ -/* $Xorg: AllWidgets.c,v 1.4 2001/02/09 02:03:42 xorgcvs Exp $ */ - -/* - -Copyright (c) 1991, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/AllWidgets.c,v 1.3 2001/08/23 21:49:51 tsi Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include - -extern WidgetClass applicationShellWidgetClass; -extern WidgetClass asciiSinkObjectClass; -extern WidgetClass asciiSrcObjectClass; -extern WidgetClass asciiTextWidgetClass; -extern WidgetClass boxWidgetClass; -extern WidgetClass commandWidgetClass; -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 overrideShellWidgetClass; -extern WidgetClass panedWidgetClass; -extern WidgetClass pannerWidgetClass; -extern WidgetClass portholeWidgetClass; -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; -#if !defined(OLDXAW) && !defined(XAW7) -extern WidgetClass xawPrintShellWidgetClass; -#endif - -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 }, -#if !defined(OLDXAW) && !defined(XAW7) -{ "printShell", &xawPrintShellWidgetClass }, -#endif -}; - -int XawWidgetCount = XtNumber(XawWidgetArray); - diff --git a/nx-X11/lib/Xaw/AllWidgets.h b/nx-X11/lib/Xaw/AllWidgets.h deleted file mode 100644 index 0200ac4cc..000000000 --- a/nx-X11/lib/Xaw/AllWidgets.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * $Xorg: AllWidgets.h,v 1.5 2001/02/09 02:03:42 xorgcvs Exp $ - * -Copyright 1990, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 - -#include - -/* - * This file matches the generated AllWidgets.c - */ -extern XmuWidgetNode XawWidgetArray[]; -extern int XawWidgetCount; - -#endif /* _XawAllWidgets_h */ diff --git a/nx-X11/lib/Xaw/AsciiSink.c b/nx-X11/lib/Xaw/AsciiSink.c deleted file mode 100644 index ad35a127c..000000000 --- a/nx-X11/lib/Xaw/AsciiSink.c +++ /dev/null @@ -1,1951 +0,0 @@ -/* $Xorg: AsciiSink.c,v 1.4 2001/02/09 02:03:42 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.26 2001/12/14 19:54:38 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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; - 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 - * | | - * | #### - * | ### | - * | #### | - * | #### | - * | ########## | - * | #### | - * | #### | - * | #### | - * | #### | - * |### | - * #### | - * | | - * - */ - 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; - - if (!sink->ascii_sink.echo) - return; - - /* 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; - sink->text_sink.paint->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); - } - } - - paint->width = segment.x2 - segment.x1; - x = segment.x1 = segment.x2; - - if (paint->length == 0) { - paint->x = x; - continue; - } - paint->text = XtRealloc(paint->text, paint->length); - property = paint->property; - paint = XtNew(XawTextPaintStruct); - paint->next = sink->text_sink.paint->paint; - sink->text_sink.paint->paint = paint; - paint->x = x; - paint->y = y + ascent; - paint->property = 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; - } - - 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; -#if 0 - XawTextPaintStruct *base, *head; -#endif - XawTextPaintStruct *paint = list->paint; - XawTextProperty *property; - XFontStruct *font = NULL; - 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. */ -#if 0 - 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; - } -#endif - 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; -#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; - - if (!sink->ascii_sink.echo) { - if (sink->ascii_sink.laststate != state) { - int width = CharWidth(sink, font, 0, ' ') - 1; - - x = ctx->text.margin.left; - y = ctx->text.margin.top; - font = sink->ascii_sink.font; - fheight = font->ascent + font->descent; - if (state == XawisOn) { - if (ctx->text.hasfocus) - XFillRectangle(XtDisplay(ctx), XtWindow(ctx), - sink->ascii_sink.xorgc, x, y, - width + 1, fheight + 1); - else - XDrawRectangle(XtDisplay(ctx), XtWindow(ctx), - sink->ascii_sink.xorgc, x, y, - width, fheight); - - } - else - _XawTextSinkClearToBackground(w, x, y, - width + 1, fheight + 1); - } - sink->ascii_sink.cursor_x = x; - sink->ascii_sink.cursor_y = y; - sink->ascii_sink.laststate = state; - return; - } - - - 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 = (long)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); - - if (!sink->ascii_sink.font) XtError("Aborting: no font found\n"); - - 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/nx-X11/lib/Xaw/AsciiSink.h b/nx-X11/lib/Xaw/AsciiSink.h deleted file mode 100644 index 234927493..000000000 --- a/nx-X11/lib/Xaw/AsciiSink.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * $Xorg: AsciiSink.h,v 1.4 2001/02/09 02:03:42 xorgcvs Exp $ - */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.5 2001/01/17 19:42:25 dawes Exp $ */ - -#ifndef _XawAsciiSink_h -#define _XawAsciiSink_h - -/* - * AsciiSink Object - */ - -#include - -/* 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/nx-X11/lib/Xaw/AsciiSinkP.h b/nx-X11/lib/Xaw/AsciiSinkP.h deleted file mode 100644 index b160092f3..000000000 --- a/nx-X11/lib/Xaw/AsciiSinkP.h +++ /dev/null @@ -1,101 +0,0 @@ -/* -* $Xorg: AsciiSinkP.h,v 1.4 2001/02/09 02:03:42 xorgcvs Exp $ -*/ - - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.9 2001/01/17 19:42:25 dawes Exp $ */ - -#ifndef _XawAsciiSinkP_h -#define _XawAsciiSinkP_h - -/* - * AsciiSink Object Private Data - */ -#include -#include - -/* 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/nx-X11/lib/Xaw/AsciiSrc.c b/nx-X11/lib/Xaw/AsciiSrc.c deleted file mode 100644 index b23ba4fca..000000000 --- a/nx-X11/lib/Xaw/AsciiSrc.c +++ /dev/null @@ -1,1886 +0,0 @@ -/* $Xorg: AsciiSrc.c,v 1.4 2001/02/09 02:03:42 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.33 2002/07/04 17:04:20 paulo Exp $ */ - -/* - * AsciiSrc.c - AsciiSrc object. (For use with the text widget). - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef OLDXAW -#include -#include -#endif -#include "Private.h" - -#include -#include -#include - -#if (defined(ASCII_STRING) || defined(ASCII_DISK)) -#include /* 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 - - -#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; - - if (src->ascii_src.use_string_in_place && src->ascii_src.string == NULL) - src->ascii_src.use_string_in_place = 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 character position following the retrieved text. - */ -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 = anchor->position + entity->offset + entity->length; - if (state == False || - !(entity->flags & XAW_TENTF_REPLACE)) { - 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 = Max(0, (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) -{ - mode_t open_mode = 0; - const char *fdopen_mode = NULL; - int fd; - FILE *file; - - 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) { - if (src->ascii_src.string != NULL) - 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 = O_RDONLY; - fdopen_mode = "r"; - break; - case XawtextAppend: - case XawtextEdit: - if (src->ascii_src.string == NULL) { - src->ascii_src.string = "*ascii-src*"; - src->ascii_src.is_tempfile = True; - } - else { -/* O_NOFOLLOW is a FreeBSD & Linux extension */ -#ifdef O_NOFOLLOW - open_mode = O_RDWR | O_NOFOLLOW; -#else - open_mode = O_RDWR; /* unsafe; subject to race conditions */ -#endif /* O_NOFOLLOW */ - fdopen_mode = "r+"; - } - break; - default: - XtErrorMsg("badMode", "asciiSourceCreate", "XawError", - "Bad editMode for ascii source; must be Read, " - "Append or Edit.", - NULL, NULL); - } - - /* If is_tempfile, allocate a private copy of the text - * Unlikely to be changed, just to set allocated_string */ - 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 ((fd = open(src->ascii_src.string, open_mode, 0666)) != -1) { - if ((file = fdopen(fd, fdopen_mode))) { - (void)fseek(file, 0, SEEK_END); - src->ascii_src.length = (XawTextPosition)ftell(file); - return (file); - } - } - { - 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 XPointer pagesize; - - if (pagesize == 0) { - pagesize = (XPointer)((long)_XawGetPageSize()); - if (pagesize < (XPointer)BUFSIZ) - pagesize = (XPointer)BUFSIZ; - } - - value->addr = (XPointer)&pagesize; -} - -#if (defined(ASCII_STRING) || defined(ASCII_DISK)) -# include -#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/nx-X11/lib/Xaw/AsciiSrc.h b/nx-X11/lib/Xaw/AsciiSrc.h deleted file mode 100644 index 8728dd9ea..000000000 --- a/nx-X11/lib/Xaw/AsciiSrc.h +++ /dev/null @@ -1,175 +0,0 @@ -/* $Xorg: AsciiSrc.h,v 1.4 2001/02/09 02:03:42 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.7 2001/01/17 19:42:25 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 - -/* 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/nx-X11/lib/Xaw/AsciiSrcP.h b/nx-X11/lib/Xaw/AsciiSrcP.h deleted file mode 100644 index 22d30082a..000000000 --- a/nx-X11/lib/Xaw/AsciiSrcP.h +++ /dev/null @@ -1,145 +0,0 @@ -/* -* $Xorg: AsciiSrcP.h,v 1.4 2001/02/09 02:03:42 xorgcvs Exp $ -*/ - - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.8 2001/01/17 19:42:25 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 -#include - -#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/nx-X11/lib/Xaw/AsciiText.c b/nx-X11/lib/Xaw/AsciiText.c deleted file mode 100644 index 7305100f6..000000000 --- a/nx-X11/lib/Xaw/AsciiText.c +++ /dev/null @@ -1,360 +0,0 @@ -/* $Xorg: AsciiText.c,v 1.4 2001/02/09 02:03:42 xorgcvs Exp $ */ - -/* - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.9 2001/01/17 19:42:25 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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xaw/AsciiText.h b/nx-X11/lib/Xaw/AsciiText.h deleted file mode 100644 index e6b4bc863..000000000 --- a/nx-X11/lib/Xaw/AsciiText.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * $Xorg: AsciiText.h,v 1.4 2001/02/09 02:03:42 xorgcvs Exp $ - */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.5 2001/01/17 19:42:25 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 -#include -#include - -/* 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/nx-X11/lib/Xaw/AsciiTextP.h b/nx-X11/lib/Xaw/AsciiTextP.h deleted file mode 100644 index 25e3eeeab..000000000 --- a/nx-X11/lib/Xaw/AsciiTextP.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - * $Xorg: AsciiTextP.h,v 1.4 2001/02/09 02:03:42 xorgcvs Exp $ - */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.8 2001/01/17 19:42:25 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 -#include -#include -#include - -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/nx-X11/lib/Xaw/Box.c b/nx-X11/lib/Xaw/Box.c deleted file mode 100644 index f4f293926..000000000 --- a/nx-X11/lib/Xaw/Box.c +++ /dev/null @@ -1,675 +0,0 @@ -/* $Xorg: Box.c,v 1.4 2001/02/09 02:03:43 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.14 2001/01/17 19:42:25 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xaw/Box.h b/nx-X11/lib/Xaw/Box.h deleted file mode 100644 index 17db281d6..000000000 --- a/nx-X11/lib/Xaw/Box.h +++ /dev/null @@ -1,108 +0,0 @@ -/* -* $Xorg: Box.h,v 1.4 2001/02/09 02:03:43 xorgcvs Exp $ -*/ - - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.7 2001/01/17 19:42:25 dawes Exp $ */ - -#ifndef _XawBox_h -#define _XawBox_h - -#include - -/* - * 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/nx-X11/lib/Xaw/BoxP.h b/nx-X11/lib/Xaw/BoxP.h deleted file mode 100644 index a64142e7d..000000000 --- a/nx-X11/lib/Xaw/BoxP.h +++ /dev/null @@ -1,103 +0,0 @@ -/* -* $Xorg: BoxP.h,v 1.4 2001/02/09 02:03:43 xorgcvs Exp $ -*/ - - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.10 2001/01/17 19:42:25 dawes Exp $ */ - -#ifndef _XawBoxP_h -#define _XawBoxP_h - -/* - * Box Widget Private Data - */ -#include -#include -#include - -/* 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/nx-X11/lib/Xaw/CHANGES b/nx-X11/lib/Xaw/CHANGES deleted file mode 100644 index 2eb316abb..000000000 --- a/nx-X11/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/nx-X11/lib/Xaw/Cardinals.h b/nx-X11/lib/Xaw/Cardinals.h deleted file mode 100644 index a8b3dfc41..000000000 --- a/nx-X11/lib/Xaw/Cardinals.h +++ /dev/null @@ -1,43 +0,0 @@ -/* $Xorg: Cardinals.h,v 1.4 2001/02/09 02:03:43 xorgcvs Exp $ */ -/* - -Copyright 1985, 1986, 1987, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/nx-X11/lib/Xaw/Changelog b/nx-X11/lib/Xaw/Changelog deleted file mode 100644 index 263ae04d5..000000000 --- a/nx-X11/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 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: -:\ - get-values(1, $fg, foreground, $bg, background)\n\ -:\ - set-values(1, foreground, yellow, background, gray30)\n\ -:\ - 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: -{+-} or /. 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 - + Function XmuSnprintf, defined in - + 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 -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: 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= - 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[ - f->min_char_or_byte2].rbearing - > f->per_char[ - f->min_char_or_byte2].width -or - f->per_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 converter is installed in the class - initialization of a widget, the code also installs a 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: - -xrm '*shapeStyle: ellipse' - and/or - -xrm '*shapeStyle: oval' -Revision of DrRndRect.c to make the widget looks 'more correct' when using: - -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 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 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 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 ->text.sink and ->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 ->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 '^.*$' /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 "á" 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: - or - *ispell*br.wordChars: - or simply - *ispell*wordChars: - + The skipLines resource is set only for the text mode now. - To set it, write something like: - *ispell*options.formats.text.skipLines: - or - *ispell*options*text.skipLines: - or simply - *ispell*skipLines: - - -#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 &; 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[]' to 'XtPointer pad[/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 "cq,Tab" of the search/replace popup. - This action is already done by the translation "Q," 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
    ,
      ,
    1. ,
      ,
      ,
      and the table tags. - - - -$XFree86: xc/lib/Xaw/Changelog,v 3.31 1999/08/15 13:00:31 dawes Exp $ diff --git a/nx-X11/lib/Xaw/Command.c b/nx-X11/lib/Xaw/Command.c deleted file mode 100644 index fdab1b1ba..000000000 --- a/nx-X11/lib/Xaw/Command.c +++ /dev/null @@ -1,660 +0,0 @@ -/* $Xorg: Command.c,v 1.5 2001/02/09 02:03:43 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.15tsi Exp $ */ - -/* - * Command.c - Command button widget - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "Private.h" - -#define DEFAULT_HIGHLIGHT_THICKNESS 2 -#define DEFAULT_SHAPE_HIGHLIGHT 32767 -#define STR_EQUAL(str1, str2) (str1 == str2 || strcmp(str1, str2) == 0) - -/* - * 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 void XawCommandGetValuesHook(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[] = -":" "highlight()\n" -":" "reset()\n" -":" "set()\n" -":" "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 */ - XawCommandGetValuesHook, /* 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->label.font) XtError("Aborting: no font found\n"); - - 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; - - XawCommandToggle(w); - cbw->command.set= True; -} - -/*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 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) { - rev_gc = cbw->command.normal_GC; - } - else { - 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) { - cbw->command.highlighted = HighlightNone; - redisplay = True; - } - - if (cbw->command.set) { - unsigned int i; - Pixel foreground, background; - - foreground = oldcbw->label.foreground; - background = oldcbw->core.background_pixel; - for (i = 0; i < *num_args; i++) { - if (STR_EQUAL(args[i].name, XtNforeground)) - background = cbw->label.foreground; - else if (STR_EQUAL(args[i].name, XtNbackground)) - foreground = cbw->core.background_pixel; - } - cbw->label.foreground = foreground; - cbw->core.background_pixel = background; - } - - 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 -XawCommandGetValuesHook(Widget w, ArgList args, Cardinal *num_args) -{ - CommandWidget cbw = (CommandWidget)w; - unsigned int i; - - for (i = 0; i < *num_args; i++) { - if (STR_EQUAL(args[i].name, XtNforeground)) - *((String*)args[i].value) = cbw->command.set ? - (String)cbw->core.background_pixel : (String)cbw->label.foreground; - else if (STR_EQUAL(args[i].name, XtNbackground)) - *((String*)args[i].value) = cbw->command.set ? - (String)cbw->label.foreground : (String)cbw->core.background_pixel; - } -} - -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/nx-X11/lib/Xaw/Command.h b/nx-X11/lib/Xaw/Command.h deleted file mode 100644 index 49eb99122..000000000 --- a/nx-X11/lib/Xaw/Command.h +++ /dev/null @@ -1,119 +0,0 @@ -/* $Xorg: Command.h,v 1.4 2001/02/09 02:03:43 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.5 2001/01/17 19:42:26 dawes Exp $ */ - -#ifndef _XawCommand_h -#define _XawCommand_h - -#include - -/* 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/nx-X11/lib/Xaw/CommandP.h b/nx-X11/lib/Xaw/CommandP.h deleted file mode 100644 index bc639f825..000000000 --- a/nx-X11/lib/Xaw/CommandP.h +++ /dev/null @@ -1,117 +0,0 @@ -/* -* $Xorg: CommandP.h,v 1.4 2001/02/09 02:03:43 xorgcvs Exp $ -*/ - - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.7 2001/01/17 19:42:26 dawes Exp $ */ - -#ifndef _XawCommandP_h -#define _XawCommandP_h - -/* - * Command Widget Private Data - */ -#include -#include - -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/nx-X11/lib/Xaw/Converters.c b/nx-X11/lib/Xaw/Converters.c deleted file mode 100644 index 24c01ca14..000000000 --- a/nx-X11/lib/Xaw/Converters.c +++ /dev/null @@ -1,701 +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.13 1999/06/06 08:47:54 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xaw/Dialog.c b/nx-X11/lib/Xaw/Dialog.c deleted file mode 100644 index 0c8b82faf..000000000 --- a/nx-X11/lib/Xaw/Dialog.c +++ /dev/null @@ -1,463 +0,0 @@ -/* $Xorg: Dialog.c,v 1.4 2001/02/09 02:03:43 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.7 2001/01/17 19:42:26 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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; - } - else if (streq(args[i].name, XtNlabel)) { - XtSetArg(a[0], XtNlabel, &s); - XtGetValues(src->dialog.labelW, 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/nx-X11/lib/Xaw/Dialog.h b/nx-X11/lib/Xaw/Dialog.h deleted file mode 100644 index 96fd36d38..000000000 --- a/nx-X11/lib/Xaw/Dialog.h +++ /dev/null @@ -1,101 +0,0 @@ -/* $Xorg: Dialog.h,v 1.4 2001/02/09 02:03:43 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.5 2001/01/17 19:42:26 dawes Exp $ */ - -#ifndef _XawDialog_h -#define _XawDialog_h - -#include - -/* 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/nx-X11/lib/Xaw/DialogP.h b/nx-X11/lib/Xaw/DialogP.h deleted file mode 100644 index fcc2240d7..000000000 --- a/nx-X11/lib/Xaw/DialogP.h +++ /dev/null @@ -1,104 +0,0 @@ -/* $Xorg: DialogP.h,v 1.4 2001/02/09 02:03:43 xorgcvs Exp $ */ - - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.8 2001/01/17 19:42:26 dawes Exp $ */ - -#ifndef _DialogP_h -#define _DialogP_h - -#include -#include - -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/nx-X11/lib/Xaw/DisplayList.c b/nx-X11/lib/Xaw/DisplayList.c deleted file mode 100644 index e43621b21..000000000 --- a/nx-X11/lib/Xaw/DisplayList.c +++ /dev/null @@ -1,2257 +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.18 2003/05/23 14:51:15 tsi Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "Private.h" - -#ifdef __UNIXOS2__ -static char dummy; -#endif - -#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; - y += ypad; - 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 long)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 = (long)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 = (long)args; - - xdata->mode = mode; -} - -/* ARGSUSED */ -static void -DlShapeMode(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) -{ - XawXlibData *xdata = (XawXlibData *)data; - int shape = (long)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 = (long)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 = (long)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 = (long)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 = (long)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 = (long)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 = (long)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; - y += ypad; - 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 = (long)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)(long)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 long -read_int(char *cp, char **cpp) -{ - long 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/nx-X11/lib/Xaw/Form.c b/nx-X11/lib/Xaw/Form.c deleted file mode 100644 index 1d162407b..000000000 --- a/nx-X11/lib/Xaw/Form.c +++ /dev/null @@ -1,1110 +0,0 @@ -/* $Xorg: Form.c,v 1.4 2001/02/09 02:03:43 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.20 2001/02/05 22:38:04 paulo Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#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); - -#ifdef OLDXAW - fw->form.old_width = fw->core.width; - fw->form.old_height = fw->core.height; -#endif - - 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) -{ - 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; - - LayoutChild(ref); - form->form.new_x += ref_form->form.new_x + XtWidth(ref) + - (XtBorderWidth(ref) << 1); - } - if ((ref = form->form.vert_base) != NULL) { - FormConstraints ref_form = (FormConstraints)ref->core.constraints; - - LayoutChild(ref); - form->form.new_y += ref_form->form.new_y + XtHeight(ref) + - (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)) { - Widget *childP; - int num_children = fw->composite.num_children; - WidgetList children = fw->composite.children; - - 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; - - /* - * Resets everything. - */ - fw->form.old_width = XtWidth(fw); - fw->form.old_height = XtHeight(fw); - for (childP = children; childP - children < num_children; childP++) { - Widget nw = *childP; - - if (XtIsManaged(nw)) { - FormConstraints nform = (FormConstraints)nw->core.constraints; - -#ifndef OLDXAW - nform->form.virtual_x = XtX(nw); - nform->form.virtual_y = XtY(nw); -#endif - nform->form.virtual_width = XtWidth(nw); - nform->form.virtual_height = XtHeight(nw); - } - } - } - else { - XtWidth(w) = old_width; - XtHeight(w) = old_height; - ret_val = XtGeometryNo; - } - } - - 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); - - 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)nw->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) - 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/nx-X11/lib/Xaw/Form.h b/nx-X11/lib/Xaw/Form.h deleted file mode 100644 index 9eb1ad7d6..000000000 --- a/nx-X11/lib/Xaw/Form.h +++ /dev/null @@ -1,171 +0,0 @@ -/* $Xorg: Form.h,v 1.5 2001/02/09 02:03:43 xorgcvs Exp $ */ - - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.8 2001/01/17 19:42:26 dawes Exp $ */ - -#ifndef _XawForm_h -#define _XawForm_h - -#include - -/* 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/nx-X11/lib/Xaw/FormP.h b/nx-X11/lib/Xaw/FormP.h deleted file mode 100644 index 7203dda0c..000000000 --- a/nx-X11/lib/Xaw/FormP.h +++ /dev/null @@ -1,142 +0,0 @@ -/* $Xorg: FormP.h,v 1.4 2001/02/09 02:03:43 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.13 2001/12/14 19:54:40 dawes Exp $ */ - -/* Form widget private definitions */ - -#ifndef _XawFormP_h -#define _XawFormP_h - -#include - -#include -#include - -_XFUNCPROTOBEGIN - -#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; - -_XFUNCPROTOEND - -#endif /* _XawFormP_h */ diff --git a/nx-X11/lib/Xaw/Grip.c b/nx-X11/lib/Xaw/Grip.c deleted file mode 100644 index c9d418368..000000000 --- a/nx-X11/lib/Xaw/Grip.c +++ /dev/null @@ -1,188 +0,0 @@ -/* $Xorg: Grip.c,v 1.4 2001/02/09 02:03:43 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.7 2001/01/17 19:42:26 dawes Exp $ */ - -/* - * Grip.c - Grip Widget (Used by Paned Widget) - * - */ -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include - -/* - * 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/nx-X11/lib/Xaw/Grip.h b/nx-X11/lib/Xaw/Grip.h deleted file mode 100644 index 1c19f6043..000000000 --- a/nx-X11/lib/Xaw/Grip.h +++ /dev/null @@ -1,99 +0,0 @@ -/* $Xorg: Grip.h,v 1.4 2001/02/09 02:03:43 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.6 2001/01/17 19:42:26 dawes Exp $ */ - -/* - * Grip.h - Public Definitions for Grip widget (used by VPane Widget) - * - */ - -#ifndef _XawGrip_h -#define _XawGrip_h - -#include - -/* 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/nx-X11/lib/Xaw/GripP.h b/nx-X11/lib/Xaw/GripP.h deleted file mode 100644 index f40a8d1e7..000000000 --- a/nx-X11/lib/Xaw/GripP.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -* $Xorg: GripP.h,v 1.4 2001/02/09 02:03:43 xorgcvs Exp $ -*/ - - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.7 2001/01/17 19:42:26 dawes Exp $ */ - -#ifndef _XawGripP_h -#define _XawGripP_h - -#include -#include - -#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/nx-X11/lib/Xaw/Imakefile b/nx-X11/lib/Xaw/Imakefile deleted file mode 100644 index 23842b71f..000000000 --- a/nx-X11/lib/Xaw/Imakefile +++ /dev/null @@ -1,209 +0,0 @@ -XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:45:33 cpqbld Exp $ - - - - -XCOMM $XFree86: xc/lib/Xaw/Imakefile,v 1.10 2001/01/17 19:42:27 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 -DPROJECT_ROOT=\"$(PROJECTROOT)\" $(VENDOR_DEFINES) - - 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 \ - Print.h \ - PrintSP.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 \ - PrintShell.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 \ - PrintShell.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 - -#if DoSharedLib && SharedDataSeparation -SpecialCObjectRule(sharedlib,NullParameter,$(SHLIBDEF)) -#endif - -MANSUFFIX = $(LIBMANSUFFIX) -InstallManPage(Xaw,$(LIBMANDIR)) -DependTarget() diff --git a/nx-X11/lib/Xaw/Label.c b/nx-X11/lib/Xaw/Label.c deleted file mode 100644 index 0a4c6ea2a..000000000 --- a/nx-X11/lib/Xaw/Label.c +++ /dev/null @@ -1,824 +0,0 @@ -/* $Xorg: Label.c,v 1.5 2001/02/09 02:03:43 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.12 2001/01/17 19:42:27 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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.font) XtError("Aborting: no font found\n"); - if (lw->simple.international && !lw->label.fontset) - XtError("Aborting: no fontset found\n"); - - 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->simple.international - && curlw->label.fontset != newlw->label.fontset) - 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/nx-X11/lib/Xaw/Label.h b/nx-X11/lib/Xaw/Label.h deleted file mode 100644 index fc3942b01..000000000 --- a/nx-X11/lib/Xaw/Label.h +++ /dev/null @@ -1,135 +0,0 @@ -/* $Xorg: Label.h,v 1.4 2001/02/09 02:03:44 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.6 2001/01/17 19:42:27 dawes Exp $ */ - -#ifndef _XawLabel_h -#define _XawLabel_h - -/* - * Label Widget - */ - -#include - -/* 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/nx-X11/lib/Xaw/LabelP.h b/nx-X11/lib/Xaw/LabelP.h deleted file mode 100644 index 9f49fdd4f..000000000 --- a/nx-X11/lib/Xaw/LabelP.h +++ /dev/null @@ -1,121 +0,0 @@ -/* -* $Xorg: LabelP.h,v 1.4 2001/02/09 02:03:44 xorgcvs Exp $ -*/ - - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.7 2001/01/17 19:42:27 dawes Exp $ */ - -#ifndef _XawLabelP_h -#define _XawLabelP_h - -/* - * Label Widget Private Data - */ -#include -#include - -/* 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/nx-X11/lib/Xaw/List.c b/nx-X11/lib/Xaw/List.c deleted file mode 100644 index 54ca5168f..000000000 --- a/nx-X11/lib/Xaw/List.c +++ /dev/null @@ -1,1273 +0,0 @@ -/* $Xorg: List.c,v 1.4 2001/02/09 02:03:44 xorgcvs Exp $ */ - -/* -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.16 2001/01/17 19:42:27 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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#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[] = -":" "Set()\n" -":" "Notify()\n" -; - -#define offset(field) XtOffsetOf(ListRec, 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 - }, -#ifndef OLDXAW - { - XtNshowCurrent, - XtCBoolean, - XtRBoolean, - sizeof(Boolean), - offset(list.show_current), - XtRImmediate, - (XtPointer)False - }, -#endif -}; -#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; - - if (!lw->list.font) XtError("Aborting: no font found\n"); - if (lw->simple.international && !lw->list.fontset) - XtError("Aborting: no fontset found\n"); - - /* - * 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) || item > lw->list.nitems) - 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) { -#ifndef OLDXAW - if (!lw->list.show_current || lw->list.selected == NO_HIGHLIGHT) - XawListUnhighlight(w); - else - XawListHighlight(w, lw->list.selected); -#else - XawListUnhighlight(w); -#endif - 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); - -#ifndef OLDXAW - lw->list.selected = item; -#endif - /* - * 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; - -#ifndef OLDXAW - lw->list.selected = lw->list.highlight; -#endif - 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 || cl->list.nitems != nl->list.nitems) - 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/nx-X11/lib/Xaw/List.h b/nx-X11/lib/Xaw/List.h deleted file mode 100644 index 2115eefd4..000000000 --- a/nx-X11/lib/Xaw/List.h +++ /dev/null @@ -1,237 +0,0 @@ -/* $Xorg: List.h,v 1.4 2001/02/09 02:03:44 xorgcvs Exp $ */ - -/* -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.7 2001/01/17 19:42:27 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 - -/* 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" -#define XtNshowCurrent "showCurrent" - -#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/nx-X11/lib/Xaw/ListP.h b/nx-X11/lib/Xaw/ListP.h deleted file mode 100644 index 2b8fc4639..000000000 --- a/nx-X11/lib/Xaw/ListP.h +++ /dev/null @@ -1,118 +0,0 @@ -/* $Xorg: ListP.h,v 1.4 2001/02/09 02:03:44 xorgcvs Exp $ */ - -/* -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.8 2001/01/17 19:42:27 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 -#include - -#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 - int selected; - Boolean show_current; - char pad1[(sizeof(XtPointer) - sizeof(Boolean)) + - (sizeof(XtPointer) - sizeof(int))]; - XtPointer pad2[2]; /* 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/nx-X11/lib/Xaw/MenuButtoP.h b/nx-X11/lib/Xaw/MenuButtoP.h deleted file mode 100644 index 416fdf9b5..000000000 --- a/nx-X11/lib/Xaw/MenuButtoP.h +++ /dev/null @@ -1,80 +0,0 @@ -/* $Xorg: MenuButtoP.h,v 1.4 2001/02/09 02:03:44 xorgcvs Exp $ - * -Copyright 1989,1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.7 2001/01/17 19:42:27 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 -#include - -/* 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/nx-X11/lib/Xaw/MenuButton.c b/nx-X11/lib/Xaw/MenuButton.c deleted file mode 100644 index 6c5da154a..000000000 --- a/nx-X11/lib/Xaw/MenuButton.c +++ /dev/null @@ -1,276 +0,0 @@ -/* $Xorg: MenuButton.c,v 1.4 2001/02/09 02:03:44 xorgcvs Exp $ */ - -/* -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.9 2001/10/11 21:17:00 paulo 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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include "Private.h" - -/* - * Class Methods - */ -static void XawMenuButtonClassInitialize(void); -static void XawMenuButtonInitialize(Widget, Widget, ArgList, Cardinal*); -static void XawMenuButtonDestroy(Widget); -static Boolean XawMenuButtonSetValues(Widget, Widget, Widget, ArgList, Cardinal*); - -/* - * Actions - */ -static void PopupMenu(Widget, XEvent*, String*, Cardinal*); - -/* - * Initialization - */ -#define superclass ((CommandWidgetClass)&commandClassRec) - -static char defaultTranslations[] = -":" "highlight()\n" -":" "reset()\n" -"Any:" "reset() PopupMenu()\n"; - -static char default_menu_name[] = "menu"; - -#define offset(field) XtOffsetOf(MenuButtonRec, field) -static XtResource resources[] = { - { - XtNmenuName, - XtCMenuName, - XtRString, - sizeof(String), - offset(menu_button.menu_name), - XtRString, - (XtPointer)default_menu_name - }, -}; -#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 */ - XawMenuButtonInitialize, /* 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 */ - XawMenuButtonDestroy, /* destroy */ - XtInheritResize, /* resize */ - XtInheritExpose, /* expose */ - XawMenuButtonSetValues, /* 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 -XawMenuButtonInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) -{ - MenuButtonWidget mbw = (MenuButtonWidget)cnew; - - if (mbw->menu_button.menu_name != default_menu_name) - mbw->menu_button.menu_name = XtNewString(mbw->menu_button.menu_name); -} - -static void -XawMenuButtonDestroy(Widget w) -{ - MenuButtonWidget mbw = (MenuButtonWidget)w; - - if (mbw->menu_button.menu_name != default_menu_name) - XtFree(mbw->menu_button.menu_name); -} - -/*ARGSUSED*/ -static Boolean -XawMenuButtonSetValues(Widget current, Widget request, Widget cnew, - ArgList args, Cardinal *num_args) -{ - MenuButtonWidget mbw_old = (MenuButtonWidget)current; - MenuButtonWidget mbw_new = (MenuButtonWidget)cnew; - - if (mbw_old->menu_button.menu_name != mbw_new->menu_button.menu_name) { - if (mbw_old->menu_button.menu_name != default_menu_name) - XtFree(mbw_old->menu_button.menu_name); - if (mbw_new->menu_button.menu_name != default_menu_name) - mbw_new->menu_button.menu_name = - XtNewString(mbw_new->menu_button.menu_name); - } - - return (False); -} - -/*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/nx-X11/lib/Xaw/MenuButton.h b/nx-X11/lib/Xaw/MenuButton.h deleted file mode 100644 index 59744c26c..000000000 --- a/nx-X11/lib/Xaw/MenuButton.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * $Xorg: MenuButton.h,v 1.4 2001/02/09 02:03:44 xorgcvs Exp $ - * -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.5 2001/01/17 19:42:27 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 - -/* 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/nx-X11/lib/Xaw/MultiSink.c b/nx-X11/lib/Xaw/MultiSink.c deleted file mode 100644 index 8abe2dedd..000000000 --- a/nx-X11/lib/Xaw/MultiSink.c +++ /dev/null @@ -1,978 +0,0 @@ -/* $Xorg: MultiSink.c,v 1.4 2001/02/09 02:03:44 xorgcvs Exp $ */ - -/* - * 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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.19 2001/01/17 19:42:27 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include "XawI18n.h" -#include -#include -#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 = (long)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); - - if (!sink->multi_sink.fontset) XtError("Aborting: no fontset found\n"); - - 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/nx-X11/lib/Xaw/MultiSink.h b/nx-X11/lib/Xaw/MultiSink.h deleted file mode 100644 index 49ef1df2e..000000000 --- a/nx-X11/lib/Xaw/MultiSink.h +++ /dev/null @@ -1,113 +0,0 @@ -/* $Xorg: MultiSink.h,v 1.4 2001/02/09 02:03:44 xorgcvs Exp $ */ - -/* - * 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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.5 2001/01/17 19:42:27 dawes Exp $ */ - -#ifndef _XawMultiSink_h -#define _XawMultiSink_h - -/* - * MultiSink Object - */ - -#include - -/* 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/nx-X11/lib/Xaw/MultiSinkP.h b/nx-X11/lib/Xaw/MultiSinkP.h deleted file mode 100644 index 537e0b12a..000000000 --- a/nx-X11/lib/Xaw/MultiSinkP.h +++ /dev/null @@ -1,141 +0,0 @@ -/* $Xorg: MultiSinkP.h,v 1.4 2001/02/09 02:03:44 xorgcvs Exp $ */ - -/* - * 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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.8 2001/01/17 19:42:28 dawes Exp $ */ - -#ifndef _XawMultiSinkP_h -#define _XawMultiSinkP_h - -#include - -/* - * MultiSink Object Private Data - */ -#include -#include - -/* 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/nx-X11/lib/Xaw/MultiSrc.c b/nx-X11/lib/Xaw/MultiSrc.c deleted file mode 100644 index 2daf0f6e8..000000000 --- a/nx-X11/lib/Xaw/MultiSrc.c +++ /dev/null @@ -1,1620 +0,0 @@ -/* $Xorg: MultiSrc.c,v 1.4 2001/02/09 02:03:44 xorgcvs Exp $ */ - -/* - * 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.28 2002/11/21 16:22:52 paulo Exp $ */ - -/* - -Copyright 1991, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "XawI18n.h" -#include "Private.h" - -#include -#include -#include - -#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 - - -/* - * 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; - - if (src->multi_src.use_string_in_place && src->multi_src.string == NULL) - src->multi_src.use_string_in_place = 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 character position following the retrieved text. - */ -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 = Max(0, (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) -{ - mode_t open_mode = 0; - const char *fdopen_mode = NULL; - int fd; - FILE *file; - 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 = O_RDONLY; - fdopen_mode = "r"; - break; - case XawtextAppend: - case XawtextEdit: - if (src->multi_src.string == NULL) { - src->multi_src.string = "*multi-src*"; - src->multi_src.is_tempfile = True; - } - else { -/* O_NOFOLLOW is a BSD & Linux extension */ -#ifdef O_NOFOLLOW - open_mode = O_RDWR | O_NOFOLLOW; -#else - open_mode = O_RDWR; /* unsafe; subject to race conditions */ -#endif - fdopen_mode = "r+"; - } - break; - default: - XtErrorMsg("badMode", "multiSourceCreate", "XawError", - "Bad editMode for multi source; must be " - "Read, Append or Edit.", NULL, NULL); - } - - /* If is_tempfile, allocate a private copy of the text - * Unlikely to be changed, just to set allocated_string */ - 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 ((fd = open((char *)src->multi_src.string, open_mode, 0666)) != -1) { - if ((file = fdopen(fd, fdopen_mode)) != NULL) { - (void)fseek(file, 0, SEEK_END); - src->multi_src.length = (XawTextPosition)ftell(file); - return(file); - } - } - { - 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 XPointer pagesize; - - if (pagesize == 0) { - pagesize = (XPointer)((long)_XawGetPageSize()); - if (pagesize < (XPointer)BUFSIZ) - pagesize = (XPointer)BUFSIZ; - } - - value->addr = (XPointer)&pagesize; -} diff --git a/nx-X11/lib/Xaw/MultiSrc.h b/nx-X11/lib/Xaw/MultiSrc.h deleted file mode 100644 index 00c27f6c7..000000000 --- a/nx-X11/lib/Xaw/MultiSrc.h +++ /dev/null @@ -1,133 +0,0 @@ -/* $Xorg: MultiSrc.h,v 1.4 2001/02/09 02:03:44 xorgcvs Exp $ */ - -/* - * 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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:28 dawes Exp $ */ - -/* - * This file was modified from AsciiSrc.h. - * - * By Li Yuhong, Sept. 18, 1990 - */ - -#ifndef _XawMultiSrc_h -#define _XawMultiSrc_h - -#include - -/* 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/nx-X11/lib/Xaw/MultiSrcP.h b/nx-X11/lib/Xaw/MultiSrcP.h deleted file mode 100644 index 49f7abc3a..000000000 --- a/nx-X11/lib/Xaw/MultiSrcP.h +++ /dev/null @@ -1,182 +0,0 @@ -/* $Xorg: MultiSrcP.h,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $ */ - -/* - * 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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.8 2001/01/17 19:42:28 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 -#include -#include - -#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/nx-X11/lib/Xaw/OS.c b/nx-X11/lib/Xaw/OS.c deleted file mode 100644 index ec80e63ff..000000000 --- a/nx-X11/lib/Xaw/OS.c +++ /dev/null @@ -1,64 +0,0 @@ -/* $XFree86: xc/lib/Xaw/OS.c,v 1.1 1998/12/06 10:44:34 dawes Exp $ */ - -/* Some OS-dependent utility code */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "Private.h" - -#ifndef X_NOT_POSIX -#include /* for sysconf(), and getpagesize() */ -#endif - -#if defined(linux) -/* kernel header doesn't work with -ansi */ -/* #include *//* 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/nx-X11/lib/Xaw/Paned.c b/nx-X11/lib/Xaw/Paned.c deleted file mode 100644 index 4dbdb3017..000000000 --- a/nx-X11/lib/Xaw/Paned.c +++ /dev/null @@ -1,2067 +0,0 @@ -/* $Xorg: Paned.c,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.11 2001/08/23 00:03:19 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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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[] = -":" "GripAction(Start,UpLeftPane)\n" -":" "GripAction(Start,ThisBorderOnly)\n" -":" "GripAction(Start,LowRightPane)\n" -":" "GripAction(Move,UpLeft)\n" -":" "GripAction(Move,ThisBorder)\n" -":" "GripAction(Move,LowRight)\n" -"Any:" "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/nx-X11/lib/Xaw/Paned.h b/nx-X11/lib/Xaw/Paned.h deleted file mode 100644 index aaa532030..000000000 --- a/nx-X11/lib/Xaw/Paned.h +++ /dev/null @@ -1,264 +0,0 @@ -/* -* $Xorg: Paned.h,v 1.5 2001/02/09 02:03:45 xorgcvs Exp $ -*/ - - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.6 2001/01/17 19:42:28 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 -#include - -/* 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/nx-X11/lib/Xaw/PanedP.h b/nx-X11/lib/Xaw/PanedP.h deleted file mode 100644 index a94b0f34d..000000000 --- a/nx-X11/lib/Xaw/PanedP.h +++ /dev/null @@ -1,180 +0,0 @@ -/*********************************************************** - - $Xorg: PanedP.h,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $ - - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.7 2001/01/17 19:42:28 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 - -/* 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/nx-X11/lib/Xaw/Panner.c b/nx-X11/lib/Xaw/Panner.c deleted file mode 100644 index e0ae2c20a..000000000 --- a/nx-X11/lib/Xaw/Panner.c +++ /dev/null @@ -1,1082 +0,0 @@ -/* - * $Xorg: Panner.c,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $ - * -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.8 2001/07/25 15:04:49 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "Private.h" - -#if defined(ISC) && __STDC__ && !defined(ISC30) -extern double atof(char *); -#else -#include /* for atof() */ -#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[] = -":" "start()\n" -":" "move()\n" -":" "notify() stop()\n" -":" "abort()\n" -":KP_Enter:" "set(rubberband,toggle)\n" -"space:" "page(+1p,+1p)\n" -"Delete:" "page(-1p,-1p)\n" -":KP_Delete:" "page(-1p,-1p)\n" -"BackSpace:" "page(-1p,-1p)\n" -"Left:" "page(-.5p,+0)\n" -":KP_Left:" "page(-.5p,+0)\n" -"Right:" "page(+.5p,+0)\n" -":KP_Right:" "page(+.5p,+0)\n" -"Up:" "page(+0,-.5p)\n" -":KP_Up:" "page(+0,-.5p)\n" -"Down:" "page(+0,+.5p)\n" -":KP_Down:" "page(+0,+.5p)\n" -"Home:" "page(0,0)\n" -":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 + .5) - / (double)pw->panner.canvas_width; - pw->panner.vaspect = ((double)XtHeight(pw) - vpad + .5) - / (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/nx-X11/lib/Xaw/Panner.h b/nx-X11/lib/Xaw/Panner.h deleted file mode 100644 index 594e2eb47..000000000 --- a/nx-X11/lib/Xaw/Panner.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * $Xorg: Panner.h,v 1.5 2001/02/09 02:03:45 xorgcvs Exp $ - * -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.5 2001/01/17 19:42:28 dawes Exp $ */ - -#ifndef _XawPanner_h -#define _XawPanner_h - -#include -#include - -/***************************************************************************** - * - * 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/nx-X11/lib/Xaw/PannerP.h b/nx-X11/lib/Xaw/PannerP.h deleted file mode 100644 index aacf2e26c..000000000 --- a/nx-X11/lib/Xaw/PannerP.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * $Xorg: PannerP.h,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $ - * -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.7 2001/01/17 19:42:29 dawes Exp $ */ - -#ifndef _XawPannerP_h -#define _XawPannerP_h - -#include -#include - -/* 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/nx-X11/lib/Xaw/Pixmap.c b/nx-X11/lib/Xaw/Pixmap.c deleted file mode 100644 index 06e326a74..000000000 --- a/nx-X11/lib/Xaw/Pixmap.c +++ /dev/null @@ -1,993 +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.17 2002/05/18 02:05:39 paulo Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#ifndef OLDXAW -#include -#endif -#include "Private.h" - -#ifdef __UNIXOS2__ -static char dummy; -#endif - -#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 *); -static void GetResourcePixmapPath(Display*); - -/* - * 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)((long)pixmap - (long)((*(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 || !(*cache)->num_elems) - 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 || !(*cache)->num_elems) - return (NULL); - if (flags == FIND_COLORMAP) - return (*cache); - - /* Depth */ - cache = (XawCache **)bsearch((void *)(long)depth, (*cache)->elems, - (*cache)->num_elems, sizeof(XtPointer), - bcmp_long); - - if (!cache || !(*cache)->num_elems) - 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); -} - -#ifndef PROJECT_ROOT -#define PROJECT_ROOT "/usr/X11R6" -#endif - -static char *pixmap_path = NULL; - -static void -GetResourcePixmapPath(Display *display) -{ - XrmName xrm_name[2]; - XrmClass xrm_class[2]; - XrmRepresentation rep_type; - XrmValue value; - static char *default_path = - "%H/%T/%N:%P/include/X11/%T/%N:/usr/X11R6/include/X11/%T/%N:/usr/include/X11/%T/%N:%N"; - - xrm_name[0] = XrmPermStringToQuark("pixmapFilePath"); - xrm_name[1] = NULLQUARK; - xrm_class[0] = XrmPermStringToQuark("PixmapFilePath"); - xrm_class[1] = NULLQUARK; - if (!XrmGetDatabase(display)) - (void) XGetDefault(display, "", ""); - if (XrmQGetResource(XrmGetDatabase(display), xrm_name, xrm_class, - &rep_type, &value) && - rep_type == XrmPermStringToQuark("String")) { - int length = 0; - char *tok, *buffer = XtNewString(value.addr); - - for (tok = strtok(buffer, ":"); tok; tok = strtok(NULL, ":")) { - int toklen = strlen(tok); - - if (toklen) { - pixmap_path = XtRealloc(pixmap_path, length + toklen + 5); - strcpy(pixmap_path + length, tok); - if (length) - pixmap_path[length++] = ':'; - sprintf(pixmap_path + length, "%s/%%N", tok); - length += strlen(tok) + 3; - } - } - pixmap_path = XtRealloc(pixmap_path, length + strlen(default_path) + 2); - if (length) - pixmap_path[length++] = ':'; - strcpy(pixmap_path + length, default_path); - } - else - pixmap_path = default_path; -} - -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"}, - {'P', PROJECT_ROOT}, - }; - 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; - if (pixmap_path == NULL) - GetResourcePixmapPath(DisplayOfScreen(screen)); - 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"}, - {'P', PROJECT_ROOT}, - }; - 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; - if (pixmap_path == NULL) - GetResourcePixmapPath(DisplayOfScreen(screen)); - 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/nx-X11/lib/Xaw/Porthole.c b/nx-X11/lib/Xaw/Porthole.c deleted file mode 100644 index 3bf161592..000000000 --- a/nx-X11/lib/Xaw/Porthole.c +++ /dev/null @@ -1,378 +0,0 @@ -/* - * $Xorg: Porthole.c,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $ - * -Copyright 1990, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:29 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xaw/Porthole.h b/nx-X11/lib/Xaw/Porthole.h deleted file mode 100644 index 68274d886..000000000 --- a/nx-X11/lib/Xaw/Porthole.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * $Xorg: Porthole.h,v 1.5 2001/02/09 02:03:45 xorgcvs Exp $ - * -Copyright 1990, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.5 2001/01/17 19:42:29 dawes Exp $ */ - -#ifndef _XawPorthole_h -#define _XawPorthole_h - -#include -#include - -/***************************************************************************** - * - * 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/nx-X11/lib/Xaw/PortholeP.h b/nx-X11/lib/Xaw/PortholeP.h deleted file mode 100644 index 39dcbdc53..000000000 --- a/nx-X11/lib/Xaw/PortholeP.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * $Xorg: PortholeP.h,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $ - * -Copyright 1990, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.7 2001/01/17 19:42:29 dawes Exp $ */ - -#ifndef _XawPortholeP_h -#define _XawPortholeP_h - -#include - -/* 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/nx-X11/lib/Xaw/Print.h b/nx-X11/lib/Xaw/Print.h deleted file mode 100644 index 7946e8a57..000000000 --- a/nx-X11/lib/Xaw/Print.h +++ /dev/null @@ -1,132 +0,0 @@ -/* $Xorg: Print.h,v 1.1 2003/07/11 19:46:06 gisburn Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (c) Copyright 2003 Danny Backx - ** (c) Copyright 2003-2004 Roland Mainz - ** - ** Permission is hereby granted, free of charge, to any person obtaining a copy - ** of this software and associated documentation files (the "Software"), to deal - ** in the Software without restriction, including without limitation the rights - ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - ** copies of the Software, and to permit persons to whom the Software is - ** furnished to do so, subject to the following conditions: - ** - ** The above copyright notice and this permission notice shall be included in - ** all copies or substantial portions of the Software. - ** - ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ** - ** Except as contained in this notice, the names of the copyright holders shall - ** not be used in advertising or otherwise to promote the sale, use or other - ** dealings in this Software without prior written authorization from said - ** copyright holders. - ** - ****************************************************************************** - *****************************************************************************/ - - -#ifndef _XAW_PRINT_H -#define _XAW_PRINT_H 1 - -#include - -/* Resources: - NOT WRITTEN YET -*/ - -/* XawPrintConfigureLayoutMode - define how the shell resizes/moves itself - * to match the paper size - * Values: - * - XawPrintLAYOUTMODE_NONE - * do nothing - * - XawPrintLAYOUTMODE_PAGESIZE - * set width/height to page size - * (this is the default (mainly for compatibilty to XmPrintShell)) - * - XawPrintLAYOUTMODE_DRAWABLEAREA - * set x/y/width/height to drawable area of pag - */ -typedef -enum -{ - XawPrintLAYOUTMODE_NONE, - XawPrintLAYOUTMODE_PAGESIZE, - XawPrintLAYOUTMODE_DRAWABLEAREA -} XawPrintConfigureLayoutMode; - - -#define XawNstartJobCallback "startJobCallback" -#define XawNendJobCallback "endJobCallback" -#define XawNdocSetupCallback "docSetupCallback" -#define XawNpageSetupCallback "pageSetupCallback" -#define XawNlayoutMode "layoutMode" -#define XawCLayoutMode "LayoutMode" -#define XawNminX "minX" -#define XawCMinX "MinX" -#define XawNminY "minY" -#define XawCMinY "MinY" -#define XawNmaxX "maxX" -#define XawCMaxX "MaxX" -#define XawNmaxY "maxY" -#define XawCMaxY "MaxY" -#define XawNcurrDocNumInJob "currDocNumInJob" -#define XawCCurrDocNumInJob "CurrDocNumInJob" -#define XawNcurrPageNumInDoc "currPageNumInDoc" -#define XawCCurrPageNumInDoc "CurrPageNumInDoc" -#define XawNcurrPageNumInJob "currPageNumInJob" -#define XawCCurrPageNumInJob "CurrPageNumInJob" -#define XawNdefaultPixmapResolution "defaultPixmapResolution" -#define XawCDefaultPixmapResolution "DefaultPixmapResolution" - -#define XawCR_START_JOB 70 -#define XawCR_END_JOB 71 -#define XawCR_DOC_SETUP 72 -#define XawCR_PAGE_SETUP 73 - -typedef struct -{ - int reason; - XEvent *event; - XPContext context; - Boolean last_page_in_doc; - Boolean last_page_in_job; - XtPointer detail; -} XawPrintShellCallbackStruct; - -extern WidgetClass xawPrintShellWidgetClass; -typedef struct XawPrintShellRec *XawPrintShellWidget; - -/************************************************************ - * - * Public Functions. - * - ************************************************************/ - -_XFUNCPROTOBEGIN - -/* Returns whether the widget passed in is a print shell or "print shell"-like - * widget (e.g. print preview). - * Note that this will return |True| for more classes than |XawPrintShell| in - * the future (like for |XmPrintShell| etc.) - */ -extern Boolean XawIsPrintShell( -#if NeedFunctionPrototypes - Widget w -#endif -); - -extern void XawPrintRedisplayWidget( -#if NeedFunctionPrototypes - Widget w /* Widget */ -#endif -); - -_XFUNCPROTOEND - -#endif /* !_XAW_PRINT_H */ - diff --git a/nx-X11/lib/Xaw/PrintSP.h b/nx-X11/lib/Xaw/PrintSP.h deleted file mode 100644 index e0aca277b..000000000 --- a/nx-X11/lib/Xaw/PrintSP.h +++ /dev/null @@ -1,135 +0,0 @@ -/* $Xorg: PrintSP.h,v 1.1 2003/07/11 19:46:06 gisburn Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (c) Copyright 2003 Danny Backx - ** (c) Copyright 2003-2004 Roland Mainz - ** - ** Permission is hereby granted, free of charge, to any person obtaining a copy - ** of this software and associated documentation files (the "Software"), to deal - ** in the Software without restriction, including without limitation the rights - ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - ** copies of the Software, and to permit persons to whom the Software is - ** furnished to do so, subject to the following conditions: - ** - ** The above copyright notice and this permission notice shall be included in - ** all copies or substantial portions of the Software. - ** - ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ** - ** Except as contained in this notice, the names of the copyright holders shall - ** not be used in advertising or otherwise to promote the sale, use or other - ** dealings in this Software without prior written authorization from said - ** copyright holders. - ** - ****************************************************************************** - *****************************************************************************/ - -#ifndef _XAW_PRINTSP_H -#define _XAW_PRINTSP_H 1 - -#include -#include - -_XFUNCPROTOBEGIN - -/* New fields for the XawPrintShell widget class record */ - -typedef struct { - XtPointer extension; /* pointer to extension record */ -} XawPrintShellClassPart; - -typedef struct XawPrintShellClassRec { - 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; - XawPrintShellClassPart print_shell_class; -} XawPrintShellClassRec; - -extern XawPrintShellClassRec xawPrintShellClassRec; - -/* New fields for the XawPrint shell widget */ - -typedef struct { - XtCallbackList start_job_callback, - end_job_callback, - doc_setup_callback, - page_setup_callback; - XtEnum layoutmode; /* see XawPrintConfigureLayoutMode */ - unsigned short page_width, - page_height; - Dimension min_x, - min_y, - max_x, - max_y; - unsigned int curr_doc_num_in_job, /* Current document number in job */ - curr_page_num_in_doc, /* Current page number in doc */ - curr_page_num_in_job; /* Current page number in job */ - unsigned short default_pixmap_resolution; - long print_resolution; - Boolean last_page_in_doc; - Boolean last_page_in_job; -} XawPrintShellPart; - -typedef struct XawPrintShellRec { - CorePart core; - CompositePart composite; - ShellPart shell; - WMShellPart wm; - VendorShellPart vendor; - TopLevelShellPart topLevel; - ApplicationShellPart application; - XawPrintShellPart print; -} XawPrintShellRec; -extern WidgetClass xawPrintShellWidgetClass; - -#define PS_StartJobCallback(w) \ - (((XawPrintShellWidget) (w))->print.start_job_callback) -#define PS_EndJobCallback(w) \ - (((XawPrintShellWidget) (w))->print.end_job_callback) -#define PS_DocSetupCallback(w) \ - (((XawPrintShellWidget) (w))->print.doc_setup_callback) -#define PS_PageSetupCallback(w) \ - (((XawPrintShellWidget) (w))->print.page_setup_callback) -#define PS_LayoutMode(w) \ - (((XawPrintShellWidget) (w))->print.layoutmode) -#define PS_PageWidth(w) \ - (((XawPrintShellWidget) (w))->print.page_width) -#define PS_PageHeight(w) \ - (((XawPrintShellWidget) (w))->print.page_height) -#define PS_MinX(w) \ - (((XawPrintShellWidget) (w))->print.min_x) -#define PS_MinY(w) \ - (((XawPrintShellWidget) (w))->print.min_y) -#define PS_MaxX(w) \ - (((XawPrintShellWidget) (w))->print.max_x) -#define PS_MaxY(w) \ - (((XawPrintShellWidget) (w))->print.max_y) -#define PS_CurrDocNumInJob(w) \ - (((XawPrintShellWidget) (w))->print.curr_doc_num_in_job) -#define PS_CurrPageNumInDoc(w) \ - (((XawPrintShellWidget) (w))->print.curr_page_num_in_doc) -#define PS_CurrPageNumInJob(w) \ - (((XawPrintShellWidget) (w))->print.curr_page_num_in_job) -#define PS_DefaultPixmapResolution(w) \ - (((XawPrintShellWidget) (w))->print.default_pixmap_resolution) -#define PS_PrintResolution(w) \ - (((XawPrintShellWidget) (w))->print.print_resolution) -#define PS_LastPageInDoc(w) \ - (((XawPrintShellWidget) (w))->print.last_page_in_doc) -#define PS_LastPageInJob(w) \ - (((XawPrintShellWidget) (w))->print.last_page_in_job) - -_XFUNCPROTOEND - -#endif /* !_XAW_PRINTSP_H */ - diff --git a/nx-X11/lib/Xaw/PrintShell.c b/nx-X11/lib/Xaw/PrintShell.c deleted file mode 100644 index 26cb86d1d..000000000 --- a/nx-X11/lib/Xaw/PrintShell.c +++ /dev/null @@ -1,750 +0,0 @@ -/* $Xorg: PrintShell.c,v 1.1 2003/07/11 19:46:06 gisburn Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (c) Copyright 2003 Danny Backx - ** (c) Copyright 2003-2004 Roland Mainz - ** - ** 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. - ** - ****************************************************************************** - *****************************************************************************/ - - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include - -#include -#include - -#include "Print.h" -#include "PrintSP.h" - -/* Local prototypes */ -static void class_initialize(void); -static void class_part_initialize(WidgetClass w_class); -static void initialize(Widget request, Widget new_w, ArgList args, Cardinal *num_args); -static void destroy(Widget w); -static Boolean set_values(Widget current, Widget request, Widget new_w, ArgList args, Cardinal *num_args); -static void XawPrintNotify(Widget w, XtPointer client, XEvent *evp, Boolean *cont); -static void XawAttributesNotify(Widget w, XtPointer client, XEvent *evp, Boolean *cont); -static void XawUpdateLayout(Widget w); -static void XawUpdateResources(Widget w, XPContext pcontext); - -#define Offset(field) XtOffsetOf(XawPrintShellRec, print.field) - -#ifdef XAWDEBUG -#define DEBUGOUT(x) XawDebug x ; - -static void -XawDebug(const char *fn, Widget w, const char *fmt, ...) -{ - va_list ap; - - if (w) { - fprintf(stderr, "%s %s: ", - w->core.widget_class->core_class.class_name, XtName(w)); - } else { - fprintf(stderr, "(null widget): "); - } - - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); -} -#else -#define DEBUGOUT(x) -#endif /* XAWDEBUG */ - -/* Resources for the PrintShell class */ -static XtResource resources[] = -{ - { - XawNstartJobCallback, XtCCallback, XtRCallback, - sizeof(XtCallbackList), Offset(start_job_callback), - XtRImmediate, (XtPointer)NULL - }, - { - XawNendJobCallback, XtCCallback, XtRCallback, - sizeof(XtCallbackList), Offset(end_job_callback), - XtRImmediate, (XtPointer)NULL - }, - { - XawNdocSetupCallback, XtCCallback, XtRCallback, - sizeof(XtCallbackList), Offset(doc_setup_callback), - XtRImmediate, (XtPointer)NULL - }, - { - XawNpageSetupCallback, XtCCallback, XtRCallback, - sizeof(XtCallbackList), Offset(page_setup_callback), - XtRImmediate, (XtPointer)NULL - }, - { - XawNlayoutMode, XawCLayoutMode, XtREnum, - sizeof(XtEnum), Offset(layoutmode), - XtRImmediate, (XtPointer)XawPrintLAYOUTMODE_PAGESIZE - }, - { - XawNminX, XawCMinX, XtRDimension, - sizeof(Dimension), Offset(min_x), - XtRImmediate, (XtPointer)NULL /* dynamic */ - }, - { - XawNminY, XawCMinY, XtRDimension, - sizeof(Dimension), Offset(min_y), - XtRImmediate, (XtPointer)NULL /* dynamic */ - }, - { - XawNmaxX, XawCMaxX, XtRDimension, - sizeof(Dimension), Offset(max_x), - XtRImmediate, (XtPointer)NULL /* dynamic */ - }, - { - XawNmaxY, XawCMaxY, XtRDimension, - sizeof(Dimension), Offset(max_y), - XtRImmediate, (XtPointer)NULL /* dynamic */ - }, - { - XawNcurrDocNumInJob, XawCCurrDocNumInJob, XtRInt, - sizeof(unsigned int), Offset(curr_doc_num_in_job), - XtRImmediate, (XtPointer)NULL /* dynamic */ - }, - { - XawNcurrPageNumInDoc, XawCCurrPageNumInDoc, XtRInt, - sizeof(unsigned int), Offset(curr_page_num_in_doc), - XtRImmediate, (XtPointer)NULL /* dynamic */ - }, - { - XawNcurrPageNumInJob, XawCCurrPageNumInJob, XtRInt, - sizeof(unsigned int), Offset(curr_page_num_in_job), - XtRImmediate, (XtPointer)NULL /* dynamic */ - }, - { - XawNdefaultPixmapResolution, XawCDefaultPixmapResolution, XtRShort, - sizeof(unsigned short), Offset(default_pixmap_resolution), - XtRImmediate, (XtPointer)0 - }, -}; - -static XtActionsRec actions[] = -{ - { NULL, NULL } -}; - -XawPrintShellClassRec xawPrintShellClassRec = { - /* Core class part */ - { - /* superclass */ (WidgetClass) &applicationShellClassRec, - /* class_name */ "XawPrintShell", - /* widget_size */ sizeof(XawPrintShellRec), - /* class_initialize */ class_initialize, - /* class_part_initialize */ class_part_initialize, - /* 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 */ False, - /* compress_exposure */ XtExposeCompressSeries, - /* compress_enterleave */ False, - /* visible_interest */ False, - /* destroy */ destroy, - /* resize */ XtInheritResize, - /* expose */ XtInheritExpose, - /* set_values */ set_values, - /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, - /* accept_focus */ NULL, - /* version */ XtVersion, - /* callback offsets */ NULL, - /* tm_table */ XtInheritTranslations, - /* query_geometry */ XtInheritQueryGeometry, - /* display_accelerator */ NULL, - /* extension */ NULL /* (XtPointer)&_XawPrintShellCoreClassExtRec */ - }, - /* Composite class part */ - { - /* geometry manager */ XtInheritGeometryManager, - /* change_managed */ XtInheritChangeManaged, - /* insert_child */ XtInheritInsertChild, - /* delete_child */ XtInheritDeleteChild, - /* extension */ NULL, - }, - /* Shell class part */ - { - /* extension */ NULL, - }, - /* WM Shell class part */ - { - /* extension */ NULL, - }, - /* VendorShell class part */ - { - /* extension */ NULL, - }, - /* TopLevelShell class part */ - { - /* extension */ NULL, - }, - /* ApplicationShell class part */ - { - /* extension */ NULL, - }, - { - /* ?? */ NULL, - }, -}; - -WidgetClass xawPrintShellWidgetClass = (WidgetClass)&xawPrintShellClassRec; - - -static void -class_initialize(void) -{ -} - - -static void -class_part_initialize(WidgetClass widget_class) -{ -} - -/* - * This is a static table to keep the link between widgets and XPContexts. - * Yeah - this is probably not a very bright idea. Maybe it should also - * contain the Display. - */ -typedef struct { - Widget w; - XPContext c; -} WidgetContext; -static WidgetContext *w_ctxt = NULL; -static int wc_nfields = 0; - -static void -XawStoreWidgetContext(Widget w, XPContext c) -{ - wc_nfields++; - w_ctxt = (WidgetContext *)XtRealloc((XtPointer)w_ctxt, sizeof(WidgetContext) * wc_nfields); - w_ctxt[wc_nfields-1].w = w; - w_ctxt[wc_nfields-1].c = c; -} - -/* FIXME: This is not threadsafe... */ -static Widget -XawPrintContextToWidget(XPContext c) -{ - int i; - - for( i = 0 ; i < wc_nfields ; i++ ) { - if( w_ctxt[i].c == c ) { - return w_ctxt[i].w; - } - } - return NULL; -} - -/* FIXME: This is not threadsafe... */ -static XPContext -XawPrintWidgetToContext(Widget w) -{ - int i; - - for( i = 0 ; i < wc_nfields ; i++ ) { - if (w_ctxt[i].w == w) { - return w_ctxt[i].c; - } - } - return (XPContext)None; -} - -/* FIXME: This is not threadsafe... */ -static void -XawPrintDeleteWidgetContext(Widget w) -{ - int i; - - for( i = 0 ; i < wc_nfields ; i++ ) { - if( w_ctxt[i].w == w ) { - w_ctxt[i].w = NULL; - w_ctxt[i].c = None; - } - } -} - -static void -SelectNotify(Widget w, int *e, XtPointer *s, int n, XtPointer client) -{ - XPContext c = XpGetContext(XtDisplay(w)); - - if (!c) { - XtAppWarning(XtWidgetToApplicationContext(w), - "XawPrintShell: SelectNotify: no print context\n"); - return; - } - - XpSelectInput(XtDisplay(w), c, XPPrintMask|XPAttributeMask); -} - - -static Boolean -DispatchEvent(XEvent *evp) -{ - XPPrintEvent *e = (XPPrintEvent*)evp; - - Widget w = XawPrintContextToWidget(e->context); - - /* Make sure this event is really for this window... */ - if (XFilterEvent(evp, XtWindow(w))) - { - DEBUGOUT((__FILE__, w, "XawPrintShell-DispatchEvent *** filter XFilterEvent() matched.\n")); - return True; - } - - /* Only for debugging */ -#ifdef XAWDEBUG - { - int error_base, - event_base; - - if (!XpQueryExtension(XtDisplay(w), &event_base, &error_base)) { - return False; - } - - if (e->type == event_base + XPPrintNotify) { - switch (e->detail) { - case XPStartJobNotify: - DEBUGOUT((__FILE__, w, "XawPrintShell-DispatchEvent XPStartJobNotify\n")); - break; - case XPEndJobNotify: - DEBUGOUT((__FILE__, w, "XawPrintShell-DispatchEvent XPEndJobNotify\n")); - break; - case XPStartDocNotify: - DEBUGOUT((__FILE__, w, "XawPrintShell-DispatchEvent XPStartDocNotify\n")); - break; - case XPStartPageNotify: - DEBUGOUT((__FILE__, w, "XawPrintShell-DispatchEvent XPStartPageNotify\n")); - break; - case XPEndPageNotify: - DEBUGOUT((__FILE__, w, "XawPrintShell-DispatchEvent XPEndPageNotify\n")); - break; - case XPEndDocNotify: - DEBUGOUT((__FILE__, w, "XawPrintShell-DispatchEvent XPEndDocNotify\n")); - break; - default: - DEBUGOUT((__FILE__, w, "XawPrintShell DispatchEvent\n")); - } - } - } -#endif /* XAWDEBUG */ - - return XtDispatchEventToWidget(w, evp); -} - - -static void -initialize(Widget request, Widget new_w, ArgList args, Cardinal *num_args) -{ - int error_base, - event_base; - XPContext pcontext; - - DEBUGOUT((__FILE__, new_w, "XawPrintShell Initialize\n")); - - if (!XpQueryExtension(XtDisplay(new_w), &event_base, &error_base)) { - DEBUGOUT((__FILE__, new_w, "XawPrintShell initialize: failed!!\n")); - XtAppWarning(XtWidgetToApplicationContext(new_w), - "XawPrintShell: initialize: XpQueryExtension() failed. BAD.\n"); - return; - } - - DEBUGOUT((__FILE__, new_w, "XawPrintShell Initialize event_base %d error_base %d\n", - event_base, error_base)); - - pcontext = XpGetContext(XtDisplay(new_w)); - - if( pcontext == None ) { - XtAppWarning(XtWidgetToApplicationContext(new_w), - "XawPrintShell: initialize: No print content. BAD.\n"); - return; - } - - /* Make sure that the Xt machinery is really using the right screen (assertion) */ - if( XpGetScreenOfContext(XtDisplay(new_w), pcontext) != XtScreen(new_w) ) { - XtAppWarning(XtWidgetToApplicationContext(new_w), - "XawPrintShell: initialize: Widget's screen != print screen. BAD.\n"); - return; - } - - XawStoreWidgetContext(new_w, pcontext); - - XtInsertEventTypeHandler(new_w, - event_base + XPPrintNotify, - (XtPointer)XPPrintMask, - XawPrintNotify, NULL, - XtListTail); - XtInsertEventTypeHandler(new_w, - event_base + XPAttributeNotify, - (XtPointer)XPAttributeMask, - XawAttributesNotify, NULL, - XtListTail); - - XtRegisterExtensionSelector(XtDisplay(new_w), - event_base + XPPrintNotify, - event_base + XPAttributeNotify, - SelectNotify, - NULL); - - XtSetEventDispatcher(XtDisplay(new_w), - event_base + XPPrintNotify, - DispatchEvent); - XtSetEventDispatcher(XtDisplay(new_w), - event_base + XPAttributeNotify, - DispatchEvent); - - PS_LastPageInDoc(new_w) = False; - PS_LastPageInJob(new_w) = False; - - XawUpdateResources(new_w, pcontext); - XawUpdateLayout(new_w); - - DEBUGOUT((__FILE__, new_w, "XawPrintShell Initialize x %d y %d wid %d ht %d\n", - new_w->core.x, - new_w->core.y, - new_w->core.width, - new_w->core.height)); -} - - -static void -destroy(Widget w) -{ - DEBUGOUT((__FILE__, w, "XawPrintShell Destroy\n")); - XawPrintDeleteWidgetContext(w); -} - -static Boolean -set_values(Widget current, Widget request, Widget new_w, - ArgList args, Cardinal *num_args) -{ - DEBUGOUT((__FILE__, new_w, "XawPrintShell SetValues\n")); - return True; -} - -void XawPrintRedisplayWidget(Widget w) -{ - XExposeEvent xev; - Region region; - - xev.type = Expose; - xev.serial = XLastKnownRequestProcessed(XtDisplay(w)); - xev.send_event = False; - xev.display = XtDisplay(w); - xev.window = XtWindowOfObject(w); - xev.x = 0; - xev.y = 0; - xev.width = w->core.width; - xev.height = w->core.height; - xev.count = 0; - - region = XCreateRegion(); - if (!region) - return; - - XtAddExposureToRegion((XEvent*)&xev, region); - - if (w->core.widget_class->core_class.expose) - (*(w->core.widget_class->core_class.expose))(w, (XEvent *)&xev, region); - - XDestroyRegion(region); -} - -/* Returns whether the widget passed in is a print shell or "print shell"-like - * widget (e.g. print preview). - * Note that this will return |True| for more classes than |XawPrintShell| in - * the future (like for |XmPrintShell| etc.) - */ -Boolean -XawIsPrintShell(Widget w) -{ - return XtIsSubclass(w, xawPrintShellWidgetClass); -} - - -static void -XawPrintNotify(Widget w, XtPointer client, XEvent *evp, Boolean *cont) -{ - XPPrintEvent *e = (XPPrintEvent *)evp; - XawPrintShellCallbackStruct cbs; - - switch (e->detail) { - case XPStartPageNotify: - DEBUGOUT((__FILE__, w, "XPStartPageNotify\n")); - - /* Re do not have to call |XawPrintRedisplayWidget(w)| here since - * Xprint triggers an expose event anyway - */ - - DEBUGOUT((__FILE__, w, "XpEndPage\n")); - XpEndPage(XtDisplay(w)); - break; - - case XPEndPageNotify: - DEBUGOUT((__FILE__, w, "XPEndPageNotify\n")); - - if (PS_LastPageInDoc(w) || PS_LastPageInJob(w)) { - DEBUGOUT((__FILE__, w, "XpEndDoc\n")); - XpEndDoc(XtDisplay(w)); - } - else { - /* Increment page numbers... */ - PS_CurrPageNumInDoc(w) += 1; - PS_CurrPageNumInJob(w) += 1; - - /* ... do the page setup callback ... */ - cbs.reason = XawCR_PAGE_SETUP; - cbs.event = evp; - cbs.detail = NULL; - cbs.context = XawPrintWidgetToContext(w); - cbs.last_page_in_doc = False; - cbs.last_page_in_job = False; - - if (PS_PageSetupCallback(w)) - XtCallCallbackList(w, PS_PageSetupCallback(w), &cbs); - - PS_LastPageInDoc(w) = cbs.last_page_in_doc; - PS_LastPageInJob(w) = cbs.last_page_in_job; - - /* ... and start the new page */ - DEBUGOUT((__FILE__, w, "XpStartPage\n")); - XpStartPage(XtDisplay(w), XtWindow(w)); - } - break; - - case XPStartDocNotify: - DEBUGOUT((__FILE__, w, "XPStartDocNotify\n")); - - cbs.reason = XawCR_PAGE_SETUP; - cbs.event = evp; - cbs.detail = NULL; - cbs.context = XawPrintWidgetToContext(w); - cbs.last_page_in_doc = False; - cbs.last_page_in_job = False; - - if (PS_PageSetupCallback(w)) - XtCallCallbackList(w, PS_PageSetupCallback(w), &cbs); - - PS_LastPageInDoc(w) = cbs.last_page_in_doc; - PS_LastPageInJob(w) = cbs.last_page_in_job; - - DEBUGOUT((__FILE__, w, "XpStartPage\n")); - XpStartPage(XtDisplay(w), XtWindow(w)); - break; - - case XPEndDocNotify: - DEBUGOUT((__FILE__, w, "XPEndDocNotify\n")); - - /* Start a new document (via XpStartDoc()) if we are not done with the job yet, - * otherwise finish the job (via XpEndJob()) - */ - if (PS_LastPageInJob(w)) { - DEBUGOUT((__FILE__, w, "XpEndJob\n")); - XpEndJob(XtDisplay(w)); - } - else { - PS_CurrDocNumInJob(w) += 1; - PS_CurrPageNumInDoc(w) = 1; - - cbs.reason = XawCR_DOC_SETUP; - cbs.event = evp; - cbs.detail = NULL; - cbs.context = XawPrintWidgetToContext(w); - cbs.last_page_in_doc = False; - cbs.last_page_in_job = False; - - if (PS_DocSetupCallback(w)) - XtCallCallbackList(w, PS_DocSetupCallback(w), &cbs); - - PS_LastPageInDoc(w) = cbs.last_page_in_doc; - PS_LastPageInJob(w) = cbs.last_page_in_job; - - DEBUGOUT((__FILE__, w, "XpStartDoc\n")); - XpStartDoc(XtDisplay(w), XPDocNormal); - } - break; - - case XPStartJobNotify: - DEBUGOUT((__FILE__, w, "XPStartJobNotify\n")); - PS_LastPageInJob(w) = False; - PS_LastPageInDoc(w) = False; - PS_CurrDocNumInJob(w) = 1; - PS_CurrPageNumInDoc(w) = 1; - PS_CurrPageNumInJob(w) = 1; - - cbs.reason = XawCR_START_JOB; - cbs.event = evp; - cbs.detail = NULL; - cbs.context = XawPrintWidgetToContext(w); - cbs.last_page_in_doc = False; - cbs.last_page_in_job = False; - - if (PS_StartJobCallback(w)) - XtCallCallbackList(w, PS_StartJobCallback(w), &cbs); - - PS_LastPageInDoc(w) = cbs.last_page_in_doc; - PS_LastPageInJob(w) = cbs.last_page_in_job; - - /* Start a document (which will trigger the first page in - * |XPStartDocNotify| above) */ - if (PS_LastPageInDoc(w) || PS_LastPageInJob(w)) { - DEBUGOUT((__FILE__, w, "XpEndJob\n")); - XpEndJob(XtDisplay(w)); - } - else - { - cbs.reason = XawCR_DOC_SETUP; - cbs.event = evp; - cbs.detail = NULL; - cbs.context = XawPrintWidgetToContext(w); - cbs.last_page_in_doc = False; - cbs.last_page_in_job = False; - - if (PS_DocSetupCallback(w)) - XtCallCallbackList(w, PS_DocSetupCallback(w), &cbs); - - PS_LastPageInDoc(w) = cbs.last_page_in_doc; - PS_LastPageInJob(w) = cbs.last_page_in_job; - - DEBUGOUT((__FILE__, w, "XpStartDoc\n")); - XpStartDoc(XtDisplay(w), XPDocNormal); - } - break; - - case XPEndJobNotify: - DEBUGOUT((__FILE__, w, "XPEndJobNotify\n")); - cbs.reason = XawCR_END_JOB; - cbs.event = evp; - cbs.detail = NULL; - cbs.context = None; - cbs.last_page_in_doc = True; - cbs.last_page_in_job = True; - - if (PS_EndJobCallback(w)) - XtCallCallbackList(w, PS_EndJobCallback(w), &cbs); - break; - - default: - DEBUGOUT((__FILE__, w, "XawPrintNotify(default)\n")); - break; - } -} - -static void -XawUpdateResources(Widget w, XPContext pcontext) -{ - XawPrintShellWidget print_shell = (XawPrintShellWidget)w; - String string_resolution; - XRectangle drawable_paper_area; - - string_resolution = XpGetOneAttribute(XtDisplay(w), pcontext, XPDocAttr, "default-printer-resolution"); - if (!string_resolution) { - XtAppWarning(XtWidgetToApplicationContext(w), - "XawPrintShell: XawUpdateResources: Could not get 'default-printer-resolution' XPDocAttr\n"); - } - print_shell->print.print_resolution = atol(string_resolution); - XFree(string_resolution); - - if (print_shell->print.print_resolution == 0) { - XtAppWarning(XtWidgetToApplicationContext(w), - "XawPrintShell: XawUpdateResources: Resolution '0' invalid\n"); - } - - /* Get the paper size... */ - XpGetPageDimensions(XtDisplay(w), pcontext, - &print_shell->print.page_width, &print_shell->print.page_height, - &drawable_paper_area); - /* ... and store it in the widget */ - print_shell->print.min_x = drawable_paper_area.x; - print_shell->print.min_y = drawable_paper_area.y; - print_shell->print.max_x = drawable_paper_area.x + drawable_paper_area.width; - print_shell->print.max_y = drawable_paper_area.y + drawable_paper_area.height; -} - -static void -XawUpdateLayout(Widget w) -{ - XawPrintShellWidget print_shell = (XawPrintShellWidget)w; - - switch( print_shell->print.layoutmode ) - { - case XawPrintLAYOUTMODE_NONE: - break; - case XawPrintLAYOUTMODE_PAGESIZE: - XtResizeWidget(w, - print_shell->print.page_width, - print_shell->print.page_height, - w->core.border_width); - break; - case XawPrintLAYOUTMODE_DRAWABLEAREA: - XtConfigureWidget(w, - print_shell->print.min_x, - print_shell->print.min_y, - print_shell->print.max_x - print_shell->print.min_x, - print_shell->print.max_y - print_shell->print.min_y, - w->core.border_width); - break; - default: - XtAppWarning(XtWidgetToApplicationContext(w), - "XawPrintShell: XawUpdateResources: Invalid layout mode\n"); - break; - } -} - - -/* Update widget attributes+properties when the we receive - * "Xp attribute change"-events (e.g. paper (size/orientation/etc.) - * changed etc.) */ -static void -XawAttributesNotify(Widget w, - XtPointer client, - XEvent *evp, - Boolean *cont) -{ - XawPrintShellWidget print_shell = (XawPrintShellWidget)w; - XPAttributeEvent *xpevp = (XPAttributeEvent *)evp; - - XawUpdateResources(w, xpevp->context); - XawUpdateLayout(w); -} - - - diff --git a/nx-X11/lib/Xaw/Private.h b/nx-X11/lib/Xaw/Private.h deleted file mode 100644 index a76207a4d..000000000 --- a/nx-X11/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.9 1999/05/16 10:12:48 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/nx-X11/lib/Xaw/Repeater.c b/nx-X11/lib/Xaw/Repeater.c deleted file mode 100644 index 52ae2959e..000000000 --- a/nx-X11/lib/Xaw/Repeater.c +++ /dev/null @@ -1,300 +0,0 @@ -/* - * $Xorg: Repeater.c,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $ - * -Copyright 1990, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:29 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include - -#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[] = -":" "highlight()\n" -":" "unhighlight()\n" -":" "set() start()\n" -":" "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/nx-X11/lib/Xaw/Repeater.h b/nx-X11/lib/Xaw/Repeater.h deleted file mode 100644 index cfb2c5313..000000000 --- a/nx-X11/lib/Xaw/Repeater.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * $Xorg: Repeater.h,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $ - * -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.5 2001/01/17 19:42:29 dawes Exp $ */ - -#ifndef _XawRepeater_h -#define _XawRepeater_h - -#include - -/***************************************************************************** - * - * 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/nx-X11/lib/Xaw/RepeaterP.h b/nx-X11/lib/Xaw/RepeaterP.h deleted file mode 100644 index 3ce0a498c..000000000 --- a/nx-X11/lib/Xaw/RepeaterP.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * $Xorg: RepeaterP.h,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $ - * -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.7 2001/01/17 19:42:29 dawes Exp $ */ - -#ifndef _XawRepeaterP_h -#define _XawRepeaterP_h - -#include -#include - -/* 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/nx-X11/lib/Xaw/Reports.h b/nx-X11/lib/Xaw/Reports.h deleted file mode 100644 index 33f18d187..000000000 --- a/nx-X11/lib/Xaw/Reports.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * $Xorg: Reports.h,v 1.5 2001/02/09 02:03:45 xorgcvs Exp $ - * -Copyright 1990, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 - -#include - -/* - * 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/nx-X11/lib/Xaw/Scrollbar.c b/nx-X11/lib/Xaw/Scrollbar.c deleted file mode 100644 index e6dea9c41..000000000 --- a/nx-X11/lib/Xaw/Scrollbar.c +++ /dev/null @@ -1,885 +0,0 @@ -/* $Xorg: Scrollbar.c,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.12 2001/01/17 19:42:29 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#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[] = -":" "StartScroll(Forward)\n" -":" "StartScroll(Continuous) MoveThumb() NotifyThumb()\n" -":" "StartScroll(Backward)\n" -":" "MoveThumb() NotifyThumb()\n" -":" "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; - long 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; - union { - XtPointer xtp; - float xtf; - } xtpf; - - 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. */ - xtpf.xtf = w->scrollbar.top; - XtCallCallbacks(gw, XtNthumbProc, xtpf.xtp); - 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/nx-X11/lib/Xaw/Scrollbar.h b/nx-X11/lib/Xaw/Scrollbar.h deleted file mode 100644 index c776d41e2..000000000 --- a/nx-X11/lib/Xaw/Scrollbar.h +++ /dev/null @@ -1,137 +0,0 @@ -/* $Xorg: Scrollbar.h,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $ */ - - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.6 2001/01/17 19:42:29 dawes Exp $ */ - -#ifndef _Scrollbar_h -#define _Scrollbar_h - -/* - * Scrollbar Widget - */ - -#include -#include - -/* 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/nx-X11/lib/Xaw/ScrollbarP.h b/nx-X11/lib/Xaw/ScrollbarP.h deleted file mode 100644 index ec3af46f8..000000000 --- a/nx-X11/lib/Xaw/ScrollbarP.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * $Xorg: ScrollbarP.h,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $ - */ - - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.7 2001/01/17 19:42:29 dawes Exp $ */ - -#ifndef _ScrollbarP_h -#define _ScrollbarP_h - -#include -#include - -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/nx-X11/lib/Xaw/Simple.c b/nx-X11/lib/Xaw/Simple.c deleted file mode 100644 index 95b7a1aa1..000000000 --- a/nx-X11/lib/Xaw/Simple.c +++ /dev/null @@ -1,504 +0,0 @@ -/* $Xorg: Simple.c,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.16 2001/09/29 04:36:02 paulo Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include "Private.h" -#ifndef OLDXAW -#include -#endif - -/* - * Class Methods - */ -static Bool ChangeSensitive(Widget); -static void XawSimpleClassInitialize(void); -static void XawSimpleClassPartInitialize(WidgetClass); -#ifndef OLDXAW -static void XawSimpleInitialize(Widget, Widget, ArgList, Cardinal*); -static void XawSimpleDestroy(Widget); -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 */ -#ifndef OLDXAW - XawSimpleInitialize, /* initialize */ -#else - NULL, /* initialize */ -#endif - 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 */ -#ifndef OLDXAW - XawSimpleDestroy, /* destroy */ -#else - NULL, /* destroy */ -#endif - 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; -} - -#ifndef OLDXAW -/*ARGSUSED*/ -static void -XawSimpleInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) -{ - SimpleWidget simple = (SimpleWidget)cnew; - - if (simple->simple.tip) - simple->simple.tip = XtNewString(simple->simple.tip); -} - -static void -XawSimpleDestroy(Widget w) -{ - SimpleWidget simple = (SimpleWidget)w; - - if (simple->simple.tip) - XtFree((XtPointer)simple->simple.tip); -} -#endif - -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) { - if (s_old->simple.tip) - XtFree((XtPointer)s_old->simple.tip); - if (s_new->simple.tip) - s_new->simple.tip = XtNewString(s_new->simple.tip); - } - - 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/nx-X11/lib/Xaw/Simple.h b/nx-X11/lib/Xaw/Simple.h deleted file mode 100644 index 7ba9354b9..000000000 --- a/nx-X11/lib/Xaw/Simple.h +++ /dev/null @@ -1,116 +0,0 @@ -/* $Xorg: Simple.h,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.8 2001/01/17 19:42:30 dawes Exp $ */ - -#ifndef _Simple_h -#define _Simple_h - -#include - -/* 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/nx-X11/lib/Xaw/SimpleMenP.h b/nx-X11/lib/Xaw/SimpleMenP.h deleted file mode 100644 index 46102059e..000000000 --- a/nx-X11/lib/Xaw/SimpleMenP.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * $Xorg: SimpleMenP.h,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $ - * -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.12 2001/01/17 19:42:30 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 -#include -#include -#include - -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/nx-X11/lib/Xaw/SimpleMenu.c b/nx-X11/lib/Xaw/SimpleMenu.c deleted file mode 100644 index b7ed28651..000000000 --- a/nx-X11/lib/Xaw/SimpleMenu.c +++ /dev/null @@ -1,1834 +0,0 @@ -/* $Xorg: SimpleMenu.c,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $ */ - -/* -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.21 2001/03/23 23:59:15 paulo 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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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[] = -":" "highlight()\n" -":" "unhighlight()\n" -":" "highlight()\n" -#ifndef OLDXAW -":" "popdown() notify() unhighlight()\n" -#else -":" "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; - - while (XtParent(w) && - XtIsSubclass(XtParent(w), simpleMenuWidgetClass)) { - if (((SimpleMenuWidget)XtParent(w))->simple_menu.sub_menu == (Widget)w) { - w = XtParent(w); - smw = (SimpleMenuWidget)w; - smw->simple_menu.entry_set = NULL; - } - else - break; - } - - 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/nx-X11/lib/Xaw/SimpleMenu.h b/nx-X11/lib/Xaw/SimpleMenu.h deleted file mode 100644 index 0ee689683..000000000 --- a/nx-X11/lib/Xaw/SimpleMenu.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - * $Xorg: SimpleMenu.h,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $ - * -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.7 2001/01/17 19:42:30 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 -#include - -/* - * 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/nx-X11/lib/Xaw/SimpleP.h b/nx-X11/lib/Xaw/SimpleP.h deleted file mode 100644 index f2fa3fa22..000000000 --- a/nx-X11/lib/Xaw/SimpleP.h +++ /dev/null @@ -1,102 +0,0 @@ -/*********************************************************** - - $Xorg: SimpleP.h,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $ - - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.12 2001/12/14 19:54:43 dawes Exp $ */ - -#ifndef _SimpleP_h -#define _SimpleP_h - -#include - -#include - -_XFUNCPROTOBEGIN - -#include - -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; - -_XFUNCPROTOEND - -#endif /* _SimpleP_h */ diff --git a/nx-X11/lib/Xaw/Sme.c b/nx-X11/lib/Xaw/Sme.c deleted file mode 100644 index a4af577d8..000000000 --- a/nx-X11/lib/Xaw/Sme.c +++ /dev/null @@ -1,272 +0,0 @@ -/* $Xorg: Sme.c,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $ */ - -/* -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:31 dawes Exp $ */ - -/* - * Date: September 26, 1989 - * - * By: Chris D. Peterson - * MIT X Consortium - * kit@expo.lcs.mit.edu - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xaw/Sme.h b/nx-X11/lib/Xaw/Sme.h deleted file mode 100644 index fb87b0073..000000000 --- a/nx-X11/lib/Xaw/Sme.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * $Xorg: Sme.h,v 1.5 2001/02/09 02:03:45 xorgcvs Exp $ - * -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.5 2001/01/17 19:42:31 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 -#include - -/* 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/nx-X11/lib/Xaw/SmeBSB.c b/nx-X11/lib/Xaw/SmeBSB.c deleted file mode 100644 index 0d77278ab..000000000 --- a/nx-X11/lib/Xaw/SmeBSB.c +++ /dev/null @@ -1,774 +0,0 @@ -/* $Xorg: SmeBSB.c,v 1.5 2001/02/09 02:03:45 xorgcvs Exp $ */ - -/* -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.11 2001/01/17 19:42:31 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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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.font) XtError("Aborting: no font found\n"); - - 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/nx-X11/lib/Xaw/SmeBSB.h b/nx-X11/lib/Xaw/SmeBSB.h deleted file mode 100644 index 094b558c3..000000000 --- a/nx-X11/lib/Xaw/SmeBSB.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * $Xorg: SmeBSB.h,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $ - * -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:31 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 -#include - -/* 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/nx-X11/lib/Xaw/SmeBSBP.h b/nx-X11/lib/Xaw/SmeBSBP.h deleted file mode 100644 index 6b263e7a8..000000000 --- a/nx-X11/lib/Xaw/SmeBSBP.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * $Xorg: SmeBSBP.h,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $ - * -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.8 2001/01/17 19:42:31 dawes Exp $ */ - -#ifndef _XawSmeBSBP_h -#define _XawSmeBSBP_h - -/* - * Sme Object Private Data - */ -#include -#include - -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/nx-X11/lib/Xaw/SmeLine.c b/nx-X11/lib/Xaw/SmeLine.c deleted file mode 100644 index 88a6e9ce5..000000000 --- a/nx-X11/lib/Xaw/SmeLine.c +++ /dev/null @@ -1,267 +0,0 @@ -/* $Xorg: SmeLine.c,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $ */ - -/* -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.7 2001/01/17 19:42:31 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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xaw/SmeLine.h b/nx-X11/lib/Xaw/SmeLine.h deleted file mode 100644 index 7c9d4e41a..000000000 --- a/nx-X11/lib/Xaw/SmeLine.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * $Xorg: SmeLine.h,v 1.4 2001/02/09 02:03:45 xorgcvs Exp $ - * -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.5 2001/01/17 19:42:31 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 -#include - -/* 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/nx-X11/lib/Xaw/SmeLineP.h b/nx-X11/lib/Xaw/SmeLineP.h deleted file mode 100644 index 7102d03f9..000000000 --- a/nx-X11/lib/Xaw/SmeLineP.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * $Xorg: SmeLineP.h,v 1.4 2001/02/09 02:03:46 xorgcvs Exp $ - * -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.7 2001/01/17 19:42:31 dawes Exp $ */ - -#ifndef _XawSmeLineP_h -#define _XawSmeLineP_h - -/* - * SmeLine Widget Private Data - */ -#include -#include - -/* 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/nx-X11/lib/Xaw/SmeP.h b/nx-X11/lib/Xaw/SmeP.h deleted file mode 100644 index 94342fffd..000000000 --- a/nx-X11/lib/Xaw/SmeP.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * $Xorg: SmeP.h,v 1.4 2001/02/09 02:03:46 xorgcvs Exp $ - * -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.8 2001/12/14 19:54:43 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 - -#include - -_XFUNCPROTOBEGIN - -/* 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 - -_XFUNCPROTOEND - -#endif /* _XawSmeP_h */ diff --git a/nx-X11/lib/Xaw/StripCharP.h b/nx-X11/lib/Xaw/StripCharP.h deleted file mode 100644 index 50ed74c98..000000000 --- a/nx-X11/lib/Xaw/StripCharP.h +++ /dev/null @@ -1,110 +0,0 @@ -/* -* $Xorg: StripCharP.h,v 1.4 2001/02/09 02:03:46 xorgcvs Exp $ -*/ - - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.7 2001/01/17 19:42:32 dawes Exp $ */ - -#ifndef _XawStripChartP_h -#define _XawStripChartP_h - -#include -#include - -#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/nx-X11/lib/Xaw/StripChart.c b/nx-X11/lib/Xaw/StripChart.c deleted file mode 100644 index ada85f172..000000000 --- a/nx-X11/lib/Xaw/StripChart.c +++ /dev/null @@ -1,579 +0,0 @@ -/* $Xorg: StripChart.c,v 1.4 2001/02/09 02:03:46 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.7 2001/01/17 19:42:32 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xaw/StripChart.h b/nx-X11/lib/Xaw/StripChart.h deleted file mode 100644 index b6c6f212a..000000000 --- a/nx-X11/lib/Xaw/StripChart.h +++ /dev/null @@ -1,119 +0,0 @@ -/* $Xorg: StripChart.h,v 1.5 2001/02/09 02:03:46 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.5 2001/01/17 19:42:32 dawes Exp $ */ - -#ifndef _XawStripChart_h -#define _XawStripChart_h - -#include - -/*********************************************************************** - * - * StripChart Widget - * - ***********************************************************************/ - -/* StripChart 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/nx-X11/lib/Xaw/Template.c b/nx-X11/lib/Xaw/Template.c deleted file mode 100644 index 9c3763b52..000000000 --- a/nx-X11/lib/Xaw/Template.c +++ /dev/null @@ -1,198 +0,0 @@ -/* $Xorg: Template.c,v 1.4 2001/02/09 02:03:46 xorgcvs Exp $ */ - -/* - -Copyright 1987, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.8 2001/08/01 00:44:39 tsi Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include - -/* - * 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[] = -":" "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/nx-X11/lib/Xaw/Template.h b/nx-X11/lib/Xaw/Template.h deleted file mode 100644 index 5ec0974cf..000000000 --- a/nx-X11/lib/Xaw/Template.h +++ /dev/null @@ -1,70 +0,0 @@ -/* $Xorg: Template.h,v 1.5 2001/02/09 02:03:46 xorgcvs Exp $ */ - -/* - -Copyright 1987, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.5 2001/01/17 19:42:32 dawes Exp $ */ - -#ifndef _Template_h -#define _Template_h - -#include - -/**************************************************************** - * - * Template widget - * - ****************************************************************/ - -/* 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 */ -#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/nx-X11/lib/Xaw/TemplateP.h b/nx-X11/lib/Xaw/TemplateP.h deleted file mode 100644 index f3e3d67d5..000000000 --- a/nx-X11/lib/Xaw/TemplateP.h +++ /dev/null @@ -1,68 +0,0 @@ -/* $Xorg: TemplateP.h,v 1.5 2001/02/09 02:03:46 xorgcvs Exp $ */ - -/* - -Copyright 1987, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:32 dawes Exp $ */ - -#ifndef _TemplateP_h -#define _TemplateP_h - -#include - -/* include superclass private header file */ -#include - -/* define unique representation types not found in */ -#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; -#if defined(__cplusplus) || defined(c_plusplus) - TemplatePart c_template; -#else - TemplatePart template; -#endif -} TemplateRec; - -#endif /* _TemplateP_h */ diff --git a/nx-X11/lib/Xaw/Text.c b/nx-X11/lib/Xaw/Text.c deleted file mode 100644 index 7d7dd2e61..000000000 --- a/nx-X11/lib/Xaw/Text.c +++ /dev/null @@ -1,4164 +0,0 @@ -/* $Xorg: Text.c,v 1.4 2001/02/09 02:03:46 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.53tsi Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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); -#ifndef OLDXAW -static void DisplayText(Widget, XawTextPosition, XawTextPosition); -#endif -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 _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); - } - XtSetKeyboardFocus(vbar, (Widget)ctx); -} - -/* - * 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; - if (!ctx->core.being_destroyed) { - 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); - } - XtSetKeyboardFocus(hbar, (Widget)ctx); -} - -/* - * 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; - if (!ctx->core.being_destroyed) - 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 = XtGetGC(cnew, 0, 0); - 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; - lt->position = position; - } - 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; - } - if (lt->textWidth != width) { - if (lt->textWidth > width) - ctx->text.clear_to_eol = True; - 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; - bzero(lt, sizeof(XawTextLineTableEntry)); - ++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; - long pixels = (long)callData; - - if (pixels > 0) { - long 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; - long 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 (line == ctx->text.lt.lines) - right = -1; - else 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 < 0) || (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; - long height, lines = (long)callData; - - height = XtHeight(ctx) - VMargins(ctx); - if (height < 1) - height = 1; - lines = (lines * 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); - - XtSetArg(args[0], XtNeditType, &edit_mode); - XtGetValues(src, args, ONE); - - XmuConvertStandardSelection(w, ctx->text.time, selection, - target, type, (XPointer*)&std_targets, - &std_length, format); - - *length = 7 + (edit_mode == XawtextEdit) + std_length; - *value = XtMalloc((unsigned)sizeof(Atom)*(*length)); - targetP = *(Atom**)value; - *targetP++ = XA_STRING; - *targetP++ = XA_TEXT(d); - *targetP++ = XA_UTF8_STRING(d); - *targetP++ = XA_COMPOUND_TEXT(d); - *targetP++ = XA_LENGTH(d); - *targetP++ = XA_LIST_LENGTH(d); - *targetP++ = XA_CHARACTER_POSITION(d); - if (edit_mode == XawtextEdit) { - *targetP++ = XA_DELETE(d); - } - (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_UTF8_STRING(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; - } - /* Got *value,*length, now in COMPOUND_TEXT format. */ - 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, &wlist, &count) - < Success - || count < 1) { - XtFree((char *)*value); - return (False); - } - XtFree((char *)*value); - if (XwcTextListToTextProperty(d, wlist, 1, XStringStyle, &textprop) - < Success) { - XwcFreeStringList((wchar_t**) wlist); - return (False); - } - *value = (XtPointer)textprop.value; - *length = textprop.nitems; - XwcFreeStringList(wlist); - } else if (*type == XA_UTF8_STRING(d)) { - XTextProperty textprop; - char **list; - int count; - - textprop.encoding = XA_COMPOUND_TEXT(d); - textprop.value = (unsigned char *)*value; - textprop.nitems = strlen(*value); - textprop.format = 8; - if (Xutf8TextPropertyToTextList(d, &textprop, &list, &count) - < Success - || count < 1) { - XtFree((char *)*value); - return (False); - } - XtFree((char *)*value); - *value = *list; - *length = strlen(*list); - XFree(list); - } - *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) { - XawTextPosition old_insert = ctx->text.old_insert; - - if (right < ctx->text.old_insert) - old_insert -= right - left; - else - old_insert = left; - - ctx->text.insertPos = 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); - } -} - -#ifndef OLDXAW -/*ARGSUSED*/ -static void -DisplayText(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 y, line; - XawTextPosition from, to, lastPos; - 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 (XtIsRealized((Widget)ctx) && 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)) { - ctx->text.s.right = XawMin(ctx->text.s.right, ctx->text.lastPos); - ctx->text.s.left = XawMin(ctx->text.s.left, ctx->text.s.right); - -#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); - XtReleaseGC((Widget)ctx, ctx->text.gc); -} - -/* - * 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 - -#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.lastPos = GETLASTPOS; - top = FindGoodPosition(ctx, top); - startPos = FindGoodPosition(ctx, startPos); - ctx->text.insertPos = ctx->text.old_insert = startPos; - _XawTextPrepareToUpdate(ctx); - - _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/nx-X11/lib/Xaw/Text.h b/nx-X11/lib/Xaw/Text.h deleted file mode 100644 index af80ffcdb..000000000 --- a/nx-X11/lib/Xaw/Text.h +++ /dev/null @@ -1,373 +0,0 @@ -/* $Xorg: Text.h,v 1.4 2001/02/09 02:03:46 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.14 2001/01/17 19:42:34 dawes Exp $ */ - -#ifndef _XawText_h -#define _XawText_h - -#include - -/* - - 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 -#include - -#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 -#include - -#endif /* _XawText_h */ diff --git a/nx-X11/lib/Xaw/TextAction.c b/nx-X11/lib/Xaw/TextAction.c deleted file mode 100644 index 2da0a9ff5..000000000 --- a/nx-X11/lib/Xaw/TextAction.c +++ /dev/null @@ -1,4428 +0,0 @@ -/* $Xorg: TextAction.c,v 1.4 2001/02/09 02:03:46 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.46tsi Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include /* for select() and struct timeval */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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 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*); -static void DestroyFocusCallback(Widget, XtPointer, XtPointer); - -/* - * 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; - int asked; /* which selection currently has been asked for: - 0 = UTF8_STRING, 1 = COMPOUND_TEXT, 2 = STRING */ - Atom selection; /* selection atom (normally XA_PRIMARY) */ -}; - -/*ARGSUSED*/ -static void -_SelectionReceived(Widget w, XtPointer client_data, Atom *selection, - Atom *type, XtPointer value, unsigned long *length, - int *format) -{ - Display *d = XtDisplay(w); - 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->asked == 0) { - /* If we just asked for XA_UTF8_STRING and got no response, - we'll ask again, this time for XA_COMPOUND_TEXT. */ - list->asked++; - XtGetSelectionValue(w, list->selection, XA_COMPOUND_TEXT(d), - _SelectionReceived, - (XtPointer)list, list->time); - } else if (list->asked == 1) { - /* If we just asked for XA_COMPOUND_TEXT and got no response, - we'll ask again, this time for XA_STRING. */ - list->asked++; - XtGetSelectionValue(w, list->selection, XA_STRING, - _SelectionReceived, - (XtPointer)list, list->time); - } else { - /* We tried all possible text targets in this param. - Recurse on the tail of the params list. */ - GetSelection(w, list->time, list->params, list->count); - XtFree(client_data); - } - } - return; - } - - StartAction(ctx, NULL); - if (XawTextFormat(ctx, XawFmtWide)) { - XTextProperty textprop; - wchar_t **wlist; - int count; - - textprop.encoding = *type; - textprop.value = (unsigned char *)value; - textprop.nitems = strlen(value); - textprop.format = 8; - - if (XwcTextPropertyToTextList(d, &textprop, &wlist, &count) - != Success - || count < 1) { - XwcFreeStringList(wlist); - - /* Notify the user on strerr and in the insertion :) */ - fprintf(stderr, "Xaw Text Widget: An attempt was made to insert " - "an illegal selection.\n"); - - textprop.value = (unsigned char *)" >> ILLEGAL SELECTION << "; - textprop.nitems = strlen((char *) textprop.value); - if (XwcTextPropertyToTextList(d, &textprop, &wlist, &count) - != Success - || count < 1) - return; - } - - XFree(value); - value = (XPointer)wlist[0]; - - *length = wcslen(wlist[0]); - XtFree((XtPointer)wlist); - text.format = XawFmtWide; - } else { - XTextProperty textprop; - char **list; - int count; - - textprop.encoding = *type; - textprop.value = (unsigned char *)value; - textprop.nitems = strlen(value); - textprop.format = 8; - - if (XmbTextPropertyToTextList(d, &textprop, &list, &count) - != Success - || count < 1) { - XFreeStringList(list); - - /* Notify the user on strerr and in the insertion :) */ - fprintf(stderr, "Xaw Text Widget: An attempt was made to insert " - "an illegal selection.\n"); - - textprop.value = (unsigned char *)" >> ILLEGAL SELECTION << "; - textprop.nitems = strlen((char *) textprop.value); - if (XmbTextPropertyToTextList(d, &textprop, &list, &count) - != Success - || count < 1) - return; - } - - XFree(value); - value = (XPointer)list[0]; - - *length = strlen(list[0]); - XtFree((XtPointer)list); - 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->asked = 0; - list->selection = selection; - } - else - list = NULL; - XtGetSelectionValue(w, selection, XA_UTF8_STRING(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, <emp, &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); - - XtSetArg(args[0], XtNeditType,&edit_mode); - XtGetValues(src, args, 1); - - XmuConvertStandardSelection(w, ctx->text.time, selection, - target, type, (XPointer *)&std_targets, - &std_length, format); - - *length = 7 + (edit_mode == XawtextEdit) + std_length; - *value = XtMalloc((unsigned)sizeof(Atom)*(*length)); - targetP = *(Atom**)value; - *targetP++ = XA_STRING; - *targetP++ = XA_TEXT(d); - *targetP++ = XA_UTF8_STRING(d); - *targetP++ = XA_COMPOUND_TEXT(d); - *targetP++ = XA_LENGTH(d); - *targetP++ = XA_LIST_LENGTH(d); - *targetP++ = XA_CHARACTER_POSITION(d); - if (edit_mode == XawtextEdit) { - *targetP++ = XA_DELETE(d); - } - 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_UTF8_STRING(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; - } - /* Got *value,*length, now in COMPOUND_TEXT format. */ - 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, &wlist, &count) - < Success - || count < 1) { - XtFree(*value); - return (False); - } - XtFree(*value); - if (XwcTextListToTextProperty(d, wlist, 1, XStringStyle, &textprop) - < Success) { - XwcFreeStringList((wchar_t**)wlist); - return (False); - } - *value = (XtPointer)textprop.value; - *length = textprop.nitems; - XwcFreeStringList((wchar_t**) wlist); - } else if (*type == XA_UTF8_STRING(d)) { - XTextProperty textprop; - char **list; - int count; - - textprop.encoding = XA_COMPOUND_TEXT(d); - textprop.value = (unsigned char *)*value; - textprop.nitems = strlen(*value); - textprop.format = 8; - if (Xutf8TextPropertyToTextList(d, &textprop, &list, &count) - < Success - || count < 1) { - XtFree(*value); - return (False); - } - XtFree(*value); - *value = *list; - *length = strlen(*list); - XFree(list); - } - *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 = █ - } - 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); -#ifndef OLDXAW - XawTextPosition position; -#endif - 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; - } - -#ifndef OLDXAW - position = SrcScan(ctx->text.source, ctx->text.insertPos, - XawstEOL, XawsdLeft, 1, False); -#endif - 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) -{ -#ifndef OLDXAW - int old_y = ctx->text.ev_y; -#endif - - StartAction(ctx, event); - NotePosition(ctx, event); - -#ifndef OLDXAW - 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); - } - } -#endif - 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); -} - -/* This is kind of a hack, but, only one text widget can have focus at - * a time on one display. There is a problem in the implementation of the - * text widget, the scrollbars can not be adressed via editres, since they - * are not children of a subclass of composite. - * The focus variable is required to make sure only one text window will - * show a block cursor at one time. - */ -struct _focus { Display *display; Widget widget; }; -static struct _focus *focus; -static Cardinal num_focus; - -/*ARGSUSED*/ -static void -DestroyFocusCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - struct _focus *f = (struct _focus*)(user_data); - - if (f->widget == w) - f->widget = NULL; -} - -/*ARGSUSED*/ -static void -TextFocusIn(Widget w, XEvent *event, String *p, Cardinal *n) -{ - TextWidget ctx = (TextWidget)w; - Bool display_caret = ctx->text.display_caret; - int i; - - if (event->xfocus.detail == NotifyPointer) - return; - - if (event->xfocus.send_event) { - Window root, child; - int rootx, rooty, x, y; - unsigned int mask; - - if (ctx->text.hasfocus) - return; - - if (XQueryPointer(XtDisplay(w), XtWindow(w), &root, &child, - &rootx, &rooty, &x, &y, &mask)) { - if (child) - 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); - - for (i = 0; i < num_focus; i++) - if (focus[i].display == XtDisplay(w)) - break; - if (i >= num_focus) { - focus = (struct _focus*) - XtRealloc((XtPointer)focus, sizeof(struct _focus) * (num_focus + 1)); - i = num_focus; - focus[i].widget = NULL; - focus[i].display = XtDisplay(w); - num_focus++; - } - if (focus[i].widget != w) { - Widget old = focus[i].widget; - - focus[i].widget = w; - if (old != NULL) { - TextFocusOut(old, event, p, n); - /* TextFocusOut may set it to NULL */ - focus[i].widget = w; - } - XtAddCallback(w, XtNdestroyCallback, - DestroyFocusCallback, (XtPointer)&focus[i]); - } -} - -/*ARGSUSED*/ -static void -TextFocusOut(Widget w, XEvent *event, String *p, Cardinal *n) -{ - TextWidget ctx = (TextWidget)w; - Bool display_caret = ctx->text.display_caret; - Widget shell; - Window window; - int i, revert; - - shell = w; - while (shell) { - if (XtIsShell(shell)) - break; - shell = XtParent(shell); - } - - for (i = 0; i < num_focus; i++) - if (focus[i].display == XtDisplay(w)) - break; - XGetInputFocus(XtDisplay(w), &window, &revert); - if ((XtWindow(shell) == window && - (i < num_focus && focus[i].widget == w)) - || event->xfocus.detail == NotifyPointer) - return; - - if (i < num_focus && focus[i].widget) { - XtRemoveCallback(focus[i].widget, XtNdestroyCallback, - DestroyFocusCallback, (XtPointer)&focus[i]); - focus[i].widget = NULL; - } - - /* 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; - XtAppContext app_context = XtWidgetToApplicationContext(w); - - 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(app_context) & XtIMXEvent) { - XEvent ev; - if (! XtAppPeekEvent(app_context, &ev)) - break; - if (ev.type == KeyPress || ev.type == ButtonPress) - break; - XtAppProcessEvent(app_context, XtIMXEvent); - } - FD_ZERO(&fds); - FD_SET(ConnectionNumber(XtDisplay(w)), &fds); - (void)select(FD_SETSIZE, &fds, NULL, NULL, &tmval); - if (tmval.tv_usec != 500000) - usleep(40000); - - 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') * (mult < 0 ? -1 : 1); - ctx->text.mult = ctx->text.mult * 10 + (params[0][0] - '0') * - (mult < 0 ? -1 : 1); - } - 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/nx-X11/lib/Xaw/TextP.h b/nx-X11/lib/Xaw/TextP.h deleted file mode 100644 index 0edbdd29b..000000000 --- a/nx-X11/lib/Xaw/TextP.h +++ /dev/null @@ -1,321 +0,0 @@ -/* -* $Xorg: TextP.h,v 1.4 2001/02/09 02:03:46 xorgcvs Exp $ -*/ - - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.21 2001/12/14 19:54:44 dawes Exp $ */ - -#ifndef _XawTextP_h -#define _XawTextP_h - -#include - -#include -#include - -_XFUNCPROTOBEGIN - -#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 - ); - -void _XawTextNeedsUpdating -( - TextWidget ctx, - XawTextPosition left, - XawTextPosition right - ); - -_XFUNCPROTOEND - -#endif /* _XawTextP_h */ diff --git a/nx-X11/lib/Xaw/TextPop.c b/nx-X11/lib/Xaw/TextPop.c deleted file mode 100644 index dd67ef4a1..000000000 --- a/nx-X11/lib/Xaw/TextPop.c +++ /dev/null @@ -1,1554 +0,0 @@ -/* $Xorg: TextPop.c,v 1.4 2001/02/09 02:03:46 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.20tsi 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); - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "XawI18n.h" - -static char* INSERT_FILE = "Enter Filename:"; -static char* SEARCH_LABEL_1 = "Use to change fields."; -static char* SEARCH_LABEL_2 = "Use ^q for ."; -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[] = -",:" "set() notify()\n" -; - -static char search_text_trans[] = -"~sReturn:" "DoSearchAction(Popdown)\n" -"sReturn:" "DoSearchAction() SetField(Replace)\n" -"cc:" "PopdownSearchAction()\n" -":" "select-start() SetField(Search)\n" -"Tab:" "DoSearchAction() SetField(Replace)\n" -; - -static char rep_text_trans[] = -"~sReturn:" "DoReplaceAction(Popdown)\n" -"sReturn:" "SetField(Search)\n" -"cc:" "PopdownSearchAction()\n" -":" "select-start() DoSearchAction() SetField(Replace)\n" -"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 to insert file - */ - trans = XtParseTranslationTable("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[37]; - 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)(unsigned long) - ((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) { - char *ptr; - int len; - - ptr = GetString(search->search_text); - len = strlen(ptr); - (void)XmuSnprintf(msg, sizeof(msg), "%s", ptr); - - ptr = strchr(msg, '\n'); - if (ptr != NULL || sizeof(msg) - 1 < len) { - if (ptr != NULL) - len = ptr - msg + 4; - else - len = strlen(msg); - - if (len < 4) - strcpy(msg, "..."); - else - strcpy(msg + len - 4, "..."); - } - XawTextUnsetSelection(tw); - SetSearchLabels(search, "Could not find string", 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)(unsigned long) - ((XPointer)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[37]; - char *ptr; - int len; - - ptr = GetString(search->search_text); - len = strlen(ptr); - (void)XmuSnprintf(msg, sizeof(msg), "%s", ptr); - ptr = strchr(msg, '\n'); - if (ptr != NULL || sizeof(msg) - 1 < len) { - if (ptr != NULL) - len = ptr - msg + 4; - else - len = strlen(msg); - - if (len < 4) - strcpy(msg, "..."); - else - strcpy(msg + len - 4, "..."); - } - SetSearchLabels(search, "Could not find string", 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 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) { - SetSearchLabels(search, "Error while replacing.", "", 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); - } - } - else - ctx->text.insertPos = ipos; - 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("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/nx-X11/lib/Xaw/TextSink.c b/nx-X11/lib/Xaw/TextSink.c deleted file mode 100644 index 75f952fff..000000000 --- a/nx-X11/lib/Xaw/TextSink.c +++ /dev/null @@ -1,1829 +0,0 @@ -/* $Xorg: TextSink.c,v 1.4 2001/02/09 02:03:46 xorgcvs Exp $ */ -/* - -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.21 2002/06/03 21:39:24 paulo Exp $ */ - -/* - * Author: Chris Peterson, MIT X Consortium. - * - * Much code taken from X11R3 AsciiSink. - */ - -/* - * TextSink.c - TextSink object. (For use with the text widget). - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#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); -} - -#if 0 -/*ARGSUSED*/ -static void -PreparePaint(Widget w, int y, int line, XawTextPosition from, XawTextPosition to, - Bool highlight) -{ -} -#endif - -void -XawTextSinkDoPaint(Widget w) -{ - TextSinkObjectClass cclass = (TextSinkObjectClass)w->core.widget_class; - - (*cclass->text_sink_class.extension->DoPaint)(w); -} - -#if 0 -/*ARGSUSED*/ -static void -DoPaint(Widget w) -{ -} -#endif - -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; - return (True); -} - -static XawTextPropertyList **prop_lists; -static Cardinal num_prop_lists; - -static int -bcmp_qident(_Xconst void *left, _Xconst void *right) -{ - return ((long)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); -} - -static XawTextProperty * -_XawTextSinkGetProperty(XawTextPropertyList *list, XrmQuark property) -{ - if (property != NULLQUARK && list && list->properties) { - XawTextProperty **ptr = (XawTextProperty**) - bsearch((void*)(long)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); -} - -static 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), "%08lx%08lx%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 = NULL; - XawTextPropertyList *propl, *prev = NULL; - XawTextProperty *def_prop = NULL; - String str, tok, tmp; - char buffer[BUFSIZ]; - - if (prop_lists) ptr = (XawTextPropertyList**) - bsearch((void*)(long)qname, prop_lists, num_prop_lists, - sizeof(XawTextPropertyList*), bcmp_qident); - 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) { - XmuSnprintf(buffer, sizeof(buffer), - "Bad text property name \"%s\".", params->name); - XtAppWarning(XtDisplayToApplicationContext - (DisplayOfScreen(screen)), buffer); - 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) { - XmuSnprintf(buffer, sizeof(buffer), - "Cannot load font \"%s\".", argval->value); - XtAppWarning(XtDisplayToApplicationContext - (DisplayOfScreen(screen)), buffer); - 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)) { - XmuSnprintf(buffer, sizeof(buffer), - "Cannot allocate color \"%s\".", argval->value); - XtAppWarning(XtDisplayToApplicationContext - (DisplayOfScreen(screen)), buffer); - 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)) { - XmuSnprintf(buffer, sizeof(buffer), - "Cannot allocate color \"%s\".", argval->value); - XtAppWarning(XtDisplayToApplicationContext - (DisplayOfScreen(screen)), buffer); - 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 = NULL; - if (prop_lists) ptr = (XawTextPropertyList**) - bsearch((void*)(long)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/nx-X11/lib/Xaw/TextSink.h b/nx-X11/lib/Xaw/TextSink.h deleted file mode 100644 index 291b9600d..000000000 --- a/nx-X11/lib/Xaw/TextSink.h +++ /dev/null @@ -1,364 +0,0 @@ -/* - * $Xorg: TextSink.h,v 1.4 2001/02/09 02:03:46 xorgcvs Exp $ - */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.9 2001/01/17 19:42:35 dawes Exp $ */ - -#ifndef _XawTextSink_h -#define _XawTextSink_h - -#include - -/*********************************************************************** - * - * 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/nx-X11/lib/Xaw/TextSinkP.h b/nx-X11/lib/Xaw/TextSinkP.h deleted file mode 100644 index 6cc873328..000000000 --- a/nx-X11/lib/Xaw/TextSinkP.h +++ /dev/null @@ -1,306 +0,0 @@ -/* -* $Xorg: TextSinkP.h,v 1.4 2001/02/09 02:03:46 xorgcvs Exp $ -*/ - - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.11 2001/01/17 19:42:35 dawes Exp $ */ - -#ifndef _XawTextSinkP_h -#define _XawTextSinkP_h - -/* - * TextSink Object Private Data - */ -#include -#include /* This sink works with the Text widget */ -#include /* This sink works with the Text Source */ -#include - -#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; - 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/nx-X11/lib/Xaw/TextSrc.c b/nx-X11/lib/Xaw/TextSrc.c deleted file mode 100644 index 0fd6bd36d..000000000 --- a/nx-X11/lib/Xaw/TextSrc.c +++ /dev/null @@ -1,1981 +0,0 @@ -/* $Xorg: TextSrc.c,v 1.5 2001/02/09 02:03:47 xorgcvs Exp $ */ -/* - -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.33 2002/09/08 02:29:47 paulo Exp $ */ - -/* - * Author: Chris Peterson, MIT X Consortium. - * Much code taken from X11R3 String and Disk Sources. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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. - * - * Returns: - * The character position following the retrieved text. - */ -/*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; - if (l_state->buffer != SrcNL && l_state->buffer != (char*)SrcWNL) - 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 = 0, 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) { - eprev = NULL; - anchor = XawTextSourceRemoveAnchor(w, anchor); - entity = anchor ? anchor->entities : 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) { - eprev = NULL; - 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]; - 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)((long)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); - - 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; - - if (position == panchor->position) - return (panchor); - - anchor = XtNew(XawTextAnchor); - 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 = XtNew(XawTextAnchor); - 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); -} - -XawTextEntity * -XawTextSourceAddEntity(Widget w, int type, int flags, XtPointer data, - XawTextPosition position, Cardinal length, - XrmQuark property) -{ - XawTextAnchor *next, *anchor = _XawTextSourceFindAnchor(w, position); - XawTextEntity *entity, *eprev; - - /* There is no support for zero length entities for now */ - if (length == 0) - return (NULL); - - 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, data, position, - length, property)); - } - } - } - - /* Automatically join sequential entities if possible */ - if (eprev && - anchor->position + eprev->offset + eprev->length == position && - eprev->property == property && eprev->type == type && - eprev->flags == flags && eprev->data == data) { - eprev->length += length; - return (eprev); - } - - entity = XtNew(XawTextEntity); - entity->type = type; - entity->flags = flags; - entity->data = data; - 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) -{ - XawTextAnchor *anchor = XawTextSourceFindAnchor(w, left); - XawTextEntity *entity, *eprev, *enext; - XawTextPosition offset; - int 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) { - eprev = NULL; - if ((anchor->entities = enext) == NULL) { - if ((anchor = XawTextSourceRemoveAnchor(w, anchor)) == NULL) - return; - entity = anchor->entities; - } - 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) -{ - XawTextAnchor *anchor; - - anchor = XawTextSourceFindAnchor(w, position); - - position -= position % ANCHORS_DIST; - - if (position - anchor->position >= ANCHORS_DIST) - return (XawTextSourceAddAnchor(w, position)); - - return (anchor); -} -#endif diff --git a/nx-X11/lib/Xaw/TextSrc.h b/nx-X11/lib/Xaw/TextSrc.h deleted file mode 100644 index 817132d48..000000000 --- a/nx-X11/lib/Xaw/TextSrc.h +++ /dev/null @@ -1,280 +0,0 @@ -/* - * $Xorg: TextSrc.h,v 1.4 2001/02/09 02:03:47 xorgcvs Exp $ - */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.11 2001/01/17 19:42:35 dawes Exp $ */ - -#ifndef _XawTextSrc_h -#define _XawTextSrc_h - -#include - -/* 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/nx-X11/lib/Xaw/TextSrcP.h b/nx-X11/lib/Xaw/TextSrcP.h deleted file mode 100644 index e26557b90..000000000 --- a/nx-X11/lib/Xaw/TextSrcP.h +++ /dev/null @@ -1,264 +0,0 @@ -/* -* $Xorg: TextSrcP.h,v 1.4 2001/02/09 02:03:47 xorgcvs Exp $ -*/ - - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.14 2001/12/14 19:54:45 dawes Exp $ */ - -#ifndef _XawTextSrcP_h -#define _XawTextSrcP_h - -/* - * TextSrc Object Private Data - */ -#include - -#include -#include /* This source works with the Text widget */ - -_XFUNCPROTOBEGIN - -#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, - XtPointer data, - 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 - -_XFUNCPROTOEND - -#endif /* _XawTextSrcP_h */ diff --git a/nx-X11/lib/Xaw/TextTr.c b/nx-X11/lib/Xaw/TextTr.c deleted file mode 100644 index c918ee6db..000000000 --- a/nx-X11/lib/Xaw/TextTr.c +++ /dev/null @@ -1,159 +0,0 @@ -/* $Xorg: TextTr.c,v 1.4 2001/02/09 02:03:47 xorgcvs Exp $ */ - -/* - -Copyright 1991, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.15 2001/01/17 19:42:35 dawes Exp $ */ - -/* INTERNATIONALIZATION: - -The OMRON R5 contrib added the following action to the old TextTr: - - Ctrlbackslash: 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: - - 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[] = -"cA:" "beginning-of-line()\n" -"cB:" "backward-character()\n" -"cC:" "insert-selection(CUT_BUFFER0)\n" -"cD:" "delete-next-character()\n" -"cE:" "end-of-line()\n" -"cF:" "forward-character()\n" -#ifndef OLDXAW -"cG:" "keyboard-reset()\n" -#else -"cG:" "multiply(Reset)\n" -#endif -"cH:" "delete-previous-character()\n" -"cJ:" "newline-and-indent()\n" -"cK:" "kill-to-end-of-line()\n" -"cL:" "redraw-display()\n" -"cM:" "newline()\n" -"cN:" "next-line()\n" -"cO:" "newline-and-backup()\n" -"cP:" "previous-line()\n" -"cR:" "search(backward)\n" -"cS:" "search(forward)\n" -"cT:" "transpose-characters()\n" -#ifndef OLDXAW -"cU:" "multiply(Start)\n" -#else -"cU:" "multiply(4)\n" -#endif -"cV:" "next-page()\n" -"cW:" "kill-selection()\n" -"cY:" "insert-selection(SECONDARY)\n" -"cZ:" "scroll-one-line-up()\n" -"mB:" "backward-word()\n" -"mC:" "capitalize-word()\n" -"mF:" "forward-word()\n" -"mI:" "insert-file()\n" -"mK:" "kill-to-end-of-paragraph()\n" -"mL:" "downcase-word()\n" -"mQ:" "form-paragraph()\n" -"mU:" "upcase-word()\n" -"mV:" "previous-page()\n" -#ifndef OLDXAW -"mY:" "kill-ring-yank()\n" -#endif -"mZ:" "scroll-one-line-down()\n" -"~s md:" "kill-word(alnum)\n" -"s md:" "delete-next-word(alnum)\n" -"~s mh:" "backward-kill-word(alnum)\n" -"s mh:" "delete-previous-word(alnum)\n" -":m\\<:" "beginning-of-file()\n" -":m\\>:" "end-of-file()\n" -":m]:" "forward-paragraph()\n" -":m[:" "backward-paragraph()\n" -"~s mDelete:" "backward-kill-word(alnum)\n" -"s mDelete:" "delete-previous-word(alnum)\n" -"~s mBackSpace:" "backward-kill-word(alnum)\n" -"s mBackSpace:" "delete-previous-word(alnum)\n" -"cLeft:" "backward-word(alnum)\n" -"cRight:" "forward-word(alnum)\n" -"cUp:" "backward-paragraph()\n" -"cDown:" "forward-paragraph()\n" -"Home:" "beginning-of-file()\n" -":KP_Home:" "beginning-of-file()\n" -"End:" "end-of-file()\n" -":KP_End:" "end-of-file()\n" -"Next:" "next-page()\n" -":KP_Next:" "next-page()\n" -"Prior:" "previous-page()\n" -":KP_Prior:" "previous-page()\n" -"Right:" "forward-character()\n" -":KP_Right:" "forward-character()\n" -"Left:" "backward-character()\n" -":KP_Left:" "backward-character()\n" -"Down:" "next-line()\n" -":KP_Down:" "next-line()\n" -"Up:" "previous-line()\n" -":KP_Up:" "previous-line()\n" -"Delete:" "delete()\n" -":KP_Delete:" "delete()\n" -"BackSpace:" "delete-previous-character()\n" -"Linefeed:" "newline-and-indent()\n" -"Return:" "newline()\n" -":KP_Enter:" "newline()\n" -"cbackslash:" "reconnect-im()\n" -"Kanji:" "reconnect-im()\n" -#ifndef OLDXAW -":0:" "numeric(0)\n" -":1:" "numeric(1)\n" -":2:" "numeric(2)\n" -":3:" "numeric(3)\n" -":4:" "numeric(4)\n" -":5:" "numeric(5)\n" -":6:" "numeric(6)\n" -":7:" "numeric(7)\n" -":8:" "numeric(8)\n" -":9:" "numeric(9)\n" -":-:" "numeric(-)\n" -":c_:" "undo()\n" -#endif -"s Insert:" "insert-selection(PRIMARY, CUT_BUFFER0)\n" -"Q,:" "insert-char()\n" -":" "insert-char()\n" -":" "enter-window()\n" -":" "leave-window()\n" -":" "focus-in()\n" -":" "focus-out()\n" -":" "select-start()\n" -":" "extend-adjust()\n" -":" "extend-end(PRIMARY, CUT_BUFFER0)\n" -":" "insert-selection(PRIMARY, CUT_BUFFER0)\n" -":" "extend-start()\n" -":" "extend-adjust()\n" -":" "extend-end(PRIMARY, CUT_BUFFER0)\n" -; diff --git a/nx-X11/lib/Xaw/Tip.c b/nx-X11/lib/Xaw/Tip.c deleted file mode 100644 index 3c4b79437..000000000 --- a/nx-X11/lib/Xaw/Tip.c +++ /dev/null @@ -1,638 +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 $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#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; - - if (!tip->tip.font) XtError("Aborting: no font found\n"); - if (tip->tip.international && !tip->tip.fontset) - XtError("Aborting: no fontset found\n"); - - 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) { - /*CONSTCOND*/ - while (True) { - int w = XmbTextEscapement(fset, label, (int)(nl - label)); - - if (w > width) - width = w; - if (*nl == '\0') - break; - label = nl + 1; - if (*label) - height += ext->max_ink_extent.height; - if ((nl = index(label, '\n')) == NULL) - nl = index(label, '\0'); - } - } - else - width = XmbTextEscapement(fset, label, strlen(label)); - } - else { - height = fs->max_bounds.ascent + fs->max_bounds.descent; - if ((nl = index(label, '\n')) != NULL) { - /*CONSTCOND*/ - while (True) { - 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; - if (*nl == '\0') - break; - label = nl + 1; - if (*label) - height += fs->max_bounds.ascent + fs->max_bounds.descent; - if ((nl = index(label, '\n')) == NULL) - nl = index(label, '\0'); - } - } - 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; - 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) { - 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/nx-X11/lib/Xaw/Tip.h b/nx-X11/lib/Xaw/Tip.h deleted file mode 100644 index f5b8d9be5..000000000 --- a/nx-X11/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$ */ - -#ifndef _XawTip_h -#define _XawTip_h - -/* - * Tip Widget - */ - -#include - -/* 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/nx-X11/lib/Xaw/TipP.h b/nx-X11/lib/Xaw/TipP.h deleted file mode 100644 index 2b9e12619..000000000 --- a/nx-X11/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$ */ - -#ifndef _XawTipP_h -#define _XawTipP_h - -#include -#include -#include - -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/nx-X11/lib/Xaw/Toggle.c b/nx-X11/lib/Xaw/Toggle.c deleted file mode 100644 index dfbcf7677..000000000 --- a/nx-X11/lib/Xaw/Toggle.c +++ /dev/null @@ -1,632 +0,0 @@ -/* $Xorg: Toggle.c,v 1.4 2001/02/09 02:03:47 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.8 2001/08/23 00:03:20 dawes Exp $ */ - -/* - * Author: Chris D. Peterson - * MIT X Consortium - * kit@expo.lcs.mit.edu - * - * Date: January 12, 1989 - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * 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[] = -":" "highlight(Always)\n" -":" "unhighlight()\n" -",:" "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/nx-X11/lib/Xaw/Toggle.h b/nx-X11/lib/Xaw/Toggle.h deleted file mode 100644 index 4858961f2..000000000 --- a/nx-X11/lib/Xaw/Toggle.h +++ /dev/null @@ -1,181 +0,0 @@ -/* - * $Xorg: Toggle.h,v 1.4 2001/02/09 02:03:47 xorgcvs Exp $ - * -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.5 2001/01/17 19:42:35 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 - -/* 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/nx-X11/lib/Xaw/ToggleP.h b/nx-X11/lib/Xaw/ToggleP.h deleted file mode 100644 index c1477379d..000000000 --- a/nx-X11/lib/Xaw/ToggleP.h +++ /dev/null @@ -1,95 +0,0 @@ -/* $Xorg: ToggleP.h,v 1.4 2001/02/09 02:03:47 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.7 2001/01/17 19:42:35 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 -#include - -/* - * 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/nx-X11/lib/Xaw/Tree.c b/nx-X11/lib/Xaw/Tree.c deleted file mode 100644 index 88bd51f90..000000000 --- a/nx-X11/lib/Xaw/Tree.c +++ /dev/null @@ -1,1017 +0,0 @@ -/* - * $Xorg: Tree.c,v 1.4 2001/02/09 02:03:47 xorgcvs Exp $ - * - -Copyright 1990, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.9 2001/01/17 19:42:35 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xaw/Tree.h b/nx-X11/lib/Xaw/Tree.h deleted file mode 100644 index ae0990aa5..000000000 --- a/nx-X11/lib/Xaw/Tree.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * $Xorg: Tree.h,v 1.4 2001/02/09 02:03:47 xorgcvs Exp $ - * - -Copyright 1990, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.6 2001/01/17 19:42:35 dawes Exp $ */ - - -#ifndef _XawTree_h -#define _XawTree_h - -#include - -/****************************************************************************** - * - * 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/nx-X11/lib/Xaw/TreeP.h b/nx-X11/lib/Xaw/TreeP.h deleted file mode 100644 index 00e59c0a4..000000000 --- a/nx-X11/lib/Xaw/TreeP.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * $Xorg: TreeP.h,v 1.4 2001/02/09 02:03:47 xorgcvs Exp $ - * - -Copyright 1990, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.6 2001/01/17 19:42:35 dawes Exp $ */ - - -#ifndef _XawTreeP_h -#define _XawTreeP_h - -#include - -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/nx-X11/lib/Xaw/Vendor.c b/nx-X11/lib/Xaw/Vendor.c deleted file mode 100644 index 930c4485a..000000000 --- a/nx-X11/lib/Xaw/Vendor.c +++ /dev/null @@ -1,527 +0,0 @@ -/* $Xorg: Vendor.c,v 1.4 2001/02/09 02:03:47 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.8 2001/12/14 19:54:45 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 */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* The following two headers are for the input method. */ - -#include -#include - -/* - * 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 - * - ***************************************************************************/ - -#if defined(__UNIXOS2__) || defined(__CYGWIN__) -/* to fix the EditRes problem because of wrong linker semantics */ -extern WidgetClass vendorShellWidgetClass; /* from Xt/Vendor.c */ -extern VendorShellClassRec _XawVendorShellClassRec; -extern void _XawFixupVendorShell(); - -#if defined(__UNIXOS2__) -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; - } -} -#endif - -#if defined(__CYGWIN__) -int __stdcall -DllMain(unsigned long mod_handle, unsigned long flag, void *routine) -{ - switch (flag) - { - case 1: /* DLL_PROCESS_ATTACH - process attach */ - vendorShellWidgetClass = (WidgetClass)(&_XawVendorShellClassRec); - _XawFixupVendorShell(); - break; - case 0: /* DLL_PROCESS_DETACH - process detach */ - break; - } - return 1; -} -#endif - -#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 __UNIXOS2__ -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(__UNIXOS2__) || defined(__CYGWIN__) -/* 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/nx-X11/lib/Xaw/VendorEP.h b/nx-X11/lib/Xaw/VendorEP.h deleted file mode 100644 index dc85b3644..000000000 --- a/nx-X11/lib/Xaw/VendorEP.h +++ /dev/null @@ -1,84 +0,0 @@ -/* $Xorg: VendorEP.h,v 1.4 2001/02/09 02:03:47 xorgcvs Exp $ */ - -/* - * 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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.5 2001/01/17 19:42:36 dawes Exp $ */ - -#ifndef _VendorEP_h -#define _VendorEP_h - -#include - -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/nx-X11/lib/Xaw/Viewport.c b/nx-X11/lib/Xaw/Viewport.c deleted file mode 100644 index 90c909e10..000000000 --- a/nx-X11/lib/Xaw/Viewport.c +++ /dev/null @@ -1,1102 +0,0 @@ -/* $Xorg: Viewport.c,v 1.4 2001/02/09 02:03:47 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.10 2001/08/23 00:03:20 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#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 = (long)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/nx-X11/lib/Xaw/Viewport.h b/nx-X11/lib/Xaw/Viewport.h deleted file mode 100644 index a4b678c83..000000000 --- a/nx-X11/lib/Xaw/Viewport.h +++ /dev/null @@ -1,121 +0,0 @@ -/* $Xorg: Viewport.h,v 1.4 2001/02/09 02:03:47 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1987, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.6 2001/01/17 19:42:36 dawes Exp $ */ - -#ifndef _XawViewport_h -#define _XawViewport_h - -#include -#include - -/* 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/nx-X11/lib/Xaw/ViewportP.h b/nx-X11/lib/Xaw/ViewportP.h deleted file mode 100644 index 9de6eaed8..000000000 --- a/nx-X11/lib/Xaw/ViewportP.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * $Xorg: ViewportP.h,v 1.4 2001/02/09 02:03:47 xorgcvs Exp $ - * Private declarations for ViewportWidgetClass - */ - -/************************************************************ - -Copyright 1987, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.7 2001/01/17 19:42:36 dawes Exp $ */ - -#ifndef _ViewportP_h -#define _ViewportP_h - -#include -#include - -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/nx-X11/lib/Xaw/Xaw-def.cpp b/nx-X11/lib/Xaw/Xaw-def.cpp deleted file mode 100644 index 45666d378..000000000 --- a/nx-X11/lib/Xaw/Xaw-def.cpp +++ /dev/null @@ -1,157 +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 -#ifndef __UNIXOS2__ - vendorShellClassRec DATA - vendorShellWidgetClass DATA -#endif - 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 -#ifdef __UNIXOS2__ /* xconsole */ - _XawTextGetSTRING - XawTextSourceAddEntity - XawTextSourceAnchorAndEntity - XawTextSourceNextAnchor - XawTextSourcePrevAnchor - XawTextSourceFindAnchor - _XawTextShowPosition - _XawTextSrcUndo - XawTextSinkConvertPropertyList - XawTextGetSink - _XawTextBuildLineTable - XawTextSourceClearEntities - _XawTextNeedsUpdating - XawTextSinkCopyProperty - XawTextSinkGetProperty - XawTextSinkCombineProperty - XawTextSinkAddProperty - XawTextLastPosition -#endif -/* $Xorg: Xaw-def.cpp,v 1.3 2000/08/17 19:45:44 cpqbld Exp $ */ -/* $XFree86: xc/lib/Xaw/Xaw-def.cpp,v 1.2 2002/05/31 18:45:44 dawes Exp $ */ diff --git a/nx-X11/lib/Xaw/Xaw.man b/nx-X11/lib/Xaw/Xaw.man deleted file mode 100644 index 8803f10f9..000000000 --- a/nx-X11/lib/Xaw/Xaw.man +++ /dev/null @@ -1,588 +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.7 2001/11/04 21:16:39 paulo Exp $ -.\" -.de TQ -.br -.ns -.TP \\$1 -.. -.TH Xaw 3 __vendorversion__ -.SH NAME - Xaw \- X Athena Widgets -.SH DESCRIPTION -.B Xaw -is a widget set based on the X Toolkit Intrinsics (Xt) Library. This -release by the X.org Foundation includes additions and modifications -originally made for The XFree86 Project, Inc. This manual page describes -these changes as well as some of the common interfaces between its version -and the previous X Consortium release (Xaw6). -.SH ACTIONS -All of 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: -.PP -.I action-name \fP(\fIboolean-expression\fP, \fIarguments\fP) -.PP -\fBAction-name\fP is one of \fIcall-proc\fP, \fIdeclare\fP, -\fIget-values\fP or \fIset-values\fP. -.PP -\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, -which starts with a \fI$\fR; a resource name without the bindings \fI.\fP -or \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). -.PP -\fBArguments\fP are self-explanatory; when starting with a \fI$\fP they name -a variable, otherwise, they indicate a resource name. -.TP 8 -.B call-proc \fP(\fIboolean-expression\fP, \fIprocedure-name\fP) -This action allows the evaluation of a boolean expression in the first -parameter before calling a action procedure. The procedure is only called -if the expression evaluates as true. Example: -.br -.I call-proc("$inside & $pressed", notify) -.TP 8 -.B declare \fP(\fIboolean-expression\fP, \fIvariable\fP, \fIvalue\fP, ...) -This action is used to create new variables or change their values. Any -number of variable-value tuples may be specified. Example: -.br -.I declare(1, $pressed, 1) -.TP 8 -.B get-values \fP(\fIboolean-expression\fP, \fIvariable\fP, \fIvalue\fP, ...) -This action reads a widget resource value into a variable. Any number of -variable-value tuples may be specified. Example: -.br -.I get-values(1, $fg, foreground, $bg, background) -.TP 8 -.B set-values \fP(\fIboolean-expression\fP, \fIvariable\fP, \fIvalue\fP, ...) -This action sets a widget resource to the given value, which may be a -variable. Any number of variable-value tuples may be specified. Example: -.br -.I set-values(1, foreground, $bg, background, $fg) -.PP -Here is a sample translation to make a label widget behave like a button: -.PP -.nf -: get-values(1, $fg, foreground, $bg, background)\\n\\ -: set-values(1, foreground, yellow, background, gray30)\\n\\ -: set-values(1, foreground, $fg, background, $bg) -.fi -.SH DISPLAY LISTS -All of the \fBXaw\fP widgets have now the additional resource -\fIdisplayList\fP. This resource allows drawing the widget decorations -using commands embedded in a resource string. The displayList resource has -the syntax: -.PP -\fI[class-name:]function-name arguments[[{;\\n}]...]\fP -.PP -\fBClass-name\fP is any registered set of functions to draw in the widget. -Currently the only existing class is \fIxlib\fP, which provides access to -the Xlib drawing primitives. -.PP -\fBFunction-name\fP is the drawing or configuration function to be called, -described bellow. -.PP -\fBArguments\fP may be anything suitable to the displayList function being -called. When the function requires a coordinate, the syntax is -\fI{+-}\fP or \fI/\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 \fImode\fPs are "pieslice" and "chord", which -set 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. \fIcolor-spec\fP must a valid color -specification. Example: -.br -.I background red -.TP 8 -.B cap-style \fPstyle -Sets the cap style. Accepted \fIstyle\fPs are "notlast", "butt", "round", -and "projecting", which set 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 below. Example: -.br -.I clip-mask xlogo11 -.TP 8 -.B clip-origin \fPx,y -Sets the clip x and y origin. Requires two arguments, the x and y -coordinates. 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 \fBPIXMAPS\fP section below. \fIX2\fP and -\fIy2\fP are the coordinates of the end copy, not the width and height; if -not defined, the parser calculates them. \fIsrc_x\fP and \fIsrc_y\fP -default 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 \fBPIXMAPS\fP section below. \fIX2\fP and -\fIy2\fP are the coordinates of the end copy, not the width and height; if -not defined, the parser calculates them. \fIsrc_x\fP and \fIsrc_y\fP -default 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 specified, 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, which are the start and end -coordinate pairs. 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 space can be quoted with -the \fI"\fP character; the backslash character \fI\\\fP can also be used, -but it will be necessary escape it twice. Example: -.br -\fI draw-string 10,10, "Hello world!"\fP -.TP 8 -.B exposures \fPboolean -Sets 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", which -set 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", which set 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", which 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", -which set 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 -\fBPIXMAPS\fP section below. \fIxs\fP and \fIys\fP are the coordinates from -where to start copying the pixmap; \fIxe\fP and \fIye\fP are optional (they -default 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. Requires four arguments, -the starting and ending coordinate pairs. Example: -.br -.I line +0,+0, -1,-1 -.TP 8 -.B line-width \fPinteger -Selects a line width for drawing. Example: -.br -.I line-width 2 -.TP 8 -.B line-style \fPstyle -Sets the line style. Accepted parameters are "solid", "onoffdash" and -"doubledash", which set 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 argument pairs 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, a coordinate pair. Example: -.br -.I point +10,+10 -.TP 8 -.B plane-mask \fPinteger -Sets the plane mask. Requires an 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. The 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 -Sets the shape mode used in \fIfill-polygon\fP. Accepted parameters are -"complex", "convex" or "nonconvex", which set 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 a stipple. Requires a pixmap parameter, as described -in the \fBPIXMAPS\fP section below. Example: -.br -.I stipple plaid -.TP 8 -.B subwindow-mode \fPmode -Sets the subwindow mode in the GC. Accepted parameters are -"includeinferiors" and "clipbychildren", which set the subwindow mode to -IncludeInferiors or ClipByChildren, respectively. Example: -.br -.I subwindow-mode includeinferiors -.TP 8 -.B tile \fPpixmap-spec -Sets the pixmap for a tile. Requires a pixmap parameter, as described -in the \fBPIXMAPS\fP section below. 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, if it has been 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 has been 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: -.PP -.I [type:]name[?arg=val[{&}...]] -.PP -\fBType\fP can be one of \fIbitmap\fP, \fIgradient\fP or \fIxpm\fP. -.PP -\fBName\fP may be a file name, or, in the case of type \fIgradient\fP, may be -either \fIvertical\fP or \fIhorizontal\fP. -.PP -\fBArg=val\fP is a list of arguments to the converter. An argument list is -preceded by a question mark, and multiple arguments are separated by -ampersands. The most common arguments are \fIforeground\fP and -\fIbackground\fP. Gradients also support the arguments \fIstart\fP and -\fIend\fP (colors with which to start and end the gradient); the -\fPsteps\fP argument, to allow using less colors; and the \fIdimension\fP -argument to specify the size of the gradient. The \fIxpm\fP converter -understands the \fIcloseness\fP argument, which aids in using fewer 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. -.PP -A couple of highly visible changes in the Text widget are due to many bugs -in the Xaw6 implementation involving scrollbars and auto-resizing. -Scrollbars being added or removed caused several problems in keeping the -text cursor visible, and in Xaw6 it was very easy to have a widget thinking -the cursor was visible, when it was not. Also, permitting automatic -resizing of the widget to a larger geometry created other problems, making -it difficult to have a consistent layout in the application, and, if the -window manager did not interfere, windows larger than the screen could -result. Therefore, some functionality involving scrollbars and -auto-resizing has been disabled; see the section on new and modified -Text widget resources below. -.PP -The Text widget's default key bindings were originally based on the Emacs -text editor. In this release, even more operations familiar to Emacs users -have been added. New text actions include: -.TP 8 -.B indent -Indents text blocks. Not bound by default. The Text widget also does not -attempt to perform auto-indentation of its source object by default. -.TP 8 -.B keyboard-reset -Resets the keyboard state. Reverts the action multiplier to 1, and if undo -is enabled, toggles between undo and redo. Bound by default to -\fIControlG\fP. -.TP 8 -.B kill-ring-yank -In this version of Xaw, text killed in any text field is kept in memory, -allowing cut and paste operations internally to the program between text -fields. Bound by default to \fIMetaY\fP. -.TP 8 -.B numeric -Listed here only for purposes of documentation. 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 composition of the multiplication number of text actions. -.TP 8 -.B set-keyboard-focus -Sets the input focus of the top level widget to the text field. Not -enabled by default, but bound to the \fI\fP event. -.TP 8 -.B toggle-overwrite -Toggles overwrite mode. In overwrite mode, any text inserted in a text -field will replace existing text. Bound by default to \fIInsert\fP. -.TP 8 -.B undo -Sets the \fIenableUndo\fP resource of the textSrcObject. Not enabled by -default, but bound to \fIControl_\fP. -.PP -New and modified Text widget 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 at which to break text. Text lines started with -an alphanumeric character will automatically start at this column. -.TP 8 -.B positionCallback (\fPClass\fB Callback) -Allows installation of a callback to be called every time the cursor is -moved, and/or the file changes its size. The callback is called with a -pointer to a structure 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 write text editors based -on the Xaw widget set. -.TP 8 -.B resize (\fPClass\fB Resize) -No longer supported, but recognized for backward compatibility with -resource specifications written for the Xaw6 Text widget. -.TP 8 -.B rightColumn (\fPClass\fB Column) -Specifies the right column at which to break text. Text lines started with -an alphanumeric character will automatically end at this column. -.TP 8 -.B scrollHorizontal (\fPClass\fB Scroll) -.TQ -.B scrollVertical (\fPClass\fB Scroll) -These resources control the placement of scrollbars on the left and bottom -edges of the Text widget. They accept the values \fIXawtextScrollAlways\fP -and \fIXawtextScrollNever\fP. A converter is registered for this resource -that will convert the following strings: \fIalways\fP and \fInever\fP. The -value \fIXawtextScrollWhenNeeded\fP (and \fIwhenNeeded\fP, recognized by -the converter), is accepted for backwards compatibility with resource -specifications written for the Xaw6 Text widget, but ignored (effectively -treated as \fIXawtextScrollNever\fP). -.SH TEXT SOURCE OBJECT -The textSrcObject allows display of its contents to more than one window, -and also stores undo information. The new resources for the textSrcObject -are: -.TP 8 -.B callback (\fPClass\fB Callback) -Previous versions of Xaw had this resource in subclasses of the TextSource -object. 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, this resource was previously in subclasses of -the TextSource object. It is now in the textSrcObject to control the -changed/unchanged state when undo is enabled. -.SH TEXT SINK OBJECT -The textSinkObject subclasses asciiSinkObject and multiSinkObject have been -changed slightly to use a new cursor shape (no longer a caret at the -baseline) that indicates the input focus of the text widget, and allow -specification of the cursor color. The new resource is: -.TP 8 -.B cursorColor (\fPClass\fB Color) -Sets 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 has been changed to -enable multiple columns when a single column does not fit on the screen. -It was also modified to enable submenus. -.SH SME BSB OBJECT -A new resource has been added to the smeBSBObject to allow binding submenus -to it. The new resource is: -.TP 8 -.B menuName (\fPClass\fB MenuName) -Specifies 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 actively being developed. 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 thing, and -sometimes an encouraged programming practice, programs that access private -data structures may have problems with newer releases in the current stage -of -.I Xaw -development. Efforts are being made to avoid such problems and to guarantee -that newer releases will be source and binary compatible. -.SH AUTHORS -The original X Consortium version of the Athena Widget Set and its -documentation were the work of many people, including Chris D. Peterson, -Ralph Swick, Mark Ackerman, Donna Converse, Jim Fulton, Loretta -Guarino-Reid, Charles Haynes, Rich Hyde, Mary Larson, Joel McCormack, Ron -Newman, Jeanne Rich, Terry Weissman, Mike Gancarz, Phil Karlton, Kathleen -Langone, Ram Rao, Smokey Wallace, Al Mento, and Jean Diaz. -.PP -The additions and modifications to \fIXaw\fR which were -originally made for XFree86 were written by Paulo -C\('esar Pereira de Andrade. -.SH SEE ALSO -.I Athena Widget Set - C Language Interface diff --git a/nx-X11/lib/Xaw/XawI18n.c b/nx-X11/lib/Xaw/XawI18n.c deleted file mode 100644 index ca95866e5..000000000 --- a/nx-X11/lib/Xaw/XawI18n.c +++ /dev/null @@ -1,104 +0,0 @@ -/* $Xorg: XawI18n.c,v 1.4 2001/02/09 02:03:47 xorgcvs Exp $ */ - -/* 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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.7 2001/01/17 19:42:36 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#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/nx-X11/lib/Xaw/XawI18n.h b/nx-X11/lib/Xaw/XawI18n.h deleted file mode 100644 index 481f78a6f..000000000 --- a/nx-X11/lib/Xaw/XawI18n.h +++ /dev/null @@ -1,122 +0,0 @@ -/* $XdotOrg: xc/lib/Xaw/XawI18n.h,v 1.4 2005/11/08 06:33:25 jkj Exp $ */ -/* $Xorg: XawI18n.h,v 1.4 2001/02/09 02:03:47 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1993, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.14 2001/12/14 19:54:46 dawes Exp $ */ - -#ifdef HAS_WCTYPE_H -#include -#ifndef NO_WIDEC_H -#include -#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 -#endif - -#if defined(AIXV3) || defined(__SCO__) -#include -#endif - -#ifdef NCR -#define iswspace(c) _Xaw_iswspace(c) -int _Xaw_iswspace -( - wchar_t c - ); -#endif - -#ifdef sony -#ifndef SVR4 -#include -#define iswspace(c) jisspace(c) -#endif -#endif - -#ifdef QNX4 -#define toascii( c ) ((unsigned)(c) & 0x007f) -#endif - -#include - -#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 -#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/nx-X11/lib/Xaw/XawIm.c b/nx-X11/lib/Xaw/XawIm.c deleted file mode 100644 index 24b647d81..000000000 --- a/nx-X11/lib/Xaw/XawIm.c +++ /dev/null @@ -1,1613 +0,0 @@ -/* $Xorg: XawIm.c,v 1.6 2001/02/09 02:03:47 xorgcvs Exp $ */ - -/* - * 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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.14tsi Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "XawI18n.h" -#include - -#include - -#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 - * - *****************************************************/ - -/* - * 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 - */ - 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); - CloseIM(ve); - 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; - 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); - ic_a[ic_cnt] = (XPointer) XNPreeditAttributes; ic_cnt++; - ic_a[ic_cnt] = (XPointer) pe_attr; ic_cnt++; - } - if (p->input_style & XIMStatusArea) { - st_attr = XVaCreateNestedList(0, XNAreaNeeded, &st_area_needed, NULL); - ic_a[ic_cnt] = (XPointer) XNStatusAttributes; ic_cnt++; - ic_a[ic_cnt] = (XPointer) st_attr; ic_cnt++; - } - 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], NULL); - 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 = 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); - ic_a[ic_cnt] = (XPointer) XNStatusAttributes; ic_cnt++; - 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); - ic_a[ic_cnt] = (XPointer) XNPreeditAttributes; ic_cnt++; - ic_a[ic_cnt] = (XPointer) pe_attr; ic_cnt++; - } - ic_a[ic_cnt] = (XPointer) NULL; - XSetICValues(p->xic, ic_a[0], ic_a[1], ic_a[2], ic_a[3], NULL); - 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) { - pe_a[pe_cnt] = (XPointer) XNFontSet; pe_cnt++; - pe_a[pe_cnt] = (XPointer) p->font_set; pe_cnt++; - st_a[st_cnt] = (XPointer) XNFontSet; st_cnt++; - st_a[st_cnt] = (XPointer) p->font_set; st_cnt++; - if (p->font_set) { - height = maxAscentOfFontSet(p->font_set) - + maxDescentOfFontSet(p->font_set); - } - height = SetVendorShellHeight(ve, height); - } - if (p->flg & CIFg) { - pe_a[pe_cnt] = (XPointer) XNForeground; pe_cnt++; - pe_a[pe_cnt] = (XPointer) p->foreground; pe_cnt++; - st_a[st_cnt] = (XPointer) XNForeground; st_cnt++; - st_a[st_cnt] = (XPointer) p->foreground; st_cnt++; - } - if (p->flg & CIBg) { - pe_a[pe_cnt] = (XPointer) XNBackground; pe_cnt++; - pe_a[pe_cnt] = (XPointer) p->background; pe_cnt++; - st_a[st_cnt] = (XPointer) XNBackground; st_cnt++; - st_a[st_cnt] = (XPointer) p->background; st_cnt++; - } - if (p->flg & CIBgPixmap) { - pe_a[pe_cnt] = (XPointer) XNBackgroundPixmap; pe_cnt++; - pe_a[pe_cnt] = (XPointer) p->bg_pixmap; pe_cnt++; - st_a[st_cnt] = (XPointer) XNBackgroundPixmap; st_cnt++; - st_a[st_cnt] = (XPointer) p->bg_pixmap; st_cnt++; - } - if (p->flg & CILineS) { - pe_a[pe_cnt] = (XPointer) XNLineSpace; pe_cnt++; - pe_a[pe_cnt] = (XPointer) p->line_spacing; pe_cnt++; - st_a[st_cnt] = (XPointer) XNLineSpace; st_cnt++; - 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; - pe_a[pe_cnt] = (XPointer) XNArea; pe_cnt++; - 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); - pe_a[pe_cnt] = (XPointer) XNArea; pe_cnt++; - 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; - } - pe_a[pe_cnt] = (XPointer) XNSpotLocation; pe_cnt++; - 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; - st_a[st_cnt] = (XPointer) XNArea; st_cnt++; - st_a[st_cnt] = (XPointer) &st_area; st_cnt++; - } - - ic_a[ic_cnt] = (XPointer) XNInputStyle; ic_cnt++; - ic_a[ic_cnt] = (XPointer) p->input_style; ic_cnt++; - ic_a[ic_cnt] = (XPointer) XNClientWindow; ic_cnt++; - ic_a[ic_cnt] = (XPointer) XtWindow(ve->parent); ic_cnt++; - ic_a[ic_cnt] = (XPointer) XNFocusWindow; ic_cnt++; - ic_a[ic_cnt] = (XPointer) XtWindow(w); ic_cnt++; - - if (pe_cnt > 0) { - 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], NULL); - ic_a[ic_cnt] = (XPointer) XNPreeditAttributes; ic_cnt++; - ic_a[ic_cnt] = (XPointer) pe_attr; ic_cnt++; - } - - if (st_cnt > 0) { - 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], NULL); - ic_a[ic_cnt] = (XPointer) XNStatusAttributes; ic_cnt++; - ic_a[ic_cnt] = (XPointer) st_attr; ic_cnt++; - } - 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], NULL); - 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 = 0; - - 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) { - pe_a[pe_cnt] = (XPointer) XNFontSet; pe_cnt++; - pe_a[pe_cnt] = (XPointer) p->font_set; pe_cnt++; - st_a[st_cnt] = (XPointer) XNFontSet; st_cnt++; - st_a[st_cnt] = (XPointer) p->font_set; st_cnt++; - if (p->font_set) { - height = maxAscentOfFontSet(p->font_set) - + maxDescentOfFontSet(p->font_set); - } - height = SetVendorShellHeight(ve, height); - } - if (p->flg & CIFg) { - pe_a[pe_cnt] = (XPointer) XNForeground; pe_cnt++; - pe_a[pe_cnt] = (XPointer) p->foreground; pe_cnt++; - st_a[st_cnt] = (XPointer) XNForeground; st_cnt++; - st_a[st_cnt] = (XPointer) p->foreground; st_cnt++; - } - if (p->flg & CIBg) { - pe_a[pe_cnt] = (XPointer) XNBackground; pe_cnt++; - pe_a[pe_cnt] = (XPointer) p->background; pe_cnt++; - st_a[st_cnt] = (XPointer) XNBackground; st_cnt++; - st_a[st_cnt] = (XPointer) p->background; st_cnt++; - } - if (p->flg & CIBgPixmap) { - pe_a[pe_cnt] = (XPointer) XNBackgroundPixmap; pe_cnt++; - pe_a[pe_cnt] = (XPointer) p->bg_pixmap; pe_cnt++; - st_a[st_cnt] = (XPointer) XNBackgroundPixmap; st_cnt++; - st_a[st_cnt] = (XPointer) p->bg_pixmap; st_cnt++; - } - if (p->flg & CILineS) { - pe_a[pe_cnt] = (XPointer) XNLineSpace; pe_cnt++; - pe_a[pe_cnt] = (XPointer) p->line_spacing; pe_cnt++; - st_a[st_cnt] = (XPointer) XNLineSpace; st_cnt++; - 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); - pe_a[pe_cnt] = (XPointer) XNSpotLocation; pe_cnt++; - 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); - pe_a[pe_cnt] = (XPointer) XNArea; pe_cnt++; - pe_a[pe_cnt] = (XPointer) &pe_area; pe_cnt++; - } - } - - if (pe_cnt > 0) { - 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], NULL); - ic_a[ic_cnt] = (XPointer) XNPreeditAttributes; ic_cnt++; - ic_a[ic_cnt] = (XPointer) pe_attr; ic_cnt++; - } - if (st_cnt > 0) { - 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], NULL); - ic_a[ic_cnt] = (XPointer) XNStatusAttributes; ic_cnt++; - ic_a[ic_cnt] = (XPointer) st_attr; ic_cnt++; - } - if (focus == TRUE) { - ic_a[ic_cnt] = (XPointer) XNFocusWindow; ic_cnt++; - ic_a[ic_cnt] = (XPointer) XtWindow(w); ic_cnt++; - } - if (ic_cnt > 0) { - 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], NULL); - 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) -{ - VendorShellWidget vw; - - if ((vw = SearchVendorShell(w)) && 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/nx-X11/lib/Xaw/XawImP.h b/nx-X11/lib/Xaw/XawImP.h deleted file mode 100644 index e36f5050f..000000000 --- a/nx-X11/lib/Xaw/XawImP.h +++ /dev/null @@ -1,213 +0,0 @@ -/* $Xorg: XawImP.h,v 1.4 2001/02/09 02:03:47 xorgcvs Exp $ */ - -/* - * 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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.8 2001/01/17 19:42:36 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 - -#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/nx-X11/lib/Xaw/XawInit.c b/nx-X11/lib/Xaw/XawInit.c deleted file mode 100644 index 79bc78a5e..000000000 --- a/nx-X11/lib/Xaw/XawInit.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * $Xorg: XawInit.c,v 1.4 2001/02/09 02:03:47 xorgcvs Exp $ - * -Copyright 1989, 1998 The Open Group -Copyright 2003-2004 Roland Mainz - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.9 2001/01/17 19:42:36 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include "Private.h" - -void -XawInitializeWidgetSet(void) -{ - static Boolean firsttime = True; - - if (firsttime) { - firsttime = False; -#ifndef OLDXAW - XawPixmapsInitialize(); - XawInitializeDefaultConverters(); -#endif - XtInitializeWidgetClass(vendorShellWidgetClass); - } -} - -/* XawOpenApplication() - mainly identical to XtOpenApplication() but - * takes a |Display *| and |Screen *| as arguments, too... */ -Widget XawOpenApplication(XtAppContext *app_context_return, - Display *dpy, - Screen *screen, - String application_name, - String application_class, - WidgetClass widget_class, - int *argc, - String *argv) -{ - Widget toplevel; - Cardinal n; - Arg args[2]; - - XtToolkitInitialize(); - *app_context_return = XtCreateApplicationContext(); - if( *app_context_return == NULL ) - return NULL; - - XtDisplayInitialize(*app_context_return, dpy, - application_name, application_class, - NULL, 0, - argc, argv); - - n = 0; - if (screen) { - XtSetArg(args[n], XtNscreen, screen); n++; - } - toplevel = XtAppCreateShell(application_name, - application_class, - widget_class, - dpy, - args, n); - - return toplevel; -} - diff --git a/nx-X11/lib/Xaw/XawInit.h b/nx-X11/lib/Xaw/XawInit.h deleted file mode 100644 index 31852e283..000000000 --- a/nx-X11/lib/Xaw/XawInit.h +++ /dev/null @@ -1,64 +0,0 @@ -/* $Xorg: XawInit.h,v 1.5 2001/02/09 02:03:47 xorgcvs Exp $ - * -Copyright 1989, 1994, 1998 The Open Group -Copyright 2003-2004 Roland Mainz - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.12 2001/01/17 19:42:36 dawes Exp $ */ - -/* $XdotOrg: xc/lib/Xaw/XawInit.h,v 1.3 2005/07/03 07:00:56 daniels Exp $ */ -#ifndef _XawInit_h -#define _XawInit_h - -#define XawVendor XVENDORNAMESHORT - -#ifdef OLDXAW -#define XawVersion 6700002L -#else -#define XawVersion 7000002L - -typedef struct _XawDL XawDisplayList; -#endif /* OLDXAW */ - -#include - -_XFUNCPROTOBEGIN - -void XawInitializeWidgetSet(void); -#ifndef OLDXAW -void XawInitializeDefaultConverters(void); -#endif - -extern Widget XawOpenApplication( - XtAppContext *app_context_return, - Display *dpy, - Screen *screen, - String application_name, - String application_class, - WidgetClass widget_class, - int *argc, - String *argv -); - -_XFUNCPROTOEND - -#endif /* _XawInit_h */ diff --git a/nx-X11/lib/Xaw/genlist.sh b/nx-X11/lib/Xaw/genlist.sh deleted file mode 100644 index e920337fd..000000000 --- a/nx-X11/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 < -#include - -EOF -egrep '^extern WidgetClass' $tmp -echo "" -cat < -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if !defined(OLDXAW) && !defined(XAW7) -#include -#endif - -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; - -#if !defined(OLDXAW) && !defined(XAW7) -extern XawPrintShellClassRec xawPrintShellClassRec; -WidgetClass xawPrintShellWidgetClass = (WidgetClass) &xawPrintShellClassRec; -#endif - -#endif /* SUNSHLIB */ diff --git a/nx-X11/lib/Xaw6/Imakefile b/nx-X11/lib/Xaw6/Imakefile deleted file mode 100644 index 58b54b228..000000000 --- a/nx-X11/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 $(OSOBJS) - -INCLUDES = -I$(AWIDGETSRC) - -#include - -#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/nx-X11/lib/Xaw6/Xaw-def.cpp b/nx-X11/lib/Xaw6/Xaw-def.cpp deleted file mode 100644 index 5fcdc9352..000000000 --- a/nx-X11/lib/Xaw6/Xaw-def.cpp +++ /dev/null @@ -1,144 +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 -#ifndef __UNIXOS2__ - vendorShellClassRec DATA - vendorShellWidgetClass DATA -#endif - 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 -#ifdef __UNIXOS2__ /* xconsole */ - _XawTextGetSTRING - _XawTextShowPosition - XawTextGetSink - _XawTextBuildLineTable - _XawTextNeedsUpdating -#endif -/* $Xorg: Xaw-def.cpp,v 1.3 2000/08/17 19:45:44 cpqbld Exp $ */ -/* $XFree86$ */ diff --git a/nx-X11/lib/Xaw7/Imakefile b/nx-X11/lib/Xaw7/Imakefile deleted file mode 100644 index d6dcc2e9a..000000000 --- a/nx-X11/lib/Xaw7/Imakefile +++ /dev/null @@ -1,336 +0,0 @@ -XCOMM $Xorg$ -#define DoNormalLib NormalLibXaw7 -#define DoSharedLib SharedLibXaw7 -#define DoExtraLib SharedLibXaw7 -#define DoDebugLib DebugLibXaw7 -#define DoProfileLib ProfileLibXaw7 -#define HasSharedData YES -#define LibName Xaw -#define SoRev SOXAW7REV - -#if BuildXaw -# define LibHeaders NO -# define NoSoSymlink -#else /* !BuildXaw */ -# define IncSubdir X11 -# define IncSubSubdir Xaw - -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 -#endif /* !BuildXaw */ - -#ifdef SharedXaw7Reqs -REQUIREDLIBS = SharedXaw7Reqs -#endif - -DEFINES = XawI18nDefines -DXAW7 -DPROJECT_ROOT=\"$(PROJECTROOT)\" $(VENDOR_DEFINES) - - 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 \ - 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 - -#if DoSharedLib && SharedDataSeparation -SpecialCObjectRule(sharedlib,NullParameter,$(SHLIBDEF)) -#endif - -#if !BuildXaw -MANSUFFIX = $(LIBMANSUFFIX) -InstallManPage(Xaw,$(LIBMANDIR)) -#endif - -#if SharedDataSeparation -UNSHAREDOBJS = AllWidgets.o sharedlib.o -#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(Tip.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)) - -LinkSourceFile(AllWidgets.h,$(AWIDGETSRC)) -LinkSourceFile(AsciiSink.h,$(AWIDGETSRC)) -LinkSourceFile(AsciiSinkP.h,$(AWIDGETSRC)) -LinkSourceFile(AsciiSrc.h,$(AWIDGETSRC)) -LinkSourceFile(AsciiSrcP.h,$(AWIDGETSRC)) -LinkSourceFile(AsciiText.h,$(AWIDGETSRC)) -LinkSourceFile(AsciiTextP.h,$(AWIDGETSRC)) -LinkSourceFile(Box.h,$(AWIDGETSRC)) -LinkSourceFile(BoxP.h,$(AWIDGETSRC)) -LinkSourceFile(Cardinals.h,$(AWIDGETSRC)) -LinkSourceFile(Command.h,$(AWIDGETSRC)) -LinkSourceFile(CommandP.h,$(AWIDGETSRC)) -LinkSourceFile(Dialog.h,$(AWIDGETSRC)) -LinkSourceFile(DialogP.h,$(AWIDGETSRC)) -LinkSourceFile(Form.h,$(AWIDGETSRC)) -LinkSourceFile(FormP.h,$(AWIDGETSRC)) -LinkSourceFile(Grip.h,$(AWIDGETSRC)) -LinkSourceFile(GripP.h,$(AWIDGETSRC)) -LinkSourceFile(Label.h,$(AWIDGETSRC)) -LinkSourceFile(LabelP.h,$(AWIDGETSRC)) -LinkSourceFile(List.h,$(AWIDGETSRC)) -LinkSourceFile(ListP.h,$(AWIDGETSRC)) -LinkSourceFile(MenuButton.h,$(AWIDGETSRC)) -LinkSourceFile(MenuButtoP.h,$(AWIDGETSRC)) -LinkSourceFile(MultiSrc.h,$(AWIDGETSRC)) -LinkSourceFile(MultiSrcP.h,$(AWIDGETSRC)) -LinkSourceFile(MultiSink.h,$(AWIDGETSRC)) -LinkSourceFile(MultiSinkP.h,$(AWIDGETSRC)) -LinkSourceFile(Paned.h,$(AWIDGETSRC)) -LinkSourceFile(PanedP.h,$(AWIDGETSRC)) -LinkSourceFile(Panner.h,$(AWIDGETSRC)) -LinkSourceFile(PannerP.h,$(AWIDGETSRC)) -LinkSourceFile(Porthole.h,$(AWIDGETSRC)) -LinkSourceFile(PortholeP.h,$(AWIDGETSRC)) -LinkSourceFile(Private.h,$(AWIDGETSRC)) -LinkSourceFile(Repeater.h,$(AWIDGETSRC)) -LinkSourceFile(RepeaterP.h,$(AWIDGETSRC)) -LinkSourceFile(Reports.h,$(AWIDGETSRC)) -LinkSourceFile(Scrollbar.h,$(AWIDGETSRC)) -LinkSourceFile(ScrollbarP.h,$(AWIDGETSRC)) -LinkSourceFile(Simple.h,$(AWIDGETSRC)) -LinkSourceFile(SimpleP.h,$(AWIDGETSRC)) -LinkSourceFile(SimpleMenu.h,$(AWIDGETSRC)) -LinkSourceFile(SimpleMenP.h,$(AWIDGETSRC)) -LinkSourceFile(Sme.h,$(AWIDGETSRC)) -LinkSourceFile(SmeP.h,$(AWIDGETSRC)) -LinkSourceFile(SmeBSB.h,$(AWIDGETSRC)) -LinkSourceFile(SmeBSBP.h,$(AWIDGETSRC)) -LinkSourceFile(SmeLine.h,$(AWIDGETSRC)) -LinkSourceFile(SmeLineP.h,$(AWIDGETSRC)) -LinkSourceFile(StripChart.h,$(AWIDGETSRC)) -LinkSourceFile(StripCharP.h,$(AWIDGETSRC)) -LinkSourceFile(Template.c,$(AWIDGETSRC)) -LinkSourceFile(Template.h,$(AWIDGETSRC)) -LinkSourceFile(TemplateP.h,$(AWIDGETSRC)) -LinkSourceFile(Text.h,$(AWIDGETSRC)) -LinkSourceFile(TextP.h,$(AWIDGETSRC)) -LinkSourceFile(TextSink.h,$(AWIDGETSRC)) -LinkSourceFile(TextSinkP.h,$(AWIDGETSRC)) -LinkSourceFile(TextSrc.h,$(AWIDGETSRC)) -LinkSourceFile(TextSrcP.h,$(AWIDGETSRC)) -LinkSourceFile(Tip.h,$(AWIDGETSRC)) -LinkSourceFile(TipP.h,$(AWIDGETSRC)) -LinkSourceFile(Toggle.h,$(AWIDGETSRC)) -LinkSourceFile(ToggleP.h,$(AWIDGETSRC)) -LinkSourceFile(Tree.h,$(AWIDGETSRC)) -LinkSourceFile(TreeP.h,$(AWIDGETSRC)) -LinkSourceFile(VendorEP.h,$(AWIDGETSRC)) -LinkSourceFile(Viewport.h,$(AWIDGETSRC)) -LinkSourceFile(ViewportP.h,$(AWIDGETSRC)) -LinkSourceFile(XawI18n.h,$(AWIDGETSRC)) -LinkSourceFile(XawImP.h,$(AWIDGETSRC)) -LinkSourceFile(XawInit.h,$(AWIDGETSRC)) - -#if !BuildXaw -LinkSourceFile(Xaw.man,$(AWIDGETSRC)) -#endif - -DependTarget() diff --git a/nx-X11/lib/Xaw7/Xaw-def.cpp b/nx-X11/lib/Xaw7/Xaw-def.cpp deleted file mode 100644 index 5b504d4fa..000000000 --- a/nx-X11/lib/Xaw7/Xaw-def.cpp +++ /dev/null @@ -1,156 +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 -#ifndef __UNIXOS2__ - vendorShellClassRec DATA - vendorShellWidgetClass DATA -#endif - 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 -#ifdef __UNIXOS2__ /* xconsole */ - _XawTextGetSTRING - XawTextSourceAddEntity - XawTextSourceAnchorAndEntity - XawTextSourceNextAnchor - XawTextSourcePrevAnchor - XawTextSourceFindAnchor - _XawTextShowPosition - _XawTextSrcUndo - XawTextSinkConvertPropertyList - XawTextGetSink - _XawTextBuildLineTable - XawTextSourceClearEntities - _XawTextNeedsUpdating - XawTextSinkCopyProperty - XawTextSinkGetProperty - XawTextSinkCombineProperty - XawTextSinkAddProperty - XawTextLastPosition -#endif -/* $Xorg$ */ diff --git a/nx-X11/lib/Xbsd/Berklib.c b/nx-X11/lib/Xbsd/Berklib.c deleted file mode 100644 index 0e36c2e61..000000000 --- a/nx-X11/lib/Xbsd/Berklib.c +++ /dev/null @@ -1,331 +0,0 @@ -/* $Xorg: Berklib.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $ */ -/* - -Copyright 1987, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be 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/Xbsd/Berklib.c,v 3.8 2001/07/25 15:04:49 dawes Exp $ */ - - -/* - * These are routines found in BSD but not on all other systems. The core - * MIT distribution does not use them except for ffs in the server, unless - * the system is seriously deficient. You should enable only the ones that - * you need for your system. Use Xfuncs.h in clients to avoid using the - * slow versions of bcopy, bcmp, and bzero provided here. - */ - -#include - -#ifdef hpux -#define WANT_RANDOM -#define WANT_QUE -#endif - -#ifdef macII -/* silly bcopy in A/UX does not handle overlaps */ -#define WANT_BFUNCS -#define WANT_MEMMOVE -#define NO_BZERO -#define WANT_RANDOM -#endif - -#if defined(SVR4) && !defined(__UNIXWARE__) -#define WANT_BFUNCS -#define WANT_FFS -#define WANT_RANDOM -#endif - -#ifdef hcx -#define WANT_FFS -#endif - -#ifdef SYSV -#ifdef i386 -#if !defined(__SCO__) && !defined(__UNIXWARE__) -#define WANT_FFS -#define WANT_MEMMOVE -#endif -#endif -#endif - -#ifdef _SEQUENT_ -#define WANT_GTOD -#define WANT_FFS -#endif /* _SEQUENT_ */ - -/* you should use Xfuncs.h in code instead of relying on Berklib */ -#ifdef WANT_BFUNCS - -#include - -#if (__STDC__) || defined(SVR4) || defined(hpux) - -#include - -void bcopy (b1, b2, length) - register char *b1, *b2; - register int length; -{ - memmove(b2, b1, (size_t)length); -} - -int bcmp (b1, b2, length) - register char *b1, *b2; - register int length; -{ - return memcmp(b1, b2, (size_t)length); -} - -void bzero (b, length) - register char *b; - register int length; -{ - memset(b, 0, (size_t)length); -} - -#else - -void bcopy (b1, b2, length) - register char *b1, *b2; - register int length; -{ - if (b1 < b2) { - b2 += length; - b1 += length; - while (length--) - *--b2 = *--b1; - } else { - while (length--) - *b2++ = *b1++; - } -} - -#if defined(SYSV) - -#include - -int bcmp (b1, b2, length) - register char *b1, *b2; - register int length; -{ - return memcmp(b1, b2, length); -} - -#ifndef NO_BZERO - -bzero (b, length) - register char *b; - register int length; -{ - memset(b, 0, length); -} - -#endif - -#else - -int bcmp (b1, b2, length) - register char *b1, *b2; - register int length; -{ - while (length--) { - if (*b1++ != *b2++) return 1; - } - return 0; -} - -void bzero (b, length) - register char *b; - register int length; -{ - while (length--) - *b++ = '\0'; -} - -#endif -#endif -#endif /* WANT_BFUNCS */ - -#ifdef WANT_MEMMOVE -char *memmove (b1, b2, length) - register char *b1, *b2; - register int length; -{ - char *sb1 = b1; - - if (b2 < b1) { - b1 += length; - b2 += length; - while (length--) - *--b1 = *--b2; - } else { - while (length--) - *b1++ = *b2++; - } - return sb1; -} -#endif - -#ifdef WANT_FFS -int -ffs(mask) -unsigned int mask; -{ - register i; - - if ( ! mask ) return 0; - i = 1; - while (! (mask & 1)) { - i++; - mask = mask >> 1; - } - return i; -} -#endif - -#ifdef WANT_RANDOM -#if defined(SYSV) || defined(SVR4) || defined(hpux) - -long lrand48(); - -long random() -{ - return (lrand48()); -} - -void srandom(seed) - int seed; -{ - srand48(seed); -} - -#else - -long random() -{ - return (rand()); -} - -void srandom(seed) - int seed; -{ - srand(seed); -} - -#endif -#endif /* WANT_RANDOM */ - -/* - * insque, remque - insert/remove element from a queue - * - * DESCRIPTION - * Insque and remque manipulate queues built from doubly linked - * lists. Each element in the queue must in the form of - * ``struct qelem''. Insque inserts elem in a queue immedi- - * ately after pred; remque removes an entry elem from a queue. - * - * SEE ALSO - * ``VAX Architecture Handbook'', pp. 228-235. - */ - -#ifdef WANT_QUE -struct qelem { - struct qelem *q_forw; - struct qelem *q_back; - char *q_data; - }; - -insque(elem, pred) -register struct qelem *elem, *pred; -{ - register struct qelem *q; - /* Insert locking code here */ - if ( elem->q_forw = q = (pred ? pred->q_forw : pred) ) - q->q_back = elem; - if ( elem->q_back = pred ) - pred->q_forw = elem; - /* Insert unlocking code here */ -} - -remque(elem) -register struct qelem *elem; -{ - register struct qelem *q; - if ( ! elem ) return; - /* Insert locking code here */ - - if ( q = elem->q_back ) q->q_forw = elem->q_forw; - if ( q = elem->q_forw ) q->q_back = elem->q_back; - - /* insert unlocking code here */ -} -#endif /* WANT_QUE */ - -/* - * gettimeofday emulation - * Caution -- emulation is incomplete - * - has only second, not microsecond, resolution. - * - does not return timezone info. - */ - -#ifdef WANT_GTOD - -#ifdef _SEQUENT_ -#include -#endif /* _SEQUENT_ */ - -int gettimeofday (tvp, tzp) - struct timeval *tvp; - struct timezone *tzp; -{ -#ifdef _SEQUENT_ - /* - * Sequent has microsecond resolution. Need to link with -lseq - */ - get_process_stats (tvp, -1, NULL, NULL); -#ifndef SVR4 - if (tzp) - { - tzset (); - tzp->tz_minuteswest = timezone / 60; - tzp->tz_dsttime = daylight; - } -#endif /* SVR4 */ - return (0); -#else /* _SEQUENT_ */ - time (&tvp->tv_sec); - tvp->tv_usec = 0L; - -#ifndef SVR4 - if (tzp) { - fprintf( stderr, - "Warning: gettimeofday() emulation does not return timezone\n" - ); - } -#endif /* SVR4 */ -#endif /* _SEQUENT_ */ -} -#endif /* WANT_GTOD */ diff --git a/nx-X11/lib/Xbsd/Imakefile b/nx-X11/lib/Xbsd/Imakefile deleted file mode 100644 index 19b7c2b8c..000000000 --- a/nx-X11/lib/Xbsd/Imakefile +++ /dev/null @@ -1,16 +0,0 @@ -XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:45:46 cpqbld Exp $ - - - - -XCOMM $XFree86: xc/lib/Xbsd/Imakefile,v 3.2 1999/04/17 09:08:11 dawes Exp $ - -SRCS = Berklib.c -OBJS = Berklib.o - -#undef _LinkBuildLibrary -#define _LinkBuildLibrary(lib) LinkBuildLibrary(lib) -NormalLibraryTarget(Xbsd,$(OBJS)) -InstallLibrary(Xbsd,$(USRLIBDIR)) - -DependTarget() diff --git a/nx-X11/lib/Xevie/AUTHORS b/nx-X11/lib/Xevie/AUTHORS deleted file mode 100644 index b60343fbd..000000000 --- a/nx-X11/lib/Xevie/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Derek Wang, SUN diff --git a/nx-X11/lib/Xevie/Imakefile b/nx-X11/lib/Xevie/Imakefile deleted file mode 100644 index 24e1f6ef2..000000000 --- a/nx-X11/lib/Xevie/Imakefile +++ /dev/null @@ -1,76 +0,0 @@ -XCOMM $XdotOrg: xc/lib/Xevie/Imakefile,v 1.4 2005/10/24 23:30:21 alanc Exp $ - -#ifndef NormalLibXevie -#define NormalLibXevie YES -SOXEVIEREV=1.0.0 -#endif - -#ifndef SharedLibXevie -#define SharedLibXevie YES -#endif - -#define DoNormalLib NormalLibXevie -#define DoSharedLib SharedLibXevie -#define DoDebugLib DebugLibXevie -#define DoProfileLib ProfileLibXevie - -#define LibName Xevie -#define SoRev SOXEVIEREV -#define IncSubdir X11 -#define IncSubSubdir extensions - -#ifdef SharedXevieReqs -REQUIREDLIBS = SharedXevieReqs -#endif - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - -XEVIE_VERSION=1.0.0 - -X_LIBS=-L$(SHLIBDIR) $(XONLYLIB) -X_CFLAGS=-I$(INCROOT) $(THREADS_DEFINES) - -RPATH_CFLAG = HardCodeLibdirFlag - - DEFINES = $(ALLOC_DEFINES) - INCLUDES = -I. -I$(XLIBSRC) -I$(EXTINCSRC) - SRCS = Xevie.c - OBJS = Xevie.o - LINTLIBS = $(LINTXLIB) - -HEADERS= xevieplaceholder.h - -SUBSTVARS=prefix="$(PROJECTROOT)" \ - exec_prefix="$(BINDIR)" \ - libdir="$(USRLIBDIR)" \ - hardcode_libdir_flag_spec="$(RPATH_CFLAG)" \ - includedir="$(INCROOT)" \ - X_LIBS="$(X_LIBS)" \ - X_CFLAGS="$(X_CFLAGS)" \ - VERSION="$(XEVIE_VERSION)" - -#include - -MANSUFFIX = $(LIBMANSUFFIX) - -#define PreprocessManPages -InstallManPage(Xevie,$(LIBMANDIR)) - -DependTarget() - -all:: xevie.pc - -xevie.pc: xevie.pc.in - RemoveFile($@) - sh ../Xcursor/config-subst $(SUBSTVARS) < xevie.pc.in > $@ - -InstallNonExecFile(xevie.pc,$(USRLIBDIR)/pkgconfig) - -clean:: - RemoveFile(xevie.pc) - -#if ExpandManNames -InstallManPageAliases(Xevie,$(LIBMANDIR),XevieQueryVersion XevieStart XevieSelectInput XevieSendEvent XevieEnd) -#endif diff --git a/nx-X11/lib/Xevie/Xevie.c b/nx-X11/lib/Xevie/Xevie.c deleted file mode 100644 index 9698881b5..000000000 --- a/nx-X11/lib/Xevie/Xevie.c +++ /dev/null @@ -1,211 +0,0 @@ -/* $XdotOrg: xc/lib/Xevie/Xevie.c,v 1.3 2005/07/03 07:00:56 daniels Exp $ */ -/************************************************************ - -Copyright 2003 Sun Microsystems, 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, and/or sell copies of the Software, and to permit persons -to whom the Software is furnished to do so, provided that the above -copyright notice(s) and this permission notice appear in all copies of -the Software and that both the above copyright notice(s) and this -permission notice appear in supporting documentation. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT -OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL -INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING -FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, -NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION -WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -Except as contained in this notice, the name of a copyright holder -shall not be used in advertising or otherwise to promote the sale, use -or other dealings in this Software without prior written authorization -of the copyright holder. - -************************************************************/ - -#define NEED_EVENTS -#define NEED_REPLIES -#include -#include -#include -#include -#include - -static XExtensionInfo _xevie_info_data; -static XExtensionInfo *xevie_info = &_xevie_info_data; -static char *xevie_extension_name = XEVIENAME; -static int major_opcode = 0; -static long xevie_mask = 0; - - -/***************************************************************************** - * * - * private utility routines * - * * - *****************************************************************************/ - -static int close_display(); -static /* const */ XExtensionHooks xevie_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, xevie_info, - xevie_extension_name, - &xevie_extension_hooks, - 0, NULL) - -static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xevie_info) - -/***************************************************************************** - * * - * public Xevie Extension routines * - * * - *****************************************************************************/ - -Status -XevieQueryVersion(dpy, major_version_return, minor_version_return) - Display* dpy; - int* major_version_return; - int* minor_version_return; -{ - XExtDisplayInfo *info = find_display (dpy); - xXevieQueryVersionReply rep; - xXevieQueryVersionReq *req; - - XextCheckExtension(dpy, info, xevie_extension_name, False); - - major_opcode = info->codes->major_opcode; - LockDisplay(dpy); - GetReq(XevieQueryVersion, req); - req->reqType = major_opcode; - req->xevieReqType = X_XevieQueryVersion; - req->client_major_version = XEVIE_MAJOR_VERSION; - req->client_minor_version = XEVIE_MINOR_VERSION; - if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - *major_version_return = rep.server_major_version; - *minor_version_return = rep.server_minor_version; - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -/* Win32 reserves 20 colormap entries for its desktop */ -#ifndef TYP_RESERVED_ENTRIES -#define TYP_RESERVED_ENTRIES 20 -#endif - -Status -#if NeedFunctionPrototypes -XevieStart( - Display* dpy) -#else -XevieStart(dpy) - Display* dpy; -#endif -{ - XExtDisplayInfo *info = find_display (dpy); - xXevieStartReply rep; - xXevieStartReq *req; - - XextCheckExtension(dpy, info, xevie_extension_name, False); - - major_opcode = info->codes->major_opcode; - LockDisplay(dpy); - GetReq(XevieStart, req); - req->reqType = major_opcode; - req->xevieReqType = X_XevieStart; - if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - } - UnlockDisplay(dpy); - SyncHandle(); - return(rep.pad1); -} - -Status -XevieEnd(dpy) - Display* dpy; -{ - XExtDisplayInfo *info = find_display (dpy); - xXevieEndReply rep; - xXevieEndReq *req; - - XextCheckExtension (dpy, info, xevie_extension_name, False); - - LockDisplay(dpy); - GetReq(XevieEnd, req); - req->reqType = info->codes->major_opcode; - req->xevieReqType = X_XevieEnd; - - if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - } - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Status -XevieSendEvent(dpy, event, dataType) - Display* dpy; - XEvent* event; - char dataType; -{ - xXevieSendReply rep; - xXevieSendReq *req; - - LockDisplay(dpy); - GetReq(XevieSend, req); - req->reqType = major_opcode; - req->xevieReqType = X_XevieSend; - req->dataType = dataType; - _XEventToWire(dpy, event, &req->event); - if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - } - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Status -XevieSelectInput(dpy, event_mask) - Display* dpy; - long event_mask; -{ - xXevieSelectInputReply rep; - xXevieSelectInputReq *req; - - LockDisplay(dpy); - GetReq(XevieSelectInput, req); - req->reqType = major_opcode; - req->xevieReqType = X_XevieSelectInput; - req->event_mask = event_mask; - xevie_mask = event_mask; - if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - } - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - diff --git a/nx-X11/lib/Xevie/Xevie.man b/nx-X11/lib/Xevie/Xevie.man deleted file mode 100644 index 79aeb18c5..000000000 --- a/nx-X11/lib/Xevie/Xevie.man +++ /dev/null @@ -1,88 +0,0 @@ -.\" -.\" $XdotOrg: xc/lib/Xevie/Xevie.man,v 1.2 2005/04/04 02:41:49 alanc Exp $ -.\" -.\" -.de TQ -.br -.ns -.TP \\$1 -.. -.TH XEVIE __libmansuffix__ __vendorversion__ - -.SH NAME -Xevie \- X Event Interception Extension (XEvIE) -.SH SYNTAX -\&#include -.nf -.sp -Status XevieQueryVersion \^(\^Display *\fIdpy\fP, - int *\fImajor_versionp\fP, - int *\fIminor_versionp\fP\^); -.sp -Status XevieStart \^(\^Display *\fIdpy\fp\^); -.sp -Status XevieSelectInput \^(\^Display *\fIdpy\fP, - long \fIevent_mask\fP\^); -.sp -Status XevieSendEvent \^(\^ - \^(\^Display *\fIdpy\fP, - XEvent *\fIevent\fP, - char *fIdataType\fP\^); -.sp -Status XevieEnd \^(\^Display *\fIdpy\fp\^); -.sp - -.SH ARGUMENTS -.IP \fIdisplay\fP 1i -Specifies the connection to the X server. -.IP \fIevent_mask\fP 1i -Specifies the mask of events to redirect. -.IP \fIdatatype\fP 1i - -XEVIE_MODIFIED or XEVIE_UNMODIFIED - whether the Xevie client -has changed or synthesised this event. - -.SH DATATYPES - - -.SH DESCRIPTION -.B X Event Interception Extension (XEvIE) -is designed for users who need to intercept all the Keyboard and Mouse events. -Programs can determine which events should be forwarded to other clients and -modify the events if necessary. -.PP - -.SH FUNCTIONS - -.B XevieQueryVersion -The XevieQueryVersion function returns the major and minor protocol version -numbers supported by the server. -XevieQueryVersion returns True if success, otherwise, it returns False. - -.B XevieStart -The XevieStart function requests that the X server enable the XEvIE extension. -Once XEvIE is successfully enabled, all the XevieSelectInput specified events -will be sent to the client which has enabled XEvIE. -If XKB or AccessX is enabled, the events that are sent to the XEvIE clients -are XKB/AccessX processed (filtered) ones. - -.B XevieSendEvent -Events are sent back to the X server through XevieSendEvent. - -.B XevieEnd -The XevieEnd function requests that the X server disables the XEvIE extension. -Once XEvIE is disabled successfully, the X server stops sending events to the -XEvIE client. - -.B XevieSelectInput -The XevieSelectInput function requests that the X server reports the keyboard -and pointer events associated with the specified event mask. -By default, X will report KeyPress, KeyRelease, ButtonPress, ButtonRelease -and MotionNotify events. - -.SH RESTRICTIONS -.B Xevie -will remain upward compatible after the current 1.0 release. -.SH AUTHORS -Derek Wang and Stuart Kreitman, Sun Microsystems, Inc. - diff --git a/nx-X11/lib/Xevie/xevie.pc.in b/nx-X11/lib/Xevie/xevie.pc.in deleted file mode 100644 index 88e8b361f..000000000 --- a/nx-X11/lib/Xevie/xevie.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ -xlibs=@X_LIBS@ -xcflags=@X_CFLAGS@ - -Name: Xevie -Description: X Event Interceptor Library -Version: @VERSION@ -Cflags: -I${includedir} ${xcflags} -Libs: -L${libdir} -lXevie ${xlibs} diff --git a/nx-X11/lib/Xevie/xevieplaceholder.h b/nx-X11/lib/Xevie/xevieplaceholder.h deleted file mode 100644 index e69de29bb..000000000 diff --git a/nx-X11/lib/Xfontcache/FontCache.c b/nx-X11/lib/Xfontcache/FontCache.c deleted file mode 100644 index 7561f6605..000000000 --- a/nx-X11/lib/Xfontcache/FontCache.c +++ /dev/null @@ -1,209 +0,0 @@ -/*- - * Copyright (c) 1998-1999 Shunsuke Akiyama . - * 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.8 1999/01/31 12:52:49 akiyama Exp $ - */ -/* $XFree86: FontCache.c,v 1.3 2002/10/16 00:37:28 dawes Exp $ */ - -/* THIS IS NOT AN X CONSORTIUM STANDARD */ - -#define NEED_EVENTS -#define NEED_REPLIES -#include -#include -#include -#include - -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(Display *, XExtCodes *); - -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(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 -FontCacheQueryVersion(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(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(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(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/nx-X11/lib/Xfontcache/Imakefile b/nx-X11/lib/Xfontcache/Imakefile deleted file mode 100644 index dd0e57831..000000000 --- a/nx-X11/lib/Xfontcache/Imakefile +++ /dev/null @@ -1,42 +0,0 @@ -XCOMM Id: Imakefile,v 1.3 1999/01/31 12:54:33 akiyama Exp $ - - - -XCOMM $XFree86: xc/lib/Xfontcache/Imakefile,v 1.5 2003/10/13 21:49:21 herrb 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 - -#ifdef SharedXfontcacheReqs - REQUIREDLIBS = SharedXfontcacheReqs -#endif - - FONTCACHESRCS = FontCache.c - FONTCACHEOBJS = FontCache.o - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - - DEFINES = $(ALLOC_DEFINES) - SRCS = $(FONTCACHESRCS) - OBJS = $(FONTCACHEOBJS) - LINTLIBS = $(LINTXLIB) - -#include - -MANSUFFIX=$(LIBMANSUFFIX) -InstallManPage(LibName,$(LIBMANDIR)) -#if ExpandManNames -InstallManPageAliases(LibName,$(LIBMANDIR),FontCacheQueryExtension FontCacheQueryVersion FontCacheGetCacheSettings FontCacheChangeCacheSettings FontCacheGetCacheStatistics) -#endif - -DependTarget() diff --git a/nx-X11/lib/Xfontcache/Xfontcache-def.cpp b/nx-X11/lib/Xfontcache/Xfontcache-def.cpp deleted file mode 100644 index 26b141aed..000000000 --- a/nx-X11/lib/Xfontcache/Xfontcache-def.cpp +++ /dev/null @@ -1,9 +0,0 @@ -LIBRARY Xfontcache -VERSION LIBRARY_VERSION -EXPORTS - FontCacheChangeCacheSettings - FontCacheGetCacheSettings - FontCacheGetCacheStatistics - FontCacheQueryExtension - FontCacheQueryVersion -/* $XFree86$ */ diff --git a/nx-X11/lib/Xfontcache/Xfontcache.man b/nx-X11/lib/Xfontcache/Xfontcache.man deleted file mode 100644 index 473a4e306..000000000 --- a/nx-X11/lib/Xfontcache/Xfontcache.man +++ /dev/null @@ -1,137 +0,0 @@ -.\" -.\" $XFree86: xc/lib/Xfontcache/Xfontcache.man,v 1.1 2003/10/13 21:19:28 herrb Exp $ -.\" -.\" Copyright (C) 2003 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 NON-INFRINGEMENT. -.\" 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. -.\" -.TH Xfontcache __libmansuffix__ __vendorversion__ -.SH NAME -Xfontcache \- X-TrueType font cache extension client library -.SH SYNOPSIS -.B #include -.PP -.nf -.ta .5i 2i -typedef struct { - long himark; - long lowmark; - long balance; -} FontCacheSettings, *FontCacheSettingsPtr; - -struct cacheinfo { - long hits; - long misshits; - long purged; - long usage; -}; - -typedef struct { - long purge_runs; - long purge_stat; - long balance; - struct cacheinfo f; - struct cacheinfo v; -} FontCacheStatistics, *FontCacheStatisticsPtr; -.fi -.HP -Bool FontCacheQueryExtension(Display *\fIdpy\fP, -int *\fIevent_basep\fP, int *\fIerror_basep\fP\^); -.HP -Status FontCacheQueryVersion(Display *\fIdpy\fP, int *\fImajor_versionp\fP, -int *\fIminor_versionp\fP\^); -.HP -Status FontCacheGetCacheSettings(Display *\fIdpy\fP, -FontCacheSettings *\fIcache info\fP); -.HP -Status FontCacheChangeCacheSettings(Display *\fIdpy\fP, -FontCacheSettings *\fIcache info\fP); -.HP -Status FontCacheGetCacheStatistics(Display *\fIdpy\fP, -FontCacheStatistics *\fIcache statistics info\fP); -.PP -.SH DESCRIPTION -.B FontCache -is an extension that is used by X-TrueType to cache informations about -fonts. -.\" XXXX This should be filled in -.PP -.B FontCacheQueryExtension -returns -.B True -if the -.I FontCache -extension is available on the given display. -A client must call -.B FontCacheQueryExtension -before calling any other Xfontcache function in order -to negotiate a compatible protocol version; otherwise the client will -get undefined behavior (Xfontcache may or may not work). -.PP -.B FontCacheQueryVersion -returns -.B True -if the request succeeded; the values of the major and minor protocol -versions supported by the server are returned in -.I major_versionp -and -.I minor_versionp . -.PP -.B FontCacheGetCacheSettings -should be documented here. -Returns -.B True -on success or -.B False -on failure. -.PP -.B FontCacheChangeCacheSettings -should be documented here. -Returns -.B True -on success or -.B False -on failure. -.PP -.B FontCacheGetCacheStatistics -should be documented here. -Returns -.B True -on success or -.B False -on failure. -.SH "ERRORS" -.B FontCacheChangeCacheSettings -will return -.I BadValue -if passed an illegal parameters for lowmark, himark or balance fields. -.SH "SEE ALSO" -X(__miscmansuffix__) -.SH AUTHOR -Akio Morita, X-TrueType team, Nozomi Ytow. -.SH STABILITY -This API is considered as experimental. The Xfontcache library major -revision may be incremented whenever incompatible changes are done to -the API without notice. Use with care. diff --git a/nx-X11/lib/Xft/AUTHORS b/nx-X11/lib/Xft/AUTHORS deleted file mode 100644 index 2fe754d23..000000000 --- a/nx-X11/lib/Xft/AUTHORS +++ /dev/null @@ -1,10 +0,0 @@ -Keith Packard, of SuSE and HP - -Automake work by Noah Levitt -Frank Giessler - OS/2 -Jungshik Shin - UTF-16 api's -Ralf Habacker, Suhaib Siddiqi - Cygwin port -Marc La France - Sun port -David Dawes - bug fixes, maintenance. - -Our apologies if we've overlooked someone. diff --git a/nx-X11/lib/Xft/COPYING b/nx-X11/lib/Xft/COPYING deleted file mode 100644 index 31a72eed3..000000000 --- a/nx-X11/lib/Xft/COPYING +++ /dev/null @@ -1,22 +0,0 @@ -$Id: COPYING,v 1.3 2005/06/24 22:43:20 alanc Exp $ - -Copyright © 2001,2003 Keith Packard - -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. - diff --git a/nx-X11/lib/Xft/ChangeLog b/nx-X11/lib/Xft/ChangeLog deleted file mode 100644 index 8e6f68250..000000000 --- a/nx-X11/lib/Xft/ChangeLog +++ /dev/null @@ -1,1216 +0,0 @@ -2005-05-17 Egbert Eich - * Xft.h: - gcc4 allows to check if sentinels are correct (a sentinel is the - terminating element in a varargs list). A sentinel needs to be - NULL, not 0 - which doesn't make a difference on 32bit but - matters on 64bit. - Furthermore it can be told that functions have a printf-like - format string and argument list so that they can verify that - both match. - To use these features certain attributes need to be set - which - are compiler specific. To do this we define macros which are - expanded depending on the compiler version. - For now we put those in include/Xfuncproto.h (the XFree86 DDX - layer contains a file compiler.h which however is not visible - outside the DDX) (Bugzilla #3268). - -2005-05-01 Josh Triplett - - * Makefile.am: - * configure.ac: - * xft-config.1.in: - Add Branden Robinson's xft-config manpage. - -2005-04-20 Branden Robinson - - * Xft.3.in: - - Independently document each of the XftTextExtents* functions, - with particular attention to the units the "len" parameter is - measuring for each function. (Thanks to Matthew Allum for the - suggestion.) - - Tweak wording to not risk programmer inference that exposed - functions used internally are not for application usage. - - Don't escape hyphens when we don't really mean it (unescaped - hyphens are perfectly appropriate for hyphenated terms like - "mother-in-law" or "UTF-8". - -2005-04-20 Branden Robinson - - * Xft.3.in: - - Flesh out with more details of constants, data types, and - functions used in the library. This continues to be a - work-in-progress. - - Move Xft 1.x compatibility interfaces to a new subsection of the - "COMPATBILITY" section. - - Add "HEADER FILE" section. - - Add "SEE ALSO" section. - -2005-04-02 Branden Robinson - * Xft.3.in: - Improve roff markup in many respects: - - Don't define a macro we don't use (TQ). - - Eliminate gratuitous blank lines. - - End sentences with newlines so that roff knows when to use - intersentence spacing. - - Consistently use boldface when referring to the Xft library name - and data types. - - Mark up function prototypes more legibly. - - Remove extraneous whitespace characters at ends of lines. - Make editorial changes to improve comprehensibility: - - Delcare manpage name in .TH macro using mixed case. - - Rename "DATATYPES" section to "DATA TYPES". - - Make various wording changes and clarifications. - - Consistently refer to the RENDER extension as the "X Rendering - Extension". - -2005-04-02 Branden Robinson - - * Makefile.am: - Remove $(man_MANS) from EXTRA_DIST; the Xft.3 manpage is generated - by the ./configure script, so there is no need to ship it as part - of the distribution tarball. - Whitespace police. - -2005-03-29 Keith Packard - - * README: - * Xft.h: - * configure.ac: - Update for version 2.1.7 - -2005-03-01 Keith Packard - - * xftdpy.c: (_XftDisplayInfoGet), (XftDefaultSubstitute): - Avoid calling any Render functions when Render is missing (#137) - - * xftglyphs.c: (XftFontLoadGlyphs): - Only clip to bounding box when FC_CHARCELL is specified. - Only fix glyph spacing when FC_MONO is specified. - -2005-02-28 Keith Packard - - * configure.ac: - * xftdpy.c: (_XftDefaultInit), (XftDefaultSubstitute): - * xftfreetype.c: (XftFontInfoFill), (XftFontOpenInfo): - * xftglyphs.c: (XftFontLoadGlyphs): - * xftint.h: - Add support for artificial emboldening of glyphs through - the FT_GlyphSlot_Embolden API when it is available. - - * xftextent.c: (XftGlyphExtents): - Optimize one glyph extents case (it happens a *lot*). - (Ross Burton) - -2004-11-28 James Henstridge - - * xftfreetype.c (_XftReleaseFile): add parentheses in the - expression in the second argument to XftMemFree so that it is - interpreted correctly. - -2004-09-05 Keith Packard - - * configure.ac: - Move AC_CONFIG_AUX_DIR above AM_INIT_AUTOMAKE to make - automake 1.9 happy - -Fri Aug 13 19:47:12 2004 Soeren Sandmann - - * xftint.h: Make HAVE_FT_BITMAP_SIZE_Y_PPEM conditional on the - FreeType version instead of proping it. This way it will work - with the monolithic version too. #1062, Patch by Owen Taylor. - -2004-08-03 Keith Packard - - * xftfreetype.c: (_XftReleaseFile): - Called strlen with (f->file) without checking for NULL (which - happens when directly using FT_Face objects). - -2004-04-14 Keith Packard - - * AUTHORS: - * Makefile.am: - * Xft-def.cpp: - * Xft.3.in: - * Xft.h: - * XftCompat.h: - * configure.ac: - * xftcolor.c: - * xftcore.c: - * xftdbg.c: - * xftdpy.c: - * xftdraw.c: - * xftextent.c: - * xftfont.c: - * xftfreetype.c: (XftFontOpenInfo): - * xftglyphs.c: - * xftinit.c: - * xftint.h: - * xftlist.c: - * xftname.c: - * xftrender.c: - * xftstr.c: - * xftswap.c: - * xftxlfd.c: - Regularize #include usage so that all includes - happen in xftint.h. This allows conditional inclusion - of system headers like string.h/strings.h - - Add GCC warnings on GCC systems. - - Fix CVS Id strings - -2004-03-22 Keith Packard - - * Makefile.am: - * Xft.h: - * configure.ac: - Bump version number to 2.1.6 - Bump .so version to 2.1.2 - -2004-03-19 Keith Packard - - * xftfreetype.c: (_XftSetFace): - Rework bitmap instance selection code to make it look prettier. - Also, try both y_ppem/x_ppem *and* width/height to see - which values will actually manage to load a font -- FreeType 2.1.7 - has broken bdf/pcf loaders. - -2004-03-11 Keith Packard - - * Xft.h: - * configure.ac: - * xftfreetype.c: (_XftSetFace): - Oops. Left #warnings from testing in the release. - Bump to version 2.1.5 and respin the release... - -2004-03-10 Keith Packard - - * Xft.h: - * configure.ac: - Sigh. "someone" released a 2.1.3 without fixing - the version numbers. Update to 2.1.4. - -2004-03-10 Keith Packard - - * Xft.h: - Update version number to 2.1.3 - Change #include syntax for recent FreeType - - * configure.ac: - Update version number to 2.1.3 - Depend on fontconfig 2.2 instead of 2.2.91 - Add check for y_ppem field in FTBitmapSize structure - - * xftdraw.c: (XftDrawRect): - Use PictOpSrc for painting rectangles with XftDrawRect - - * xftdpy.c: (_XftDefaultInit), (XftDefaultSubstitute): - Use FC_HINT_STYLE only when available - - * xftfreetype.c: (_XftSetFace), (XftFontInfoFill): - Search for closest bitmap size when font provides only bitmaps - Use FC_HINT_STYLE only when available - -2004-03-04 Jan van Dijk - - * configure.ac: Updated version check for fontconfig: usage of the - FC_HINT_* macros in Xft requires version >= 2.2.91 - -2004-02-03 Jim Gettys - - * AUTHORS: Get a cut at an author's list. - -2004-01-17 Daniel Stone - * Xft.h, configure.ac: Bump version to 2.1.3, to release for the - first freedesktop.org platform release. - -2004-01-15 Harold L Hunt II - * Makefile.am: Pass -no-undefined to libtool via LDFLAGS. - -2003-12-02 Noah Levitt - - * configure.ac: Sometimes autoconf doesn't set $VERSION, so use - $PACKAGE_VERSION. (#156) - -2003-11-18 Noah Levitt - - * .cvsignore: ignore *.loT - - * Xft.h: Fix build with freetype 2.1.7. (bug #149, Eric - Christopherson) - -2003-09-23 Owen Taylor - - Support FC_HINT_STYLE (#Bug 118) - - * xftfreetype.c: Hook up FC_HINT_STYLE to FT_LOAD_TARGET_LIGHT; - also use FT_LOAD_TARGET_MONO when appropriate. - - * xftdpy.c: Hook up FC_HINT_STYLE to the Xft default system. - -2003-09-05 07:76 keithp - - * xftfreetype.c: use FT_LOAD_TARGET_LCD/FT_LOAD_TARGET_LCD_V - so that the autohinter will snap stems to pixel boundaries - -2003-05-05 22:37 keithp - - * Xft.h, configure.ac: Bump version to 2.1.2 - -2003-05-05 21:50 branden - - * ChangeLog: cvs2cl - -2003-05-05 21:44 keithp - - * configure.ac: Make sure -lXext is included for broken Xrender - packages - -2003-05-05 21:33 branden - - * ChangeLog: Generate ChangeLog with cvs2cl. - -2003-05-02 14:42 keithp - - * xftfreetype.c, xftrender.c: Must switch to non-ARGB format when - mixing ARGB and non-ARGB fonts - -2003-04-30 17:49 branden - - * xft-config.in, xft.pc.in: Add -lX11 to the list of libraries one - needs to link against when using Xft. (Someday, perhaps XFree86 - will support pkg-config...) - -2003-04-30 17:48 branden - - * configure.ac: Add -lXext and -lX11 to XRENDER_LIBS, since the - Xrender library links against those. - -2003-04-30 17:13 keithp - - * xftdraw.c, xftfreetype.c, xftglyphs.c: Avoid uninitialized - fields. Dont call malloc for zero bytes - -2003-04-30 09:48 keithp - - * xftglyphs.c: Walking off the end of the hash table - -2003-04-27 22:20 keithp - - * xftfreetype.c: Mark reduction in memory usage as fonts are - destroyed - -2003-04-25 09:11 keithp - - * Xft.3.in: Fix typo in Xft man page (from Miloslav Trmac - ) - -2003-04-24 09:14 keithp - - * xftfreetype.c: Allow glyphs to range up to num_glyphs to fix PCF - problems - -2003-04-21 10:28 nlevitt - - * .cvsignore: No more question marks. - -2003-04-21 10:18 keithp - - * Makefile.am: Remove bogus extra EXTRA_DIST - -2003-04-21 10:12 keithp - - * ChangeLog, INSTALL, Makefile.am, README, Xft.3.in, Xft.man, - configure.ac: Fix manual page version and install (manx_MANS is - busted) - -2003-04-21 09:59 keithp - - * Makefile.am, Xft.h, configure.ac, xft.pc.in: Remove extra version - number (PACKAGE_VERSION) from confgiure.ac. One (VERSION) seems - like plenty. Bump version to 2.1.1 - -2003-04-19 20:32 nlevitt - - * Makefile.am: Remove XftFreetype.h. - -2003-04-19 19:16 keithp - - * Xft.man: Fix manual page example to use NULL where appropriate - -2003-04-19 19:07 keithp - - * XftFreetype.h: Remove XftFreetype.h - -2003-04-17 16:37 nlevitt - - * .cvsignore: Quiet, please. - -2003-04-17 16:34 nlevitt - - * configure.ac: Check for Xrender with pkg-config first. - -2003-04-17 12:52 nlevitt - - * Makefile.am, autogen.sh: Use libtool 1.5 and -version-info for - library versioning. - -2003-04-17 08:37 nlevitt - - * Xft.man: Remove XftConfig from the man page. - -2003-04-17 08:06 nlevitt - - * Imakefile, config/config-subst: Removed imake files. - -2003-04-17 08:00 nlevitt - - * configure.ac: Require fontconfig >= 1.0.1. - -2003-04-16 23:05 nlevitt - - * configure.ac: Not sure what version of fontconfig we actually - require, but it at least compiles ok with 1.0.1. Requiring >= - 1.0.0. - -2003-04-16 22:00 nlevitt - - * configure.ac: Everything is in the package root. - -2003-04-16 21:57 nlevitt - - * Makefile.am: Everything is in the package root. - -2003-04-16 21:56 nlevitt - - * config/config-subst: Re-adding config-subst, probably shouldn't - have deleted it. - -2003-04-16 21:51 nlevitt - - * Imakefile: Re-adding Imakefile, probably shouldn't have deleted - it. - -2003-04-16 21:29 nlevitt - - * Xft.h, Xft.man, XftCompat.h, XftFreetype.h, xftcolor.c, - xftcore.c, xftdbg.c, xftdpy.c, xftdraw.c, xftextent.c, xftfont.c, - xftfreetype.c, xftglyphs.c, xftinit.c, xftint.h, xftlist.c, - xftname.c, xftrender.c, xftstr.c, xftswap.c, xftxlfd.c: Change - copyright symbol to UTF-8 and replace $ with $. - -2003-04-16 21:16 nlevitt - - * Makefile.am: Include autogen.sh in the distribution. - -2003-04-16 21:15 nlevitt - - * configure.ac: Fail in ./configure if required libraries are not - found. - -2003-04-16 20:19 nlevitt - - * COPYING, Makefile.am, autogen.sh, configure.ac: Initial checking - of automake stuff. - -2003-04-16 20:12 nlevitt - - * Imakefile, Makefile.in, config.h.in, configure.in: Removed old - autoconf stuff. - -2003-04-16 20:09 nlevitt - - * Makefile.in, config.h.in, config/config-subst, - config/config.guess, config/config.sub, config/install.sh: Removed - stuff in config/. - -2003-04-16 19:41 nlevitt - - * xftpat.c: Removing xftpat.c, since it isn't used anymore. - -2003-04-05 05:33 herrb - - * Xft.man: fix man page name to make man -k a bit more useful - -2003-04-03 14:25 dawes - - * xftdraw.c: 51. Fix segfaults that can happen when using - composition of RENDER and - non-RENDER fonts (#A.1656, Wu Jian Feng). - -2003-03-26 12:43 tsi - - * xftfreetype.c: 28. Various build and warning fixes (#A.1703, - Peter Breitenlohner). - 27. Avoid overlapping strcpy() in imake.c (Dan Nelson). - -2003-03-24 20:18 dawes - - * Imakefile, Xft-def.cpp: 26. Updates for building on OS/2 - (#5650, Frank Giessler). - -2003-02-25 14:18 dawes - - * Imakefile: Missing part of libXft minor rev bump (#5652, Mike - Harris). - -2003-02-25 13:57 dawes - - * Xft.h: 954. Bump the libXft minor revision for the UTF-16 APIs - that were added - after rev 2.0 (#A.1643, A.1644, Keith Packard). - -2003-02-15 14:30 dawes - - * xftcore.c: 903. Fix some bugs with Xft drawing to non-Render - enabled servers: - - Drawing monochrome glyphs had an infinite loop. - - XftGlyphSpecCore failed to render some glyphs, leading to - application - crashes from uninitialized values. - (#A.1608, Keith Packard, reported by Nalin Dahyabhai). - -2003-02-12 19:17 dawes - - * xftcore.c: 882. Add missing zero-sized check to one of Xft's - core rendering routines - (#A.1599, Keith Packard). - -2002-12-13 17:59 dawes - - * Xft.h, xftextent.c, xftrender.c: 632. Finish off the UTF-16 APIs - in Xft, and fix the UTF-16 conversion - code in fontconfig (#A.1411, Keith Packard, Jungshik Shin). - -2002-11-14 13:01 tsi - - * Imakefile: First pass at imake warnings. + some ATI driver - formatting changes. - - Please ensure these changes are reflected in DRI's CVS. - -2002-10-19 11:52 herrb - - * Imakefile: Build fix for systems without gcc - -2002-10-16 14:07 keithp - - * xftcore.c: Destroy images when drawing glyphs with the core - protocol - -2002-10-11 10:53 keithp - - * Xft.h, xftcolor.c, xftcore.c, xftdpy.c, xftdraw.c, xftextent.c, - xftfont.c, xftfreetype.c, xftglyphs.c, xftinit.c, xftint.h, - xftrender.c: Add a bunch more consts to Xft and fontconfig apis - -2002-10-04 08:06 keithp - - * Xft.man: Update Xft manual - -2002-10-02 00:10 keithp - - * xftdpy.c: Remove unnecessary link between FC RGBA values and - Render subpixel order constants - -2002-10-02 00:02 keithp - - * XftCompat.h, xftcore.c, xftdpy.c, xftfreetype.c: Make handling of - RGBA constants more consistent and less error prone - -2002-09-25 19:56 keithp - - * xftdpy.c: Add image transformation and sub-pixel ordering to - Render - -2002-09-25 19:55 keithp - - * xftfreetype.c: Wrong datatype caused a warning - -2002-09-25 17:31 keithp - - * xftfreetype.c, xftglyphs.c: Fix file/face locking to make it more - sensible - -2002-09-17 18:25 dawes - - * Xft-def.cpp: 325. Export some more Xft symbols (Cygwin) that are - needed for qt 3.x - (#5285, Ralf Habacker). - 324. Don't sleep on Cygwin for ICE directory mode problems (#5284, - Ralf Habacker). - 323. Fix a bug in XtGetDisplays() with more than 1 open display - (#5282, - Kip Rugger). - CVS - :------------------------------------------------------------------ - ---- - -2002-08-31 15:18 keithp - - * Xft.h: Rename public to pub for c++ - -2002-08-31 11:08 keithp - - * Xft.h, xftdraw.c, xftrender.c, xftxlfd.c: Add XftDrawStringUtf16. - Fix GlyphFontSpecRender where it loads glyphs one at a time. Stop - writing to XLFD string - -2002-08-22 01:09 keithp - - * Xft.h, xftdpy.c, xftdraw.c, xftint.h: Add rectangle clipping, - avoid Xlib whining on servers without Render - -2002-08-12 15:16 keithp - - * xftdpy.c, xftdraw.c, xftfreetype.c, xftglyphs.c, xftint.h, - xftrender.c: Create per-dpy info only when needed, fix fencepost in - indexing array of glyphs - -2002-08-02 11:48 keithp - - * xftdpy.c, xftfreetype.c, xftglyphs.c: _XftCloseDisplay was - corrupting global list. Compute charset at open time for fonts - without them. Dont crash in XftCharIndex when fonts have no - unicode mapping - -2002-07-05 18:24 keithp - - * xftdraw.c, xftextent.c: XftDrawGlyphFontSpec and - XftTextExtentsUtf8 were both horribly broken - -2002-06-19 13:18 keithp - - * xftdpy.c: Add FC_AUTOHINT and FC_HINTING to X resources - -2002-06-19 13:18 keithp - - * xftint.h: remove a couple of duplicate function declarations - -2002-06-19 13:08 keithp - - * xftfont.c: Add a bit of error reporting on font open failure - -2002-06-07 10:55 keithp - - * configure.in: Make autoconf use correct options to build solaris - shared libraries - -2002-06-02 13:52 keithp - - * xftfreetype.c, xftglyphs.c, xftint.h: Add aspect ratio support to - Xft and fontconfig - -2002-06-02 13:33 keithp - - * xftfreetype.c, xftglyphs.c: Transform global font metrics with - font matrix - -2002-05-31 16:21 keithp - - * xftfreetype.c, xftint.h: Add support for user-provided freetype - faces to Xft - -2002-05-31 00:01 keithp - - * Makefile.in: Fix autoconf make install in Xft to remove link - targets before linking - -2002-05-30 23:52 keithp - - * Imakefile: Fix Xft2 to build right library version on old systems - with xmkmf. Fix fc-cache location for xmkmf out-of-tree build on - old systems - -2002-05-30 21:45 keithp - - * Imakefile, Xft.h, xftcore.c, xftdpy.c, xftfreetype.c, - xftglyphs.c, xftint.h: Interpose the XftFontInfo structure between - patterns and fonts. Fix image leak in core drawing code. Attempt - to deal with xmkmf and pre-fontconfig config files. Save closed - fonts for a while. - -2002-05-28 09:15 keithp - - * xftrender.c: Fix obvious bug in XftTextRenderUtf8 - -2002-05-28 09:11 keithp - - * xftdraw.c: Fix obvious bugs in XftDrawStringUtf8 - -2002-05-28 08:59 keithp - - * xft-config.in: xft-config was returning -lxft instead of -lXft - -2002-05-25 06:52 herrb - - * Imakefile: $< in a non-implicit rule is a GNU-makeism. It's not - supported by BSD make. - -2002-05-25 05:03 alanh - - * Xft-def.cpp: #5283, Fix Xft-def.cpp for Cygwin/XFree86 - -2002-05-24 00:02 keithp - - * xftname.c: Add XftNameUnparse - -2002-05-23 23:26 keithp - - * Makefile.in: Clean up autoconf install to obey DESTDIR - -2002-05-23 22:54 keithp - - * Xft.h, XftCompat.h, xftdraw.c, xftint.h: Add XftSetSubwindowMode - and another c++ compatiblity cast - -2002-05-23 16:18 keithp - - * Makefile.in: Few autoconf build fixes - -2002-05-23 16:01 keithp - - * Imakefile, Makefile.in, Xft.h, config.h.in, configure.in, - xft-config.in, xft.pc.in, xftinit.c, config/config-subst, - config/config.guess, config/config.sub, config/install.sh: Add - autoconf build support to Xft - -2002-05-22 10:15 keithp - - * xftdpy.c, xftglyphs.c: Add debugging to check memory stats, dont - attempt to rasterize glyphs twice - -2002-05-22 10:14 keithp - - * XftCompat.h: Allow Xft1 c++ programs to compile without - signed/unsigned type error - -2002-05-13 12:06 keithp - - * Xft.h, xftdraw.c: Expose useful XftDrawSrcPicture function - -2002-04-10 09:20 tsi - - * xftfreetype.c: Warnings - -2002-03-04 13:15 tsi - - * xftdpy.c: Warning fixes - -2002-02-20 21:30 keithp - - * Xft.h: Fix Xft.h for use by C++ progs - -2002-02-19 16:54 keithp - - * Imakefile: Switch Xft from referencing libxml2 to expat - -2002-02-18 23:56 keithp - - * xftdraw.c, xftfreetype.c: check for region equality in - XftDrawSetClip - -2002-02-18 23:51 keithp - - * Xft.h, XftCompat.h, xftcore.c, xftrender.c: Fix - CharSpec/GlyphSpec rendering - -2002-02-14 23:46 keithp - - * XftConfig.cpp: Remove prototype Xft configuration file; its not - used anymore - -2002-02-14 23:37 keithp - - * XftCompat.h, xftswap.c: Add a few missing files from the Xft 2 - update - -2002-02-14 23:36 keithp - - * Imakefile, Xft.h, XftConfig.cpp, XftFreetype.h, xftcache.c, - xftcfg.c, xftcore.c, xftdbg.c, xftdir.c, xftdpy.c, xftdraw.c, - xftextent.c, xftfont.c, xftfreetype.c, xftfs.c, xftglyphs.c, - xftgram.y, xftinit.c, xftint.h, xftlex.l, xftlist.c, xftmatch.c, - xftmatrix.c, xftname.c, xftpat.c, xftrender.c, xftstr.c, xftxlfd.c: - Update to Xft version 2 - -2002-01-16 13:50 tsi - - * xftcfg.c, xftint.h: Resync with 4.1.99.6 - -2002-01-12 12:46 keithp - - * xftcfg.c, xftint.h: Xft crashed doing multiple edits to same - field. Also made edit debug use XFT_DEBUG. - -2001-12-18 09:08 tsi - - * xftdpy.c, xftfreetype.c, xftint.h: Another resync with HEAD - branch. - -2001-12-13 09:26 keithp - - * xftdpy.c, xftfreetype.c, xftint.h: Make freetype cache - per-display - -2001-11-21 15:41 keithp - - * XftConfig.cpp: Fix aliasing for Luxi font name change - -2001-11-21 13:31 dawes - - * XftConfig.cpp: 499. Add new Luxi fonts from Bigelow & Holmes - (#5010, Charles Bigelow and - Kris Holmes, integrated by Juliusz Chroboczek). - -2001-11-17 00:22 keithp - - * xftglyphs.c: Force outline load as Xft doesnt deal with bitmaps - yet - -2001-10-27 20:32 tsi - - * xftfreetype.c: 407. Fix for threaded libraries (Marc La France). - 406. Finish removal of SuperProbe (Marc La France). - 405. A rather large number of warning fixes throughout (Marc La - France). - 404. Fix bug in HTML install script (Marc La France). - 403. Missing ident lines for some XFree86-modified files (Marc La - France). - 402. Add default half-width doublescanned modes (Marc La France). - 401. Mark all driver-registered resources with ResBus (Maarc La - France). - 400. Fix DPMS-related build problem (Marc La France). - 399. Log a message just before calling each ChipProbe() during - '-probe' - processing (Marc La France). - 398. Temporarily disable ISA probing on SPARCs and PowerPCs (Marc - La France). - 397. Add PCI IDs for Sun hardware (Marc La France). - 396. Fix memory leak in resource relocation (Marc La France). - 395. Do not relocate resources that only conflict with disabled - non-video PCI - devices or disabled PCI ROMs (Marc La France). - 394. Re-organise SBUS code (Marc La France). - 393. Add as-yet-unused definitions for PCI resource types other - than I/O and - memory (Marc La France). - 392. Add doc for Solaris, but don't format it yet (Marc La - France). - 391. Normalise driver names (Marc La France). - 390. For SPARCs, disable DGA support in ATI driver (Marc La - France). - 389. Clean up some debugging messages (Marc La France). - 388. Fix newport driver for when a /proc fs isn't mounted (Marc La - France). - 387. Fix DAC handling bugs in s3 driver (Marc La France). - 386. Fix resource registration bug for PCI Tseng's (Marc La - France). - 385. Add aperture driver for Solaris (not yet used) (Marc La - France). - 384. Rework scanpci to fix problems that prevented it from - completely - displaying non-PCI bridges and Simba bridges (Marc La - France). - 383. Fix build problems in some input drivers (Marc La France). - 382. Fix int10 compile problem for SPARCs and PowerPCs (Marc La - France). - 381. Ensure master aborts on secondary buses complete normally - during PCI - scans (Marc La France). - 380. Some memory mapping and Solaris cleanups (Marc La France). - -2001-09-29 10:47 herrb - - * Imakefile: whitespace fix - -2001-09-21 12:54 keithp - - * xftfreetype.c, xftmatch.c: Make XFT_ANTIALIAS much less important - in the match - -2001-07-13 11:16 keithp - - * xftint.h, xftrender.c: Change unsigned int to XftChar32 - everywhere else, fix RenderExtents{16,32,Utf8} to match - RenderExtents8 - -2001-06-11 15:53 keithp - - * xftcache.c: lib/Xft: handle truetype fontfiles with more than one - font -- .xftcache was getting busted - -2001-05-18 09:03 tsi - - * xftint.h, xftlex.l: 543. Back out sunleo conversion to fb. This - driver is too heavily dependent - on cfb32 for a simple fb conversion (Marc La France). - 542. Miscellaneous build/warning fixes (Marc La France). - 541. More prep work for SunOS (Marc La France). - 540. Fix libXft build on SunOS (Marc La France). - 539. Another makedepend bug fix (Marc La France). - 538. Fix use of xftcache utility during !UseInstalled builds (Marc - La France). - -2001-05-16 12:20 keithp - - * xftdraw.c: Use PictOpOver for XftDrawRect - -2001-05-16 10:20 keithp - - * xftcolor.c: Allow apps to allocate non-opaque colors in - XftColorAllocValue, even though they wont work without Render - -2001-05-16 03:32 keithp - - * xftdir.c, xftfreetype.c, xftglyphs.c, xftgram.y, xftlex.l: Clean - up memory leaks in Xft, remove mono spacing attribute from TT fonts - -2001-04-28 20:21 keithp - - * Xft.h, xftdpy.c: Add Xft.dpi resource to override server provided - resolution value - -2001-04-27 07:55 tsi - - * Imakefile, XftConfig.cpp: Build fix - -2001-04-21 09:58 keithp - - * xftrender.c: Fix extents computation for FreeType fonts - -2001-04-19 09:07 dawes - - * Imakefile: 402. Install the XftConfig file under $(CONFDIR), - with a link from the - usual place (based on #4569, Branden Robinson). - 401. Update the Debian section on linux.cf (#4568, Branden - Robinson). - -2001-04-05 12:29 dawes - - * Xft-def.cpp: 341. Add a driver for VMware virtual SVGA devices. - This is for use - by X servers running under a VMware guest OS (#4529, VMware, - Inc). - 340. Remove Cygwin-specific #ifdef in Xserver/os/Waitfor.c, which - fixes - a crash (#4528, Suhaib Siddiqi). - 339. Cygwin build fixes (#4527, Suhaib Siddiqi). - - fix some doc typos - -2001-04-01 07:00 tsi - - * xftdraw.c, xftextent.c, xftfreetype.c, xftglyphs.c, xftstr.c: - 317. glxinfo needs libGLU (Marc La France). - 316. Rage128 fix to Cards database (Marc La France). - 315. Minor fix to PCI resource overlap handling (Marc La France). - 314. Loader code simplification and IA-64 cache flushes (Marc La - France). - 313. Workaround in the ATI driver for troublesome interaction - between loader - and compiler optimisation (Marc La France). - 312. Warning fixes for `gcc -fno-builtin`, which appears to be the - default on - some systems (Marc La France). - - + more of #301, tags, warnings and build fixes. - -2001-03-31 15:07 keithp - - * XftFreetype.h: Reorder struct elements in exposed datatype to - provide backward compatibility - -2001-03-30 17:57 keithp - - * xftcfg.c, xftdbg.c, xftglyphs.c, xftgram.y, xftint.h, xftlex.l: + - Add matrix support to XftConfig files + Change SwitchYYPrefix to - edit __REALLY_YY__ back to yy + Add change log entry for glyph - transformations in Xft - -2001-03-30 10:50 keithp - - * Imakefile, Xft.h, XftFreetype.h, xftdbg.c, xftdraw.c, - xftfreetype.c, xftglyphs.c, xftint.h, xftmatrix.c, xftname.c, - xftpat.c: Add matrix transformations to Freetype fonts - -2001-03-29 18:15 keithp - - * XftFreetype.h, xftint.h: Add Xmuu library to remove requirement - for Xt/Xaw from most X utilities Add i810 and Xv support to kdrive - -2001-03-18 06:50 dawes - - * Imakefile: rework the Freetype2 switches - -2001-03-12 08:03 keithp - - * Imakefile: Add freetype2 to 4.0.2 branch - -2001-03-10 03:43 keithp - - * xftstr.c: Guard against broken fonts with missing fields - -2001-03-06 10:00 keithp - - * xftmatch.c: xft: make font spacing less important than font - family - -2001-02-13 11:19 dawes - - * Xft-def.cpp: 135. Updates for Cygwin support (#4433, Suhaib M. - Siddiqi). - 134. Fix a bug in the fonts.sgml doc (#4432, Juliusz Chroboczek). - 133. Fix the xdpyinfo so that it will build when the XKB extension - isn't - defined (#4422, Jim Gettys). - 132. Fix the xdm greeter so that it will build when the XKB - extension isn't - defined (#4421, Jim Gettys). - 131. Only build setxkbmap when building the XKB lib support (based - on #4420, - Jim Gettys). - 130. Improve the mga driver messages when the HAL module isn't - available - (#4451, David Woodhouse). - 129. Add G450 support to the mga driver (#4416, Luugi Marsan - (Matrox), - 4449, David Woodhouse). - 128. Mga driver updates, including HAL cleanups, add a Crtc2Ram - option, - and merge with Matrox beta4 source (#4415, Antii Tapaninen, - #4423, - Simon Hosie). - 127. Fix a rounding problem in the wacom driver that was causing - some - position instability (#4417, Hannes Eriksson). - -2001-02-08 16:35 keithp - - * Imakefile: Fix Freetype2 compilation, document changed Freetype - status - -2001-01-26 12:51 keithp - - * Xft.h, xftdpy.c, xftfreetype.c, xftglyphs.c, xftint.h, - xftmatch.c, xftname.c: Add a bit more debug to Xft along with - vertical sub-pixel decimation - -2001-01-01 18:46 keithp - - * Imakefile, Xft.h, XftFreetype.h, xftcache.c, xftcfg.c, xftdir.c, - xftfreetype.c, xftgram.y, xftint.h, xftlex.l, xftname.c: Add - FreeType font file info caching - -2000-12-21 21:05 tsi - - * XftFreetype.h, xftfreetype.c, xftint.h, xftname.c, xftxlfd.c: - Build fixes - -2000-12-21 18:25 keithp - - * XftFreetype.h, xftfreetype.c, xftglyphs.c, xftint.h: Move - XftFreeTypeSetFace to XftFreetype.h - -2000-12-20 02:24 keithp - - * xftstr.c: Xft: fix utf8->ucs4 conversion - -2000-12-19 16:28 keithp - - * Xft.h, XftFreetype.h, xftcore.c, xftdraw.c, xftextent.c, - xftint.h, xftrender.c, xftstr.c: Add UTF-8 support to Xft - -2000-12-19 16:20 keithp - - * Xft.h, XftFreetype.h, xftdpy.c, xftdraw.c, xftfont.c, - xftfreetype.c, xftglyphs.c, xftint.h, xftname.c, xftxlfd.c: Xft: - Add font/face sharing. Improve debug. Add minspace for Dirk and - Linus. - -2000-12-17 01:11 keithp - - * xftcfg.c: Xft: correct order of config file tests - -2000-12-17 00:30 keithp - - * xftdpy.c: Xft: unintialized variable - -2000-12-15 14:48 dawes - - * xftlex.l: 1204. Fix an Xlib memory overrun when the - Xutf8TextPropertyToTextList function is used in a unibyte - locale (#4394, Bruno Haible). 1203. Fix the yen/backslash keys for - Solaris 8/x86 with Japanese 106 keyboards (based on #4393, - Takaaki Nomura). 1202. Fix type mismatches in the r128 DRI driver - on Alpha platforms (#4392, Gareth Hughes). 1201. Fix build - on Japanized version of Solaris 8 for x86 (#4390, Takaaki - Nomura). 1200. Remove some old XtOffset magic for the arm that - affects building with gcc (#4388, Keith Packard). - -2000-12-15 09:12 keithp - - * Imakefile, XftFreetype.h, xftcfg.c, xftdraw.c, xftextent.c, - xftfont.c, xftfreetype.c, xftglyphs.c, xftinit.c, xftint.h: Xft: - Change build w/o FREETYPE2 to not include any FreeType2 related - functions, fix XftFreetype.h to be usable by apps - -2000-12-14 15:03 keithp - - * XftConfig.cpp, xftcfg.c, xftdpy.c, xftfont.c, xftfreetype.c, - xftint.h, xftmatch.c, xftname.c, xftpat.c, xftstr.c, xftxlfd.c: - Xft: Fix string compares and default config - -2000-12-11 16:45 keithp - - * xftdraw.c, xftfont.c, xftint.h, xftmatch.c, xftxlfd.c: Fix pixel - values for core font rendering in Xft, add environment-selectable - debugging - -2000-12-11 13:48 keithp - - * xftglyphs.c: Xft: TT fonts may not contain all glyphs in encoding - -2000-12-07 23:51 keithp - - * Xft.h, XftFreetype.h, xftcore.c, xftdraw.c, xftextent.c, - xftfont.c, xftglyphs.c, xftint.h, xftpat.c, xftrender.c: Xft: be - liberal in what you accept... Also, metrics for missing glyphs are - all zeros now. Also added typedefs for 8,16,32 bit char datatypes - -2000-12-07 15:57 keithp - - * xftint.h, xftlist.c, xftpat.c: Dont pass address of va_list - around anymore (ppc portability) - -2000-12-06 10:03 keithp - - * Xft.h, xftdraw.c, xftint.h: Xft: add bitmap drawable support - -2000-12-05 10:26 keithp - - * xftdpy.c: Xft: add X resource to disable anti-aliasing - -2000-12-04 23:42 keithp - - * xftdraw.c: Xft,Xrender: make clip rectangles actually work - -2000-12-04 19:13 keithp - - * Xft.h, XftFreetype.h, xftdraw.c, xftint.h, xftrender.c: - Xft,Xrender,Render: c++ support, clip rectangles, warnings - -2000-12-03 11:05 keithp - - * xftcfg.c: Xft: (oops) left some debug output enabled - -2000-12-03 11:03 keithp - - * Xft.h, xftcfg.c, xftfreetype.c, xftglyphs.c: Xft: allow apps to - specify char spacing for FreeType fonts Fix append/prepend editing - steps to make them relative to the match - -2000-12-02 16:45 keithp - - * xftname.c: Xft: allow style names like "bold" to be used without - prefix in font names - -2000-12-02 02:02 keithp - - * Xft.h, XftFreetype.h, xftcore.c, xftfont.c, xftfreetype.c, - xftglyphs.c, xftint.h, xftname.c, xftxlfd.c: Xft: fix name parsing, - add unencoded glyph access for FreeType fonts - -2000-12-01 13:32 keithp - - * Xft.h, XftFreetype.h, xftcore.c, xftdraw.c, xftextent.c, - xftint.h, xftrender.c: Xrender/Xft: handle long strings, use - unsigned int for 32-bit glyphs - -2000-11-30 19:27 keithp - - * Imakefile, Xft.h, xftcolor.c, xftdraw.c, xftfont.c, xftint.h, - xftxlfd.c: Xft: add new XftColor datatype, update xterm and x11perf - -2000-11-30 16:41 keithp - - * xftname.c: Xft: workaround for wedging when given invalid font - name (like XLFD) - -2000-11-30 15:30 dawes - - * xftgram.y, xftint.h, xftlex.l: Fix libXft build problems on - systems that don't have flex (like Solaris). 1031. Add PAM - authentication to the X server (based on Red Hat's - XFree86-4.0-Xwrapper patch). 1030. Add Slovenian and Romanian - entries to XKB's keymap/xfree86 file (Red Hat's - XFree86-4.0-si_xkb patch and XFree86-4.0-ro_xkb.patch). 1029. Fix - for PAM support in xdm SessionExit() (Red Hat's - XFree86-4.0-pamsession patch). 1028. XlibInt.c patch to avoid - buffer overflow (Red Hat's XFree86-3.3.6-fixemacs patch). - 1027. Updates to xfs from Red Hat and Debian, including: - - command line options to make xfs drop it's root privs (-droppriv - and -user) - command line options to make xfs start as - a daemon, and a build option to make this the default. - - don't let a port option in the config file override the -port - command line option - cleanup/fix syslogging - (based on #4253, Debian, and Red Hat's XFree86-4.0-xfsredhat - patch). 1026. Support for startx to set up the Xauth when starting - an X server (based on Red Hat's XFree86-4.0-startx_xauth - patch). - -2000-11-30 10:58 keithp - - * Imakefile: Use sed to whack lex/yacc names in Xft - -2000-11-30 02:42 keithp - - * Xft.h, xftdraw.c: Xft: Add XftDrawChange - -2000-11-29 22:59 keithp - - * Imakefile, Xft.h, Xft.man, XftFreetype.h, xftcfg.c, xftint.h, - xftlist.c, xftpat.c: Xft: add font listing functions, update man - page and clean up headers - -2000-11-29 09:40 dawes - - * xftrender.c: missing ident lines - -2000-11-29 00:39 keithp - - * Imakefile, Xft.h, XftConfig.cpp, XftFreetype.h, drawstr.c, - extents.c, glyphs.c, lex.c, load.c, match.c, metrics.c, parse.c, - xftcfg.c, xftcore.c, xftdbg.c, xftdir.c, xftdpy.c, xftdraw.c, - xftextent.c, xftfont.c, xftfreetype.c, xftfs.c, xftglyphs.c, - xftgram.y, xftinit.c, xftint.h, xftlex.l, xftmatch.c, xftname.c, - xftpat.c, xftrender.c, xftstr.c, xftxlfd.c: Rewrite Xft library, - update xterm to match - -2000-10-13 06:41 keithp - - * Imakefile, Xft.h, drawstr.c, glyphs.c, load.c, xftint.h: Update - for current Freetype2 CVS - -2000-10-10 07:05 tsi - - * XftConfig.cpp: Static build fix and ident lines. - -2000-10-06 22:54 keithp - - * load.c: Xft: Fix up horizontal advance computation - -2000-10-05 17:01 keithp - - * Imakefile, XftConfig.cpp: Fix XftConfig file generation - -2000-10-05 15:57 keithp - - * Xft.h, drawstr.c, parse.c: Add debugging to Xft config parsing - -2000-10-05 11:05 keithp - - * Imakefile, Xft.h, Xft.man, XftConfig.cpp, drawstr.c, extents.c, - glyphs.c, lex.c, load.c, match.c, metrics.c, parse.c, xftint.h: Add - new Xft library to convert FreeType 2 fonts into Render glyphsets - diff --git a/nx-X11/lib/Xft/INSTALL b/nx-X11/lib/Xft/INSTALL deleted file mode 100644 index 85a675941..000000000 --- a/nx-X11/lib/Xft/INSTALL +++ /dev/null @@ -1,8 +0,0 @@ -Xft is built with the traditional configure script: - - $ ./configure --prefix=/usr/X11R6 - -This should generate valid Makefiles, then: - - $ make - $ make install diff --git a/nx-X11/lib/Xft/Imakefile b/nx-X11/lib/Xft/Imakefile deleted file mode 100644 index 4b827be5c..000000000 --- a/nx-X11/lib/Xft/Imakefile +++ /dev/null @@ -1,145 +0,0 @@ -XCOMM $XFree86: xc/lib/Xft/Imakefile,v 1.28 2003/11/17 15:18:04 tsi Exp $ -XCOMM $XdotOrg: xc/lib/Xft/Imakefile,v 1.5 2005/10/19 02:46:56 kem 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 - -#ifndef XftLibDir -#define XftLibDir $(LIBDIR) -#endif - -#ifndef XftType1Dir -#define XftType1Dir $(LIBDIR)/fonts/Type1 -#endif - -#ifdef UseInstalled -/* when using xmkmf, make sure the needed definitions for the fontconfig - * library are available - */ - -#ifndef SharedFontconfigRev -#define SharedFontconfigRev 1.0.4 -SharedLibReferences(FONTCONFIG,fontconfig,$(FONTCONFIGLIBSRC),SOFONTCONFIGREV,SharedFontconfigRev) -#endif - -/* make sure we're building the right major version */ -SOXFTREV=2.1 - -#endif - -XFTLIBDIR=XftLibDir - -TYPE1DIR=XftType1Dir -#if HasGcc2 || HasGcc3 -WARNINGS=-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -#endif -INCLUDES=$(FONTCONFIGINCLUDES) $(FREETYPE2INCLUDES) -I$(XBUILDINCDIR) $(WARNINGS) -DEFINES=$(FREETYPE2DEFINES) $(RENDERDEFINES) -DXFREE86_FT2 - -XFT_REVISION=8 -XFT_VERSION=2.1.$(XFT_REVISION) - -FREETYPE_LIBS=$(FREETYPE2LIB) -FREETYPE_CFLAGS=$(FREETYPE2INCLUDES) -XRENDER_LIBS=$(XRENDERLIB) -XRENDER_CFLAGS=$(XRENDERINCLUDES) -FONTCONFIG_CFLAGS=$(FONTCONFIGINCLUDES) -FONTCONFIG_LIBS=$(FONTCONFIGLIB) - -#if !defined(UseInstalled) - -/* these must always be computed using the installed location, - * when building inside the tree that means extra work - */ -#if BuildFontconfigLibrary -FONTCONFIG_LIBS=-L$(USRLIBDIR) -lfontconfig -FONTCONFIG_CFLAGS=-I$(INCROOT) -#endif - -#if BuildFreetype2Library -FREETYPE_LIBS=-L$(USRLIBDIR) -lfreetype -FREETYPE_CFLAGS=-I$(INCROOT)/freetype2 -#endif - -#if BuildRenderLibrary -XRENDER_LIBS=-L$(USRLIBDIR) -lXrender -XRENDER_CFLAGS=-I$(INCROOT) -#endif - -#endif - -RPATH_CFLAG = HardCodeLibdirFlag - -SUBSTVARS=prefix="$(PROJECTROOT)" \ - exec_prefix="$(BINDIR)" \ - libdir="$(USRLIBDIR)" \ - hardcode_libdir_flag_spec="$(RPATH_CFLAG)" \ - includedir="$(INCROOT)" \ - VERSION="$(XFT_VERSION)" \ - FREETYPE_LIBS="$(FREETYPE_LIBS)" \ - FREETYPE_CFLAGS="$(FREETYPE_CFLAGS)" \ - XRENDER_LIBS="$(XRENDER_LIBS)" \ - XRENDER_CFLAGS="$(XRENDER_CFLAGS)" \ - FONTCONFIG_CFLAGS="$(FONTCONFIG_CFLAGS)" \ - FONTCONFIG_LIBS="$(FONTCONFIG_LIBS)" - -REQUIREDLIBS=$(LDPRELIBS) $(XRENDERLIB) $(XLIB) $(FONTCONFIGLIB) $(EXPATLIB) $(FREETYPE2LIB) - -HEADERS = Xft.h XftCompat.h - - SRCS = xftcolor.c xftdbg.c xftdpy.c \ - xftdraw.c xftextent.c xftfont.c \ - xftinit.c xftlist.c \ - xftname.c xftstr.c xftswap.c xftxlfd.c \ - xftfreetype.c xftglyphs.c xftrender.c xftcore.c - - OBJS = xftcolor.o xftdbg.o xftdpy.o \ - xftdraw.o xftextent.o xftfont.o \ - xftinit.o xftlist.o \ - xftname.o xftstr.o xftswap.o xftxlfd.o \ - xftfreetype.o xftglyphs.o xftrender.o xftcore.o - -#include - -#if DoSharedLib && SharedDataSeparation -SpecialCObjectRule(sharedlib,NullParameter,$(SHLIBDEF)) -#endif - -#define ConfigSubst(file, old_suffix, new_suffix) @@\ - @@\ -all:: Concat(file,new_suffix) @@\ - @@\ -Concat(file,new_suffix): Concat(file,old_suffix) @@\ - RemoveFile($@) @@\ - sh config/config-subst $(SUBSTVARS) < Concat(file,old_suffix) > $@ @@\ - @@\ -clean:: @@\ - RemoveFile(Concat(file,new_suffix)) - -XCOMM Create xft-config.script from xft-config.in -ConfigSubst(xft-config,.in,.script) -InstallScript(xft-config,$(BINDIR)) - -XCOMM Create xft.pc from xft.pc.in -ConfigSubst(xft.pc,.in,/*none*/) -InstallNonExecFile(xft.pc,$(USRLIBDIR)/pkgconfig) - -XCOMM Create man pages from .*.in files -ConfigSubst(xft-config,.1.in,.man) -ConfigSubst(Xft,.3.in,.man) - -InstallGenManPage(xft-config,$(MANDIR),$(MANSUFFIX)) -InstallGenManPage(Xft,$(LIBMANDIR),$(LIBMANSUFFIX)) - -DependTarget() diff --git a/nx-X11/lib/Xft/Makefile.am b/nx-X11/lib/Xft/Makefile.am deleted file mode 100644 index 38ca35360..000000000 --- a/nx-X11/lib/Xft/Makefile.am +++ /dev/null @@ -1,64 +0,0 @@ -# -# $Id: Makefile.am,v 1.3 2005/06/24 22:43:20 alanc Exp $ -# -# Copyright © 2003 Keith Packard, Noah Levitt -# -# 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. - -bin_SCRIPTS = xft-config - -man_MANS = Xft.3 xft-config.1 - -AM_CFLAGS = $(FONTCONFIG_CFLAGS) $(FREETYPE_CFLAGS) $(XRENDER_CFLAGS) \ - $(WARN_CFLAGS) - -lib_LTLIBRARIES = libXft.la - -libXft_la_SOURCES = Xft.h \ - XftCompat.h \ - xftint.h \ - xftcolor.c \ - xftcore.c \ - xftdbg.c \ - xftdpy.c \ - xftdraw.c \ - xftextent.c \ - xftfont.c \ - xftfreetype.c \ - xftglyphs.c \ - xftinit.c \ - xftlist.c \ - xftname.c \ - xftrender.c \ - xftstr.c \ - xftswap.c \ - xftxlfd.c - -libXft_la_LIBADD = @FONTCONFIG_LIBS@ @FREETYPE_LIBS@ @XRENDER_LIBS@ - -# -version-number requires libtool >= 1.5 -libXft_la_LDFLAGS = -version-number 2:1:2 -no-undefined - -libXftincludedir = $(includedir)/X11/Xft -libXftinclude_HEADERS = Xft.h XftCompat.h - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = xft.pc - -EXTRA_DIST = xft-config.in xft-config.1.in xft.pc.in Xft.3.in autogen.sh diff --git a/nx-X11/lib/Xft/Makefile.in b/nx-X11/lib/Xft/Makefile.in deleted file mode 100644 index 0827f7769..000000000 --- a/nx-X11/lib/Xft/Makefile.in +++ /dev/null @@ -1,780 +0,0 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# -# $Id: Makefile.in,v 1.2 2004/04/23 18:43:41 eich Exp $ -# -# Copyright © 2003 Keith Packard, Noah Levitt -# -# 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. - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = . - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ -FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ -FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ -FREETYPE_LIBS = @FREETYPE_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XRENDER_CFLAGS = @XRENDER_CFLAGS@ -XRENDER_LIBS = @XRENDER_LIBS@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -ft_config = @ft_config@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -bin_SCRIPTS = xft-config - -man_MANS = Xft.3 - -AM_CFLAGS = $(FONTCONFIG_CFLAGS) $(FREETYPE_CFLAGS) $(XRENDER_CFLAGS) - -lib_LTLIBRARIES = libXft.la - -libXft_la_SOURCES = Xft.h \ - XftCompat.h \ - xftint.h \ - xftcolor.c \ - xftcore.c \ - xftdbg.c \ - xftdpy.c \ - xftdraw.c \ - xftextent.c \ - xftfont.c \ - xftfreetype.c \ - xftglyphs.c \ - xftinit.c \ - xftlist.c \ - xftname.c \ - xftrender.c \ - xftstr.c \ - xftswap.c \ - xftxlfd.c - - -libXft_la_LIBADD = @FONTCONFIG_LIBS@ @FREETYPE_LIBS@ @XRENDER_LIBS@ - -# -version-number requires libtool >= 1.5 -libXft_la_LDFLAGS = -version-number 2:1:1 -no-undefined - -libXftincludedir = $(includedir)/X11/Xft -libXftinclude_HEADERS = Xft.h XftCompat.h - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = xft.pc - -EXTRA_DIST = xft-config.in xft.pc.in Xft.3.in $(man_MANS) autogen.sh -subdir = . -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = xft.pc xft-config Xft.3 -LTLIBRARIES = $(lib_LTLIBRARIES) - -libXft_la_DEPENDENCIES = -am_libXft_la_OBJECTS = xftcolor.lo xftcore.lo xftdbg.lo xftdpy.lo \ - xftdraw.lo xftextent.lo xftfont.lo xftfreetype.lo xftglyphs.lo \ - xftinit.lo xftlist.lo xftname.lo xftrender.lo xftstr.lo \ - xftswap.lo xftxlfd.lo -libXft_la_OBJECTS = $(am_libXft_la_OBJECTS) -SCRIPTS = $(bin_SCRIPTS) - - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I. -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/xftcolor.Plo ./$(DEPDIR)/xftcore.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/xftdbg.Plo ./$(DEPDIR)/xftdpy.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/xftdraw.Plo ./$(DEPDIR)/xftextent.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/xftfont.Plo ./$(DEPDIR)/xftfreetype.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/xftglyphs.Plo ./$(DEPDIR)/xftinit.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/xftlist.Plo ./$(DEPDIR)/xftname.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/xftrender.Plo ./$(DEPDIR)/xftstr.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/xftswap.Plo ./$(DEPDIR)/xftxlfd.Plo -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(libXft_la_SOURCES) - -NROFF = nroff -MANS = $(man_MANS) -DATA = $(pkgconfig_DATA) - -HEADERS = $(libXftinclude_HEADERS) - -DIST_COMMON = README $(libXftinclude_HEADERS) $(srcdir)/Makefile.in \ - $(srcdir)/configure AUTHORS COPYING ChangeLog INSTALL \ - Makefile.am NEWS Xft.3.in aclocal.m4 config.guess config.h.in \ - config.sub configure configure.ac depcomp install-sh ltmain.sh \ - missing mkinstalldirs xft-config.in xft.pc.in -SOURCES = $(libXft_la_SOURCES) - -all: config.h - $(MAKE) $(AM_MAKEFLAGS) all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj - -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) - -$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck -$(srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(srcdir)/configure.ac $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) - cd $(srcdir) && $(AUTOCONF) - -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.ac - cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) - -config.h: stamp-h1 - @if test ! -f $@; then \ - rm -f stamp-h1; \ - $(MAKE) stamp-h1; \ - else :; fi - -stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status config.h - -$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(top_srcdir)/configure.ac $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOHEADER) - touch $(srcdir)/config.h.in - -distclean-hdr: - -rm -f config.h stamp-h1 -xft.pc: $(top_builddir)/config.status xft.pc.in - cd $(top_builddir) && $(SHELL) ./config.status $@ -xft-config: $(top_builddir)/config.status xft-config.in - cd $(top_builddir) && $(SHELL) ./config.status $@ -Xft.3: $(top_builddir)/config.status Xft.3.in - cd $(top_builddir) && $(SHELL) ./config.status $@ -libLTLIBRARIES_INSTALL = $(INSTALL) -install-libLTLIBRARIES: $(lib_LTLIBRARIES) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(libdir) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \ - $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \ - else :; fi; \ - done - -uninstall-libLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - p="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \ - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ - done - -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libXft.la: $(libXft_la_OBJECTS) $(libXft_la_DEPENDENCIES) - $(LINK) -rpath $(libdir) $(libXft_la_LDFLAGS) $(libXft_la_OBJECTS) $(libXft_la_LIBADD) $(LIBS) -binSCRIPT_INSTALL = $(INSTALL_SCRIPT) -install-binSCRIPTS: $(bin_SCRIPTS) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(bindir) - @list='$(bin_SCRIPTS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - if test -f $$d$$p; then \ - f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ - echo " $(binSCRIPT_INSTALL) $$d$$p $(DESTDIR)$(bindir)/$$f"; \ - $(binSCRIPT_INSTALL) $$d$$p $(DESTDIR)$(bindir)/$$f; \ - else :; fi; \ - done - -uninstall-binSCRIPTS: - @$(NORMAL_UNINSTALL) - @list='$(bin_SCRIPTS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ - echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ - rm -f $(DESTDIR)$(bindir)/$$f; \ - done - -mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xftcolor.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xftcore.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xftdbg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xftdpy.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xftdraw.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xftextent.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xftfont.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xftfreetype.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xftglyphs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xftinit.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xftlist.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xftname.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xftrender.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xftstr.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xftswap.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xftxlfd.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -man3dir = $(mandir)/man3 -install-man3: $(man3_MANS) $(man_MANS) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(man3dir) - @list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \ - l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ - for i in $$l2; do \ - case "$$i" in \ - *.3*) list="$$list $$i" ;; \ - esac; \ - done; \ - for i in $$list; do \ - if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ - else file=$$i; fi; \ - ext=`echo $$i | sed -e 's/^.*\\.//'`; \ - case "$$ext" in \ - 3*) ;; \ - *) ext='3' ;; \ - esac; \ - inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ - inst=`echo $$inst | sed -e 's/^.*\///'`; \ - inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man3dir)/$$inst"; \ - $(INSTALL_DATA) $$file $(DESTDIR)$(man3dir)/$$inst; \ - done -uninstall-man3: - @$(NORMAL_UNINSTALL) - @list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \ - l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ - for i in $$l2; do \ - case "$$i" in \ - *.3*) list="$$list $$i" ;; \ - esac; \ - done; \ - for i in $$list; do \ - ext=`echo $$i | sed -e 's/^.*\\.//'`; \ - case "$$ext" in \ - 3*) ;; \ - *) ext='3' ;; \ - esac; \ - inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ - inst=`echo $$inst | sed -e 's/^.*\///'`; \ - inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " rm -f $(DESTDIR)$(man3dir)/$$inst"; \ - rm -f $(DESTDIR)$(man3dir)/$$inst; \ - done -pkgconfigDATA_INSTALL = $(INSTALL_DATA) -install-pkgconfigDATA: $(pkgconfig_DATA) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(pkgconfigdir) - @list='$(pkgconfig_DATA)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(pkgconfigDATA_INSTALL) $$d$$p $(DESTDIR)$(pkgconfigdir)/$$f"; \ - $(pkgconfigDATA_INSTALL) $$d$$p $(DESTDIR)$(pkgconfigdir)/$$f; \ - done - -uninstall-pkgconfigDATA: - @$(NORMAL_UNINSTALL) - @list='$(pkgconfig_DATA)'; for p in $$list; do \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " rm -f $(DESTDIR)$(pkgconfigdir)/$$f"; \ - rm -f $(DESTDIR)$(pkgconfigdir)/$$f; \ - done -libXftincludeHEADERS_INSTALL = $(INSTALL_HEADER) -install-libXftincludeHEADERS: $(libXftinclude_HEADERS) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(libXftincludedir) - @list='$(libXftinclude_HEADERS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(libXftincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(libXftincludedir)/$$f"; \ - $(libXftincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(libXftincludedir)/$$f; \ - done - -uninstall-libXftincludeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(libXftinclude_HEADERS)'; for p in $$list; do \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " rm -f $(DESTDIR)$(libXftincludedir)/$$f"; \ - rm -f $(DESTDIR)$(libXftincludedir)/$$f; \ - done - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = . -distdir = $(PACKAGE)-$(VERSION) - -am__remove_distdir = \ - { test ! -d $(distdir) \ - || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr $(distdir); }; } - -GZIP_ENV = --best -distuninstallcheck_listfiles = find . -type f -print -distcleancheck_listfiles = find . -type f -print - -distdir: $(DISTFILES) - $(am__remove_distdir) - mkdir $(distdir) - $(mkinstalldirs) $(distdir)/. - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r $(distdir) -dist-gzip: distdir - $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -dist-bzip2: distdir - $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 - $(am__remove_distdir) - -dist dist-all: distdir - $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 - $(am__remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - $(am__remove_distdir) - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - - chmod -R a-w $(distdir); chmod a+w $(distdir) - mkdir $(distdir)/_build - mkdir $(distdir)/_inst - chmod a-w $(distdir) - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && cd $(distdir)/_build \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && $(mkinstalldirs) "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ - && rm -f $(distdir).tar.gz \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck - $(am__remove_distdir) - @echo "$(distdir).tar.gz is ready for distribution" | \ - sed 'h;s/./=/g;p;x;p;x' -distuninstallcheck: - @cd $(distuninstallcheck_dir) \ - && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) $(SCRIPTS) $(MANS) $(DATA) $(HEADERS) \ - config.h - -installdirs: - $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(bindir) $(DESTDIR)$(man3dir) $(DESTDIR)$(pkgconfigdir) $(DESTDIR)$(libXftincludedir) -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ - mostlyclean-am - -distclean: distclean-am - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic distclean-hdr \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: install-libXftincludeHEADERS install-man \ - install-pkgconfigDATA - -install-exec-am: install-binSCRIPTS install-libLTLIBRARIES - -install-info: install-info-am - -install-man: install-man3 - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-binSCRIPTS uninstall-info-am \ - uninstall-libLTLIBRARIES uninstall-libXftincludeHEADERS \ - uninstall-man uninstall-pkgconfigDATA - -uninstall-man: uninstall-man3 - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libLTLIBRARIES clean-libtool ctags dist dist-all \ - dist-bzip2 dist-gzip distcheck distclean distclean-compile \ - distclean-generic distclean-hdr distclean-libtool \ - distclean-tags distcleancheck distdir distuninstallcheck dvi \ - dvi-am info info-am install install-am install-binSCRIPTS \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-libLTLIBRARIES \ - install-libXftincludeHEADERS install-man install-man3 \ - install-pkgconfigDATA install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-binSCRIPTS \ - uninstall-info-am uninstall-libLTLIBRARIES \ - uninstall-libXftincludeHEADERS uninstall-man uninstall-man3 \ - uninstall-pkgconfigDATA - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/nx-X11/lib/Xft/NEWS b/nx-X11/lib/Xft/NEWS deleted file mode 100644 index e69de29bb..000000000 diff --git a/nx-X11/lib/Xft/README b/nx-X11/lib/Xft/README deleted file mode 100644 index 4a18a4c17..000000000 --- a/nx-X11/lib/Xft/README +++ /dev/null @@ -1,65 +0,0 @@ - Xft - X FreeType library - Version 2.1.7 - 2005-3-29 - -Xft version 2.1 is the first stand alone release of Xft, a library that -connects X applications with the FreeType font rasterization library. Xft -uses fontconfig to locate fonts so it has no configuration files. - -Version 2.1.7 - -Change FC_CHARCELL and FC_MONO interpretation. FC_MONO no longer clips -glyphs to charcell, you must specify FC_CHARCELL for that. - -Add support for FT_GlyphSlot_Embolden where it exists (which it usually -doesn't). - -Avoid crashing when using FT_Face objects. - -Version 2.1.6 - -Deal with broken FreeType 2.1.7 BDF/PCF loaders by trying both y_ppem/x_ppem -and width/height values. - -Version 2.1.5 - -Left some #warnings from testing in the 2.1.4 release. Spin again. - -Version 2.1.4 - -Work with older versions of Fontconfig by using various pattern elements -only when defined. - -Version 2.1.3 - -Change Freetype includes to new syntax. - -Search for nearest bitmap for bitmap-only fonts. - -Support fontconfig 2.2 release which doesn't include FC_HINT_STYLE. - -To release a version of this library: - - 1. Update the version numbers - configure.ac - Xft.h - 2. Fix the README - Change version number - Set the date - 3. Commit those changes - 4. rebuild the configuration files with autogen.sh - sh autogen.sh --sysconfdir=/etc --prefix=/usr --mandir=/usr/share/man - 5. make distcheck - 6. tag the tree - cvs tag Xft-2_1_xx - 7. Copy Xft-2.1.xx.tar.gz and Xft-2.1.xx.tar.bz2 to - freedesktop.org:/srv/xlibs.freedesktop.org/www/release - 8. Compute md5sums for release files: - md5sum Xft-2.1.xx.tar.gz Xft-2.1.xx.tar.bz2 - 9. Post a note to xorg@freedesktop.org. Include the md5sums. - gpg sign the message. - - -Keith Packard -keithp@keithp.com diff --git a/nx-X11/lib/Xft/Xft-def.cpp b/nx-X11/lib/Xft/Xft-def.cpp deleted file mode 100644 index 0a3e9c09d..000000000 --- a/nx-X11/lib/Xft/Xft-def.cpp +++ /dev/null @@ -1,183 +0,0 @@ -LIBRARY Xft -VERSION LIBRARY_VERSION -EXPORTS - -#ifndef __UNIXOS2__ -XftConfigAddDir -XftConfigAddEdit -XftConfigGetCache -XftConfigSetCache -XftConfigSubstitute -_XftConfigCompareValue -#endif -XftColorAllocName -XftColorAllocValue -XftColorFree -#ifndef __UNIXOS2__ -XftCoreConvert16 -XftCoreConvert32 -XftCoreConvertUtf8 -XftCoreExtents16 -XftCoreExtents32 -XftCoreExtents8 -XftCoreExtentsUtf8 -XftCoreGlyphExists -XftEditPrint -XftExprPrint -XftFontSetPrint -XftOpPrint -XftPatternPrint -XftSubstPrint -XftTestPrint -XftValueListPrint -XftValuePrint -#endif -XftDefaultGetBool -XftDefaultGetDouble -XftDefaultGetInteger -XftDefaultHasRender -XftDefaultParseBool -XftDefaultSet -XftDefaultSubstitute -#ifndef __UNIXOS2__ -XftDisplayGetFontSet -#endif -XftDrawChange -#ifndef __UNIXOS2__ -XftDrawCorePrepare -#endif -XftDrawCreate -XftDrawCreateBitmap -XftDrawDestroy -XftDrawRect -#ifndef __UNIXOS2__ -XftDrawRenderPrepare -#endif -XftDrawSetClip -XftDrawString16 -XftDrawString32 -XftDrawString8 -XftDrawStringUtf8 -XftTextExtents16 -XftTextExtents32 -XftTextExtents8 -XftTextExtentsUtf8 -XftFontClose -XftFontMatch -XftFontOpen -XftFontOpenName -XftFontOpenPattern -XftFontOpenXlfd -#ifndef __UNIXOS2__ -XftGlyphExists -_XftFontDebug -XftFontSetAdd -XftFontSetCreate -XftFontSetDestroy -XftConfigSaveField -XftConfigerror -XftConfigparse -XftConfigwrap -XftEditCreate -XftEditDestroy -XftExprCreateBool -XftExprCreateDouble -XftExprCreateField -XftExprCreateInteger -XftExprCreateNil -XftExprCreateOp -XftExprCreateString -XftExprDestroy -XftTestCreate -#endif -XftInit -#ifndef __UNIXOS2__ -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 -#endif -XftListFonts -XftListFontsPatternObjects -#ifndef __UNIXOS2__ -XftListMatch -XftListValueCompare -XftListValueListCompare -XftObjectSetAdd -XftObjectSetBuild -XftObjectSetCreate -XftObjectSetDestroy -XftObjectSetVaBuild -XftFontSetMatch -XftNameConstant -#endif -XftNameParse -XftNameUnparse -#ifndef __UNIXOS2__ -XftPatternAdd -XftPatternAddBool -XftPatternAddDouble -XftPatternAddInteger -XftPatternAddString -XftPatternBuild -XftPatternCreate -XftPatternDel -XftPatternDestroy -XftPatternDuplicate -XftPatternFind -XftPatternGet -XftPatternGetBool -XftPatternGetDouble -XftPatternGetInteger -XftPatternGetString -XftPatternVaBuild -XftValueDestroy -XftValueListDestroy -XftUtf8Len -XftUtf8ToUcs4 -_XftDownStr -_XftGetInt -#endif -_XftMatchSymbolic -#ifndef __UNIXOS2__ -_XftSaveString -_XftSplitField -_XftSplitStr -_XftSplitValue -_XftStrCmpIgnoreCase -XftCoreAddFonts -XftCoreClose -XftCoreOpen -#endif -XftXlfdParse -XftInitFtLibrary -#ifndef __UNIXOS2__ -XftConfigDirs -XftDirScan -XftDirSave -#endif -XftDrawPicture -XftDrawSrcPicture -#ifndef __UNIXOS2__ -XftGlyphLoad -XftGlyphCheck -XftFreeTypeGlyphExists -XftFreeTypeOpen -XftFreeTypeClose -XftRenderString16 -#else -XftCharExists -#endif /* __UNIXOS2__ */ - -/* $Id: Xft-def.cpp,v 1.3 2005/06/24 22:43:20 alanc Exp $ */ diff --git a/nx-X11/lib/Xft/Xft.3.in b/nx-X11/lib/Xft/Xft.3.in deleted file mode 100644 index 040dc1ffe..000000000 --- a/nx-X11/lib/Xft/Xft.3.in +++ /dev/null @@ -1,847 +0,0 @@ -.\" -.\" $Id: Xft.3.in,v 1.3 2005/06/24 22:43:20 alanc Exp $ -.\" -.\" Copyright © 2000 Keith Packard -.\" -.\" 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. -.\" -.TH Xft 3 "Version @VERSION@" "Xft" -.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 "HEADER FILE" -.B #include -.SH CONSTANTS -.TP -.B XFT_MAJOR -is the major version number of -.BR Xft . -.TP -.B XFT_MINOR -is the minor version number of -.BR Xft . -.TP -.B XFT_REVISION -is the revision number of -.BR Xft . -.TP -.B XFT_VERSION -is -.B XFT_MAJOR -times 10000 (ten thousand), plus -.B XFT_MINOR -times 100, plus -.BR XFT_REVISION . -.TP -.B XftVersion -is an alias for -.BR XFT_VERSION . -.PP -The following example illustrates how -.BR Xft 's -version constants might be used: -.nf - #if (XFT_VERSION >= 20107) - (void) puts("Version 2.1.7 or later of the Xft library is in" - " use."); - #else - (void) printf("Insufficient version of Xft (%d.%d.%d) installed; - " need at least version 2.1.7.\(rsn", XFT_MAJOR, - XFT_MINOR, - XFT_REVISION); - #endif -.fi -.\" I don't understand what these are for. -- BR, 2005-04-02 -.\" XFT_CORE used in xftname.c -.\" XFT_RENDER used in xftdpy.c, xftfreetype.c, xftname.c -.\" XFT_XLFD used in xftname.c, xftxlfd.c -.\" XFT_MAX_GLYPH_MEMORY used in xftdpy.c, xftfreetype.c -.\" XFT_MAX_UNREF_FONTS used in xftdpy.c -.\" XFT_NMISSING used in xftcore.c, xftextent.c, xftglyphs.c, -.\" xftrender.c -.SH "DATA TYPES" -.TP -.B XftFont -.nf -typedef struct _XftFont { - int ascent; - int descent; - int height; - int max_advance_width; - FcCharSet *charset; - FcPattern *pattern; -} XftFont; -.fi -An -.B XftFont -is the primary data structure of interest to programmers using -.BR Xft ; -it contains general font metrics and pointers to the Fontconfig -character set and pattern associated with the font. -The -.B FcCharSet -and -.B FcPattern -data types are defined by the Fontconfig library. -.TP -.B "" -.BR XftFont s -are populated with any of -.BR XftFontOpen (), -.BR XftFontOpenName (), -.BR XftFontOpenXlfd (), -.BR XftFontOpenInfo (), -or -.BR XftFontOpenPattern (). -.BR XftFontCopy () -is used to duplicate -.BR XftFont s, -and -.BR XftFontClose () -is used to mark an -.B XftFont -as unused. -.BR XftFont s -are internally allocated, reference-counted, and freed by -.BR Xft ; -the programmer does not ordinarily need to allocate or free storage -for them. -.TP -.B "" -.BR XftDrawGlyphs (), -the -.BR XftDrawString *() -family, -.BR XftDrawCharSpec (), -and -.BR XftDrawGlyphSpec () -use -.BR XftFont s -to render text to an -.B XftDraw -object, which may correspond to either a core X drawable or an X -Rendering Extension drawable. -.TP -.B "" -.BR XftGlyphExtents () -and the -.BR XftTextExtents *() -family are used to determine the extents (maximum dimensions) of an -.BR XftFont . -.TP -.B "" -An -.BR XftFont 's -glyph or character coverage can be determined with -.BR XftFontCheckGlyph () -or -.BR XftCharExists (). -.BR XftCharIndex () -returns the -.BR XftFont -specific -character index corresponding to a given Unicode codepoint. -.TP -.B "" -.BR XftGlyphRender (), -.BR XftGlyphSpecRender (), -.BR XftCharSpecRender (), -and the -.BR XftTextRender *() -family use -.BR XftFont s -to draw into X Rendering Extension -.B Picture -structures. -.B Note: -.BR XftDrawGlyphs (), -the -.BR XftDrawString *() -family, -.BR XftDrawCharSpec (), -and -.BR XftDrawGlyphSpec () -provide a means of rendering fonts that is independent of the -availability of the X Rendering Extension on the X server. -.\" I'm not sure what these are for; they're used internally, but why -.\" would any external users want them? -- BR, 2005-04-02 -.\" .BR XftLockFace() -.\" .BR XftUnlockFace() -.TP -.B XftFontInfo -is an opaque object that stores information about a font. -.B XftFontInfo -structures are created with -.BR XftFontInfoCreate (), -freed with -.BR XftFontInfoDestroy (), -and compared with -.BR XftFontInfoEqual (). -.B XftFontInfo -objects are internally allocated and freed by -.BR Xft ; -the programmer does not ordinarily need to allocate or free storage -for them. -.TP -.B "" -Each -.B XftFontInfo -structure in use is associated with a unique identifier, which can be -retrieved with -.BR XftFontInfoHash (). -An -.B XftFont -can be opened based on -.B XftFontInfo -data with -.BR XftFontOpenInfo (). -.TP -.B XftColor -.nf -typedef struct _XftColor { - unsigned long pixel; - XRenderColor color; -} XftColor; -.fi -An -.B XftColor -object permits text and other items to be rendered in a particular -color (or the closest approximation offered by the X visual in use). -The -.B XRenderColor -data type is defined by the X Render Extension library. -.TP -.B "" -.BR XftColorAllocName () -and -.BR XftColorAllocValue () -request a color allocation from the X server (if necessary) and -initialize the members of -.BR XftColor . -.BR XftColorFree () -instructs the X server to free the color currently allocated for an -.BR XftColor . -.TP -.B "" -One an -.B XftColor -has been initialized, -.BR XftDrawSrcPicture (), -.BR XftDrawGlyphs (), -the -.BR XftDrawString *() -family, -.BR XftDrawCharSpec (), -.BR XftDrawCharFontSpec (), -.BR XftDrawGlyphSpec (), -.BR XftDrawGlyphFontSpec (), -and -.BR XftDrawRect () -may be used to draw various objects using it. -.TP -.B XftDraw -is an opaque object which holds information used to render to an X drawable -using either the core protocol or the X Rendering extension. -.TP -.B "" -.B XftDraw -objects are created with any of -.BR XftDrawCreate () -(which associates an -.B XftDraw -with an existing X drawable), -.BR XftDrawCreateBitmap (), -or -.BR XftDrawCreateAlpha (), -and destroyed with -.BR XftDrawDestroy (). -The X drawable associated with an -.B XftDraw -can be changed with -.BR XftDrawChange (). -.BR XftDraw s -are internally allocated and freed by -.BR Xft ; -the programmer does not ordinarily need to allocate or free storage -for them. -.TP -.B "" -The X -.BR Display , -.BR Drawable , -.BR Colormap , -and -.BR Visual -of an -.B XftDraw -can be queried with -.BR XftDrawDisplay (), -.BR XftDrawDrawable (), -.BR XftDrawColormap (), -and -.BR XftDrawVisual (), -respectively. -The X Rendering Extension -.B Picture -associated with an -.B XftDraw -is returned by -.BR XftDrawPicture (). -.\" XftDrawSrcPicture -.\" XftDrawGlyphs -.\" XftDrawString* -.\" XftDrawCharSpec -.\" XftDrawCharFontSpec -.\" XftDrawGlyphSpec -.\" XftDrawGlyphFontSpec -.\" XftDrawRect -.\" XftDrawSetClip -.\" XftDrawSetClipRectangles -.\" XftDrawSetSubwindowMode -.TP -.B XftCharSpec -.nf -typedef struct _XftCharSpec { - FcChar32 ucs4; - short x; - short y; -} XftCharSpec; -.fi -.TP -.B "" -The -.B FcChar32 -data type is defined by the Fontconfig library. -.\" XftDrawCharSpec -.\" XftCharSpecRender -.TP -.B XftCharFontSpec -.nf -typedef struct _XftCharFontSpec { - XftFont *font; - FcChar32 ucs4; - short x; - short y; -} XftCharFontSpec; -.fi -.TP -.B "" -The -.B FcChar32 -data type is defined by the Fontconfig library. -.\" XftDrawCharFontSpec -.\" XftCharFontSpecRender -.TP -.B XftGlyphSpec -.nf -typedef struct _XftGlyphSpec { - FT_UInt glyph; - short x; - short y; -} XftGlyphSpec; -.fi -.TP -.B "" -The -.B FT_UInt -data type is defined by the FreeType library. -.\" XftDrawGlyphSpec -.\" XftGlyphSpecRender -.TP -.B XftGlyphFontSpec -.nf -typedef struct _XftGlyphFontSpec { - XftFont *font; - FT_UInt glyph; - short x; - short y; -} XftGlyphFontSpec; -.fi -.TP -.B "" -The -.B FT_UInt -data type is defined by the FreeType library. -.\" XftDrawGlyphFontSpec -.\" XftGlyphFontSpecRender -.SH FUNCTIONS -.SS "Opening and Matching Fonts" -.nf -\fBXftFont *\fR -\fBXftFontOpen (Display *\fIdpy\fB,\fR -\fB int \fIscreen\fB,\fR -\fB ...);\fR\fR -.fi -.B XftFontOpen -takes a list of pattern element triples of the form -.IR field , " type" , " value" -(terminated with a NULL), matches that pattern against the available fonts, -and opens the matching font, sizing it correctly for screen number -.I screen -on display -.IR dpy . -The -.B Display -data type is defined by the X11 library. -Returns NULL if no match is found. -.PP -Example: -.nf - font = XftFontOpen (dpy, screen, - XFT_FAMILY, XftTypeString, "charter", - XFT_SIZE, XftTypeDouble, 12.0, - NULL); -.fi -This opens the \(lqcharter\(rq font at 12 points. -The point size is automatically converted to the correct pixel size based -on the resolution of the monitor. -.PP -.nf -\fBXftFont *\fR -\fBXftFontOpenName (Display *\fIdpy\fB,\fR -\fB int \fIscreen\fB,\fR -\fB unsigned char *\fIname\fB);\fR -.fi -.B XftFontOpenName -behaves as -.B XftFontOpen -does, except that it takes a Fontconfig pattern string (which is passed to -the Fontconfig library's -.BR FcNameParse () -function). -.PP -.nf -\fBXftFont *\fR -\fBXftFontOpenXlfd (Display *\fIdpy\fB,\fR -\fB int \fIscreen\fB,\fR -\fB unsigned char *\fIxlfd\fB)\fR -.fi -.B XftFontOpenXlfd -behaves as -.B XftFontOpen -does, except that it takes a string containing an X Logical Font -Description (XLFD). -.PP -.nf -\fBFcPattern *\fR -\fBXftFontMatch (Display *\fIdpy\fB,\fR -\fB int \fIscreen\fB,\fR -\fB FcPattern *\fIpattern\fB,\fR -\fB FcResult *\fIresult\fB);\fR -.fi -Also used internally by the -.BR XftFontOpen * -functions, -.B XftFontMatch -can also be used directly to determine the Fontconfig font pattern -resulting from an Xft font open request. -The -.B FcPattern -and -.B FcResult -data types are defined by the Fontconfig library. -.SS "Determining the Pixel Extents of a Text String" -.nf -\fBvoid\fR -\fBXftTextExtents8 (Display *\fIdpy\fB,\fR -\fB XftFont *\fIfont\fB,\fR -\fB FcChar8 *\fIstring\fB,\fR -\fB int \fIlen\fB,\fR -\fB XGlyphInfo *\fIextents\fB);\fR -.fi -.B XftTextExtents8 -computes the pixel extents on display -.I dpy -of no more than -.I len -glyphs of a -.I string -consisting of eight-bit characters when drawn with -.IR font , -storing them in -.IR extents . -The -.B FcChar8 -data type is defined by the Fontconfig library, and the -.B XGlyphInfo -data type is defined by the X Rendering Extension library. -.PP -.nf -\fBvoid\fR -\fBXftTextExtents16 (Display *\fIdpy\fB,\fR -\fB XftFont *\fIfont\fB,\fR -\fB FcChar16 *\fIstring\fB,\fR -\fB int \fIlen\fB,\fR -\fB XGlyphInfo *\fIextents\fB);\fR -.fi -.B XftTextExtents16 -computes the pixel extents on display -.I dpy -of no more than -.I len -glyphs of a -.I string -consisting of sixteen-bit characters when drawn with -.IR font , -storing them in -.IR extents . -The -.B FcChar16 -data type is defined by the Fontconfig library, and the -.B XGlyphInfo -data type is defined by the X Rendering Extension library. -.PP -.nf -\fBvoid\fR -\fBXftTextExtents32 (Display *\fIdpy\fB,\fR -\fB XftFont *\fIfont\fB,\fR -\fB FcChar32 *\fIstring\fB,\fR -\fB int \fIlen\fB,\fR -\fB XGlyphInfo *\fIextents\fB);\fR -.fi -.B XftTextExtents32 -computes the pixel extents on display -.I dpy -of no more than -.I len -glyphs of a -.I string -consisting of thirty-two-bit characters when drawn with -.IR font , -storing them in -.IR extents . -The -.B FcChar32 -data type is defined by the Fontconfig library, and the -.B XGlyphInfo -data type is defined by the X Rendering Extension library. -.PP -.nf -\fBvoid\fR -\fBXftTextExtentsUtf8 (Display *\fIdpy\fB,\fR -\fB XftFont *\fIfont\fB,\fR -\fB FcChar8 *\fIstring\fB,\fR -\fB int \fIlen\fB,\fR -\fB XGlyphInfo *\fIextents\fB);\fR -.fi -.B XftTextExtentsUtf8 -computes the pixel extents on display -.I dpy -of no more than -.I len -bytes of a UTF-8 encoded -.I string -when drawn with -.IR font , -storing them in -.IR extents . -The -.B XGlyphInfo -data type is defined by the X Rendering Extension library. -.PP -.nf -\fBvoid\fR -\fBXftTextExtentsUtf16 (Display *\fIdpy\fB,\fR -\fB XftFont *\fIfont\fB,\fR -\fB FcChar8 *\fIstring\fB,\fR -\fB FcEndian \fIendian\fB,\fR -\fB int \fIlen\fB,\fR -\fB XGlyphInfo *\fIextents\fB);\fR -.fi -.B XftTextExtentsUtf16 -computes the pixel extents on display -.I dpy -of no more than -.I len -bytes of a UTF-16LE- or UTF-16BE-encoded -.I string -when drawn with -.IR font , -storing them in -.IR extents . -The endianness of -.I string -must be specified in -.IR endian . -The -.B FcEndian -data type is defined by the Fontconfig library, and the -.B XGlyphInfo -data type is defined by the X Rendering Extension library. -.PP -.nf -\fBvoid\fR -\fBXftGlyphExtents (Display *\fIdpy\fB,\fR -\fB XftFont *\fIfont\fB,\fR -\fB FT_UInt *\fIglyphs\fB,\fR -\fB int \fInglyphs\fB,\fR -\fB XGlyphInfo *\fIextents\fB);\fR -.fi -Also used internally by the -.BR XftTextExtents * -functions, -.B XftGlyphExtents -computes the pixel extents on display -.I dpy -of no more than -.I nglyphs -in the array -.I glyphs -drawn with -.IR font , -storing them in -.IR extents . -The -.B FT_UInt -data type is defined by the FreeType library, and the -.B XGlyphInfo -data type is defined by the X Rendering Extension library. -.SS "Drawing Strings (and Other Things)" -.nf -\fBXftDraw *\fR -\fBXftDrawCreate (Display *\fIdpy\fB,\fR -\fB Drawable \fIdrawable\fB,\fR -\fB Visual *\fIvisual\fB,\fR -\fB Colormap \fIcolormap\fB);\fR -.fi -.B XftDrawCreate -creates a structure that can be used to render text and rectangles using -the specified -.IR drawable , -.IR visual , -and -.I colormap -on -.IR display . -The -.BR Drawable , -.BR Visual , -and -.B Colormap -data types are defined by the X11 library. -.PP -.nf -\fBXftDraw *\fR -\fBXftDrawCreateBitmap (Display *\fIdpy\fB,\fR -\fB Pixmap \fIbitmap\fB);\fR -.fi -.B XftDrawCreateBitmap -behaves as -.BR XftDrawCreate , -except it uses an X pixmap of color depth 1 instead of an X drawable. -The -.B Pixmap -data type is defined by the X11 library. -.PP -.nf -\fBXftDraw *\fR -\fBXftDrawCreateAlpha (Display *\fIdpy\fB,\fR -\fB Pixmap \fIpixmap\fB,\fR -\fB int \fIdepth\fB);\fR -.fi -.B XftDrawCreateAlpha -behaves as -.BR XftDrawCreate , -except it uses an X pixmap of color depth -.I depth -instead of an X drawable. -The -.B Pixmap -data type is defined by the X11 library. -.PP -.nf -\fBvoid\fR -\fBXftDrawChange (XftDraw *\fIdraw\fB,\fR -\fB Drawable \fIdrawable\fB);\fR -.fi -.B XftDrawChange -changes the X drawable association of the existing Xft draw object -.I draw -from its current value to -.IR drawable . -.PP -.nf -\fBDisplay *\fR -\fBXftDrawDisplay (XftDraw *\fIdraw\fB);\fR -.fi -.B XftDrawDisplay -returns a pointer to the display associated with the Xft draw object -.IR draw . -.PP -.nf -\fBDrawable\fR -\fBXftDrawDrawable (XftDraw *\fIdraw\fB);\fR -.fi -.B XftDrawDrawable -returns the X drawable associated with the Xft draw object -.IR draw . -.PP -.nf -\fBColormap\fR -\fBXftDrawColormap (XftDraw *\fIdraw\fB);\fR -.fi -.B XftDrawColormap -returns the colormap associatied with the Xft draw object -.IR draw . -.PP -.nf -\fBVisual *\fR -\fBXftDrawVisual (XftDraw *\fIdraw\fB);\fR -.fi -.B XftDrawVisual -returns a pointer to the visual associated with the Xft draw object -.IR draw . -.PP -.nf -\fBPicture\fR -\fBXftDrawPicture (XftDraw *\fIdraw\fB);\fR -.fi -.B XftDrawPicture -returns the picture associated with the Xft draw object -.IR draw . -If the the X server does not support the X Rendering Extension, 0 is -returned. -.PP -.nf -\fBPicture\fR -\fBXftDrawSrcPicture (XftDraw *\fIdraw\fB,\fR -\fB XftColor *\fIcolor\fB);\fR -.fi -.\" Unfortunately, I'm not quite sure what this does. I think it is the gizmo -.\" that is used to create an Xrender Picture object so that glyphs can be -.\" drawn in the XftDraw object -.\" .I draw -.\" using the specified -.\" .IR color . -.\" -- BR, 2005-04-02 -This function is never called if the X server doesn't support the X -Rendering Extension; instead, -.B XftGlyphCore -is used. -.PP -.nf -\fBvoid\fR -\fBXftDrawDestroy (XftDraw *\fIdraw\fB);\fR -.fi -.B XftDrawDestroy -destroys -.I draw -(created by one of the -.B XftCreate -functions) and frees the memory that was allocated for it. -.PP -.nf -\fBvoid\fR -\fBXftDrawString8 (XftDraw *\fId\fB,\fR -\fB XRenderColor *\fIcolor\fB,\fR -\fB XftFont *\fIfont\fB,\fR -\fB int \fIx\fB,\fR -\fB int \fIy\fB,\fR -\fB unsigned char *\fIstring\fB,\fR -\fB int \fIlen\fB);\fR -.fi -.B XftDrawString8 -draws no more than -.I len -glyphs of -.I string -to Xft drawable -.I d -using -.I font -in -.I color -at position -.IR x , " y" . -The -.B XRenderColor -data type is defined by the X Rendering Extension library. -.PP -.nf -\fBvoid\fR -\fBXftDrawRect (XftDraw *\fId\fB,\fR -\fB XRenderColor *\fIcolor\fB,\fR -\fB int \fIx\fB,\fR -\fB int \fIy\fB,\fR -\fB unsigned int \fIwidth\fB,\fR -\fB unsigned int \fIheight\fB);\fR -.fi -.B XftDrawRect -draws a solid rectangle of the specified -.IR color , -.IR width , -and -.I height -at position -.IR x , " y" -to Xft drawable -.IR d . -.SH COMPATIBILITY -As of version 2, -.B Xft -has become relatively stable and is expected to retain source and binary -compatibility in future releases. -.PP -.B Xft -does provide a compatibility interface to its previous major version, -Xft -.RI 1. x , -described below. -.SS "Xft 1.x Compatibility Header File" -.B #include -.\" .SS "Xft 1.x Compatibility Constants" -.SS "Xft 1.x Compatibility Data Types" -.TP -.B XftPattern -holds a set of names with associated value lists; each name refers to a -property of a font. -.BR XftPattern s -are used as inputs to the matching code as well as holding information -about specific fonts. -.TP -.B XftFontSet -contains a list of -.BR XftPattern s. -Internally, -.B Xft -uses this data structure to hold sets of fonts. -Externally, -.B Xft -returns the results of listing fonts in this format. -.TP -.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. -.\" .SS "Xft 1.x Compatibility Functions" -.SH AUTHOR -Keith Packard -.SH "SEE ALSO" -.I Fontconfig Developers Reference -.br -.I FreeType API Reference -.br -.I Xlib \- C Language Interface -.\" Set Vim modeline; textwidth is 70 to account for the extra margin -.\" padding that man (on Debian GNU/Linux) does for output to -.\" terminals (7 spaces on the left, 2 on the right), so that we don't -.\" go past 80 columns total, particularly in .nf/.fi regions. -.\" vim:set ai et sts=4 sw=4 tw=70: diff --git a/nx-X11/lib/Xft/Xft.h b/nx-X11/lib/Xft/Xft.h deleted file mode 100644 index f3ea5a298..000000000 --- a/nx-X11/lib/Xft/Xft.h +++ /dev/null @@ -1,642 +0,0 @@ -/* - * $Id: Xft.h,v 1.6 2005/10/19 02:46:56 kem Exp $ - * - * Copyright © 2000 Keith Packard - * - * 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_ - -/* - * Current Xft version number. This same number - * must appear in the Xft configure.ac file. Yes, - * it'a a pain to synchronize version numbers like this. - */ - -#define XFT_MAJOR 2 -#define XFT_MINOR 1 -#define XFT_REVISION 8 -#define XFT_VERSION ((XFT_MAJOR * 10000) + (XFT_MINOR * 100) + (XFT_REVISION)) -#define XftVersion XFT_VERSION - -#include -#include -#include FT_FREETYPE_H -#include -#include - -#include -/* #include */ -#ifndef _X_SENTINEL -# define _X_SENTINEL(x) -#endif - -#ifndef _XFT_NO_COMPAT_ -#include -#endif - -#define XFT_CORE "core" -#define XFT_RENDER "render" -#define XFT_XLFD "xlfd" -#define XFT_MAX_GLYPH_MEMORY "maxglyphmemory" -#define XFT_MAX_UNREF_FONTS "maxunreffonts" - -extern FT_Library _XftFTlibrary; - -typedef struct _XftFontInfo XftFontInfo; - -typedef struct _XftFont { - int ascent; - int descent; - int height; - int max_advance_width; - FcCharSet *charset; - FcPattern *pattern; -} XftFont; - -typedef struct _XftDraw XftDraw; - -typedef struct _XftColor { - unsigned long pixel; - XRenderColor color; -} XftColor; - -typedef struct _XftCharSpec { - FcChar32 ucs4; - short x; - short y; -} XftCharSpec; - -typedef struct _XftCharFontSpec { - XftFont *font; - FcChar32 ucs4; - short x; - short y; -} XftCharFontSpec; - -typedef struct _XftGlyphSpec { - FT_UInt glyph; - short x; - short y; -} XftGlyphSpec; - -typedef struct _XftGlyphFontSpec { - XftFont *font; - FT_UInt glyph; - short x; - short y; -} XftGlyphFontSpec; - -_XFUNCPROTOBEGIN - - -/* xftcolor.c */ -Bool -XftColorAllocName (Display *dpy, - _Xconst Visual *visual, - Colormap cmap, - _Xconst char *name, - XftColor *result); - -Bool -XftColorAllocValue (Display *dpy, - Visual *visual, - Colormap cmap, - _Xconst XRenderColor *color, - XftColor *result); - -void -XftColorFree (Display *dpy, - Visual *visual, - Colormap cmap, - XftColor *color); - - -/* xftcore.c */ - -/* xftdir.c */ -FcBool -XftDirScan (FcFontSet *set, _Xconst char *dir, FcBool force); - -FcBool -XftDirSave (FcFontSet *set, _Xconst char *dir); - -/* xftdpy.c */ -Bool -XftDefaultHasRender (Display *dpy); - -Bool -XftDefaultSet (Display *dpy, FcPattern *defaults); - -void -XftDefaultSubstitute (Display *dpy, int screen, FcPattern *pattern); - -/* xftdraw.c */ - -XftDraw * -XftDrawCreate (Display *dpy, - Drawable drawable, - Visual *visual, - Colormap colormap); - -XftDraw * -XftDrawCreateBitmap (Display *dpy, - Pixmap bitmap); - -XftDraw * -XftDrawCreateAlpha (Display *dpy, - Pixmap pixmap, - int depth); - -void -XftDrawChange (XftDraw *draw, - Drawable drawable); - -Display * -XftDrawDisplay (XftDraw *draw); - -Drawable -XftDrawDrawable (XftDraw *draw); - -Colormap -XftDrawColormap (XftDraw *draw); - -Visual * -XftDrawVisual (XftDraw *draw); - -void -XftDrawDestroy (XftDraw *draw); - -Picture -XftDrawPicture (XftDraw *draw); - -Picture -XftDrawSrcPicture (XftDraw *draw, _Xconst XftColor *color); - -void -XftDrawGlyphs (XftDraw *draw, - _Xconst XftColor *color, - XftFont *pub, - int x, - int y, - _Xconst FT_UInt *glyphs, - int nglyphs); - -void -XftDrawString8 (XftDraw *draw, - _Xconst XftColor *color, - XftFont *pub, - int x, - int y, - _Xconst FcChar8 *string, - int len); - -void -XftDrawString16 (XftDraw *draw, - _Xconst XftColor *color, - XftFont *pub, - int x, - int y, - _Xconst FcChar16 *string, - int len); - -void -XftDrawString32 (XftDraw *draw, - _Xconst XftColor *color, - XftFont *pub, - int x, - int y, - _Xconst FcChar32 *string, - int len); - -void -XftDrawStringUtf8 (XftDraw *draw, - _Xconst XftColor *color, - XftFont *pub, - int x, - int y, - _Xconst FcChar8 *string, - int len); - -void -XftDrawStringUtf16 (XftDraw *draw, - _Xconst XftColor *color, - XftFont *pub, - int x, - int y, - _Xconst FcChar8 *string, - FcEndian endian, - int len); - -void -XftDrawCharSpec (XftDraw *draw, - _Xconst XftColor *color, - XftFont *pub, - _Xconst XftCharSpec *chars, - int len); - -void -XftDrawCharFontSpec (XftDraw *draw, - _Xconst XftColor *color, - _Xconst XftCharFontSpec *chars, - int len); - -void -XftDrawGlyphSpec (XftDraw *draw, - _Xconst XftColor *color, - XftFont *pub, - _Xconst XftGlyphSpec *glyphs, - int len); - -void -XftDrawGlyphFontSpec (XftDraw *draw, - _Xconst XftColor *color, - _Xconst XftGlyphFontSpec *glyphs, - int len); - -void -XftDrawRect (XftDraw *draw, - _Xconst XftColor *color, - int x, - int y, - unsigned int width, - unsigned int height); - - -Bool -XftDrawSetClip (XftDraw *draw, - Region r); - - -Bool -XftDrawSetClipRectangles (XftDraw *draw, - int xOrigin, - int yOrigin, - _Xconst XRectangle *rects, - int n); - -void -XftDrawSetSubwindowMode (XftDraw *draw, - int mode); - -/* xftextent.c */ - -void -XftGlyphExtents (Display *dpy, - XftFont *pub, - _Xconst FT_UInt *glyphs, - int nglyphs, - XGlyphInfo *extents); - -void -XftTextExtents8 (Display *dpy, - XftFont *pub, - _Xconst FcChar8 *string, - int len, - XGlyphInfo *extents); - -void -XftTextExtents16 (Display *dpy, - XftFont *pub, - _Xconst FcChar16 *string, - int len, - XGlyphInfo *extents); - -void -XftTextExtents32 (Display *dpy, - XftFont *pub, - _Xconst FcChar32 *string, - int len, - XGlyphInfo *extents); - -void -XftTextExtentsUtf8 (Display *dpy, - XftFont *pub, - _Xconst FcChar8 *string, - int len, - XGlyphInfo *extents); - -void -XftTextExtentsUtf16 (Display *dpy, - XftFont *pub, - _Xconst FcChar8 *string, - FcEndian endian, - int len, - XGlyphInfo *extents); - -/* xftfont.c */ -FcPattern * -XftFontMatch (Display *dpy, - int screen, - _Xconst FcPattern *pattern, - FcResult *result); - -XftFont * -XftFontOpen (Display *dpy, int screen, ...) _X_SENTINEL(0); - -XftFont * -XftFontOpenName (Display *dpy, int screen, _Xconst char *name); - -XftFont * -XftFontOpenXlfd (Display *dpy, int screen, _Xconst char *xlfd); - -/* xftfreetype.c */ - -FT_Face -XftLockFace (XftFont *pub); - -void -XftUnlockFace (XftFont *pub); - -XftFontInfo * -XftFontInfoCreate (Display *dpy, _Xconst FcPattern *pattern); - -void -XftFontInfoDestroy (Display *dpy, XftFontInfo *fi); - -FcChar32 -XftFontInfoHash (_Xconst XftFontInfo *fi); - -FcBool -XftFontInfoEqual (_Xconst XftFontInfo *a, _Xconst XftFontInfo *b); - -XftFont * -XftFontOpenInfo (Display *dpy, - FcPattern *pattern, - XftFontInfo *fi); - -XftFont * -XftFontOpenPattern (Display *dpy, FcPattern *pattern); - -XftFont * -XftFontCopy (Display *dpy, XftFont *pub); - -void -XftFontClose (Display *dpy, XftFont *pub); - -FcBool -XftInitFtLibrary(void); - -/* xftglyphs.c */ -void -XftFontLoadGlyphs (Display *dpy, - XftFont *pub, - FcBool need_bitmaps, - _Xconst FT_UInt *glyphs, - int nglyph); - -void -XftFontUnloadGlyphs (Display *dpy, - XftFont *pub, - _Xconst FT_UInt *glyphs, - int nglyph); - -#define XFT_NMISSING 256 - -FcBool -XftFontCheckGlyph (Display *dpy, - XftFont *pub, - FcBool need_bitmaps, - FT_UInt glyph, - FT_UInt *missing, - int *nmissing); - -FcBool -XftCharExists (Display *dpy, - XftFont *pub, - FcChar32 ucs4); - -FT_UInt -XftCharIndex (Display *dpy, - XftFont *pub, - FcChar32 ucs4); - -/* xftgram.y */ - -/* xftinit.c */ -FcBool -XftInit (_Xconst char *config); - -int -XftGetVersion (void); - -/* xftlex.l */ - -/* xftlist.c */ - -FcFontSet * -XftListFonts (Display *dpy, - int screen, - ...) _X_SENTINEL(0); - -/* xftmatch.c */ - -/* xftmatrix.c */ - -/* xftname.c */ -FcPattern -*XftNameParse (_Xconst char *name); - -/* xftpat.c */ - -/* xftrender.c */ -void -XftGlyphRender (Display *dpy, - int op, - Picture src, - XftFont *pub, - Picture dst, - int srcx, - int srcy, - int x, - int y, - _Xconst FT_UInt *glyphs, - int nglyphs); - -void -XftGlyphSpecRender (Display *dpy, - int op, - Picture src, - XftFont *pub, - Picture dst, - int srcx, - int srcy, - _Xconst XftGlyphSpec *glyphs, - int nglyphs); - -void -XftCharSpecRender (Display *dpy, - int op, - Picture src, - XftFont *pub, - Picture dst, - int srcx, - int srcy, - _Xconst XftCharSpec *chars, - int len); - -void -XftGlyphFontSpecRender (Display *dpy, - int op, - Picture src, - Picture dst, - int srcx, - int srcy, - _Xconst XftGlyphFontSpec *glyphs, - int nglyphs); - -void -XftCharFontSpecRender (Display *dpy, - int op, - Picture src, - Picture dst, - int srcx, - int srcy, - _Xconst XftCharFontSpec *chars, - int len); - -void -XftTextRender8 (Display *dpy, - int op, - Picture src, - XftFont *pub, - Picture dst, - int srcx, - int srcy, - int x, - int y, - _Xconst FcChar8 *string, - int len); - -void -XftTextRender16 (Display *dpy, - int op, - Picture src, - XftFont *pub, - Picture dst, - int srcx, - int srcy, - int x, - int y, - _Xconst FcChar16 *string, - int len); - -void -XftTextRender16BE (Display *dpy, - int op, - Picture src, - XftFont *pub, - Picture dst, - int srcx, - int srcy, - int x, - int y, - _Xconst FcChar8 *string, - int len); - -void -XftTextRender16LE (Display *dpy, - int op, - Picture src, - XftFont *pub, - Picture dst, - int srcx, - int srcy, - int x, - int y, - _Xconst FcChar8 *string, - int len); - -void -XftTextRender32 (Display *dpy, - int op, - Picture src, - XftFont *pub, - Picture dst, - int srcx, - int srcy, - int x, - int y, - _Xconst FcChar32 *string, - int len); - -void -XftTextRender32BE (Display *dpy, - int op, - Picture src, - XftFont *pub, - Picture dst, - int srcx, - int srcy, - int x, - int y, - _Xconst FcChar8 *string, - int len); - -void -XftTextRender32LE (Display *dpy, - int op, - Picture src, - XftFont *pub, - Picture dst, - int srcx, - int srcy, - int x, - int y, - _Xconst FcChar8 *string, - int len); - -void -XftTextRenderUtf8 (Display *dpy, - int op, - Picture src, - XftFont *pub, - Picture dst, - int srcx, - int srcy, - int x, - int y, - _Xconst FcChar8 *string, - int len); - -void -XftTextRenderUtf16 (Display *dpy, - int op, - Picture src, - XftFont *pub, - Picture dst, - int srcx, - int srcy, - int x, - int y, - _Xconst FcChar8 *string, - FcEndian endian, - int len); - -/* xftstr.c */ - -/* xftxlfd.c */ -FcPattern * -XftXlfdParse (_Xconst char *xlfd_orig, Bool ignore_scalable, Bool complete); - -_XFUNCPROTOEND - -#endif /* _XFT_H_ */ diff --git a/nx-X11/lib/Xft/XftCompat.h b/nx-X11/lib/Xft/XftCompat.h deleted file mode 100644 index 27442d42a..000000000 --- a/nx-X11/lib/Xft/XftCompat.h +++ /dev/null @@ -1,165 +0,0 @@ -/* - * $Id: XftCompat.h,v 1.4 2005/07/03 07:00:57 daniels Exp $ - * - * Copyright © 2001 Keith Packard - * - * 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 _XFTCOMPAT_H_ -#define _XFTCOMPAT_H_ -#include - -/* - * Compatibility definitions -- map Fc names to Xft names - */ - -typedef FcChar8 XftChar8; -typedef FcChar16 XftChar16; -typedef FcChar32 XftChar32; - -#define XFT_FAMILY FC_FAMILY -#define XFT_STYLE FC_STYLE -#define XFT_SLANT FC_SLANT -#define XFT_WEIGHT FC_WEIGHT -#define XFT_SIZE FC_SIZE -#define XFT_PIXEL_SIZE FC_PIXEL_SIZE -#define XFT_SPACING FC_SPACING -#define XFT_FOUNDRY FC_FOUNDRY -#define XFT_ANTIALIAS FC_ANTIALIAS -#define XFT_FILE FC_FILE -#define XFT_INDEX FC_INDEX -#define XFT_RASTERIZER FC_RASTERIZER -#define XFT_OUTLINE FC_OUTLINE -#define XFT_SCALABLE FC_SCALABLE -#define XFT_RGBA FC_RGBA - -/* defaults from resources */ -#define XFT_SCALE FC_SCALE -#define XFT_MINSPACE FC_MINSPACE -#define XFT_DPI FC_DPI - -/* specific to FreeType rasterizer */ -#define XFT_CHAR_WIDTH FC_CHAR_WIDTH -#define XFT_CHAR_HEIGHT FC_CHAR_HEIGHT -#define XFT_MATRIX FC_MATRIX - -#define XFT_WEIGHT_LIGHT FC_WEIGHT_LIGHT -#define XFT_WEIGHT_MEDIUM FC_WEIGHT_MEDIUM -#define XFT_WEIGHT_DEMIBOLD FC_WEIGHT_DEMIBOLD -#define XFT_WEIGHT_BOLD FC_WEIGHT_BOLD -#define XFT_WEIGHT_BLACK FC_WEIGHT_BLACK - -#define XFT_SLANT_ROMAN FC_SLANT_ROMAN -#define XFT_SLANT_ITALIC FC_SLANT_ITALIC -#define XFT_SLANT_OBLIQUE FC_SLANT_OBLIQUE - -#define XFT_PROPORTIONAL FC_PROPORTIONAL -#define XFT_MONO FC_MONO -#define XFT_CHARCELL FC_CHARCELL - -#define XFT_RGBA_UNKNOWN FC_RGBA_UNKNOWN -#define XFT_RGBA_RGB FC_RGBA_RGB -#define XFT_RGBA_BGR FC_RGBA_BGR -#define XFT_RGBA_VRGB FC_RGBA_VRGB -#define XFT_RGBA_VBGR FC_RGBA_VBGR -#define XFT_RGBA_NONE FC_RGBA_NONE - -/* - * Old constants - */ -#define XFT_ENCODING "encoding" - -typedef FcType XftType; - -typedef FcMatrix XftMatrix; - -#define XftMatrixInit(m) FcMatrixInit(m) - -typedef FcResult XftResult; - -#define XftResultMatch FcResultMatch -#define XftResultNoMatch FcResultNoMatch -#define XftResultTypeMismatch FcResultTypeMismatch -#define XftResultNoId FcResultNoId - -typedef FcValue XftValue; -typedef FcPattern XftPattern; -typedef FcFontSet XftFontSet; -typedef FcObjectSet XftObjectSet; - -#define XftGlyphExists XftCharExists - -#define XftObjectSetCreate FcObjectSetCreate -#define XftObjectSetAdd FcObjectSetAdd -#define XftObjectSetDestroy FcObjectSetDestroy -#define XftObjectSetVaBuild FcObjectSetVaBuild -#define XftObjectSetBuild FcObjectSetBuild - -#define XftFontSetMatch FcFontSetMatch -#define XftFontSetDestroy FcFontSetDestroy - -#define XftMatrixEqual FcMatrixEqual -#define XftMatrixMultiply FcMatrixMultiply -#define XftMatrixRotate FcMatrixRotate -#define XftMatrixScale FcMatrixScale -#define XftMatrixShear FcMatrixShear - -#define XftPatternCreate FcPatternCreate -#define XftPatternDuplicate FcPatternDuplicate -#define XftValueDestroy FcValueDestroy -#define XftValueListDestroy FcValueListDestroy -#define XftPatternDestroy FcPatternDestroy -#define XftPatternFind FcPatternFind -#define XftPatternAdd FcPatternAdd -#define XftPatternGet FcPatternGet -#define XftPatternDel FcPatternDel -#define XftPatternAddInteger FcPatternAddInteger -#define XftPatternAddDouble FcPatternAddDouble -#define XftPatternAddString(p,e,s) FcPatternAddString(p,e,(FcChar8 *)(s)) -#define XftPatternAddMatrix FcPatternAddMatrix -#define XftPatternAddBool FcPatternAddBool -#define XftPatternGetInteger FcPatternGetInteger -#define XftPatternGetDouble FcPatternGetDouble -#define XftPatternGetString(p,e,i,n) FcPatternGetString(p,e,i,(FcChar8 **) (n)) -#define XftPatternGetMatrix FcPatternGetMatrix -#define XftPatternGetBool FcPatternGetBool -#define XftPatternVaBuild FcPatternVaBuild -#define XftPatternBuild FcPatternBuild - -#define XftUtf8ToUcs4 FcUtf8ToUcs4 -#define XftUtf8Len FcUtf8Len - -#define XftTypeVoid FcTypeVoid -#define XftTypeInteger FcTypeInteger -#define XftTypeDouble FcTypeDouble -#define XftTypeString FcTypeString -#define XftTypeBool FcTypeBool -#define XftTypeMatrix FcTypeMatrix - -#define XftConfigSubstitute(p) FcConfigSubstitute (0, p, FcMatchPattern) - -_XFUNCPROTOBEGIN - -FcBool -XftNameUnparse (XftPattern *pat, char *dest, int len); - -_XFUNCPROTOEND - -#endif /* _XFTCOMPAT_H_ */ diff --git a/nx-X11/lib/Xft/aclocal.m4 b/nx-X11/lib/Xft/aclocal.m4 deleted file mode 100644 index 901ff4099..000000000 --- a/nx-X11/lib/Xft/aclocal.m4 +++ /dev/null @@ -1,6858 +0,0 @@ -# generated automatically by aclocal 1.7.9 -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 -# Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -# Do all the work for Automake. -*- Autoconf -*- - -# This macro actually does too much some checks are only needed if -# your package does certain things. But this isn't really a big deal. - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 10 - -AC_PREREQ([2.54]) - -# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow -# the ones we care about. -m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl - -# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) -# AM_INIT_AUTOMAKE([OPTIONS]) -# ----------------------------------------------- -# The call with PACKAGE and VERSION arguments is the old style -# call (pre autoconf-2.50), which is being phased out. PACKAGE -# and VERSION should now be passed to AC_INIT and removed from -# the call to AM_INIT_AUTOMAKE. -# We support both call styles for the transition. After -# the next Automake release, Autoconf can make the AC_INIT -# arguments mandatory, and then we can depend on a new Autoconf -# release and drop the old call support. -AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl - AC_REQUIRE([AC_PROG_INSTALL])dnl -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi -AC_SUBST([CYGPATH_W]) - -# Define the identity of the package. -dnl Distinguish between old-style and new-style calls. -m4_ifval([$2], -[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl - AC_SUBST([PACKAGE], [$1])dnl - AC_SUBST([VERSION], [$2])], -[_AM_SET_OPTIONS([$1])dnl - AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl - AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl - -_AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) - AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl - -# Some tools Automake needs. -AC_REQUIRE([AM_SANITY_CHECK])dnl -AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) -AM_MISSING_PROG(AUTOCONF, autoconf) -AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) -AM_MISSING_PROG(AUTOHEADER, autoheader) -AM_MISSING_PROG(MAKEINFO, makeinfo) -AM_MISSING_PROG(AMTAR, tar) -AM_PROG_INSTALL_SH -AM_PROG_INSTALL_STRIP -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([AC_PROG_MAKE_SET])dnl -AC_REQUIRE([AM_SET_LEADING_DOT])dnl - -_AM_IF_OPTION([no-dependencies],, -[AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES(CC)], - [define([AC_PROG_CC], - defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl -AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES(CXX)], - [define([AC_PROG_CXX], - defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl -]) -]) - - -# When config.status generates a header, we must update the stamp-h file. -# This file resides in the same directory as the config header -# that is generated. The stamp files are numbered to have different names. - -# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the -# loop where config.status creates the headers, so we can generate -# our stamp files there. -AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], -[# Compute $1's index in $config_headers. -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $1 | $1:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) - -# Copyright 2002 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - -# AM_AUTOMAKE_VERSION(VERSION) -# ---------------------------- -# Automake X.Y traces this macro to ensure aclocal.m4 has been -# generated from the m4 files accompanying Automake X.Y. -AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"]) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION so it can be traced. -# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.7.9])]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright 2001, 2002 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 2 - -# _AM_MANGLE_OPTION(NAME) -# ----------------------- -AC_DEFUN([_AM_MANGLE_OPTION], -[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) - -# _AM_SET_OPTION(NAME) -# ------------------------------ -# Set option NAME. Presently that only means defining a flag for this option. -AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) - -# _AM_SET_OPTIONS(OPTIONS) -# ---------------------------------- -# OPTIONS is a space-separated list of Automake options. -AC_DEFUN([_AM_SET_OPTIONS], -[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) - -# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) -# ------------------------------------------- -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -AC_DEFUN([_AM_IF_OPTION], -[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) - -# -# Check to make sure that the build environment is sane. -# - -# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 3 - -# AM_SANITY_CHECK -# --------------- -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftest.file -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftest.file` - fi - rm -f conftest.file - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "$[2]" = conftest.file - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -AC_MSG_RESULT(yes)]) - -# -*- Autoconf -*- - - -# Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 3 - -# AM_MISSING_PROG(NAME, PROGRAM) -# ------------------------------ -AC_DEFUN([AM_MISSING_PROG], -[AC_REQUIRE([AM_MISSING_HAS_RUN]) -$1=${$1-"${am_missing_run}$2"} -AC_SUBST($1)]) - - -# AM_MISSING_HAS_RUN -# ------------------ -# Define MISSING if not defined so far and test if it supports --run. -# If it does, set am_missing_run to use it, otherwise, to nothing. -AC_DEFUN([AM_MISSING_HAS_RUN], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - AC_MSG_WARN([`missing' script is too old or missing]) -fi -]) - -# AM_AUX_DIR_EXPAND - -# Copyright 2001 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to -# `$srcdir', `$srcdir/..', or `$srcdir/../..'. -# -# Of course, Automake must honor this variable whenever it calls a -# tool from the auxiliary directory. The problem is that $srcdir (and -# therefore $ac_aux_dir as well) can be either absolute or relative, -# depending on how configure is run. This is pretty annoying, since -# it makes $ac_aux_dir quite unusable in subdirectories: in the top -# source directory, any form will work fine, but in subdirectories a -# relative path needs to be adjusted first. -# -# $ac_aux_dir/missing -# fails when called from a subdirectory if $ac_aux_dir is relative -# $top_srcdir/$ac_aux_dir/missing -# fails if $ac_aux_dir is absolute, -# fails when called from a subdirectory in a VPATH build with -# a relative $ac_aux_dir -# -# The reason of the latter failure is that $top_srcdir and $ac_aux_dir -# are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is `.', but things will broke when you -# start a VPATH build or use an absolute $srcdir. -# -# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, -# iff we strip the leading $srcdir from $ac_aux_dir. That would be: -# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` -# and then we would define $MISSING as -# MISSING="\${SHELL} $am_aux_dir/missing" -# This will work as long as MISSING is not called from configure, because -# unfortunately $(top_srcdir) has no meaning in configure. -# However there are other variables, like CC, which are often used in -# configure, and could therefore not use this "fixed" $ac_aux_dir. -# -# Another solution, used here, is to always expand $ac_aux_dir to an -# absolute PATH. The drawback is that using absolute paths prevent a -# configured tree to be moved without reconfiguration. - -# Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50]) - -AC_DEFUN([AM_AUX_DIR_EXPAND], [ -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` -]) - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. - -# Copyright 2001 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -install_sh=${install_sh-"$am_aux_dir/install-sh"} -AC_SUBST(install_sh)]) - -# AM_PROG_INSTALL_STRIP - -# Copyright 2001 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# One issue with vendor `install' (even GNU) is that you can't -# specify the program used to strip binaries. This is especially -# annoying in cross-compiling environments, where the build's strip -# is unlikely to handle the host's binaries. -# Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in `make install-strip', and initialize -# STRIPPROG with the value of the STRIP variable (set by the user). -AC_DEFUN([AM_PROG_INSTALL_STRIP], -[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be `maybe'. -if test "$cross_compiling" != no; then - AC_CHECK_TOOL([STRIP], [strip], :) -fi -INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# -*- Autoconf -*- -# Copyright (C) 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 1 - -# Check whether the underlying file-system supports filenames -# with a leading dot. For instance MS-DOS doesn't. -AC_DEFUN([AM_SET_LEADING_DOT], -[rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null -AC_SUBST([am__leading_dot])]) - -# serial 5 -*- Autoconf -*- - -# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - - -# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be -# written in clear, in which case automake, when reading aclocal.m4, -# will think it sees a *use*, and therefore will trigger all it's -# C support machinery. Also note that it means that autoscan, seeing -# CC etc. in the Makefile, will ask for an AC_PROG_CC use... - - - -# _AM_DEPENDENCIES(NAME) -# ---------------------- -# See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "GCJ", or "OBJC". -# We try a few techniques and use that to set a single cache variable. -# -# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was -# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular -# dependency, and given that the user is not expected to run this macro, -# just rely on AC_PROG_CC. -AC_DEFUN([_AM_DEPENDENCIES], -[AC_REQUIRE([AM_SET_DEPDIR])dnl -AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl -AC_REQUIRE([AM_MAKE_INCLUDE])dnl -AC_REQUIRE([AM_DEP_TRACK])dnl - -ifelse([$1], CC, [depcc="$CC" am_compiler_list=], - [$1], CXX, [depcc="$CXX" am_compiler_list=], - [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) - -AC_CACHE_CHECK([dependency style of $depcc], - [am_cv_$1_dependencies_compiler_type], -[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_$1_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - : > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # (even with -Werror). So we grep stderr for any message - # that says an option was ignored. - if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else - am_cv_$1_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_$1_dependencies_compiler_type=none -fi -]) -AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) -AM_CONDITIONAL([am__fastdep$1], [ - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) -]) - - -# AM_SET_DEPDIR -# ------------- -# Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES -AC_DEFUN([AM_SET_DEPDIR], -[AC_REQUIRE([AM_SET_LEADING_DOT])dnl -AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl -]) - - -# AM_DEP_TRACK -# ------------ -AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE(dependency-tracking, -[ --disable-dependency-tracking Speeds up one-time builds - --enable-dependency-tracking Do not reject slow dependency extractors]) -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi -AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -AC_SUBST([AMDEPBACKSLASH]) -]) - -# Generate code to set up dependency tracking. -*- Autoconf -*- - -# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -#serial 2 - -# _AM_OUTPUT_DEPENDENCY_COMMANDS -# ------------------------------ -AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], -[for mf in $CONFIG_FILES; do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue - # Extract the definition of DEP_FILES from the Makefile without - # running `make'. - DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` - test -z "$DEPDIR" && continue - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n -e '/^U = / s///p' < "$mf"` - test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" - # We invoke sed twice because it is the simplest approach to - # changing $(DEPDIR) to its actual value in the expansion. - for file in `sed -n -e ' - /^DEP_FILES = .*\\\\$/ { - s/^DEP_FILES = // - :loop - s/\\\\$// - p - n - /\\\\$/ b loop - p - } - /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done -])# _AM_OUTPUT_DEPENDENCY_COMMANDS - - -# AM_OUTPUT_DEPENDENCY_COMMANDS -# ----------------------------- -# This macro should only be invoked once -- use via AC_REQUIRE. -# -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each `.P' file that we will -# need in order to bootstrap the dependency handling code. -AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], -[AC_CONFIG_COMMANDS([depfiles], - [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) - -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 2 - -# AM_MAKE_INCLUDE() -# ----------------- -# Check to see how make treats includes. -AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo done -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# We grep out `Entering directory' and `Leaving directory' -# messages which can occur if `w' ends up in MAKEFLAGS. -# In particular we don't look at `^make:' because GNU make might -# be invoked under some other name (usually "gmake"), in which -# case it prints its new name instead of `make'. -if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU -fi -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then - am__include=.include - am__quote="\"" - _am_result=BSD - fi -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) - -# AM_CONDITIONAL -*- Autoconf -*- - -# Copyright 1997, 2000, 2001 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 5 - -AC_PREREQ(2.52) - -# AM_CONDITIONAL(NAME, SHELL-CONDITION) -# ------------------------------------- -# Define a conditional. -AC_DEFUN([AM_CONDITIONAL], -[ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_SUBST([$1_TRUE]) -AC_SUBST([$1_FALSE]) -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi -AC_CONFIG_COMMANDS_PRE( -[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then - AC_MSG_ERROR([conditional "$1" was never defined. -Usually this means the macro was only invoked conditionally.]) -fi])]) - -# Add --enable-maintainer-mode option to configure. -# From Jim Meyering - -# Copyright 1996, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 2 - -AC_DEFUN([AM_MAINTAINER_MODE], -[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) - dnl maintainer-mode is disabled by default - AC_ARG_ENABLE(maintainer-mode, -[ --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer], - USE_MAINTAINER_MODE=$enableval, - USE_MAINTAINER_MODE=no) - AC_MSG_RESULT([$USE_MAINTAINER_MODE]) - AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) - MAINT=$MAINTAINER_MODE_TRUE - AC_SUBST(MAINT)dnl -] -) - -AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) - -# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*- - -# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -AC_PREREQ([2.52]) - -# serial 6 - -# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. -AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) - -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- - -# serial 47 AC_PROG_LIBTOOL -# Debian $Rev: 192 $ - - -# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) -# ----------------------------------------------------------- -# If this macro is not defined by Autoconf, define it here. -m4_ifdef([AC_PROVIDE_IFELSE], - [], - [m4_define([AC_PROVIDE_IFELSE], - [m4_ifdef([AC_PROVIDE_$1], - [$2], [$3])])]) - - -# AC_PROG_LIBTOOL -# --------------- -AC_DEFUN([AC_PROG_LIBTOOL], -[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl -dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX -dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. - AC_PROVIDE_IFELSE([AC_PROG_CXX], - [AC_LIBTOOL_CXX], - [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX - ])]) -dnl And a similar setup for Fortran 77 support - AC_PROVIDE_IFELSE([AC_PROG_F77], - [AC_LIBTOOL_F77], - [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 -])]) - -dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. -dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run -dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. - AC_PROVIDE_IFELSE([AC_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [ifdef([AC_PROG_GCJ], - [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) - ifdef([A][M_PROG_GCJ], - [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) - ifdef([LT_AC_PROG_GCJ], - [define([LT_AC_PROG_GCJ], - defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) -])])# AC_PROG_LIBTOOL - - -# _AC_PROG_LIBTOOL -# ---------------- -AC_DEFUN([_AC_PROG_LIBTOOL], -[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl -AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl -AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl -AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -# Prevent multiple expansion -define([AC_PROG_LIBTOOL], []) -])# _AC_PROG_LIBTOOL - - -# AC_LIBTOOL_SETUP -# ---------------- -AC_DEFUN([AC_LIBTOOL_SETUP], -[AC_PREREQ(2.50)dnl -AC_REQUIRE([AC_ENABLE_SHARED])dnl -AC_REQUIRE([AC_ENABLE_STATIC])dnl -AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_LD])dnl -AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl -AC_REQUIRE([AC_PROG_NM])dnl - -AC_REQUIRE([AC_PROG_LN_S])dnl -AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! -AC_REQUIRE([AC_OBJEXT])dnl -AC_REQUIRE([AC_EXEEXT])dnl -dnl - -AC_LIBTOOL_SYS_MAX_CMD_LEN -AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -AC_LIBTOOL_OBJDIR - -AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl -_LT_AC_PROG_ECHO_BACKSLASH - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] - -# Same as above, but do not quote variable references. -[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" - -AC_CHECK_TOOL(AR, ar, false) -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(STRIP, strip, :) - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$SED" && SED=sed -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" - ;; - *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -# Only perform the check for file, if the check method requires it -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - AC_PATH_MAGIC - fi - ;; -esac - -AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) -AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], -enable_win32_dll=yes, enable_win32_dll=no) - -AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -AC_ARG_WITH([pic], - [AC_HELP_STRING([--with-pic], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [pic_mode="$withval"], - [pic_mode=default]) -test -z "$pic_mode" && pic_mode=default - -# Use C for the default configuration in the libtool script -tagname= -AC_LIBTOOL_LANG_C_CONFIG -_LT_AC_TAGCONFIG -])# AC_LIBTOOL_SETUP - - -# _LT_AC_SYS_COMPILER -# ------------------- -AC_DEFUN([_LT_AC_SYS_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_AC_SYS_COMPILER - - -# _LT_AC_SYS_LIBPATH_AIX -# ---------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], -[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi],[]) -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -])# _LT_AC_SYS_LIBPATH_AIX - - -# _LT_AC_SHELL_INIT(ARG) -# ---------------------- -AC_DEFUN([_LT_AC_SHELL_INIT], -[ifdef([AC_DIVERSION_NOTICE], - [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -$1 -AC_DIVERT_POP -])# _LT_AC_SHELL_INIT - - -# _LT_AC_PROG_ECHO_BACKSLASH -# -------------------------- -# Add some code to the start of the generated configure script which -# will find an echo command which doesn't interpret backslashes. -AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], -[_LT_AC_SHELL_INIT([ -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` - ;; -esac - -echo=${ECHO-echo} -if test "X[$]1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X[$]1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then - # Yippee, $echo works! - : -else - # Restart under the correct shell. - exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} -fi - -if test "X[$]1" = X--fallback-echo; then - # used as fallback echo - shift - cat </dev/null && - echo_test_string="`eval $cmd`" && - (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null - then - break - fi - done -fi - -if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : -else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$echo" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - echo='print -r' - elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} - else - # Try using printf. - echo='printf %s\n' - if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - echo="$CONFIG_SHELL [$]0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$CONFIG_SHELL [$]0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do - if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "[$]0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} - else - # Oops. We lost completely, so just stick with echo. - echo=echo - fi - fi - fi - fi -fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -ECHO=$echo -if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then - ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" -fi - -AC_SUBST(ECHO) -])])# _LT_AC_PROG_ECHO_BACKSLASH - - -# _LT_AC_LOCK -# ----------- -AC_DEFUN([_LT_AC_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case "`/usr/bin/file conftest.o`" in - *32-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_LANG_PUSH(C) - AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], -[*-*-cygwin* | *-*-mingw* | *-*-pw32*) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; - ]) -esac - -need_locks="$enable_libtool_lock" - -])# _LT_AC_LOCK - - -# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], -[AC_REQUIRE([LT_AC_PROG_SED]) -AC_CACHE_CHECK([$1], [$2], - [$2=no - ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - $2=yes - fi - fi - $rm conftest* -]) - -if test x"[$]$2" = xyes; then - ifelse([$5], , :, [$5]) -else - ifelse([$6], , :, [$6]) -fi -])# AC_LIBTOOL_COMPILER_OPTION - - -# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ------------------------------------------------------------ -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], -[AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - else - $2=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - ifelse([$4], , :, [$4]) -else - ifelse([$5], , :, [$5]) -fi -])# AC_LIBTOOL_LINKER_OPTION - - -# AC_LIBTOOL_SYS_MAX_CMD_LEN -# -------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], -[# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - testring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 2>/dev/null` \ - = "XX$testring") >/dev/null 2>&1 && - new_result=`expr "X$testring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - testring=$testring$testring - done - testring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - ;; - esac -]) -if test -n $lt_cv_sys_max_cmd_len ; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -])# AC_LIBTOOL_SYS_MAX_CMD_LEN - - -# _LT_AC_CHECK_DLFCN -# -------------------- -AC_DEFUN([_LT_AC_CHECK_DLFCN], -[AC_CHECK_HEADERS(dlfcn.h)dnl -])# _LT_AC_CHECK_DLFCN - - -# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, -# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -# ------------------------------------------------------------------ -AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], -[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -if test "$cross_compiling" = yes; then : - [$4] -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -}] -EOF - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) $1 ;; - x$lt_dlneed_uscore) $2 ;; - x$lt_unknown|x*) $3 ;; - esac - else : - # compilation failed - $3 - fi -fi -rm -fr conftest* -])# _LT_AC_TRY_DLOPEN_SELF - - -# AC_LIBTOOL_DLOPEN_SELF -# ------------------- -AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], -[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ]) - ;; - - *) - AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen="shl_load"], - [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], - [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen="dlopen"], - [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], - [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], - [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) - ]) - ]) - ]) - ]) - ]) - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - AC_CACHE_CHECK([whether a program can dlopen itself], - lt_cv_dlopen_self, [dnl - _LT_AC_TRY_DLOPEN_SELF( - lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, - lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) - ]) - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - AC_CACHE_CHECK([whether a statically linked program can dlopen itself], - lt_cv_dlopen_self_static, [dnl - _LT_AC_TRY_DLOPEN_SELF( - lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, - lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) - ]) - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi -])# AC_LIBTOOL_DLOPEN_SELF - - -# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) -# --------------------------------- -# Check to see if options -c and -o are simultaneously supported by compiler -AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl -AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], - [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], - [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* -]) -])# AC_LIBTOOL_PROG_CC_C_O - - -# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) -# ----------------------------------------- -# Check to see if we can do hard links to lock some files if needed -AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], -[AC_REQUIRE([_LT_AC_LOCK])dnl - -hard_links="nottested" -if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - AC_MSG_CHECKING([if we can lock with hard links]) - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - AC_MSG_RESULT([$hard_links]) - if test "$hard_links" = no; then - AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) - need_locks=warn - fi -else - need_locks=no -fi -])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS - - -# AC_LIBTOOL_OBJDIR -# ----------------- -AC_DEFUN([AC_LIBTOOL_OBJDIR], -[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -[rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null]) -objdir=$lt_cv_objdir -])# AC_LIBTOOL_OBJDIR - - -# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) -# ---------------------------------------------- -# Check hardcoding attributes. -AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_AC_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ - test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \ - test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then - - # We can hardcode non-existant directories. - if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && - test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then - # Linking always hardcodes the temporary library directory. - _LT_AC_TAGVAR(hardcode_action, $1)=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_AC_TAGVAR(hardcode_action, $1)=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - _LT_AC_TAGVAR(hardcode_action, $1)=unsupported -fi -AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) - -if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi -])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH - - -# AC_LIBTOOL_SYS_LIB_STRIP -# ------------------------ -AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], -[striplib= -old_striplib= -AC_MSG_CHECKING([whether stripping libraries is possible]) -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) -fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -])# AC_LIBTOOL_SYS_LIB_STRIP - - -# AC_LIBTOOL_SYS_DYNAMIC_LINKER -# ----------------------------- -# PORTME Fill in your ld.so characteristics -AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], -[AC_MSG_CHECKING([dynamic linker characteristics]) -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi4*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - ld_extra=`$SED -e 's/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g' /etc/ld.so.conf` - sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=yes - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -AC_MSG_RESULT([$dynamic_linker]) -test "$dynamic_linker" = no && can_build_shared=no -])# AC_LIBTOOL_SYS_DYNAMIC_LINKER - - -# _LT_AC_TAGCONFIG -# ---------------- -AC_DEFUN([_LT_AC_TAGCONFIG], -[AC_ARG_WITH([tags], - [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], - [include additional configurations @<:@automatic@:>@])], - [tagnames="$withval"]) - -if test -f "$ltmain" && test -n "$tagnames"; then - if test ! -f "${ofile}"; then - AC_MSG_WARN([output file `$ofile' does not exist]) - fi - - if test -z "$LTCC"; then - eval "`$SHELL ${ofile} --config | grep '^LTCC='`" - if test -z "$LTCC"; then - AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) - else - AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) - fi - fi - - # Extract list of available tagged configurations in $ofile. - # Note that this assumes the entire list is on one line. - available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` - - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for tagname in $tagnames; do - IFS="$lt_save_ifs" - # Check whether tagname contains only valid characters - case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in - "") ;; - *) AC_MSG_ERROR([invalid tag name: $tagname]) - ;; - esac - - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null - then - AC_MSG_ERROR([tag name \"$tagname\" already exists]) - fi - - # Update the list of available tags. - if test -n "$tagname"; then - echo appending configuration tag \"$tagname\" to $ofile - - case $tagname in - CXX) - if test -n "$CXX" && test "X$CXX" != "Xno"; then - AC_LIBTOOL_LANG_CXX_CONFIG - else - tagname="" - fi - ;; - - F77) - if test -n "$F77" && test "X$F77" != "Xno"; then - AC_LIBTOOL_LANG_F77_CONFIG - else - tagname="" - fi - ;; - - GCJ) - if test -n "$GCJ" && test "X$GCJ" != "Xno"; then - AC_LIBTOOL_LANG_GCJ_CONFIG - else - tagname="" - fi - ;; - - RC) - AC_LIBTOOL_LANG_RC_CONFIG - ;; - - *) - AC_MSG_ERROR([Unsupported tag name: $tagname]) - ;; - esac - - # Append the new tag name to the list of available tags. - if test -n "$tagname" ; then - available_tags="$available_tags $tagname" - fi - fi - done - IFS="$lt_save_ifs" - - # Now substitute the updated list of available tags. - if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then - mv "${ofile}T" "$ofile" - chmod +x "$ofile" - else - rm -f "${ofile}T" - AC_MSG_ERROR([unable to update list of available tagged configurations.]) - fi -fi -])# _LT_AC_TAGCONFIG - - -# AC_LIBTOOL_DLOPEN -# ----------------- -# enable checks for dlopen support -AC_DEFUN([AC_LIBTOOL_DLOPEN], - [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) -])# AC_LIBTOOL_DLOPEN - - -# AC_LIBTOOL_WIN32_DLL -# -------------------- -# declare package support for building win32 dll's -AC_DEFUN([AC_LIBTOOL_WIN32_DLL], -[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) -])# AC_LIBTOOL_WIN32_DLL - - -# AC_ENABLE_SHARED([DEFAULT]) -# --------------------------- -# implement the --enable-shared flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_SHARED], -[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([shared], - [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_shared=]AC_ENABLE_SHARED_DEFAULT) -])# AC_ENABLE_SHARED - - -# AC_DISABLE_SHARED -# ----------------- -#- set the default shared flag to --disable-shared -AC_DEFUN([AC_DISABLE_SHARED], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_SHARED(no) -])# AC_DISABLE_SHARED - - -# AC_ENABLE_STATIC([DEFAULT]) -# --------------------------- -# implement the --enable-static flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_STATIC], -[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([static], - [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_static=]AC_ENABLE_STATIC_DEFAULT) -])# AC_ENABLE_STATIC - - -# AC_DISABLE_STATIC -# ----------------- -# set the default static flag to --disable-static -AC_DEFUN([AC_DISABLE_STATIC], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_STATIC(no) -])# AC_DISABLE_STATIC - - -# AC_ENABLE_FAST_INSTALL([DEFAULT]) -# --------------------------------- -# implement the --enable-fast-install flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_FAST_INSTALL], -[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([fast-install], - [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) -])# AC_ENABLE_FAST_INSTALL - - -# AC_DISABLE_FAST_INSTALL -# ----------------------- -# set the default to --disable-fast-install -AC_DEFUN([AC_DISABLE_FAST_INSTALL], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_FAST_INSTALL(no) -])# AC_DISABLE_FAST_INSTALL - - -# AC_LIBTOOL_PICMODE([MODE]) -# -------------------------- -# implement the --with-pic flag -# MODE is either `yes' or `no'. If omitted, it defaults to `both'. -AC_DEFUN([AC_LIBTOOL_PICMODE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -pic_mode=ifelse($#,1,$1,default) -])# AC_LIBTOOL_PICMODE - - -# AC_PROG_EGREP -# ------------- -# This is predefined starting with Autoconf 2.54, so this conditional -# definition can be removed once we require Autoconf 2.54 or later. -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], -[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], - [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi]) - EGREP=$ac_cv_prog_egrep - AC_SUBST([EGREP]) -])]) - - -# AC_PATH_TOOL_PREFIX -# ------------------- -# find a file program which can recognise shared library -AC_DEFUN([AC_PATH_TOOL_PREFIX], -[AC_REQUIRE([AC_PROG_EGREP])dnl -AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[case $MAGIC_CMD in -[[\\/*] | ?:[\\/]*]) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="ifelse([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$1; then - lt_cv_path_MAGIC_CMD="$ac_dir/$1" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac]) -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -])# AC_PATH_TOOL_PREFIX - - -# AC_PATH_MAGIC -# ------------- -# find a file program which can recognise a shared library -AC_DEFUN([AC_PATH_MAGIC], -[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# AC_PATH_MAGIC - - -# AC_PROG_LD -# ---------- -# find the pathname to the GNU or non-GNU linker -AC_DEFUN([AC_PROG_LD], -[AC_ARG_WITH([gnu-ld], - [AC_HELP_STRING([--with-gnu-ld], - [assume the C compiler uses GNU ld @<:@default=no@:>@])], - [test "$withval" = no || with_gnu_ld=yes], - [with_gnu_ld=no]) -AC_REQUIRE([LT_AC_PROG_SED])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by $CC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(lt_cv_path_LD, -[if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case "$host_cpu" in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux*) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd* | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -nto-qnx*) - lt_cv_deplibs_check_method=unknown - ;; - -openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' - else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown -])# AC_DEPLIBS_CHECK_METHOD - - -# AC_PROG_NM -# ---------- -# find the pathname to a BSD-compatible name lister -AC_DEFUN([AC_PROG_NM], -[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/${ac_tool_prefix}nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - esac - fi - done - IFS="$lt_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi]) -NM="$lt_cv_path_NM" -])# AC_PROG_NM - - -# AC_CHECK_LIBM -# ------------- -# check for math library -AC_DEFUN([AC_CHECK_LIBM], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -])# AC_CHECK_LIBM - - -# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl convenience library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will -# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with -# '${top_srcdir}/' (note the single quotes!). If your package is not -# flat and you're not using automake, define top_builddir and -# top_srcdir appropriately in the Makefiles. -AC_DEFUN([AC_LIBLTDL_CONVENIENCE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - case $enable_ltdl_convenience in - no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; - "") enable_ltdl_convenience=yes - ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; - esac - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_CONVENIENCE - - -# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl installable library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-install to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided and an installed libltdl is not found, it is -# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' -# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single -# quotes!). If your package is not flat and you're not using automake, -# define top_builddir and top_srcdir appropriately in the Makefiles. -# In the future, this macro may have to be called after AC_PROG_LIBTOOL. -AC_DEFUN([AC_LIBLTDL_INSTALLABLE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - AC_CHECK_LIB(ltdl, lt_dlinit, - [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], - [if test x"$enable_ltdl_install" = xno; then - AC_MSG_WARN([libltdl not installed, but installation disabled]) - else - enable_ltdl_install=yes - fi - ]) - if test x"$enable_ltdl_install" = x"yes"; then - ac_configure_args="$ac_configure_args --enable-ltdl-install" - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - LTDLINCL= - fi - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_INSTALLABLE - - -# AC_LIBTOOL_CXX -# -------------- -# enable support for C++ libraries -AC_DEFUN([AC_LIBTOOL_CXX], -[AC_REQUIRE([_LT_AC_LANG_CXX]) -])# AC_LIBTOOL_CXX - - -# _LT_AC_LANG_CXX -# --------------- -AC_DEFUN([_LT_AC_LANG_CXX], -[AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) -])# _LT_AC_LANG_CXX - - -# AC_LIBTOOL_F77 -# -------------- -# enable support for Fortran 77 libraries -AC_DEFUN([AC_LIBTOOL_F77], -[AC_REQUIRE([_LT_AC_LANG_F77]) -])# AC_LIBTOOL_F77 - - -# _LT_AC_LANG_F77 -# --------------- -AC_DEFUN([_LT_AC_LANG_F77], -[AC_REQUIRE([AC_PROG_F77]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) -])# _LT_AC_LANG_F77 - - -# AC_LIBTOOL_GCJ -# -------------- -# enable support for GCJ libraries -AC_DEFUN([AC_LIBTOOL_GCJ], -[AC_REQUIRE([_LT_AC_LANG_GCJ]) -])# AC_LIBTOOL_GCJ - - -# _LT_AC_LANG_GCJ -# --------------- -AC_DEFUN([_LT_AC_LANG_GCJ], -[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], - [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], - [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], - [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], - [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) -])# _LT_AC_LANG_GCJ - - -# AC_LIBTOOL_RC -# -------------- -# enable support for Windows resource files -AC_DEFUN([AC_LIBTOOL_RC], -[AC_REQUIRE([LT_AC_PROG_RC]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) -])# AC_LIBTOOL_RC - - -# AC_LIBTOOL_LANG_C_CONFIG -# ------------------------ -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) -AC_DEFUN([_LT_AC_LANG_C_CONFIG], -[lt_save_CC="$CC" -AC_LANG_PUSH(C) - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' - -_LT_AC_SYS_COMPILER - -# -# Check for any special shared library compilation flags. -# -_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= -if test "$GCC" = no; then - case $host_os in - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' - ;; - esac -fi -if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then - AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) - if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[ ]]" >/dev/null; then : - else - AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) - _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no - fi -fi - - -# -# Check to make sure the static flag actually works. -# -AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), - $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), - [], - [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) - - -AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_DLOPEN_SELF($1) - -# Report which librarie types wil actually be built -AC_MSG_CHECKING([if libtool supports shared libraries]) -AC_MSG_RESULT([$can_build_shared]) - -AC_MSG_CHECKING([whether to build shared libraries]) -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - -aix4*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - darwin* | rhapsody*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' - ;; - esac - fi - ;; - esac - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; -esac -AC_MSG_RESULT([$enable_shared]) - -AC_MSG_CHECKING([whether to build static libraries]) -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -AC_MSG_RESULT([$enable_static]) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_C_CONFIG - - -# AC_LIBTOOL_LANG_CXX_CONFIG -# -------------------------- -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) -AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], -[AC_LANG_PUSH(C++) -AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) - -_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_AC_TAGVAR(allow_undefined_flag, $1)= -_LT_AC_TAGVAR(always_export_symbols, $1)=no -_LT_AC_TAGVAR(archive_expsym_cmds, $1)= -_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_direct, $1)=no -_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= -_LT_AC_TAGVAR(hardcode_minus_L, $1)=no -_LT_AC_TAGVAR(hardcode_automatic, $1)=no -_LT_AC_TAGVAR(module_cmds, $1)= -_LT_AC_TAGVAR(module_expsym_cmds, $1)= -_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown -_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_AC_TAGVAR(no_undefined_flag, $1)= -_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= -_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Dependencies to place before and after the object being linked: -_LT_AC_TAGVAR(predep_objects, $1)= -_LT_AC_TAGVAR(postdep_objects, $1)= -_LT_AC_TAGVAR(predeps, $1)= -_LT_AC_TAGVAR(postdeps, $1)= -_LT_AC_TAGVAR(compiler_lib_search_path, $1)= - -# Source file extension for C++ test sources. -ac_ext=cc - -# Object file extension for compiled C++ test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_LD=$LD -lt_save_GCC=$GCC -GCC=$GXX -lt_save_with_gnu_ld=$with_gnu_ld -lt_save_path_LD=$lt_cv_path_LD -if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx -else - unset lt_cv_prog_gnu_ld -fi -if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX -else - unset lt_cv_path_LD -fi -test -z "${LDCXX+set}" || LD=$LDCXX -CC=${CXX-"c++"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -# We don't want -fno-exception wen compiling C++ code, so set the -# no_builtin_flag separately -if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' -else - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= -fi - -if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - AC_PROG_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ - grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - -else - GXX=no - with_gnu_ld=no - wlarc= -fi - -# PORTME: fill in a description of your system's C++ link characteristics -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -_LT_AC_TAGVAR(ld_shlibs, $1)=yes -case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GXX" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - darwin* | rhapsody*) - if test "$GXX" = yes; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' - ;; - esac - fi - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - dgux*) - case $cc_basename in - ec++) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - freebsd[12]*) - # C++ shared libraries reported to be fairly broken before switch to ELF - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - freebsd-elf*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - freebsd* | kfreebsd*-gnu) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - ;; - gnu*) - ;; - hpux9*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - *) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC) - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case "$host_cpu" in - ia64*|hppa*64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - irix5* | irix6*) - case $cc_basename in - CC) - # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' - fi - fi - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - linux*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc) - # Intel C++ - with_gnu_ld=yes - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - cxx) - # Compaq C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - esac - ;; - lynxos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - m88k*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - mvs*) - case $cc_basename in - cxx) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - netbsd* | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - osf3*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - osf4* | osf5*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ - $rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - psos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - sco*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - lcc) - # Lucid - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | grep -v '^2\.7' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - fi - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - fi - ;; - esac - ;; - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - vxworks*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; -esac -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_AC_TAGVAR(GCC, $1)="$GXX" -_LT_AC_TAGVAR(LD, $1)="$LD" - -AC_LIBTOOL_POSTDEP_PREDEP($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_DLOPEN_SELF($1) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC=$lt_save_CC -LDCXX=$LD -LD=$lt_save_LD -GCC=$lt_save_GCC -with_gnu_ldcxx=$with_gnu_ld -with_gnu_ld=$lt_save_with_gnu_ld -lt_cv_path_LDCXX=$lt_cv_path_LD -lt_cv_path_LD=$lt_save_path_LD -lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld -lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -])# AC_LIBTOOL_LANG_CXX_CONFIG - -# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) -# ------------------------ -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <> "$cfgfile" -ifelse([$1], [], -[#! $SHELL - -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# -# This file is part of GNU Libtool: -# Originally by Gordon Matzigkeit , 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# A sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi - -# The names of the tagged configurations supported by this script. -available_tags= - -# ### BEGIN LIBTOOL CONFIG], -[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) - -# Is the compiler the GNU C compiler? -with_gcc=$_LT_AC_TAGVAR(GCC, $1) - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_[]_LT_AC_TAGVAR(LD, $1) - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext='$shrext' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) - -# Commands used to build and install a shared archive. -archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) -archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) -module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" - -# Set to yes if exported symbols are required. -always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) - -# The commands to list exported symbols. -export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) - -# Symbols that must always be exported. -include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) - -ifelse([$1],[], -[# ### END LIBTOOL CONFIG], -[# ### END LIBTOOL TAG CONFIG: $tagname]) - -__EOF__ - -ifelse([$1],[], [ - case $host_os in - aix3*) - cat <<\EOF >> "$cfgfile" - -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -EOF - ;; - esac - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || \ - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -]) -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -fi -])# AC_LIBTOOL_CONFIG - - -# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl - -_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - - AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI - - -# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -# --------------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], -[AC_REQUIRE([AC_CANONICAL_HOST]) -AC_REQUIRE([AC_PROG_NM]) -AC_REQUIRE([AC_OBJEXT]) -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) # Its linker distinguishes data from code symbols - if test "$host_cpu" = ia64; then - symcode='[[ABCDEGRST]]' - fi - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris* | sysv5*) - symcode='[[BDRT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[[ABCDGIRSTW]]' ;; -esac - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if grep ' nm_test_var$' "$nlist" >/dev/null; then - if grep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[[]] = -{ -EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi -]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE - - -# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) -# --------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], -[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= - -AC_MSG_CHECKING([for $compiler option to produce PIC]) - ifelse([$1],[CXX],[ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | os2* | pw32*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix4* | aix5*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68) - # Green Hills C++ Compiler - # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | kfreebsd*-gnu) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux*) - case $cc_basename in - KCC) - # KAI C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - icpc) - # Intel C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - cxx) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd* | knetbsd*-gnu) - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC) - # Rational C++ 2.4.1 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx) - # Digital/Compaq C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - sco*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - *) - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc) - # Lucid - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - unixware*) - ;; - vxworks*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - newsos6) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - linux*) - case $CC in - icc* | ecc*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - ccc*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' - ;; - - solaris*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sunos4*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - uts4*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then - AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), - [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" - ;; -esac -]) - - -# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) -# ------------------------------------ -# See if the linker supports building shared libraries. -AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], -[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -ifelse([$1],[CXX],[ - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - case $host_os in - aix4* | aix5*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - ;; - *) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac -],[ - runpath_var= - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)= - _LT_AC_TAGVAR(archive_expsym_cmds, $1)= - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown - _LT_AC_TAGVAR(hardcode_automatic, $1)=no - _LT_AC_TAGVAR(module_cmds, $1)= - _LT_AC_TAGVAR(module_expsym_cmds, $1)= - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_AC_TAGVAR(include_expsyms, $1)= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs=no - fi - ;; - - netbsd* | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sunos4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - linux*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_cmds, $1)="$tmp_archive_cmds" - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="$tmp_archive_cmds" - fi - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - # see comment about different semantics on the GNU ld section - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - bsdi4*) - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - - darwin* | rhapsody*) - if test "$GXX" = yes ; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' - ;; - esac - fi - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - dgux*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - freebsd1*) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd* | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - openbsd*) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4.2uw2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv5*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_AC_TAGVAR(archive_cmds, $1) in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_MSG_CHECKING([whether -lc should be explicitly linked in]) - $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) - then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - else - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) - ;; - esac - fi - ;; -esac -])# AC_LIBTOOL_PROG_LD_SHLIBS - - -# _LT_AC_FILE_LTDLL_C -# ------------------- -# Be careful that the start marker always follows a newline. -AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ -# /* ltdll.c starts here */ -# #define WIN32_LEAN_AND_MEAN -# #include -# #undef WIN32_LEAN_AND_MEAN -# #include -# -# #ifndef __CYGWIN__ -# # ifdef __CYGWIN32__ -# # define __CYGWIN__ __CYGWIN32__ -# # endif -# #endif -# -# #ifdef __cplusplus -# extern "C" { -# #endif -# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); -# #ifdef __cplusplus -# } -# #endif -# -# #ifdef __CYGWIN__ -# #include -# DECLARE_CYGWIN_DLL( DllMain ); -# #endif -# HINSTANCE __hDllInstance_base; -# -# BOOL APIENTRY -# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) -# { -# __hDllInstance_base = hInst; -# return TRUE; -# } -# /* ltdll.c ends here */ -])# _LT_AC_FILE_LTDLL_C - - -# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) -# --------------------------------- -AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) - - -# old names -AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) -AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) -AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) -AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) -AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) - -# This is just to silence aclocal about the macro not being used -ifelse([AC_DISABLE_FAST_INSTALL]) - -AC_DEFUN([LT_AC_PROG_GCJ], -[AC_CHECK_TOOL(GCJ, gcj, no) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS) -]) - -AC_DEFUN([LT_AC_PROG_RC], -[AC_CHECK_TOOL(RC, windres, no) -]) - -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_SED. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # -# LT_AC_PROG_SED -# -------------- -# Check for a fully-functional sed program, that truncates -# as few characters as possible. Prefer GNU sed if found. -AC_DEFUN([LT_AC_PROG_SED], -[AC_MSG_CHECKING([for a sed that does not truncate output]) -AC_CACHE_VAL(lt_cv_path_SED, -[# Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && break - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -SED=$lt_cv_path_SED -]) -AC_MSG_RESULT([$SED]) -]) - - -dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) -dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page -dnl also defines GSTUFF_PKG_ERRORS on error -AC_DEFUN(PKG_CHECK_MODULES, [ - succeeded=no - - if test -z "$PKG_CONFIG"; then - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - fi - - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - AC_MSG_CHECKING(for $2) - - if $PKG_CONFIG --exists "$2" ; then - AC_MSG_RESULT(yes) - succeeded=yes - - AC_MSG_CHECKING($1_CFLAGS) - $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` - AC_MSG_RESULT($$1_CFLAGS) - - AC_MSG_CHECKING($1_LIBS) - $1_LIBS=`$PKG_CONFIG --libs "$2"` - AC_MSG_RESULT($$1_LIBS) - else - $1_CFLAGS="" - $1_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` - ifelse([$4], ,echo $$1_PKG_ERRORS,) - fi - - AC_SUBST($1_CFLAGS) - AC_SUBST($1_LIBS) - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - ifelse([$3], , :, [$3]) - else - ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) - fi -]) - - - diff --git a/nx-X11/lib/Xft/autogen.sh b/nx-X11/lib/Xft/autogen.sh deleted file mode 100755 index 904cd6746..000000000 --- a/nx-X11/lib/Xft/autogen.sh +++ /dev/null @@ -1,12 +0,0 @@ -#! /bin/sh - -srcdir=`dirname $0` -test -z "$srcdir" && srcdir=. - -ORIGDIR=`pwd` -cd $srcdir - -autoreconf -v --install || exit 1 -cd $ORIGDIR || exit $? - -$srcdir/configure --enable-maintainer-mode "$@" diff --git a/nx-X11/lib/Xft/config.guess b/nx-X11/lib/Xft/config.guess deleted file mode 100755 index cc726cd15..000000000 --- a/nx-X11/lib/Xft/config.guess +++ /dev/null @@ -1,1388 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. - -timestamp='2003-02-22' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Per Bothner . -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; - --version | -v ) - echo "$version" ; exit 0 ;; - --help | --h* | -h ) - echo "$usage"; exit 0 ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit 0 ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit 0 ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit 0;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit 0 ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit 0 ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit 0;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit 0 ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit 0 ;; - DRS?6000:UNIX_SV:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7 && exit 0 ;; - esac ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit 0 ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit 0 ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c \ - && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && exit 0 - echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit 0 ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit 0 ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit 0 ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit 0 ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit 0 ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit 0 ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit 0 ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit 0 ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit 0 ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit 0 ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit 0 ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit 0 ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit 0 ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - echo rs6000-ibm-aix3.2.5 - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit 0 ;; - *:AIX:*:[45]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit 0 ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit 0 ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit 0 ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit 0 ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit 0 ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit 0 ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - # avoid double evaluation of $set_cc_for_build - test -n "$CC_FOR_BUILD" || eval $set_cc_for_build - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - echo unknown-hitachi-hiuxwe2 - exit 0 ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit 0 ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit 0 ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit 0 ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit 0 ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit 0 ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit 0 ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit 0 ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit 0 ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit 0 ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit 0 ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit 0 ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - *:UNICOS/mp:*:*) - echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:FreeBSD:*:*) - # Determine whether the default compiler uses glibc. - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #if __GLIBC__ >= 2 - LIBC=gnu - #else - LIBC= - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} - exit 0 ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; - i*:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; - x86:Interix*:3*) - echo i586-pc-interix3 - exit 0 ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit 0 ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit 0 ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit 0 ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - *:GNU:*:*) - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; - arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 - ;; - mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips64 - #undef mips64el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 - ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit 0 ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit 0 ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit 0 ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit 0 ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit 0 ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit 0 ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit 0 ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #ifdef __INTEL_COMPILER - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 - ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit 0 ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit 0 ;; - i*86:*:5:[78]*) - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit 0 ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit 0 ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit 0 ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit 0 ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit 0 ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit 0 ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit 0 ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit 0 ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit 0 ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit 0 ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit 0 ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit 0 ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit 0 ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit 0 ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit 0 ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit 0 ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit 0 ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit 0 ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit 0 ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit 0 ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Darwin:*:*) - case `uname -p` in - *86) UNAME_PROCESSOR=i686 ;; - powerpc) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit 0 ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit 0 ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit 0 ;; - NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit 0 ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit 0 ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit 0 ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit 0 ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit 0 ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit 0 ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit 0 ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit 0 ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit 0 ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - c34*) - echo c34-convex-bsd - exit 0 ;; - c38*) - echo c38-convex-bsd - exit 0 ;; - c4*) - echo c4-convex-bsd - exit 0 ;; - esac -fi - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/nx-X11/lib/Xft/config.h.in b/nx-X11/lib/Xft/config.h.in deleted file mode 100644 index 3c5f48365..000000000 --- a/nx-X11/lib/Xft/config.h.in +++ /dev/null @@ -1,76 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* FT_Bitmap_Size structure includes y_ppem field */ -#undef HAVE_FT_BITMAP_SIZE_Y_PPEM - -/* Define to 1 if you have the `FT_Get_BDF_Property' function. */ -#undef HAVE_FT_GET_BDF_PROPERTY - -/* Define to 1 if you have the `FT_Get_Next_Char' function. */ -#undef HAVE_FT_GET_NEXT_CHAR - -/* Define to 1 if you have the `FT_Get_PS_Font_Info' function. */ -#undef HAVE_FT_GET_PS_FONT_INFO - -/* Define to 1 if you have the `FT_Has_PS_Glyph_Names' function. */ -#undef HAVE_FT_HAS_PS_GLYPH_NAMES - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_X11_EXTENSIONS_XRENDER_H - -/* Define to 1 if you have the `XRenderFindStandardFormat' function. */ -#undef HAVE_XRENDERFINDSTANDARDFORMAT - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Version number of package */ -#undef VERSION diff --git a/nx-X11/lib/Xft/config.sub b/nx-X11/lib/Xft/config.sub deleted file mode 100755 index 9772e87d2..000000000 --- a/nx-X11/lib/Xft/config.sub +++ /dev/null @@ -1,1489 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. - -timestamp='2003-02-22' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; - --version | -v ) - echo "$version" ; exit 0 ;; - --help | --h* | -h ) - echo "$usage"; exit 0 ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit 0;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis) - os= - basic_machine=$1 - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ - | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k \ - | m32r | m68000 | m68k | m88k | mcore \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64vr | mips64vrel \ - | mips64orion | mips64orionel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | msp430 \ - | ns16k | ns32k \ - | openrisc | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ - | pyramid \ - | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ - | strongarm \ - | tahoe | thumb | tic80 | tron \ - | v850 | v850e \ - | we32k \ - | x86 | xscale | xstormy16 | xtensa \ - | z8k) - basic_machine=$basic_machine-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* \ - | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* \ - | m32r-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | msp430-* \ - | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ - | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tron-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ - | xtensa-* \ - | ymp-* \ - | z8k-*) - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - crds | unos) - basic_machine=m68k-crds - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - nv1) - basic_machine=nv1-cray - os=-unicosmp - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - or32 | or32-*) - basic_machine=or32-unknown - os=-coff - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2) - basic_machine=i686-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tic4x | c4x*) - basic_machine=tic4x-unknown - os=-coff - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparc | sparcv9 | sparcv9b) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -kaos*) - os=-kaos - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-ibm) - os=-aix - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/nx-X11/lib/Xft/config/config-subst b/nx-X11/lib/Xft/config/config-subst deleted file mode 100644 index 5907e0328..000000000 --- a/nx-X11/lib/Xft/config/config-subst +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -script=config-subst.$$ -trap "rm $script" 0 -rm -f $script -for i in ${1+"$@"}; do - var="`echo "$i" | sed 's/=.*$//'`" - val="`echo "$i" | sed 's/^[^=]*=//'`" - echo "s;@$var@;$val;" >> $script -done -sed -f $script diff --git a/nx-X11/lib/Xft/configure b/nx-X11/lib/Xft/configure deleted file mode 100755 index 80cc735c5..000000000 --- a/nx-X11/lib/Xft/configure +++ /dev/null @@ -1,21551 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for libXft 2.1.5. -# -# Report bugs to . -# -# Copyright (C) 2003 Free Software Foundation, Inc. -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - - - -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` - ;; -esac - -echo=${ECHO-echo} -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then - # Yippee, $echo works! - : -else - # Restart under the correct shell. - exec $SHELL "$0" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat </dev/null && - echo_test_string="`eval $cmd`" && - (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null - then - break - fi - done -fi - -if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : -else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$echo" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - echo='print -r' - elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} - else - # Try using printf. - echo='printf %s\n' - if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - echo="$CONFIG_SHELL $0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$CONFIG_SHELL $0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do - if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "$0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} - else - # Oops. We lost completely, so just stick with echo. - echo=echo - fi - fi - fi - fi -fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -ECHO=$echo -if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then - ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" -fi - - - - -tagnames=${tagnames+${tagnames},}CXX - -tagnames=${tagnames+${tagnames},}F77 - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -exec 6>&1 - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_config_libobj_dir=. -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} - -# Identity of this package. -PACKAGE_NAME='libXft' -PACKAGE_TARNAME='libXft' -PACKAGE_VERSION='2.1.5' -PACKAGE_STRING='libXft 2.1.5' -PACKAGE_BUGREPORT='keithp@keithp.com' - -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_SYS_STAT_H -# include -#endif -#if STDC_HEADERS -# include -# include -#else -# if HAVE_STDLIB_H -# include -# endif -#endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#endif -#if HAVE_STRINGS_H -# include -#endif -#if HAVE_INTTYPES_H -# include -#else -# if HAVE_STDINT_H -# include -# endif -#endif -#if HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG XRENDER_CFLAGS XRENDER_LIBS ft_config FONTCONFIG_CFLAGS FONTCONFIG_LIBS FREETYPE_CFLAGS FREETYPE_LIBS LIBOBJS LTLIBOBJS' -ac_subst_files='' - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -ac_prev= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_option in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "enable_$ac_feature='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "with_$ac_package='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_confdir=`(dirname "$0") 2>/dev/null || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } - fi -fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 - { (exit 1); exit 1; }; } -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias -ac_env_CC_set=${CC+set} -ac_env_CC_value=$CC -ac_cv_env_CC_set=${CC+set} -ac_cv_env_CC_value=$CC -ac_env_CFLAGS_set=${CFLAGS+set} -ac_env_CFLAGS_value=$CFLAGS -ac_cv_env_CFLAGS_set=${CFLAGS+set} -ac_cv_env_CFLAGS_value=$CFLAGS -ac_env_LDFLAGS_set=${LDFLAGS+set} -ac_env_LDFLAGS_value=$LDFLAGS -ac_cv_env_LDFLAGS_set=${LDFLAGS+set} -ac_cv_env_LDFLAGS_value=$LDFLAGS -ac_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_env_CPPFLAGS_value=$CPPFLAGS -ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_cv_env_CPPFLAGS_value=$CPPFLAGS -ac_env_CPP_set=${CPP+set} -ac_env_CPP_value=$CPP -ac_cv_env_CPP_set=${CPP+set} -ac_cv_env_CPP_value=$CPP -ac_env_CXX_set=${CXX+set} -ac_env_CXX_value=$CXX -ac_cv_env_CXX_set=${CXX+set} -ac_cv_env_CXX_value=$CXX -ac_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_env_CXXFLAGS_value=$CXXFLAGS -ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_cv_env_CXXFLAGS_value=$CXXFLAGS -ac_env_CXXCPP_set=${CXXCPP+set} -ac_env_CXXCPP_value=$CXXCPP -ac_cv_env_CXXCPP_set=${CXXCPP+set} -ac_cv_env_CXXCPP_value=$CXXCPP -ac_env_F77_set=${F77+set} -ac_env_F77_value=$F77 -ac_cv_env_F77_set=${F77+set} -ac_cv_env_F77_value=$F77 -ac_env_FFLAGS_set=${FFLAGS+set} -ac_env_FFLAGS_value=$FFLAGS -ac_cv_env_FFLAGS_set=${FFLAGS+set} -ac_cv_env_FFLAGS_value=$FFLAGS - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures libXft 2.1.5 to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -_ACEOF - - cat <<_ACEOF -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data [PREFIX/share] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --infodir=DIR info documentation [PREFIX/info] - --mandir=DIR man documentation [PREFIX/man] -_ACEOF - - cat <<\_ACEOF - -Program names: - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names - -X features: - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of libXft 2.1.5:";; - esac - cat <<\_ACEOF - -Optional Features: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer - --disable-dependency-tracking Speeds up one-time builds - --enable-dependency-tracking Do not reject slow dependency extractors - --enable-shared[=PKGS] - build shared libraries [default=yes] - --enable-static[=PKGS] - build static libraries [default=yes] - --enable-fast-install[=PKGS] - optimize for fast installation [default=yes] - --disable-libtool-lock avoid locking (might break parallel builds) - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-gnu-ld assume the C compiler uses GNU ld [default=no] - --with-pic try to use only PIC/non-PIC objects [default=use - both] - --with-tags[=TAGS] - include additional configurations [automatic] - --with-x use the X Window System - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have - headers in a nonstandard directory - CPP C preprocessor - CXX C++ compiler command - CXXFLAGS C++ compiler flags - CXXCPP C++ preprocessor - F77 Fortran 77 compiler command - FFLAGS Fortran 77 compiler flags - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to . -_ACEOF -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - ac_popdir=`pwd` - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - cd $ac_dir - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_srcdir/configure.gnu; then - echo - $SHELL $ac_srcdir/configure.gnu --help=recursive - elif test -f $ac_srcdir/configure; then - echo - $SHELL $ac_srcdir/configure --help=recursive - elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then - echo - $ac_configure --help - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd "$ac_popdir" - done -fi - -test -n "$ac_init_help" && exit 0 -if $ac_init_version; then - cat <<\_ACEOF -libXft configure 2.1.5 -generated by GNU Autoconf 2.59 - -Copyright (C) 2003 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit 0 -fi -exec 5>config.log -cat >&5 <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by libXft $as_me 2.1.5, which was -generated by GNU Autoconf 2.59. Invocation command line was - - $ $0 $@ - -_ACEOF -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -hostinfo = `(hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_sep= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " - ;; - esac - done -done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - cat <<\_ASBOX -## ---------------- ## -## Cache variables. ## -## ---------------- ## -_ASBOX - echo - # The following way of writing the cache mishandles newlines in values, -{ - (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) - sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; - *) - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - sed "/^$/d" confdefs.h | sort - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core && - rm -rf conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status - ' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; - esac - fi -else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val="\$ac_cv_env_${ac_var}_value" - eval ac_new_val="\$ac_env_${ac_var}_value" - case $ac_old_set,$ac_new_set in - set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - - - - - - - - - - - - - - - - - - - - - - - -am__api_version="1.7" -ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f $ac_dir/shtool; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 -echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} - { (exit 1); exit 1; }; } -fi -ac_config_guess="$SHELL $ac_aux_dir/config.guess" -ac_config_sub="$SHELL $ac_aux_dir/config.sub" -ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in - ./ | .// | /cC/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - done - done - ;; -esac -done - - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL=$ac_install_sh - fi -fi -echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -echo "$as_me:$LINENO: checking whether build environment is sane" >&5 -echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 -# Just in case -sleep 1 -echo timestamp > conftest.file -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftest.file` - fi - rm -f conftest.file - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&5 -echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&2;} - { (exit 1); exit 1; }; } - fi - - test "$2" = conftest.file - ) -then - # Ok. - : -else - { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! -Check your system clock" >&5 -echo "$as_me: error: newly created file is older than distributed files! -Check your system clock" >&2;} - { (exit 1); exit 1; }; } -fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -test "$program_prefix" != NONE && - program_transform_name="s,^,$program_prefix,;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s,\$,$program_suffix,;$program_transform_name" -# Double any \ or $. echo might interpret backslashes. -# By default was `s,x,x', remove it if useless. -cat <<\_ACEOF >conftest.sed -s/[\\$]/&&/g;s/;s,x,x,$// -_ACEOF -program_transform_name=`echo $program_transform_name | sed -f conftest.sed` -rm conftest.sed - - -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` - -test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 -echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} -fi - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_AWK+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - echo "$as_me:$LINENO: result: $AWK" >&5 -echo "${ECHO_T}$AWK" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$AWK" && break -done - -echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` -if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.make <<\_ACEOF -all: - @echo 'ac_maketemp="$(MAKE)"' -_ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftest.make -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - SET_MAKE= -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - SET_MAKE="MAKE=${MAKE-make}" -fi - -rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null - - # test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 -echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} - { (exit 1); exit 1; }; } -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi - - -# Define the identity of the package. - PACKAGE='libXft' - VERSION='2.1.5' - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF - -# Some tools Automake needs. - -ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} - - -AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} - - -AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} - - -AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} - - -MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - - -AMTAR=${AMTAR-"${am_missing_run}tar"} - -install_sh=${install_sh-"$am_aux_dir/install-sh"} - -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - echo "$as_me:$LINENO: result: $STRIP" >&5 -echo "${ECHO_T}$STRIP" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 -echo "${ECHO_T}$ac_ct_STRIP" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - STRIP=$ac_ct_STRIP -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" - -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. - - - -echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 -echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 - # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. -if test "${enable_maintainer_mode+set}" = set; then - enableval="$enable_maintainer_mode" - USE_MAINTAINER_MODE=$enableval -else - USE_MAINTAINER_MODE=no -fi; - echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 -echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 - - -if test $USE_MAINTAINER_MODE = yes; then - MAINTAINER_MODE_TRUE= - MAINTAINER_MODE_FALSE='#' -else - MAINTAINER_MODE_TRUE='#' - MAINTAINER_MODE_FALSE= -fi - - MAINT=$MAINTAINER_MODE_TRUE - - - - ac_config_headers="$ac_config_headers config.h" - -ac_aux_dir= -for ac_dir in . $srcdir/.; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f $ac_dir/shtool; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in . $srcdir/." >&5 -echo "$as_me: error: cannot find install-sh or install.sh in . $srcdir/." >&2;} - { (exit 1); exit 1; }; } -fi -ac_config_guess="$SHELL $ac_aux_dir/config.guess" -ac_config_sub="$SHELL $ac_aux_dir/config.sub" -ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. - - -# checks for progs -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CC" && break -done - - CC=$ac_ct_CC -fi - -fi - - -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - -# Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Find the output, starting from the most likely. This scheme is -# not robust to junk in `.', hence go to wildcards (a.*) only as a last -# resort. - -# Be careful to initialize this variable, since it used to be cached. -# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. -ac_cv_exeext= -# b.out is created by i960 compilers. -for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; - conftest.$ac_ext ) - # This is the source file. - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext - break;; - * ) - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } -fi - -ac_exeext=$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6 - -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -rm -f a.out a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6 - -echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; - * ) break;; - esac -done -else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6 -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -CFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cc_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_stdc=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std1 is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std1. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext -done -rm -f conftest.$ac_ext conftest.$ac_objext -CC=$ac_save_CC - -fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; - *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; -esac - -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -cat >conftest.$ac_ext <<_ACEOF -#ifndef __cplusplus - choke me -#endif -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - '' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -#include -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -DEPDIR="${am__leading_dot}deps" - - ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo done -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 -echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# We grep out `Entering directory' and `Leaving directory' -# messages which can occur if `w' ends up in MAKEFLAGS. -# In particular we don't look at `^make:' because GNU make might -# be invoked under some other name (usually "gmake"), in which -# case it prints its new name instead of `make'. -if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU -fi -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then - am__include=.include - am__quote="\"" - _am_result=BSD - fi -fi - - -echo "$as_me:$LINENO: result: $_am_result" >&5 -echo "${ECHO_T}$_am_result" >&6 -rm -f confinc confmf - -# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then - enableval="$enable_dependency_tracking" - -fi; -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi - - -if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - - - -depcc="$CC" am_compiler_list= - -echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - : > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # (even with -Werror). So we grep stderr for any message - # that says an option was ignored. - if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 -echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - - -if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - -# Check whether --enable-shared or --disable-shared was given. -if test "${enable_shared+set}" = set; then - enableval="$enable_shared" - p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_shared=yes -fi; - -# Check whether --enable-static or --disable-static was given. -if test "${enable_static+set}" = set; then - enableval="$enable_static" - p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_static=yes -fi; - -# Check whether --enable-fast-install or --disable-fast-install was given. -if test "${enable_fast_install+set}" = set; then - enableval="$enable_fast_install" - p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_fast_install=yes -fi; - -# Make sure we can run config.sub. -$ac_config_sub sun4 >/dev/null 2>&1 || - { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 -echo "$as_me: error: cannot run $ac_config_sub" >&2;} - { (exit 1); exit 1; }; } - -echo "$as_me:$LINENO: checking build system type" >&5 -echo $ECHO_N "checking build system type... $ECHO_C" >&6 -if test "${ac_cv_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_build_alias=$build_alias -test -z "$ac_cv_build_alias" && - ac_cv_build_alias=`$ac_config_guess` -test -z "$ac_cv_build_alias" && - { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 -echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } -ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -echo "$as_me:$LINENO: result: $ac_cv_build" >&5 -echo "${ECHO_T}$ac_cv_build" >&6 -build=$ac_cv_build -build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - - -echo "$as_me:$LINENO: checking host system type" >&5 -echo $ECHO_N "checking host system type... $ECHO_C" >&6 -if test "${ac_cv_host+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_host_alias=$host_alias -test -z "$ac_cv_host_alias" && - ac_cv_host_alias=$ac_cv_build_alias -ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -echo "${ECHO_T}$ac_cv_host" >&6 -host=$ac_cv_host -host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - - -echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 -echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 -if test "${lt_cv_path_SED+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && break - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -SED=$lt_cv_path_SED - -fi - -echo "$as_me:$LINENO: result: $SED" >&5 -echo "${ECHO_T}$SED" >&6 - -echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6 -if test "${ac_cv_prog_egrep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - - -# Check whether --with-gnu-ld or --without-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then - withval="$with_gnu_ld" - test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi; -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - echo "$as_me:$LINENO: checking for ld used by $CC" >&5 -echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - echo "$as_me:$LINENO: checking for GNU ld" >&5 -echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 -else - echo "$as_me:$LINENO: checking for non-GNU ld" >&5 -echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 -fi -if test "${lt_cv_path_LD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &5 -echo "${ECHO_T}$LD" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 -echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} - { (exit 1); exit 1; }; } -echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 -echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 -if test "${lt_cv_prog_gnu_ld+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # I'd rather use --version here, but apparently some GNU ld's only accept -v. -case `$LD -v 2>&1 &5 -echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 -with_gnu_ld=$lt_cv_prog_gnu_ld - - -echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 -echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6 -if test "${lt_cv_ld_reload_flag+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_ld_reload_flag='-r' -fi -echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 -echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 -reload_flag=$lt_cv_ld_reload_flag -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' - -echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 -echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 -if test "${lt_cv_path_NM+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/${ac_tool_prefix}nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - esac - fi - done - IFS="$lt_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi -fi -echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 -echo "${ECHO_T}$lt_cv_path_NM" >&6 -NM="$lt_cv_path_NM" - -echo "$as_me:$LINENO: checking whether ln -s works" >&5 -echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me:$LINENO: result: no, using $LN_S" >&5 -echo "${ECHO_T}no, using $LN_S" >&6 -fi - -echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 -echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6 -if test "${lt_cv_deplibs_check_method+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [[regex]]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given extended regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. - -case $host_os in -aix4* | aix5*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi4*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin*) - # win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='win32_libid' - ;; - -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # win32_libid shell function, so use a weaker test based on 'objdump'. - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | kfreebsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case "$host_cpu" in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux*) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd* | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -nto-qnx*) - lt_cv_deplibs_check_method=unknown - ;; - -openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' - else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; -esac - -fi -echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 -echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Check whether --enable-libtool-lock or --disable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then - enableval="$enable_libtool_lock" - -fi; -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '#line 3664 "configure"' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case "`/usr/bin/file conftest.o`" in - *32-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 -echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 -if test "${lt_cv_cc_needs_belf+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - lt_cv_cc_needs_belf=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -lt_cv_cc_needs_belf=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 -echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; - -esac - -need_locks="$enable_libtool_lock" - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6 -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_header_stdc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_stdc=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - exit(2); - exit (0); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6 -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_Header=no" -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - -for ac_header in dlfcn.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## -------------------------------- ## -## Report this to keithp@keithp.com ## -## -------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -n "$ac_tool_prefix"; then - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - echo "$as_me:$LINENO: result: $CXX" >&5 -echo "${ECHO_T}$CXX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 -echo "${ECHO_T}$ac_ct_CXX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CXX" && break -done -test -n "$ac_ct_CXX" || ac_ct_CXX="g++" - - CXX=$ac_ct_CXX -fi - - -# Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C++ compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 -if test "${ac_cv_cxx_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 -GXX=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -CXXFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 -echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cxx_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cxx_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cxx_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -for ac_declaration in \ - '' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -#include -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi - -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -depcc="$CXX" am_compiler_list= - -echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 -if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CXX_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - : > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # (even with -Werror). So we grep stderr for any message - # that says an option was ignored. - if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else - am_cv_CXX_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CXX_dependencies_compiler_type=none -fi - -fi -echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 -echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 -CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type - - - -if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then - am__fastdepCXX_TRUE= - am__fastdepCXX_FALSE='#' -else - am__fastdepCXX_TRUE='#' - am__fastdepCXX_FALSE= -fi - - -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 -echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6 -if test -z "$CXXCPP"; then - if test "${ac_cv_prog_CXXCPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CXXCPP needs to be expanded - for CXXCPP in "$CXX -E" "/lib/cpp" - do - ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CXXCPP=$CXXCPP - -fi - CXXCPP=$ac_cv_prog_CXXCPP -else - ac_cv_prog_CXXCPP=$CXXCPP -fi -echo "$as_me:$LINENO: result: $CXXCPP" >&5 -echo "${ECHO_T}$CXXCPP" >&6 -ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - -ac_ext=f -ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_f77_compiler_gnu -if test -n "$ac_tool_prefix"; then - for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$F77"; then - ac_cv_prog_F77="$F77" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_F77="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -F77=$ac_cv_prog_F77 -if test -n "$F77"; then - echo "$as_me:$LINENO: result: $F77" >&5 -echo "${ECHO_T}$F77" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$F77" && break - done -fi -if test -z "$F77"; then - ac_ct_F77=$F77 - for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_F77"; then - ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_F77="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_F77=$ac_cv_prog_ac_ct_F77 -if test -n "$ac_ct_F77"; then - echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 -echo "${ECHO_T}$ac_ct_F77" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_F77" && break -done - - F77=$ac_ct_F77 -fi - - -# Provide some information about the compiler. -echo "$as_me:5221:" \ - "checking for Fortran 77 compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -rm -f a.out - -# If we don't use `.F' as extension, the preprocessor is not run on the -# input file. (Note that this only needs to work for GNU compilers.) -ac_save_ext=$ac_ext -ac_ext=F -echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6 -if test "${ac_cv_f77_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF - program main -#ifndef __GNUC__ - choke me -#endif - - end -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_f77_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 -ac_ext=$ac_save_ext -ac_test_FFLAGS=${FFLAGS+set} -ac_save_FFLAGS=$FFLAGS -FFLAGS= -echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 -echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_f77_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - FFLAGS=-g -cat >conftest.$ac_ext <<_ACEOF - program main - - end -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_f77_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_f77_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 -echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 -if test "$ac_test_FFLAGS" = set; then - FFLAGS=$ac_save_FFLAGS -elif test $ac_cv_prog_f77_g = yes; then - if test "x$ac_cv_f77_compiler_gnu" = xyes; then - FFLAGS="-g -O2" - else - FFLAGS="-g" - fi -else - if test "x$ac_cv_f77_compiler_gnu" = xyes; then - FFLAGS="-O2" - else - FFLAGS= - fi -fi - -G77=`test $ac_compiler_gnu = yes && echo yes` -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! - -# find the maximum length of command line arguments -echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 -echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 -if test "${lt_cv_sys_max_cmd_len+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - i=0 - testring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while (test "X"`$CONFIG_SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \ - = "XX$testring") >/dev/null 2>&1 && - new_result=`expr "X$testring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - testring=$testring$testring - done - testring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - ;; - esac - -fi - -if test -n $lt_cv_sys_max_cmd_len ; then - echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 -echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 -else - echo "$as_me:$LINENO: result: none" >&5 -echo "${ECHO_T}none" >&6 -fi - - - - -# Check for command to grab the raw symbol name followed by C symbol from nm. -echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 -echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6 -if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32*) - symcode='[ABCDGISTW]' - ;; -hpux*) # Its linker distinguishes data from code symbols - if test "$host_cpu" = ia64; then - symcode='[ABCDEGRST]' - fi - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris* | sysv5*) - symcode='[BDRT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[ABCDGIRSTW]' ;; -esac - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Now try to grab the symbols. - nlist=conftest.nm - if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 - (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if grep ' nm_test_var$' "$nlist" >/dev/null; then - if grep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[] = -{ -EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - -fi - -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - echo "$as_me:$LINENO: result: failed" >&5 -echo "${ECHO_T}failed" >&6 -else - echo "$as_me:$LINENO: result: ok" >&5 -echo "${ECHO_T}ok" >&6 -fi - -echo "$as_me:$LINENO: checking for objdir" >&5 -echo $ECHO_N "checking for objdir... $ECHO_C" >&6 -if test "${lt_cv_objdir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null -fi -echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 -echo "${ECHO_T}$lt_cv_objdir" >&6 -objdir=$lt_cv_objdir - - - - - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AR="${ac_tool_prefix}ar" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - echo "$as_me:$LINENO: result: $AR" >&5 -echo "${ECHO_T}$AR" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_AR"; then - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_AR="ar" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="false" -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 -echo "${ECHO_T}$ac_ct_AR" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - AR=$ac_ct_AR -else - AR="$ac_cv_prog_AR" -fi - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - echo "$as_me:$LINENO: result: $RANLIB" >&5 -echo "${ECHO_T}$RANLIB" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 -echo "${ECHO_T}$ac_ct_RANLIB" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - RANLIB=$ac_ct_RANLIB -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - echo "$as_me:$LINENO: result: $STRIP" >&5 -echo "${ECHO_T}$STRIP" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 -echo "${ECHO_T}$ac_ct_STRIP" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - STRIP=$ac_ct_STRIP -else - STRIP="$ac_cv_prog_STRIP" -fi - - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$SED" && SED=sed -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" - ;; - *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -# Only perform the check for file, if the check method requires it -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 -echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 -if test "${lt_cv_path_MAGIC_CMD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/${ac_tool_prefix}file; then - lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 -echo "${ECHO_T}$MAGIC_CMD" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - echo "$as_me:$LINENO: checking for file" >&5 -echo $ECHO_N "checking for file... $ECHO_C" >&6 -if test "${lt_cv_path_MAGIC_CMD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/file; then - lt_cv_path_MAGIC_CMD="$ac_dir/file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 -echo "${ECHO_T}$MAGIC_CMD" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - else - MAGIC_CMD=: - fi -fi - - fi - ;; -esac - -enable_dlopen=no -enable_win32_dll=no - -# Check whether --enable-libtool-lock or --disable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then - enableval="$enable_libtool_lock" - -fi; -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - - -# Check whether --with-pic or --without-pic was given. -if test "${with_pic+set}" = set; then - withval="$with_pic" - pic_mode="$withval" -else - pic_mode=default -fi; -test -z "$pic_mode" && pic_mode=default - -# Use C for the default configuration in the libtool script -tagname= -lt_save_CC="$CC" -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -objext=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# -# Check for any special shared library compilation flags. -# -lt_prog_cc_shlib= -if test "$GCC" = no; then - case $host_os in - sco3.2v5*) - lt_prog_cc_shlib='-belf' - ;; - esac -fi -if test -n "$lt_prog_cc_shlib"; then - { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&5 -echo "$as_me: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&2;} - if echo "$old_CC $old_CFLAGS " | grep "[ ]$lt_prog_cc_shlib[ ]" >/dev/null; then : - else - { echo "$as_me:$LINENO: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 -echo "$as_me: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} - lt_cv_prog_cc_can_build_shared=no - fi -fi - - -# -# Check to make sure the static flag actually works. -# -echo "$as_me:$LINENO: checking if $compiler static flag $lt_prog_compiler_static works" >&5 -echo $ECHO_N "checking if $compiler static flag $lt_prog_compiler_static works... $ECHO_C" >&6 -if test "${lt_prog_compiler_static_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_prog_compiler_static" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - else - lt_prog_compiler_static_works=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 -echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 - -if test x"$lt_prog_compiler_static_works" = xyes; then - : -else - lt_prog_compiler_static= -fi - - - - -lt_prog_compiler_no_builtin_flag= - -if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag=' -fno-builtin' - - -echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6253: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:6257: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" -else - : -fi - -fi - -lt_prog_compiler_wl= -lt_prog_compiler_pic= -lt_prog_compiler_static= - -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 - - if test "$GCC" = yes; then - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_static='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - ;; - - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - else - lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static='-non_shared' - ;; - - newsos6) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - linux*) - case $CC in - icc* | ecc*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-static' - ;; - ccc*) - lt_prog_compiler_wl='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - - sco3.2v5*) - lt_prog_compiler_pic='-Kpic' - lt_prog_compiler_static='-dn' - ;; - - solaris*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sunos4*) - lt_prog_compiler_wl='-Qoption ld ' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic='-Kconform_pic' - lt_prog_compiler_static='-Bstatic' - fi - ;; - - uts4*) - lt_prog_compiler_pic='-pic' - lt_prog_compiler_static='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic" >&6 - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic"; then - -echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6 -if test "${lt_prog_compiler_pic_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_pic_works=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6486: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:6490: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_prog_compiler_pic_works=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6 - -if test x"$lt_prog_compiler_pic_works" = xyes; then - case $lt_prog_compiler_pic in - "" | " "*) ;; - *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; - esac -else - lt_prog_compiler_pic= - lt_prog_compiler_can_build_shared=no -fi - -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic= - ;; - *) - lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" - ;; -esac - -echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_c_o+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6546: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:6550: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6 - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6 - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 - - runpath_var= - allow_undefined_flag= - enable_shared_with_static_runtimes=no - archive_cmds= - archive_expsym_cmds= - old_archive_From_new_cmds= - old_archive_from_expsyms_cmds= - export_dynamic_flag_spec= - whole_archive_flag_spec= - thread_safe_flag_spec= - hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld= - hardcode_libdir_separator= - hardcode_direct=no - hardcode_minus_L=no - hardcode_shlibpath_var=unsupported - link_all_deplibs=unknown - hardcode_automatic=no - module_cmds= - module_expsym_cmds= - always_export_symbols=no - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - allow_undefined_flag=unsupported - always_export_symbols=no - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs=no - fi - ;; - - netbsd* | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - linux*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_cmds="$tmp_archive_cmds" - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds="$tmp_archive_cmds" - fi - else - ld_shlibs=no - fi - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds='' - hardcode_direct=yes - hardcode_libdir_separator=':' - link_all_deplibs=yes - - if test "$GCC" = yes; then - case $host_os in aix4.012|aix4.012.*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag=' ${wl}-bernotok' - allow_undefined_flag=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec=' ' - archive_cmds_need_lc=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - - bsdi4*) - export_dynamic_flag_spec=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes=yes - ;; - - darwin* | rhapsody*) - if test "$GXX" = yes ; then - archive_cmds_need_lc=no - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag='-flat_namespace -undefined suppress' - ;; - 10.*) - allow_undefined_flag='-undefined dynamic_lookup' - ;; - esac - fi - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - whole_archive_flag_spec='-all_load $convenience' - link_all_deplibs=yes - else - ld_shlibs=no - fi - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - freebsd1*) - ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - export_dynamic_flag_spec='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld='+b $libdir' - hardcode_libdir_separator=: - hardcode_direct=no - hardcode_shlibpath_var=no - ;; - ia64*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=no - hardcode_shlibpath_var=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - *) - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - export_dynamic_flag_spec='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld='-rpath $libdir' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - link_all_deplibs=yes - ;; - - netbsd* | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - openbsd*) - hardcode_direct=yes - hardcode_shlibpath_var=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - ;; - - sco3.2v5*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - no_undefined_flag=' -z text' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=no - hardcode_shlibpath_var=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - no_undefined_flag='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv5*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec= - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $ld_shlibs" >&5 -echo "${ECHO_T}$ld_shlibs" >&6 -test "$ld_shlibs" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc=no - else - archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 -echo "${ECHO_T}$archive_cmds_need_lc" >&6 - ;; - esac - fi - ;; -esac - -echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi4*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.01* | freebsdelf3.01*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` - sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=yes - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6 -test "$dynamic_linker" = no && can_build_shared=no - -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var " || \ - test "X$hardcode_automatic"="Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action" >&5 -echo "${ECHO_T}$hardcode_action" >&6 - -if test "$hardcode_action" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - echo "$as_me:$LINENO: checking for shl_load" >&5 -echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 -if test "${ac_cv_func_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define shl_load to an innocuous variant, in case declares shl_load. - For example, HP-UX 11i declares gettimeofday. */ -#define shl_load innocuous_shl_load - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char shl_load (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef shl_load - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char shl_load (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_shl_load) || defined (__stub___shl_load) -choke me -#else -char (*f) () = shl_load; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != shl_load; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 -echo "${ECHO_T}$ac_cv_func_shl_load" >&6 -if test $ac_cv_func_shl_load = yes; then - lt_cv_dlopen="shl_load" -else - echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char shl_load (); -int -main () -{ -shl_load (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dld_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 -if test $ac_cv_lib_dld_shl_load = yes; then - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" -else - echo "$as_me:$LINENO: checking for dlopen" >&5 -echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 -if test "${ac_cv_func_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define dlopen to an innocuous variant, in case declares dlopen. - For example, HP-UX 11i declares gettimeofday. */ -#define dlopen innocuous_dlopen - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char dlopen (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef dlopen - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_dlopen) || defined (__stub___dlopen) -choke me -#else -char (*f) () = dlopen; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != dlopen; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 -echo "${ECHO_T}$ac_cv_func_dlopen" >&6 -if test $ac_cv_func_dlopen = yes; then - lt_cv_dlopen="dlopen" -else - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 -echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 -if test "${ac_cv_lib_svld_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_svld_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_svld_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 -if test $ac_cv_lib_svld_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 -echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_dld_link+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dld_link (); -int -main () -{ -dld_link (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dld_dld_link=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_dld_link=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 -if test $ac_cv_lib_dld_dld_link = yes; then - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 -echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self" >&6 - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 -echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self_static+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - -# Report which librarie types wil actually be built -echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 -echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $can_build_shared" >&5 -echo "${ECHO_T}$can_build_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 -echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - -aix4*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - darwin* | rhapsody*) - if test "$GCC" = yes; then - archive_cmds_need_lc=no - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag='-flat_namespace -undefined suppress' - ;; - 10.*) - allow_undefined_flag='-undefined dynamic_lookup' - ;; - esac - fi - ;; - esac - output_verbose_link_cmd='echo' - archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' - module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - whole_archive_flag_spec='-all_load $convenience' - link_all_deplibs=yes - else - ld_shlibs=no - fi - ;; -esac -echo "$as_me:$LINENO: result: $enable_shared" >&5 -echo "${ECHO_T}$enable_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build static libraries" >&5 -echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -echo "$as_me:$LINENO: result: $enable_static" >&5 -echo "${ECHO_T}$enable_static" >&6 - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler \ - CC \ - LD \ - lt_prog_compiler_wl \ - lt_prog_compiler_pic \ - lt_prog_compiler_static \ - lt_prog_compiler_no_builtin_flag \ - export_dynamic_flag_spec \ - thread_safe_flag_spec \ - whole_archive_flag_spec \ - enable_shared_with_static_runtimes \ - old_archive_cmds \ - old_archive_from_new_cmds \ - predep_objects \ - postdep_objects \ - predeps \ - postdeps \ - compiler_lib_search_path \ - archive_cmds \ - archive_expsym_cmds \ - postinstall_cmds \ - postuninstall_cmds \ - old_archive_from_expsyms_cmds \ - allow_undefined_flag \ - no_undefined_flag \ - export_symbols_cmds \ - hardcode_libdir_flag_spec \ - hardcode_libdir_flag_spec_ld \ - hardcode_libdir_separator \ - hardcode_automatic \ - module_cmds \ - module_expsym_cmds \ - lt_cv_prog_compiler_c_o \ - exclude_expsyms \ - include_expsyms; do - - case $var in - old_archive_cmds | \ - old_archive_from_new_cmds | \ - archive_cmds | \ - archive_expsym_cmds | \ - module_cmds | \ - module_expsym_cmds | \ - old_archive_from_expsyms_cmds | \ - export_symbols_cmds | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="${ofile}T" - trap "$rm \"$cfgfile\"; exit 1" 1 2 15 - $rm -f "$cfgfile" - { echo "$as_me:$LINENO: creating $ofile" >&5 -echo "$as_me: creating $ofile" >&6;} - - cat <<__EOF__ >> "$cfgfile" -#! $SHELL - -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# -# This file is part of GNU Libtool: -# Originally by Gordon Matzigkeit , 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# A sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi - -# The names of the tagged configurations supported by this script. -available_tags= - -# ### BEGIN LIBTOOL CONFIG - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler - -# Is the compiler the GNU C compiler? -with_gcc=$GCC - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext='$shrext' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds -archive_expsym_cmds=$lt_archive_expsym_cmds -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds -module_expsym_cmds=$lt_module_expsym_cmds - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms - -# ### END LIBTOOL CONFIG - -__EOF__ - - - case $host_os in - aix3*) - cat <<\EOF >> "$cfgfile" - -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -EOF - ;; - esac - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || \ - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC="$lt_save_CC" - - -# Check whether --with-tags or --without-tags was given. -if test "${with_tags+set}" = set; then - withval="$with_tags" - tagnames="$withval" -fi; - -if test -f "$ltmain" && test -n "$tagnames"; then - if test ! -f "${ofile}"; then - { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 -echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} - fi - - if test -z "$LTCC"; then - eval "`$SHELL ${ofile} --config | grep '^LTCC='`" - if test -z "$LTCC"; then - { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 -echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} - else - { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 -echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} - fi - fi - - # Extract list of available tagged configurations in $ofile. - # Note that this assumes the entire list is on one line. - available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` - - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for tagname in $tagnames; do - IFS="$lt_save_ifs" - # Check whether tagname contains only valid characters - case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in - "") ;; - *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 -echo "$as_me: error: invalid tag name: $tagname" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null - then - { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 -echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} - { (exit 1); exit 1; }; } - fi - - # Update the list of available tags. - if test -n "$tagname"; then - echo appending configuration tag \"$tagname\" to $ofile - - case $tagname in - CXX) - if test -n "$CXX" && test "X$CXX" != "Xno"; then - ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - - - -archive_cmds_need_lc_CXX=no -allow_undefined_flag_CXX= -always_export_symbols_CXX=no -archive_expsym_cmds_CXX= -export_dynamic_flag_spec_CXX= -hardcode_direct_CXX=no -hardcode_libdir_flag_spec_CXX= -hardcode_libdir_flag_spec_ld_CXX= -hardcode_libdir_separator_CXX= -hardcode_minus_L_CXX=no -hardcode_automatic_CXX=no -module_cmds_CXX= -module_expsym_cmds_CXX= -link_all_deplibs_CXX=unknown -old_archive_cmds_CXX=$old_archive_cmds -no_undefined_flag_CXX= -whole_archive_flag_spec_CXX= -enable_shared_with_static_runtimes_CXX=no - -# Dependencies to place before and after the object being linked: -predep_objects_CXX= -postdep_objects_CXX= -predeps_CXX= -postdeps_CXX= -compiler_lib_search_path_CXX= - -# Source file extension for C++ test sources. -ac_ext=cc - -# Object file extension for compiled C++ test sources. -objext=o -objext_CXX=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *) { return(0); }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_LD=$LD -lt_save_GCC=$GCC -GCC=$GXX -lt_save_with_gnu_ld=$with_gnu_ld -lt_save_path_LD=$lt_cv_path_LD -if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx -else - unset lt_cv_prog_gnu_ld -fi -if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX -else - unset lt_cv_path_LD -fi -test -z "${LDCXX+set}" || LD=$LDCXX -CC=${CXX-"c++"} -compiler=$CC -compiler_CXX=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -# We don't want -fno-exception wen compiling C++ code, so set the -# no_builtin_flag separately -if test "$GXX" = yes; then - lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' -else - lt_prog_compiler_no_builtin_flag_CXX= -fi - -if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - -# Check whether --with-gnu-ld or --without-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then - withval="$with_gnu_ld" - test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi; -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - echo "$as_me:$LINENO: checking for ld used by $CC" >&5 -echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - echo "$as_me:$LINENO: checking for GNU ld" >&5 -echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 -else - echo "$as_me:$LINENO: checking for non-GNU ld" >&5 -echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 -fi -if test "${lt_cv_path_LD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &5 -echo "${ECHO_T}$LD" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 -echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} - { (exit 1); exit 1; }; } -echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 -echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 -if test "${lt_cv_prog_gnu_ld+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # I'd rather use --version here, but apparently some GNU ld's only accept -v. -case `$LD -v 2>&1 &5 -echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ - grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_CXX= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - -else - GXX=no - with_gnu_ld=no - wlarc= -fi - -# PORTME: fill in a description of your system's C++ link characteristics -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 -ld_shlibs_CXX=yes -case $host_os in - aix3*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_CXX='' - hardcode_direct_CXX=yes - hardcode_libdir_separator_CXX=':' - link_all_deplibs_CXX=yes - - if test "$GXX" = yes; then - case $host_os in aix4.012|aix4.012.*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct_CXX=yes - else - # We have old collect2 - hardcode_direct_CXX=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_CXX=yes - hardcode_libdir_flag_spec_CXX='-L$libdir' - hardcode_libdir_separator_CXX= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_CXX=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_CXX='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - - archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_CXX="-z nodefs" - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_CXX=' ${wl}-bernotok' - allow_undefined_flag_CXX=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols_CXX=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_CXX=' ' - archive_cmds_need_lc_CXX=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_CXX='-L$libdir' - allow_undefined_flag_CXX=unsupported - always_export_symbols_CXX=no - enable_shared_with_static_runtimes_CXX=yes - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs_CXX=no - fi - ;; - - darwin* | rhapsody*) - if test "$GXX" = yes; then - archive_cmds_need_lc_CXX=no - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_CXX='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_CXX='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_CXX='-flat_namespace -undefined suppress' - ;; - 10.*) - allow_undefined_flag_CXX='-undefined dynamic_lookup' - ;; - esac - fi - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds_CXX='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds_CXX='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - hardcode_direct_CXX=no - hardcode_automatic_CXX=yes - hardcode_shlibpath_var_CXX=unsupported - whole_archive_flag_spec_CXX='-all_load $convenience' - link_all_deplibs_CXX=yes - else - ld_shlibs_CXX=no - fi - ;; - - dgux*) - case $cc_basename in - ec++) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - ghcx) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - freebsd12*) - # C++ shared libraries reported to be fairly broken before switch to ELF - ld_shlibs_CXX=no - ;; - freebsd-elf*) - archive_cmds_need_lc_CXX=no - ;; - freebsd* | kfreebsd*-gnu) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - ld_shlibs_CXX=yes - ;; - gnu*) - ;; - hpux9*) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: - export_dynamic_flag_spec_CXX='${wl}-E' - hardcode_direct_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC) - archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld_CXX='+b $libdir' - hardcode_libdir_separator_CXX=: - ;; - ia64*) - hardcode_libdir_flag_spec_CXX='-L$libdir' - ;; - *) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: - export_dynamic_flag_spec_CXX='${wl}-E' - ;; - esac - fi - case "$host_cpu" in - hppa*64*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - ;; - ia64*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - *) - hardcode_direct_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC) - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case "$host_cpu" in - ia64*|hppa*64*) - archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - irix5* | irix6*) - case $cc_basename in - CC) - # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' - fi - fi - link_all_deplibs_CXX=yes - ;; - esac - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - ;; - linux*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc) - # Intel C++ - with_gnu_ld=yes - archive_cmds_need_lc_CXX=no - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - cxx) - # Compaq C++ - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - esac - ;; - lynxos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - m88k*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - mvs*) - case $cc_basename in - cxx) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - netbsd* | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_direct_CXX=yes - hardcode_shlibpath_var_CXX=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - osf3*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - hardcode_libdir_separator_CXX=: - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' - - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - cxx) - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - osf4* | osf5*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - hardcode_libdir_separator_CXX=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - cxx) - allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ - $rm $lib.exp' - - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - psos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - sco*) - archive_cmds_need_lc_CXX=no - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - lcc) - # Lucid - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - no_undefined_flag_CXX=' -zdefs' - archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_shlibpath_var_CXX=no - case $host_os in - solaris2.0-5 | solaris2.0-5.*) ;; - *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. - # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - link_all_deplibs_CXX=yes - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[LR]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' - ;; - gcx) - # Green Hills C++ Compiler - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - no_undefined_flag_CXX=' ${wl}-z ${wl}defs' - if $CC --version | grep -v '^2\.7' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - fi - - hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' - fi - ;; - esac - ;; - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - archive_cmds_need_lc_CXX=no - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - vxworks*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; -esac -echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 -echo "${ECHO_T}$ld_shlibs_CXX" >&6 -test "$ld_shlibs_CXX" = no && can_build_shared=no - -GCC_CXX="$GXX" -LD_CXX="$LD" - - -cat > conftest.$ac_ext <&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - # The `*' in the case matches for architectures that use `case' in - # $output_verbose_cmd can trigger glob expansion during the loop - # eval without this substitution. - output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`" - - for p in `eval $output_verbose_link_cmd`; do - case $p in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" \ - || test $p = "-R"; then - prev=$p - continue - else - prev= - fi - - if test "$pre_test_object_deps_done" = no; then - case $p in - -L* | -R*) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$compiler_lib_search_path_CXX"; then - compiler_lib_search_path_CXX="${prev}${p}" - else - compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$postdeps_CXX"; then - postdeps_CXX="${prev}${p}" - else - postdeps_CXX="${postdeps_CXX} ${prev}${p}" - fi - fi - ;; - - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$predep_objects_CXX"; then - predep_objects_CXX="$p" - else - predep_objects_CXX="$predep_objects_CXX $p" - fi - else - if test -z "$postdep_objects_CXX"; then - postdep_objects_CXX="$p" - else - postdep_objects_CXX="$postdep_objects_CXX $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling CXX test program" -fi - -$rm -f confest.$objext - -case " $postdeps_CXX " in -*" -lc "*) archive_cmds_need_lc_CXX=no ;; -esac - -lt_prog_compiler_wl_CXX= -lt_prog_compiler_pic_CXX= -lt_prog_compiler_static_CXX= - -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 - - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - fi - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | os2* | pw32*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_CXX='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_CXX='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - lt_prog_compiler_pic_CXX= - ;; - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_CXX=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - else - case $host_os in - aix4* | aix5*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - else - lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68) - # Green Hills C++ Compiler - # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++) - lt_prog_compiler_pic_CXX='-KPIC' - ;; - ghcx) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | kfreebsd*-gnu) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - if test "$host_cpu" != ia64; then - lt_prog_compiler_pic_CXX='+Z' - fi - ;; - aCC) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_CXX='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux*) - case $cc_basename in - KCC) - # KAI C++ Compiler - lt_prog_compiler_wl_CXX='--backend -Wl,' - lt_prog_compiler_pic_CXX='-fPIC' - ;; - icpc) - # Intel C++ - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-static' - ;; - cxx) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - *) - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx) - lt_prog_compiler_pic_CXX='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd* | knetbsd*-gnu) - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC) - lt_prog_compiler_wl_CXX='--backend -Wl,' - ;; - RCC) - # Rational C++ 2.4.1 - lt_prog_compiler_pic_CXX='-pic' - ;; - cxx) - # Digital/Compaq C++ - lt_prog_compiler_wl_CXX='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - sco*) - case $cc_basename in - CC) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - *) - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - lt_prog_compiler_wl_CXX='-Qoption ld ' - ;; - gcx) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - lt_prog_compiler_pic_CXX='-pic' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - lcc) - # Lucid - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - lt_prog_compiler_pic_CXX='-KPIC' - ;; - *) - ;; - esac - ;; - unixware*) - ;; - vxworks*) - ;; - *) - lt_prog_compiler_can_build_shared_CXX=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6 - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_CXX"; then - -echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6 -if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_pic_works_CXX=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10996: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:11000: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_prog_compiler_pic_works_CXX=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6 - -if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then - case $lt_prog_compiler_pic_CXX in - "" | " "*) ;; - *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; - esac -else - lt_prog_compiler_pic_CXX= - lt_prog_compiler_can_build_shared_CXX=no -fi - -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_CXX= - ;; - *) - lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" - ;; -esac - -echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o_CXX=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11056: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:11060: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - lt_cv_prog_compiler_c_o_CXX=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6 - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6 - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 - - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - case $host_os in - aix4* | aix5*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - export_symbols_cmds_CXX="$ltdll_cmds" - ;; - cygwin* | mingw*) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - ;; - *) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac - -echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 -echo "${ECHO_T}$ld_shlibs_CXX" >&6 -test "$ld_shlibs_CXX" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_CXX" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_CXX=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_CXX in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_CXX - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_CXX - allow_undefined_flag_CXX= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc_CXX=no - else - archive_cmds_need_lc_CXX=yes - fi - allow_undefined_flag_CXX=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 -echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6 - ;; - esac - fi - ;; -esac - -echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi4*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.01* | freebsdelf3.01*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` - sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=yes - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6 -test "$dynamic_linker" = no && can_build_shared=no - -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action_CXX= -if test -n "$hardcode_libdir_flag_spec_CXX" || \ - test -n "$runpath_var CXX" || \ - test "X$hardcode_automatic_CXX"="Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_CXX" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && - test "$hardcode_minus_L_CXX" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_CXX=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_CXX=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_CXX=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 -echo "${ECHO_T}$hardcode_action_CXX" >&6 - -if test "$hardcode_action_CXX" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - echo "$as_me:$LINENO: checking for shl_load" >&5 -echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 -if test "${ac_cv_func_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define shl_load to an innocuous variant, in case declares shl_load. - For example, HP-UX 11i declares gettimeofday. */ -#define shl_load innocuous_shl_load - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char shl_load (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef shl_load - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char shl_load (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_shl_load) || defined (__stub___shl_load) -choke me -#else -char (*f) () = shl_load; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != shl_load; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 -echo "${ECHO_T}$ac_cv_func_shl_load" >&6 -if test $ac_cv_func_shl_load = yes; then - lt_cv_dlopen="shl_load" -else - echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char shl_load (); -int -main () -{ -shl_load (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dld_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 -if test $ac_cv_lib_dld_shl_load = yes; then - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" -else - echo "$as_me:$LINENO: checking for dlopen" >&5 -echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 -if test "${ac_cv_func_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define dlopen to an innocuous variant, in case declares dlopen. - For example, HP-UX 11i declares gettimeofday. */ -#define dlopen innocuous_dlopen - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char dlopen (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef dlopen - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_dlopen) || defined (__stub___dlopen) -choke me -#else -char (*f) () = dlopen; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != dlopen; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 -echo "${ECHO_T}$ac_cv_func_dlopen" >&6 -if test $ac_cv_func_dlopen = yes; then - lt_cv_dlopen="dlopen" -else - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 -echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 -if test "${ac_cv_lib_svld_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_svld_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_svld_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 -if test $ac_cv_lib_svld_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 -echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_dld_link+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dld_link (); -int -main () -{ -dld_link (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dld_dld_link=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_dld_link=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 -if test $ac_cv_lib_dld_dld_link = yes; then - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 -echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self" >&6 - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 -echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self_static+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_CXX \ - CC_CXX \ - LD_CXX \ - lt_prog_compiler_wl_CXX \ - lt_prog_compiler_pic_CXX \ - lt_prog_compiler_static_CXX \ - lt_prog_compiler_no_builtin_flag_CXX \ - export_dynamic_flag_spec_CXX \ - thread_safe_flag_spec_CXX \ - whole_archive_flag_spec_CXX \ - enable_shared_with_static_runtimes_CXX \ - old_archive_cmds_CXX \ - old_archive_from_new_cmds_CXX \ - predep_objects_CXX \ - postdep_objects_CXX \ - predeps_CXX \ - postdeps_CXX \ - compiler_lib_search_path_CXX \ - archive_cmds_CXX \ - archive_expsym_cmds_CXX \ - postinstall_cmds_CXX \ - postuninstall_cmds_CXX \ - old_archive_from_expsyms_cmds_CXX \ - allow_undefined_flag_CXX \ - no_undefined_flag_CXX \ - export_symbols_cmds_CXX \ - hardcode_libdir_flag_spec_CXX \ - hardcode_libdir_flag_spec_ld_CXX \ - hardcode_libdir_separator_CXX \ - hardcode_automatic_CXX \ - module_cmds_CXX \ - module_expsym_cmds_CXX \ - lt_cv_prog_compiler_c_o_CXX \ - exclude_expsyms_CXX \ - include_expsyms_CXX; do - - case $var in - old_archive_cmds_CXX | \ - old_archive_from_new_cmds_CXX | \ - archive_cmds_CXX | \ - archive_expsym_cmds_CXX | \ - module_cmds_CXX | \ - module_expsym_cmds_CXX | \ - old_archive_from_expsyms_cmds_CXX | \ - export_symbols_cmds_CXX | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_CXX - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_CXX - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_CXX - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_CXX - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_CXX - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext='$shrext' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_CXX -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_CXX - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_CXX -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_CXX -archive_expsym_cmds=$lt_archive_expsym_cmds_CXX -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_CXX -module_expsym_cmds=$lt_module_expsym_cmds_CXX - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_CXX - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_CXX - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_CXX - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_CXX - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_CXX - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_CXX - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_CXX - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_CXX - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_CXX - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_CXX - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_CXX - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_CXX - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_CXX" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_CXX - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_CXX - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_CXX - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_CXX - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC=$lt_save_CC -LDCXX=$LD -LD=$lt_save_LD -GCC=$lt_save_GCC -with_gnu_ldcxx=$with_gnu_ld -with_gnu_ld=$lt_save_with_gnu_ld -lt_cv_path_LDCXX=$lt_cv_path_LD -lt_cv_path_LD=$lt_save_path_LD -lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld -lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld - - else - tagname="" - fi - ;; - - F77) - if test -n "$F77" && test "X$F77" != "Xno"; then - -ac_ext=f -ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_f77_compiler_gnu - - -archive_cmds_need_lc_F77=no -allow_undefined_flag_F77= -always_export_symbols_F77=no -archive_expsym_cmds_F77= -export_dynamic_flag_spec_F77= -hardcode_direct_F77=no -hardcode_libdir_flag_spec_F77= -hardcode_libdir_flag_spec_ld_F77= -hardcode_libdir_separator_F77= -hardcode_minus_L_F77=no -hardcode_automatic_F77=no -module_cmds_F77= -module_expsym_cmds_F77= -link_all_deplibs_F77=unknown -old_archive_cmds_F77=$old_archive_cmds -no_undefined_flag_F77= -whole_archive_flag_spec_F77= -enable_shared_with_static_runtimes_F77=no - -# Source file extension for f77 test sources. -ac_ext=f - -# Object file extension for compiled f77 test sources. -objext=o -objext_F77=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code=" subroutine t\n return\n end\n" - -# Code to be used in simple link tests -lt_simple_link_test_code=" program t\n end\n" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${F77-"f77"} -compiler=$CC -compiler_F77=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 -echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $can_build_shared" >&5 -echo "${ECHO_T}$can_build_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 -echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; -aix4*) - test "$enable_shared" = yes && enable_static=no - ;; -esac -echo "$as_me:$LINENO: result: $enable_shared" >&5 -echo "${ECHO_T}$enable_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build static libraries" >&5 -echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -echo "$as_me:$LINENO: result: $enable_static" >&5 -echo "${ECHO_T}$enable_static" >&6 - -test "$ld_shlibs_F77" = no && can_build_shared=no - -GCC_F77="$G77" -LD_F77="$LD" - -lt_prog_compiler_wl_F77= -lt_prog_compiler_pic_F77= -lt_prog_compiler_static_F77= - -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 - - if test "$GCC" = yes; then - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_static_F77='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_F77='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_F77='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_F77='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared_F77=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_F77=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_F77='-fPIC' - ;; - esac - ;; - - *) - lt_prog_compiler_pic_F77='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl_F77='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_F77='-Bstatic' - else - lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_F77='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl_F77='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_F77='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static_F77='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl_F77='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static_F77='-non_shared' - ;; - - newsos6) - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - linux*) - case $CC in - icc* | ecc*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-static' - ;; - ccc*) - lt_prog_compiler_wl_F77='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static_F77='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl_F77='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static_F77='-non_shared' - ;; - - sco3.2v5*) - lt_prog_compiler_pic_F77='-Kpic' - lt_prog_compiler_static_F77='-dn' - ;; - - solaris*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - sunos4*) - lt_prog_compiler_wl_F77='-Qoption ld ' - lt_prog_compiler_pic_F77='-PIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic_F77='-Kconform_pic' - lt_prog_compiler_static_F77='-Bstatic' - fi - ;; - - uts4*) - lt_prog_compiler_pic_F77='-pic' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared_F77=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6 - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_F77"; then - -echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6 -if test "${lt_prog_compiler_pic_works_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_pic_works_F77=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_F77" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13335: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:13339: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_prog_compiler_pic_works_F77=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6 - -if test x"$lt_prog_compiler_pic_works_F77" = xyes; then - case $lt_prog_compiler_pic_F77 in - "" | " "*) ;; - *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; - esac -else - lt_prog_compiler_pic_F77= - lt_prog_compiler_can_build_shared_F77=no -fi - -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_F77= - ;; - *) - lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" - ;; -esac - -echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o_F77=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13395: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:13399: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - lt_cv_prog_compiler_c_o_F77=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6 - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6 - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 - - runpath_var= - allow_undefined_flag_F77= - enable_shared_with_static_runtimes_F77=no - archive_cmds_F77= - archive_expsym_cmds_F77= - old_archive_From_new_cmds_F77= - old_archive_from_expsyms_cmds_F77= - export_dynamic_flag_spec_F77= - whole_archive_flag_spec_F77= - thread_safe_flag_spec_F77= - hardcode_libdir_flag_spec_F77= - hardcode_libdir_flag_spec_ld_F77= - hardcode_libdir_separator_F77= - hardcode_direct_F77=no - hardcode_minus_L_F77=no - hardcode_shlibpath_var_F77=unsupported - link_all_deplibs_F77=unknown - hardcode_automatic_F77=no - module_cmds_F77= - module_expsym_cmds_F77= - always_export_symbols_F77=no - export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms_F77= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs_F77=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs_F77=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_minus_L_F77=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs_F77=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_F77=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs_F77=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_F77='-L$libdir' - allow_undefined_flag_F77=unsupported - always_export_symbols_F77=no - enable_shared_with_static_runtimes_F77=yes - export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs=no - fi - ;; - - netbsd* | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs_F77=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_F77=no - fi - ;; - - sunos4*) - archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - linux*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_cmds_F77="$tmp_archive_cmds" - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds_F77="$tmp_archive_cmds" - fi - else - ld_shlibs_F77=no - fi - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_F77=no - fi - ;; - esac - - if test "$ld_shlibs_F77" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_F77='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_F77= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag_F77=unsupported - always_export_symbols_F77=yes - archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L_F77=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct_F77=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_F77='' - hardcode_direct_F77=yes - hardcode_libdir_separator_F77=':' - link_all_deplibs_F77=yes - - if test "$GCC" = yes; then - case $host_os in aix4.012|aix4.012.*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct_F77=yes - else - # We have old collect2 - hardcode_direct_F77=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_F77=yes - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_libdir_separator_F77= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_F77=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_F77='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF - program main - - end -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_F77="-z nodefs" - archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF - program main - - end -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_F77=' ${wl}-bernotok' - allow_undefined_flag_F77=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols_F77=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_F77=' ' - archive_cmds_need_lc_F77=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_minus_L_F77=yes - # see comment about different semantics on the GNU ld section - ld_shlibs_F77=no - ;; - - bsdi4*) - export_dynamic_flag_spec_F77=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec_F77=' ' - allow_undefined_flag_F77=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds_F77='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes_F77=yes - ;; - - darwin* | rhapsody*) - if test "$GXX" = yes ; then - archive_cmds_need_lc_F77=no - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_F77='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_F77='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_F77='-flat_namespace -undefined suppress' - ;; - 10.*) - allow_undefined_flag_F77='-undefined dynamic_lookup' - ;; - esac - fi - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds_F77='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds_F77='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds_F77='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - hardcode_direct_F77=no - hardcode_automatic_F77=yes - hardcode_shlibpath_var_F77=unsupported - whole_archive_flag_spec_F77='-all_load $convenience' - link_all_deplibs_F77=yes - else - ld_shlibs_F77=no - fi - ;; - - dgux*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_shlibpath_var_F77=no - ;; - - freebsd1*) - ld_shlibs_F77=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes - hardcode_minus_L_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) - archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_F77=: - hardcode_direct_F77=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes - export_dynamic_flag_spec_F77='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_F77='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld_F77='+b $libdir' - hardcode_libdir_separator_F77=: - hardcode_direct_F77=no - hardcode_shlibpath_var_F77=no - ;; - ia64*) - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_direct_F77=no - hardcode_shlibpath_var_F77=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes - ;; - *) - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_F77=: - hardcode_direct_F77=yes - export_dynamic_flag_spec_F77='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' - fi - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_F77=: - link_all_deplibs_F77=yes - ;; - - netbsd* | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - newsos6) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_F77=: - hardcode_shlibpath_var_F77=no - ;; - - openbsd*) - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' - export_dynamic_flag_spec_F77='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-R$libdir' - ;; - *) - archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_minus_L_F77=yes - allow_undefined_flag_F77=unsupported - archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag_F77=' -expect_unresolved \*' - archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_F77=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag_F77=' -expect_unresolved \*' - archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec_F77='-rpath $libdir' - fi - hardcode_libdir_separator_F77=: - ;; - - sco3.2v5*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_F77=no - export_dynamic_flag_spec_F77='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - no_undefined_flag_F77=' -z text' - if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_shlibpath_var_F77=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; - esac - link_all_deplibs_F77=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_direct_F77=yes - hardcode_minus_L_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds_F77='$CC -r -o $output$reload_objs' - hardcode_direct_F77=no - ;; - motorola) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_F77=no - ;; - - sysv4.3*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_F77=no - export_dynamic_flag_spec_F77='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_F77=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs_F77=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes - hardcode_minus_L_F77=no - hardcode_shlibpath_var_F77=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - no_undefined_flag_F77='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_F77='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_F77=no - ;; - - sysv5*) - no_undefined_flag_F77=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec_F77= - hardcode_shlibpath_var_F77=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_shlibpath_var_F77=no - ;; - - *) - ld_shlibs_F77=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 -echo "${ECHO_T}$ld_shlibs_F77" >&6 -test "$ld_shlibs_F77" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_F77" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_F77=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_F77 in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_F77 - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_F77 - allow_undefined_flag_F77= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc_F77=no - else - archive_cmds_need_lc_F77=yes - fi - allow_undefined_flag_F77=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 -echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6 - ;; - esac - fi - ;; -esac - -echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi4*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.01* | freebsdelf3.01*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` - sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=yes - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6 -test "$dynamic_linker" = no && can_build_shared=no - -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action_F77= -if test -n "$hardcode_libdir_flag_spec_F77" || \ - test -n "$runpath_var F77" || \ - test "X$hardcode_automatic_F77"="Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_F77" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && - test "$hardcode_minus_L_F77" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_F77=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_F77=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_F77=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 -echo "${ECHO_T}$hardcode_action_F77" >&6 - -if test "$hardcode_action_F77" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - - - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_F77 \ - CC_F77 \ - LD_F77 \ - lt_prog_compiler_wl_F77 \ - lt_prog_compiler_pic_F77 \ - lt_prog_compiler_static_F77 \ - lt_prog_compiler_no_builtin_flag_F77 \ - export_dynamic_flag_spec_F77 \ - thread_safe_flag_spec_F77 \ - whole_archive_flag_spec_F77 \ - enable_shared_with_static_runtimes_F77 \ - old_archive_cmds_F77 \ - old_archive_from_new_cmds_F77 \ - predep_objects_F77 \ - postdep_objects_F77 \ - predeps_F77 \ - postdeps_F77 \ - compiler_lib_search_path_F77 \ - archive_cmds_F77 \ - archive_expsym_cmds_F77 \ - postinstall_cmds_F77 \ - postuninstall_cmds_F77 \ - old_archive_from_expsyms_cmds_F77 \ - allow_undefined_flag_F77 \ - no_undefined_flag_F77 \ - export_symbols_cmds_F77 \ - hardcode_libdir_flag_spec_F77 \ - hardcode_libdir_flag_spec_ld_F77 \ - hardcode_libdir_separator_F77 \ - hardcode_automatic_F77 \ - module_cmds_F77 \ - module_expsym_cmds_F77 \ - lt_cv_prog_compiler_c_o_F77 \ - exclude_expsyms_F77 \ - include_expsyms_F77; do - - case $var in - old_archive_cmds_F77 | \ - old_archive_from_new_cmds_F77 | \ - archive_cmds_F77 | \ - archive_expsym_cmds_F77 | \ - module_cmds_F77 | \ - module_expsym_cmds_F77 | \ - old_archive_from_expsyms_cmds_F77 | \ - export_symbols_cmds_F77 | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_F77 - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_F77 - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_F77 - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_F77 - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_F77 - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext='$shrext' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_F77 -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_F77 - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_F77 -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_F77 -archive_expsym_cmds=$lt_archive_expsym_cmds_F77 -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_F77 -module_expsym_cmds=$lt_module_expsym_cmds_F77 - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_F77 - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_F77 - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_F77 - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_F77 - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_F77 - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_F77 - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_F77 - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_F77 - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_F77 - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_F77 - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_F77 - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_F77 - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_F77" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_F77 - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_F77 - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_F77 - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_F77 - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC="$lt_save_CC" - - else - tagname="" - fi - ;; - - GCJ) - if test -n "$GCJ" && test "X$GCJ" != "Xno"; then - - - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -objext_GCJ=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String argv) {}; }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${GCJ-"gcj"} -compiler=$CC -compiler_GCJ=$CC - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -archive_cmds_need_lc_GCJ=no - - -lt_prog_compiler_no_builtin_flag_GCJ= - -if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' - - -echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15427: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:15431: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" -else - : -fi - -fi - -lt_prog_compiler_wl_GCJ= -lt_prog_compiler_pic_GCJ= -lt_prog_compiler_static_GCJ= - -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 - - if test "$GCC" = yes; then - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_static_GCJ='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_GCJ='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_GCJ='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared_GCJ=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_GCJ=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_GCJ='-fPIC' - ;; - esac - ;; - - *) - lt_prog_compiler_pic_GCJ='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl_GCJ='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_GCJ='-Bstatic' - else - lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl_GCJ='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_GCJ='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl_GCJ='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - - newsos6) - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - linux*) - case $CC in - icc* | ecc*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-static' - ;; - ccc*) - lt_prog_compiler_wl_GCJ='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl_GCJ='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - - sco3.2v5*) - lt_prog_compiler_pic_GCJ='-Kpic' - lt_prog_compiler_static_GCJ='-dn' - ;; - - solaris*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - sunos4*) - lt_prog_compiler_wl_GCJ='-Qoption ld ' - lt_prog_compiler_pic_GCJ='-PIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic_GCJ='-Kconform_pic' - lt_prog_compiler_static_GCJ='-Bstatic' - fi - ;; - - uts4*) - lt_prog_compiler_pic_GCJ='-pic' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared_GCJ=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6 - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_GCJ"; then - -echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6 -if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_pic_works_GCJ=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_GCJ" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15660: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:15664: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_prog_compiler_pic_works_GCJ=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6 - -if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then - case $lt_prog_compiler_pic_GCJ in - "" | " "*) ;; - *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; - esac -else - lt_prog_compiler_pic_GCJ= - lt_prog_compiler_can_build_shared_GCJ=no -fi - -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_GCJ= - ;; - *) - lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" - ;; -esac - -echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o_GCJ=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15720: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:15724: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - lt_cv_prog_compiler_c_o_GCJ=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6 - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6 - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 - - runpath_var= - allow_undefined_flag_GCJ= - enable_shared_with_static_runtimes_GCJ=no - archive_cmds_GCJ= - archive_expsym_cmds_GCJ= - old_archive_From_new_cmds_GCJ= - old_archive_from_expsyms_cmds_GCJ= - export_dynamic_flag_spec_GCJ= - whole_archive_flag_spec_GCJ= - thread_safe_flag_spec_GCJ= - hardcode_libdir_flag_spec_GCJ= - hardcode_libdir_flag_spec_ld_GCJ= - hardcode_libdir_separator_GCJ= - hardcode_direct_GCJ=no - hardcode_minus_L_GCJ=no - hardcode_shlibpath_var_GCJ=unsupported - link_all_deplibs_GCJ=unknown - hardcode_automatic_GCJ=no - module_cmds_GCJ= - module_expsym_cmds_GCJ= - always_export_symbols_GCJ=no - export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms_GCJ= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs_GCJ=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs_GCJ=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs_GCJ=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_GCJ=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_GCJ='-L$libdir' - allow_undefined_flag_GCJ=unsupported - always_export_symbols_GCJ=no - enable_shared_with_static_runtimes_GCJ=yes - export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs=no - fi - ;; - - netbsd* | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs_GCJ=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - - sunos4*) - archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - linux*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_cmds_GCJ="$tmp_archive_cmds" - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds_GCJ="$tmp_archive_cmds" - fi - else - ld_shlibs_GCJ=no - fi - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - esac - - if test "$ld_shlibs_GCJ" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_GCJ= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag_GCJ=unsupported - always_export_symbols_GCJ=yes - archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L_GCJ=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct_GCJ=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_GCJ='' - hardcode_direct_GCJ=yes - hardcode_libdir_separator_GCJ=':' - link_all_deplibs_GCJ=yes - - if test "$GCC" = yes; then - case $host_os in aix4.012|aix4.012.*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct_GCJ=yes - else - # We have old collect2 - hardcode_direct_GCJ=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_GCJ=yes - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_libdir_separator_GCJ= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_GCJ=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_GCJ='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_GCJ="-z nodefs" - archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_GCJ=' ${wl}-bernotok' - allow_undefined_flag_GCJ=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols_GCJ=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_GCJ=' ' - archive_cmds_need_lc_GCJ=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - # see comment about different semantics on the GNU ld section - ld_shlibs_GCJ=no - ;; - - bsdi4*) - export_dynamic_flag_spec_GCJ=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec_GCJ=' ' - allow_undefined_flag_GCJ=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds_GCJ='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes_GCJ=yes - ;; - - darwin* | rhapsody*) - if test "$GXX" = yes ; then - archive_cmds_need_lc_GCJ=no - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_GCJ='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_GCJ='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_GCJ='-flat_namespace -undefined suppress' - ;; - 10.*) - allow_undefined_flag_GCJ='-undefined dynamic_lookup' - ;; - esac - fi - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds_GCJ='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds_GCJ='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds_GCJ='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - hardcode_direct_GCJ=no - hardcode_automatic_GCJ=yes - hardcode_shlibpath_var_GCJ=unsupported - whole_archive_flag_spec_GCJ='-all_load $convenience' - link_all_deplibs_GCJ=yes - else - ld_shlibs_GCJ=no - fi - ;; - - dgux*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_shlibpath_var_GCJ=no - ;; - - freebsd1*) - ld_shlibs_GCJ=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) - archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_direct_GCJ=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - export_dynamic_flag_spec_GCJ='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_GCJ='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' - hardcode_libdir_separator_GCJ=: - hardcode_direct_GCJ=no - hardcode_shlibpath_var_GCJ=no - ;; - ia64*) - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_direct_GCJ=no - hardcode_shlibpath_var_GCJ=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - ;; - *) - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_direct_GCJ=yes - export_dynamic_flag_spec_GCJ='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' - fi - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - link_all_deplibs_GCJ=yes - ;; - - netbsd* | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - newsos6) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_shlibpath_var_GCJ=no - ;; - - openbsd*) - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' - export_dynamic_flag_spec_GCJ='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - ;; - *) - archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - allow_undefined_flag_GCJ=unsupported - archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag_GCJ=' -expect_unresolved \*' - archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag_GCJ=' -expect_unresolved \*' - archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec_GCJ='-rpath $libdir' - fi - hardcode_libdir_separator_GCJ=: - ;; - - sco3.2v5*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - export_dynamic_flag_spec_GCJ='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - no_undefined_flag_GCJ=' -z text' - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_shlibpath_var_GCJ=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; - esac - link_all_deplibs_GCJ=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds_GCJ='$CC -r -o $output$reload_objs' - hardcode_direct_GCJ=no - ;; - motorola) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_GCJ=no - ;; - - sysv4.3*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - export_dynamic_flag_spec_GCJ='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs_GCJ=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=no - hardcode_shlibpath_var_GCJ=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - no_undefined_flag_GCJ='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GCJ='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_GCJ=no - ;; - - sysv5*) - no_undefined_flag_GCJ=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec_GCJ= - hardcode_shlibpath_var_GCJ=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_shlibpath_var_GCJ=no - ;; - - *) - ld_shlibs_GCJ=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 -echo "${ECHO_T}$ld_shlibs_GCJ" >&6 -test "$ld_shlibs_GCJ" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_GCJ" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_GCJ=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_GCJ in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_GCJ - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ - allow_undefined_flag_GCJ= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc_GCJ=no - else - archive_cmds_need_lc_GCJ=yes - fi - allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 -echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6 - ;; - esac - fi - ;; -esac - -echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi4*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.01* | freebsdelf3.01*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` - sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=yes - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6 -test "$dynamic_linker" = no && can_build_shared=no - -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action_GCJ= -if test -n "$hardcode_libdir_flag_spec_GCJ" || \ - test -n "$runpath_var GCJ" || \ - test "X$hardcode_automatic_GCJ"="Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_GCJ" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && - test "$hardcode_minus_L_GCJ" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_GCJ=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_GCJ=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_GCJ=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 -echo "${ECHO_T}$hardcode_action_GCJ" >&6 - -if test "$hardcode_action_GCJ" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - echo "$as_me:$LINENO: checking for shl_load" >&5 -echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 -if test "${ac_cv_func_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define shl_load to an innocuous variant, in case declares shl_load. - For example, HP-UX 11i declares gettimeofday. */ -#define shl_load innocuous_shl_load - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char shl_load (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef shl_load - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char shl_load (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_shl_load) || defined (__stub___shl_load) -choke me -#else -char (*f) () = shl_load; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != shl_load; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 -echo "${ECHO_T}$ac_cv_func_shl_load" >&6 -if test $ac_cv_func_shl_load = yes; then - lt_cv_dlopen="shl_load" -else - echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char shl_load (); -int -main () -{ -shl_load (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dld_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 -if test $ac_cv_lib_dld_shl_load = yes; then - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" -else - echo "$as_me:$LINENO: checking for dlopen" >&5 -echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 -if test "${ac_cv_func_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define dlopen to an innocuous variant, in case declares dlopen. - For example, HP-UX 11i declares gettimeofday. */ -#define dlopen innocuous_dlopen - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char dlopen (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef dlopen - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_dlopen) || defined (__stub___dlopen) -choke me -#else -char (*f) () = dlopen; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != dlopen; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 -echo "${ECHO_T}$ac_cv_func_dlopen" >&6 -if test $ac_cv_func_dlopen = yes; then - lt_cv_dlopen="dlopen" -else - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 -echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 -if test "${ac_cv_lib_svld_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_svld_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_svld_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 -if test $ac_cv_lib_svld_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 -echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_dld_link+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dld_link (); -int -main () -{ -dld_link (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dld_dld_link=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_dld_link=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 -if test $ac_cv_lib_dld_dld_link = yes; then - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 -echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self" >&6 - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 -echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self_static+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_GCJ \ - CC_GCJ \ - LD_GCJ \ - lt_prog_compiler_wl_GCJ \ - lt_prog_compiler_pic_GCJ \ - lt_prog_compiler_static_GCJ \ - lt_prog_compiler_no_builtin_flag_GCJ \ - export_dynamic_flag_spec_GCJ \ - thread_safe_flag_spec_GCJ \ - whole_archive_flag_spec_GCJ \ - enable_shared_with_static_runtimes_GCJ \ - old_archive_cmds_GCJ \ - old_archive_from_new_cmds_GCJ \ - predep_objects_GCJ \ - postdep_objects_GCJ \ - predeps_GCJ \ - postdeps_GCJ \ - compiler_lib_search_path_GCJ \ - archive_cmds_GCJ \ - archive_expsym_cmds_GCJ \ - postinstall_cmds_GCJ \ - postuninstall_cmds_GCJ \ - old_archive_from_expsyms_cmds_GCJ \ - allow_undefined_flag_GCJ \ - no_undefined_flag_GCJ \ - export_symbols_cmds_GCJ \ - hardcode_libdir_flag_spec_GCJ \ - hardcode_libdir_flag_spec_ld_GCJ \ - hardcode_libdir_separator_GCJ \ - hardcode_automatic_GCJ \ - module_cmds_GCJ \ - module_expsym_cmds_GCJ \ - lt_cv_prog_compiler_c_o_GCJ \ - exclude_expsyms_GCJ \ - include_expsyms_GCJ; do - - case $var in - old_archive_cmds_GCJ | \ - old_archive_from_new_cmds_GCJ | \ - archive_cmds_GCJ | \ - archive_expsym_cmds_GCJ | \ - module_cmds_GCJ | \ - module_expsym_cmds_GCJ | \ - old_archive_from_expsyms_cmds_GCJ | \ - export_symbols_cmds_GCJ | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_GCJ - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_GCJ - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_GCJ - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_GCJ - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_GCJ - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext='$shrext' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_GCJ -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_GCJ - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_GCJ -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_GCJ -archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_GCJ -module_expsym_cmds=$lt_module_expsym_cmds_GCJ - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_GCJ - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_GCJ - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_GCJ - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_GCJ - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_GCJ - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_GCJ - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_GCJ - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_GCJ - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_GCJ - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_GCJ - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_GCJ - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_GCJ" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_GCJ - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_GCJ - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_GCJ - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_GCJ - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC="$lt_save_CC" - - else - tagname="" - fi - ;; - - RC) - - - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -objext_RC=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${RC-"windres"} -compiler=$CC -compiler_RC=$CC -lt_cv_prog_compiler_c_o_RC=yes - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_RC \ - CC_RC \ - LD_RC \ - lt_prog_compiler_wl_RC \ - lt_prog_compiler_pic_RC \ - lt_prog_compiler_static_RC \ - lt_prog_compiler_no_builtin_flag_RC \ - export_dynamic_flag_spec_RC \ - thread_safe_flag_spec_RC \ - whole_archive_flag_spec_RC \ - enable_shared_with_static_runtimes_RC \ - old_archive_cmds_RC \ - old_archive_from_new_cmds_RC \ - predep_objects_RC \ - postdep_objects_RC \ - predeps_RC \ - postdeps_RC \ - compiler_lib_search_path_RC \ - archive_cmds_RC \ - archive_expsym_cmds_RC \ - postinstall_cmds_RC \ - postuninstall_cmds_RC \ - old_archive_from_expsyms_cmds_RC \ - allow_undefined_flag_RC \ - no_undefined_flag_RC \ - export_symbols_cmds_RC \ - hardcode_libdir_flag_spec_RC \ - hardcode_libdir_flag_spec_ld_RC \ - hardcode_libdir_separator_RC \ - hardcode_automatic_RC \ - module_cmds_RC \ - module_expsym_cmds_RC \ - lt_cv_prog_compiler_c_o_RC \ - exclude_expsyms_RC \ - include_expsyms_RC; do - - case $var in - old_archive_cmds_RC | \ - old_archive_from_new_cmds_RC | \ - archive_cmds_RC | \ - archive_expsym_cmds_RC | \ - module_cmds_RC | \ - module_expsym_cmds_RC | \ - old_archive_from_expsyms_cmds_RC | \ - export_symbols_cmds_RC | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_RC - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_RC - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_RC - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_RC - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_RC - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext='$shrext' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_RC -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_RC - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_RC -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_RC -archive_expsym_cmds=$lt_archive_expsym_cmds_RC -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_RC -module_expsym_cmds=$lt_module_expsym_cmds_RC - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_RC - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_RC - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_RC - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_RC - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_RC - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_RC - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_RC - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_RC - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_RC - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_RC - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_RC - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_RC - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_RC - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_RC" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_RC - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_RC - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_RC - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_RC - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC="$lt_save_CC" - - ;; - - *) - { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 -echo "$as_me: error: Unsupported tag name: $tagname" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - - # Append the new tag name to the list of available tags. - if test -n "$tagname" ; then - available_tags="$available_tags $tagname" - fi - fi - done - IFS="$lt_save_ifs" - - # Now substitute the updated list of available tags. - if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then - mv "${ofile}T" "$ofile" - chmod +x "$ofile" - else - rm -f "${ofile}T" - { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 -echo "$as_me: error: unable to update list of available tagged configurations." >&2;} - { (exit 1); exit 1; }; } - fi -fi - - - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - -# Prevent multiple expansion - - - - - - - - - - - - - - - - - - - - - -# -# Check for Xrender -# - - succeeded=no - - if test -z "$PKG_CONFIG"; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_PKG_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG - -if test -n "$PKG_CONFIG"; then - echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 -echo "${ECHO_T}$PKG_CONFIG" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - fi - - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - echo "$as_me:$LINENO: checking for xrender >= 0.8.2" >&5 -echo $ECHO_N "checking for xrender >= 0.8.2... $ECHO_C" >&6 - - if $PKG_CONFIG --exists "xrender >= 0.8.2" ; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - succeeded=yes - - echo "$as_me:$LINENO: checking XRENDER_CFLAGS" >&5 -echo $ECHO_N "checking XRENDER_CFLAGS... $ECHO_C" >&6 - XRENDER_CFLAGS=`$PKG_CONFIG --cflags "xrender >= 0.8.2"` - echo "$as_me:$LINENO: result: $XRENDER_CFLAGS" >&5 -echo "${ECHO_T}$XRENDER_CFLAGS" >&6 - - echo "$as_me:$LINENO: checking XRENDER_LIBS" >&5 -echo $ECHO_N "checking XRENDER_LIBS... $ECHO_C" >&6 - XRENDER_LIBS=`$PKG_CONFIG --libs "xrender >= 0.8.2"` - echo "$as_me:$LINENO: result: $XRENDER_LIBS" >&5 -echo "${ECHO_T}$XRENDER_LIBS" >&6 - else - XRENDER_CFLAGS="" - XRENDER_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - XRENDER_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "xrender >= 0.8.2"` - - fi - - - - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - xrender_found_with_pkgconfig=yes - else - xrender_found_with_pkgconfig=no - fi - -case "$xrender_found_with_pkgconfig" in -no) - - succeeded=no - - if test -z "$PKG_CONFIG"; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_PKG_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG - -if test -n "$PKG_CONFIG"; then - echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 -echo "${ECHO_T}$PKG_CONFIG" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - fi - - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - echo "$as_me:$LINENO: checking for xrender >= 0" >&5 -echo $ECHO_N "checking for xrender >= 0... $ECHO_C" >&6 - - if $PKG_CONFIG --exists "xrender >= 0" ; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - succeeded=yes - - echo "$as_me:$LINENO: checking XRENDER_CFLAGS" >&5 -echo $ECHO_N "checking XRENDER_CFLAGS... $ECHO_C" >&6 - XRENDER_CFLAGS=`$PKG_CONFIG --cflags "xrender >= 0"` - echo "$as_me:$LINENO: result: $XRENDER_CFLAGS" >&5 -echo "${ECHO_T}$XRENDER_CFLAGS" >&6 - - echo "$as_me:$LINENO: checking XRENDER_LIBS" >&5 -echo $ECHO_N "checking XRENDER_LIBS... $ECHO_C" >&6 - XRENDER_LIBS=`$PKG_CONFIG --libs "xrender >= 0"` - echo "$as_me:$LINENO: result: $XRENDER_LIBS" >&5 -echo "${ECHO_T}$XRENDER_LIBS" >&6 - else - XRENDER_CFLAGS="" - XRENDER_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - XRENDER_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "xrender >= 0"` - - fi - - - - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - old_xrender_found_with_pkgconfig=yes - else - old_xrender_found_with_pkgconfig=no - fi - - case "$old_xrender_found_with_pkgconfig" in - yes) - XRENDER_LIBS="$XRENDER_LIBS -lXext -lX11" - ;; - *) - # checks for X - echo "$as_me:$LINENO: checking for X" >&5 -echo $ECHO_N "checking for X... $ECHO_C" >&6 - - -# Check whether --with-x or --without-x was given. -if test "${with_x+set}" = set; then - withval="$with_x" - -fi; -# $have_x is `yes', `no', `disabled', or empty when we do not yet know. -if test "x$with_x" = xno; then - # The user explicitly disabled X. - have_x=disabled -else - if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then - # Both variables are already set. - have_x=yes - else - if test "${ac_cv_have_x+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # One or both of the vars are not set, and there is no cached value. -ac_x_includes=no ac_x_libraries=no -rm -fr conftest.dir -if mkdir conftest.dir; then - cd conftest.dir - # Make sure to not put "make" in the Imakefile rules, since we grep it out. - cat >Imakefile <<'_ACEOF' -acfindx: - @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' -_ACEOF - if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then - # GNU make sometimes prints "make[1]: Entering...", which would confuse us. - eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` - # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. - for ac_extension in a so sl; do - if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && - test -f $ac_im_libdir/libX11.$ac_extension; then - ac_im_usrlibdir=$ac_im_libdir; break - fi - done - # Screen out bogus values from the imake configuration. They are - # bogus both because they are the default anyway, and because - # using them would break gcc on systems where it needs fixed includes. - case $ac_im_incroot in - /usr/include) ;; - *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; - esac - case $ac_im_usrlibdir in - /usr/lib | /lib) ;; - *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; - esac - fi - cd .. - rm -fr conftest.dir -fi - -# Standard set of common directories for X headers. -# Check X11 before X11Rn because it is often a symlink to the current release. -ac_x_header_dirs=' -/usr/X11/include -/usr/X11R6/include -/usr/X11R5/include -/usr/X11R4/include - -/usr/include/X11 -/usr/include/X11R6 -/usr/include/X11R5 -/usr/include/X11R4 - -/usr/local/X11/include -/usr/local/X11R6/include -/usr/local/X11R5/include -/usr/local/X11R4/include - -/usr/local/include/X11 -/usr/local/include/X11R6 -/usr/local/include/X11R5 -/usr/local/include/X11R4 - -/usr/X386/include -/usr/x386/include -/usr/XFree86/include/X11 - -/usr/include -/usr/local/include -/usr/unsupported/include -/usr/athena/include -/usr/local/x11r5/include -/usr/lpp/Xamples/include - -/usr/openwin/include -/usr/openwin/share/include' - -if test "$ac_x_includes" = no; then - # Guess where to find include files, by looking for Intrinsic.h. - # First, try using that file with no special directory specified. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # We can compile using X headers with no special include directory. -ac_x_includes= -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - for ac_dir in $ac_x_header_dirs; do - if test -r "$ac_dir/X11/Intrinsic.h"; then - ac_x_includes=$ac_dir - break - fi -done -fi -rm -f conftest.err conftest.$ac_ext -fi # $ac_x_includes = no - -if test "$ac_x_libraries" = no; then - # Check for the libraries. - # See if we find them without any special options. - # Don't add to $LIBS permanently. - ac_save_LIBS=$LIBS - LIBS="-lXt $LIBS" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ -XtMalloc (0) - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - LIBS=$ac_save_LIBS -# We can link X programs with no special library path. -ac_x_libraries= -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -LIBS=$ac_save_LIBS -for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` -do - # Don't even attempt the hair of trying to link an X program! - for ac_extension in a so sl; do - if test -r $ac_dir/libXt.$ac_extension; then - ac_x_libraries=$ac_dir - break 2 - fi - done -done -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi # $ac_x_libraries = no - -if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then - # Didn't find X anywhere. Cache the known absence of X. - ac_cv_have_x="have_x=no" -else - # Record where we found X for the cache. - ac_cv_have_x="have_x=yes \ - ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" -fi -fi - - fi - eval "$ac_cv_have_x" -fi # $with_x != no - -if test "$have_x" != yes; then - echo "$as_me:$LINENO: result: $have_x" >&5 -echo "${ECHO_T}$have_x" >&6 - no_x=yes -else - # If each of the values was on the command line, it overrides each guess. - test "x$x_includes" = xNONE && x_includes=$ac_x_includes - test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries - # Update the cache value to reflect the command line values. - ac_cv_have_x="have_x=yes \ - ac_x_includes=$x_includes ac_x_libraries=$x_libraries" - echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5 -echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6 -fi - - - XRENDER_CFLAGS="-I$x_includes" - XRENDER_LIBS="-L$x_libraries -lXrender -lXext -lX11" - - saved_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $XRENDER_CFLAGS" - -for ac_header in X11/extensions/Xrender.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## -------------------------------- ## -## Report this to keithp@keithp.com ## -## -------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -else - { { echo "$as_me:$LINENO: error: Xrender.h not found." >&5 -echo "$as_me: error: Xrender.h not found." >&2;} - { (exit 1); exit 1; }; } -fi - -done - - CPPFLAGS="$saved_CPPFLAGS" - - saved_LIBS="$LIBS" - LIBS="$LIBS $XRENDER_LIBS" - -for ac_func in XRenderFindStandardFormat -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -else - { { echo "$as_me:$LINENO: error: libXrender not found or too old." >&5 -echo "$as_me: error: libXrender not found or too old." >&2;} - { (exit 1); exit 1; }; } -fi -done - - LIBS="$saved_LIBS" - ;; - esac - ;; -esac - -# Check freetype configuration -# Extract the first word of "freetype-config", so it can be a program name with args. -set dummy freetype-config; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ft_config+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ft_config"; then - ac_cv_prog_ft_config="$ft_config" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ft_config="freetype-config" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ft_config=$ac_cv_prog_ft_config -if test -n "$ft_config"; then - echo "$as_me:$LINENO: result: $ft_config" >&5 -echo "${ECHO_T}$ft_config" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -if test "x$ft_config" = "x" ; then - { { echo "$as_me:$LINENO: error: freetype-config not found. freetype is required. Please make sure you have the freetype development packages installed." >&5 -echo "$as_me: error: freetype-config not found. freetype is required. Please make sure you have the freetype development packages installed." >&2;} - { (exit 1); exit 1; }; } -fi -FREETYPE_CFLAGS="`$ft_config --cflags`" -FREETYPE_LIBS="`$ft_config --libs`" - -# Check fontconfig configuration - - succeeded=no - - if test -z "$PKG_CONFIG"; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_PKG_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG - -if test -n "$PKG_CONFIG"; then - echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 -echo "${ECHO_T}$PKG_CONFIG" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - fi - - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - echo "$as_me:$LINENO: checking for fontconfig >= 2.2" >&5 -echo $ECHO_N "checking for fontconfig >= 2.2... $ECHO_C" >&6 - - if $PKG_CONFIG --exists "fontconfig >= 2.2" ; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - succeeded=yes - - echo "$as_me:$LINENO: checking FONTCONFIG_CFLAGS" >&5 -echo $ECHO_N "checking FONTCONFIG_CFLAGS... $ECHO_C" >&6 - FONTCONFIG_CFLAGS=`$PKG_CONFIG --cflags "fontconfig >= 2.2"` - echo "$as_me:$LINENO: result: $FONTCONFIG_CFLAGS" >&5 -echo "${ECHO_T}$FONTCONFIG_CFLAGS" >&6 - - echo "$as_me:$LINENO: checking FONTCONFIG_LIBS" >&5 -echo $ECHO_N "checking FONTCONFIG_LIBS... $ECHO_C" >&6 - FONTCONFIG_LIBS=`$PKG_CONFIG --libs "fontconfig >= 2.2"` - echo "$as_me:$LINENO: result: $FONTCONFIG_LIBS" >&5 -echo "${ECHO_T}$FONTCONFIG_LIBS" >&6 - else - FONTCONFIG_CFLAGS="" - FONTCONFIG_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - FONTCONFIG_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fontconfig >= 2.2"` - echo $FONTCONFIG_PKG_ERRORS - fi - - - - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - : - else - { { echo "$as_me:$LINENO: error: Library requirements (fontconfig >= 2.2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5 -echo "$as_me: error: Library requirements (fontconfig >= 2.2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;} - { (exit 1); exit 1; }; } - fi - - - - - - - - - -fontconfig_save_libs="$LIBS" -fontconfig_save_cflags="$CFLAGS" -LIBS="$LIBS $FREETYPE_LIBS" -CFLAGS="$CFLAGS $FREETYPE_CFLAGS" - - - - -for ac_func in FT_Get_Next_Char FT_Get_BDF_Property FT_Get_PS_Font_Info FT_Has_PS_Glyph_Names -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - -echo "$as_me:$LINENO: checking for FT_Bitmap_Size.y_ppem" >&5 -echo $ECHO_N "checking for FT_Bitmap_Size.y_ppem... $ECHO_C" >&6 -if test "${ac_cv_member_FT_Bitmap_Size_y_ppem+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include FT_FREETYPE_H - -int -main () -{ -static FT_Bitmap_Size ac_aggr; -if (ac_aggr.y_ppem) -return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_member_FT_Bitmap_Size_y_ppem=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include FT_FREETYPE_H - -int -main () -{ -static FT_Bitmap_Size ac_aggr; -if (sizeof ac_aggr.y_ppem) -return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_member_FT_Bitmap_Size_y_ppem=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_member_FT_Bitmap_Size_y_ppem=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_member_FT_Bitmap_Size_y_ppem" >&5 -echo "${ECHO_T}$ac_cv_member_FT_Bitmap_Size_y_ppem" >&6 -if test $ac_cv_member_FT_Bitmap_Size_y_ppem = yes; then - HAVE_FT_BITMAP_SIZE_Y_PPEM=1 -else - HAVE_FT_BITMAP_SIZE_Y_PPEM=0 -fi - - -cat >>confdefs.h <<_ACEOF -#define HAVE_FT_BITMAP_SIZE_Y_PPEM $HAVE_FT_BITMAP_SIZE_Y_PPEM -_ACEOF - - -LIBS="$fontconfig_save_libs" -CFLAGS="$fontconfig_save_cflags" - -if test "$VERSION" = "" ; then - VERSION=$PACKAGE_VERSION; -fi - - ac_config_files="$ac_config_files Makefile xft.pc xft-config Xft.3" -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -{ - (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} | - sed ' - t clear - : clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end' >>confcache -if diff $cache_file confcache >/dev/null 2>&1; then :; else - if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" - cat confcache >$cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -}' -fi - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - -if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi - -: ${CONFIG_STATUS=./config.status} -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - -exec 6>&1 - -# Open the log real soon, to keep \$[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - -This file was extended by libXft $as_me 2.1.5, which was -generated by GNU Autoconf 2.59. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 -_ACEOF - -# Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi - -cat >>$CONFIG_STATUS <<\_ACEOF - -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to ." -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -libXft config.status 2.1.5 -configured by $0, generated by GNU Autoconf 2.59, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" - -Copyright (C) 2003 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." -srcdir=$srcdir -INSTALL="$INSTALL" -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` - ac_shift=: - ;; - -*) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; - esac - - case $ac_option in - # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" - ac_need_defaults=false;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -if \$ac_cs_recheck; then - echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -# -# INIT-COMMANDS section. -# - -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" - -_ACEOF - - - -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_config_target in $ac_config_targets -do - case "$ac_config_target" in - # Handling of arguments. - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "xft.pc" ) CONFIG_FILES="$CONFIG_FILES xft.pc" ;; - "xft-config" ) CONFIG_FILES="$CONFIG_FILES xft-config" ;; - "Xft.3" ) CONFIG_FILES="$CONFIG_FILES Xft.3" ;; - "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason to put it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. -$debug || -{ - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} - -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF - -# -# CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t -s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t -s,@INSTALL_DATA@,$INSTALL_DATA,;t t -s,@CYGPATH_W@,$CYGPATH_W,;t t -s,@PACKAGE@,$PACKAGE,;t t -s,@VERSION@,$VERSION,;t t -s,@ACLOCAL@,$ACLOCAL,;t t -s,@AUTOCONF@,$AUTOCONF,;t t -s,@AUTOMAKE@,$AUTOMAKE,;t t -s,@AUTOHEADER@,$AUTOHEADER,;t t -s,@MAKEINFO@,$MAKEINFO,;t t -s,@AMTAR@,$AMTAR,;t t -s,@install_sh@,$install_sh,;t t -s,@STRIP@,$STRIP,;t t -s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t -s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t -s,@AWK@,$AWK,;t t -s,@SET_MAKE@,$SET_MAKE,;t t -s,@am__leading_dot@,$am__leading_dot,;t t -s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t -s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t -s,@MAINT@,$MAINT,;t t -s,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t -s,@EXEEXT@,$EXEEXT,;t t -s,@OBJEXT@,$OBJEXT,;t t -s,@DEPDIR@,$DEPDIR,;t t -s,@am__include@,$am__include,;t t -s,@am__quote@,$am__quote,;t t -s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t -s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t -s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t -s,@CCDEPMODE@,$CCDEPMODE,;t t -s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t -s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t -s,@build@,$build,;t t -s,@build_cpu@,$build_cpu,;t t -s,@build_vendor@,$build_vendor,;t t -s,@build_os@,$build_os,;t t -s,@host@,$host,;t t -s,@host_cpu@,$host_cpu,;t t -s,@host_vendor@,$host_vendor,;t t -s,@host_os@,$host_os,;t t -s,@EGREP@,$EGREP,;t t -s,@LN_S@,$LN_S,;t t -s,@ECHO@,$ECHO,;t t -s,@AR@,$AR,;t t -s,@ac_ct_AR@,$ac_ct_AR,;t t -s,@RANLIB@,$RANLIB,;t t -s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t -s,@CPP@,$CPP,;t t -s,@CXX@,$CXX,;t t -s,@CXXFLAGS@,$CXXFLAGS,;t t -s,@ac_ct_CXX@,$ac_ct_CXX,;t t -s,@CXXDEPMODE@,$CXXDEPMODE,;t t -s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t -s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t -s,@CXXCPP@,$CXXCPP,;t t -s,@F77@,$F77,;t t -s,@FFLAGS@,$FFLAGS,;t t -s,@ac_ct_F77@,$ac_ct_F77,;t t -s,@LIBTOOL@,$LIBTOOL,;t t -s,@PKG_CONFIG@,$PKG_CONFIG,;t t -s,@XRENDER_CFLAGS@,$XRENDER_CFLAGS,;t t -s,@XRENDER_LIBS@,$XRENDER_LIBS,;t t -s,@ft_config@,$ft_config,;t t -s,@FONTCONFIG_CFLAGS@,$FONTCONFIG_CFLAGS,;t t -s,@FONTCONFIG_LIBS@,$FONTCONFIG_LIBS,;t t -s,@FREETYPE_CFLAGS@,$FREETYPE_CFLAGS,;t t -s,@FREETYPE_LIBS@,$FREETYPE_LIBS,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t -CEOF - -_ACEOF - - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_builddir$INSTALL ;; - esac - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -s,@INSTALL@,$ac_INSTALL,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi - -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_HEADER section. -# - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' -ac_dC=' ' -ac_dD=',;t' -# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='$,\1#\2define\3' -ac_uC=' ' -ac_uD=',;t' - -for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - # Do quote $f, to prevent DOS paths from being IFS'd. - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in - -_ACEOF - -# Transform confdefs.h into two sed scripts, `conftest.defines' and -# `conftest.undefs', that substitutes the proper values into -# config.h.in to produce config.h. The first handles `#define' -# templates, and the second `#undef' templates. -# And first: Protect against being on the right side of a sed subst in -# config.status. Protect against being in an unquoted here document -# in config.status. -rm -f conftest.defines conftest.undefs -# Using a here document instead of a string reduces the quoting nightmare. -# Putting comments in sed scripts is not portable. -# -# `end' is used to avoid that the second main sed command (meant for -# 0-ary CPP macros) applies to n-ary macro definitions. -# See the Autoconf documentation for `clear'. -cat >confdef2sed.sed <<\_ACEOF -s/[\\&,]/\\&/g -s,[\\$`],\\&,g -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp -t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp -: end -_ACEOF -# If some macros were called several times there might be several times -# the same #defines, which is useless. Nevertheless, we may not want to -# sort them, since we want the *last* AC-DEFINE to be honored. -uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines -sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs -rm -f confdef2sed.sed - -# This sed command replaces #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it. -cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -_ACEOF - -# Break up conftest.defines because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS -echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS -echo ' :' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.defines >/dev/null -do - # Write a limited-size here document to $tmp/defines.sed. - echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/defines.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail - rm -f conftest.defines - mv conftest.tail conftest.defines -done -rm -f conftest.defines -echo ' fi # grep' >>$CONFIG_STATUS -echo >>$CONFIG_STATUS - -# Break up conftest.undefs because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #undef templates' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.undefs >/dev/null -do - # Write a limited-size here document to $tmp/undefs.sed. - echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/undefs.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail - rm -f conftest.undefs - mv conftest.tail conftest.undefs -done -rm -f conftest.undefs - -cat >>$CONFIG_STATUS <<\_ACEOF - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - echo "/* Generated by configure. */" >$tmp/config.h - else - echo "/* $ac_file. Generated by configure. */" >$tmp/config.h - fi - cat $tmp/in >>$tmp/config.h - rm -f $tmp/in - if test x"$ac_file" != x-; then - if diff $ac_file $tmp/config.h >/dev/null 2>&1; then - { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -echo "$as_me: $ac_file is unchanged" >&6;} - else - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - rm -f $ac_file - mv $tmp/config.h $ac_file - fi - else - cat $tmp/config.h - rm -f $tmp/config.h - fi -# Compute $ac_file's index in $config_headers. -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $ac_file | $ac_file:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || -$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X$ac_file : 'X\(//\)[^/]' \| \ - X$ac_file : 'X\(//\)$' \| \ - X$ac_file : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X$ac_file | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'`/stamp-h$_am_stamp_count -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_COMMANDS section. -# -for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue - ac_dest=`echo "$ac_file" | sed 's,:.*,,'` - ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_dir=`(dirname "$ac_dest") 2>/dev/null || -$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_dest" : 'X\(//\)[^/]' \| \ - X"$ac_dest" : 'X\(//\)$' \| \ - X"$ac_dest" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_dest" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 -echo "$as_me: executing $ac_dest commands" >&6;} - case $ac_dest in - depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then - dirpart=`(dirname "$mf") 2>/dev/null || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - else - continue - fi - grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue - # Extract the definition of DEP_FILES from the Makefile without - # running `make'. - DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` - test -z "$DEPDIR" && continue - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n -e '/^U = / s///p' < "$mf"` - test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" - # We invoke sed twice because it is the simplest approach to - # changing $(DEPDIR) to its actual value in the expansion. - for file in `sed -n -e ' - /^DEP_FILES = .*\\\\$/ { - s/^DEP_FILES = // - :loop - s/\\\\$// - p - n - /\\\\$/ b loop - p - } - /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`(dirname "$file") 2>/dev/null || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p $dirpart/$fdir - else - as_dir=$dirpart/$fdir - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 -echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} - { (exit 1); exit 1; }; }; } - - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done - ;; - esac -done -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi - - diff --git a/nx-X11/lib/Xft/configure.ac b/nx-X11/lib/Xft/configure.ac deleted file mode 100644 index 3ce090ac5..000000000 --- a/nx-X11/lib/Xft/configure.ac +++ /dev/null @@ -1,133 +0,0 @@ -dnl -dnl $Id: configure.ac,v 1.3 2005/06/24 22:43:20 alanc Exp $ -dnl -dnl Copyright © 2003 Keith Packard, Noah Levitt -dnl -dnl Permission to use, copy, modify, distribute, and sell this software and its -dnl documentation for any purpose is hereby granted without fee, provided that -dnl the above copyright notice appear in all copies and that both that -dnl copyright notice and this permission notice appear in supporting -dnl documentation, and that the name of Keith Packard not be used in -dnl advertising or publicity pertaining to distribution of the software without -dnl specific, written prior permission. Keith Packard makes no -dnl representations about the suitability of this software for any purpose. It -dnl is provided "as is" without express or implied warranty. -dnl -dnl KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -dnl EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR -dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -dnl PERFORMANCE OF THIS SOFTWARE. -dnl -dnl Process this file with autoconf to create configure. - -AC_PREREQ([2.57]) - -dnl -dnl This is the package version number, not the shared library -dnl version. This same version number must appear in Xft.h -dnl Yes, it is a pain to synchronize version numbers. Unfortunately, it's -dnl not possible to extract the version number here from Xft.h -dnl Please bump the minor library number at each release as well. -dnl -AC_INIT(libXft, 2.1.7, [keithp@keithp.com], libXft) -AC_CONFIG_AUX_DIR(.) - -AM_INIT_AUTOMAKE([dist-bzip2]) -AM_MAINTAINER_MODE - -AM_CONFIG_HEADER(config.h) - -# checks for progs -AC_PROG_CC -AC_PROG_LIBTOOL - -# -# Check for Xrender -# -PKG_CHECK_MODULES(XRENDER, xrender >= 0.8.2, [xrender_found_with_pkgconfig=yes], - [xrender_found_with_pkgconfig=no]) -case "$xrender_found_with_pkgconfig" in -no) - PKG_CHECK_MODULES(XRENDER, xrender >= 0, [old_xrender_found_with_pkgconfig=yes], - [old_xrender_found_with_pkgconfig=no]) - case "$old_xrender_found_with_pkgconfig" in - yes) - XRENDER_LIBS="$XRENDER_LIBS -lXext -lX11" - ;; - *) - # checks for X - AC_PATH_X - - XRENDER_CFLAGS="-I$x_includes" - XRENDER_LIBS="-L$x_libraries -lXrender -lXext -lX11" - - saved_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $XRENDER_CFLAGS" - AC_CHECK_HEADERS([X11/extensions/Xrender.h], [], [AC_MSG_ERROR([Xrender.h not found.])]) - CPPFLAGS="$saved_CPPFLAGS" - - saved_LIBS="$LIBS" - LIBS="$LIBS $XRENDER_LIBS" - AC_CHECK_FUNCS([XRenderFindStandardFormat], [], [AC_MSG_ERROR([libXrender not found or too old.])]) - LIBS="$saved_LIBS" - ;; - esac - ;; -esac - -# Check freetype configuration -AC_CHECK_PROG(ft_config, freetype-config, freetype-config) -if test "x$ft_config" = "x" ; then - AC_MSG_ERROR([freetype-config not found. freetype is required. Please make sure you have the freetype development packages installed.]) -fi -FREETYPE_CFLAGS="`$ft_config --cflags`" -FREETYPE_LIBS="`$ft_config --libs`" - -# Check fontconfig configuration -PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.2) - -AC_SUBST(XRENDER_CFLAGS) -AC_SUBST(XRENDER_LIBS) -AC_SUBST(FREETYPE_CFLAGS) -AC_SUBST(FREETYPE_LIBS) -AC_SUBST(FONTCONFIG_CFLAGS) -AC_SUBST(FONTCONFIG_LIBS) - -fontconfig_save_libs="$LIBS" -fontconfig_save_cflags="$CFLAGS" -LIBS="$LIBS $FREETYPE_LIBS" -CFLAGS="$CFLAGS $FREETYPE_CFLAGS" -AC_CHECK_FUNCS(FT_Get_Next_Char FT_Get_BDF_Property FT_Get_PS_Font_Info FT_Has_PS_Glyph_Names FT_GlyphSlot_Embolden) -AC_CHECK_MEMBER(FT_Bitmap_Size.y_ppem, - HAVE_FT_BITMAP_SIZE_Y_PPEM=1, - HAVE_FT_BITMAP_SIZE_Y_PPEM=0, -[#include -#include FT_FREETYPE_H]) -AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,$HAVE_FT_BITMAP_SIZE_Y_PPEM, - [FT_Bitmap_Size structure includes y_ppem field]) - -LIBS="$fontconfig_save_libs" -CFLAGS="$fontconfig_save_cflags" - -if test "$VERSION" = "" ; then - VERSION=$PACKAGE_VERSION; -fi - -WARN_CFLAGS="" - -if test "x$GCC" = "xyes"; then - WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \ - -Wmissing-prototypes -Wmissing-declarations \ - -Wnested-externs -fno-strict-aliasing" -fi -AC_SUBST(WARN_CFLAGS) - -AC_OUTPUT([Makefile - xft.pc - xft-config - xft-config.1 - Xft.3]) - diff --git a/nx-X11/lib/Xft/depcomp b/nx-X11/lib/Xft/depcomp deleted file mode 100755 index edb5d38ef..000000000 --- a/nx-X11/lib/Xft/depcomp +++ /dev/null @@ -1,479 +0,0 @@ -#! /bin/sh - -# depcomp - compile a program generating dependencies as side-effects -# Copyright 1999, 2000, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Alexandre Oliva . - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi -# `libtool' can also be set to `yes' or `no'. - -if test -z "$depfile"; then - base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` - dir=`echo "$object" | sed 's,/.*$,/,'` - if test "$dir" = "$object"; then - dir= - fi - # FIXME: should be _deps on DOS. - depfile="$dir.deps/$base" -fi - -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. - "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -## The second -e expression handles DOS-style file names with drive letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the `deleted header file' problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. - tr ' ' ' -' < "$tmpdepfile" | -## Some versions of gcc put a space before the `:'. On the theory -## that the space means something, we add a space to the output as -## well. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -sgi) - if test "$libtool" = yes; then - "$@" "-Wp,-MDupdate,$tmpdepfile" - else - "$@" -MDupdate "$tmpdepfile" - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - - if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files - echo "$object : \\" > "$depfile" - - # Clip off the initial element (the dependent). Don't try to be - # clever and replace this with sed code, as IRIX sed won't handle - # lines with more than a fixed number of characters (4096 in - # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like `#:fec' to the end of the - # dependency line. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ - tr ' -' ' ' >> $depfile - echo >> $depfile - - # The second pass generates a dummy entry for each header file. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> $depfile - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. In older versions, this file always lives in the - # current directory. Also, the AIX compiler puts `$object:' at the - # start of each line; $object doesn't have directory information. - # Version 6 uses the directory in both cases. - stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` - tmpdepfile="$stripped.u" - if test "$libtool" = yes; then - "$@" -Wc,-M - else - "$@" -M - fi - stat=$? - - if test -f "$tmpdepfile"; then : - else - stripped=`echo "$stripped" | sed 's,^.*/,,'` - tmpdepfile="$stripped.u" - fi - - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - - if test -f "$tmpdepfile"; then - outname="$stripped.o" - # Each line is of the form `foo.o: dependent.h'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -icc) - # Intel's C compiler understands `-MD -MF file'. However on - # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c - # ICC 7.0 will fill foo.d with something like - # foo.o: sub/foo.c - # foo.o: sub/foo.h - # which is wrong. We want: - # sub/foo.o: sub/foo.c - # sub/foo.o: sub/foo.h - # sub/foo.c: - # sub/foo.h: - # ICC 7.1 will output - # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using \ : - # foo.o: sub/foo.c ... \ - # sub/foo.h ... \ - # ... - - "$@" -MD -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h', - # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | - sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in `foo.d' instead, so we check for that too. - # Subdirectories are respected. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - - if test "$libtool" = yes; then - tmpdepfile1="$dir.libs/$base.lo.d" - tmpdepfile2="$dir.libs/$base.d" - "$@" -Wc,-MD - else - tmpdepfile1="$dir$base.o.d" - tmpdepfile2="$dir$base.d" - "$@" -MD - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" - exit $stat - fi - - if test -f "$tmpdepfile1"; then - tmpdepfile="$tmpdepfile1" - else - tmpdepfile="$tmpdepfile2" - fi - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a tab and a space in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - test -z "$dashmflag" && dashmflag=-M - # Require at least two characters before searching for `:' - # in the target name. This is to cope with DOS-style filenames: - # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. - "$@" $dashmflag | - sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - tr ' ' ' -' < "$tmpdepfile" | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - "$@" || exit $? - # Remove any Libtool call - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - # X makedepend - shift - cleared=no - for arg in "$@"; do - case $cleared in - no) - set ""; shift - cleared=yes ;; - esac - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift ;; - # Strip any option that makedepend may not understand. Remove - # the object too, otherwise makedepend will parse it as a source file. - -*|$object) - ;; - *) - set fnord "$@" "$arg"; shift ;; - esac - done - obj_suffix="`echo $object | sed 's/^.*\././'`" - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - sed '1,2d' "$tmpdepfile" | tr ' ' ' -' | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - "$@" -E | - sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | - sed '$ s: \\$::' > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - "$@" || exit $? - IFS=" " - for arg - do - case "$arg" in - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; - *) - set fnord "$@" "$arg" - shift - shift - ;; - esac - done - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" - echo " " >> "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 diff --git a/nx-X11/lib/Xft/install-sh b/nx-X11/lib/Xft/install-sh deleted file mode 100755 index 6ce63b9f7..000000000 --- a/nx-X11/lib/Xft/install-sh +++ /dev/null @@ -1,294 +0,0 @@ -#!/bin/sh -# -# install - install a program, script, or datafile -# -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 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 CONNEC- -# TION 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 deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd=$cpprog - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd=$stripprog - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "$0: no input file specified" >&2 - exit 1 -else - : -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d "$dst" ]; then - instcmd=: - chmodcmd="" - else - instcmd=$mkdirprog - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f "$src" ] || [ -d "$src" ] - then - : - else - echo "$0: $src does not exist" >&2 - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "$0: no destination specified" >&2 - exit 1 - else - : - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d "$dst" ] - then - dst=$dst/`basename "$src"` - else - : - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' - ' -IFS="${IFS-$defaultIFS}" - -oIFS=$IFS -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS=$oIFS - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp=$pathcomp$1 - shift - - if [ ! -d "$pathcomp" ] ; - then - $mkdirprog "$pathcomp" - else - : - fi - - pathcomp=$pathcomp/ -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd "$dst" && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename "$dst"` - else - dstfile=`basename "$dst" $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename "$dst"` - else - : - fi - -# Make a couple of temp file names in the proper directory. - - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - -# Trap to clean up temp files at exit. - - trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 - trap '(exit $?); exit' 1 2 13 15 - -# Move or copy the file name to the temp name - - $doit $instcmd "$src" "$dsttmp" && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && - -# Now remove or move aside any old file at destination location. We try this -# two ways since rm can't unlink itself on some systems and the destination -# file might be busy for other reasons. In this case, the final cleanup -# might fail but the new file should still install successfully. - -{ - if [ -f "$dstdir/$dstfile" ] - then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || - $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || - { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit - } - else - : - fi -} && - -# Now rename the file to the real destination. - - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - -fi && - -# The final little trick to "correctly" pass the exit status to the exit trap. - -{ - (exit 0); exit -} diff --git a/nx-X11/lib/Xft/ltmain.sh b/nx-X11/lib/Xft/ltmain.sh deleted file mode 100644 index fe83ff4fb..000000000 --- a/nx-X11/lib/Xft/ltmain.sh +++ /dev/null @@ -1,6290 +0,0 @@ -# ltmain.sh - Provide generalized library-building support services. -# NOTE: Changing this file will not affect anything until you rerun configure. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003 -# Free Software Foundation, Inc. -# Originally by Gordon Matzigkeit , 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Check that we have a working $echo. -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then - # Yippee, $echo works! - : -else - # Restart under the correct shell, and then maybe $echo will work. - exec $SHELL "$0" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat <&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 -fi - -# Global variables. -mode=$default_mode -nonopt= -prev= -prevopt= -run= -show="$echo" -show_help= -execute_dlfiles= -lo2o="s/\\.lo\$/.${objext}/" -o2lo="s/\\.${objext}\$/.lo/" - -##################################### -# Shell function definitions: -# This seems to be the best place for them - -# Need a lot of goo to handle *both* DLLs and import libs -# Has to be a shell function in order to 'eat' the argument -# that is supplied when $file_magic_command is called. -win32_libid () { - win32_libid_type="unknown" - win32_fileres=`file -L $1 2>/dev/null` - case $win32_fileres in - *ar\ archive\ import\ library*) # definitely import - win32_libid_type="x86 archive import" - ;; - *ar\ archive*) # could be an import, or static - if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ - grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then - win32_nmres=`eval $NM -f posix -A $1 | \ - sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` - if test "X$win32_nmres" = "Ximport" ; then - win32_libid_type="x86 archive import" - else - win32_libid_type="x86 archive static" - fi - fi - ;; - *DLL*) - win32_libid_type="x86 DLL" - ;; - *executable*) # but shell scripts are "executable" too... - case $win32_fileres in - *MS\ Windows\ PE\ Intel*) - win32_libid_type="x86 DLL" - ;; - esac - ;; - esac - $echo $win32_libid_type -} - -# End of Shell function definitions -##################################### - -# Parse our command line options once, thoroughly. -while test "$#" -gt 0 -do - arg="$1" - shift - - case $arg in - -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - execute_dlfiles) - execute_dlfiles="$execute_dlfiles $arg" - ;; - tag) - tagname="$arg" - - # Check whether tagname contains only valid characters - case $tagname in - *[!-_A-Za-z0-9,/]*) - $echo "$progname: invalid tag name: $tagname" 1>&2 - exit 1 - ;; - esac - - case $tagname in - CC) - # Don't test for the "default" C tag, as we know, it's there, but - # not specially marked. - ;; - *) - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then - taglist="$taglist $tagname" - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`" - else - $echo "$progname: ignoring unknown tag $tagname" 1>&2 - fi - ;; - esac - ;; - *) - eval "$prev=\$arg" - ;; - esac - - prev= - prevopt= - continue - fi - - # Have we seen a non-optional argument yet? - case $arg in - --help) - show_help=yes - ;; - - --version) - $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" - $echo - $echo "Copyright (C) 2003 Free Software Foundation, Inc." - $echo "This is free software; see the source for copying conditions. There is NO" - $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - exit 0 - ;; - - --config) - ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 - # Now print the configurations for the tags. - for tagname in $taglist; do - ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0" - done - exit 0 - ;; - - --debug) - $echo "$progname: enabling shell trace mode" - set -x - ;; - - --dry-run | -n) - run=: - ;; - - --features) - $echo "host: $host" - if test "$build_libtool_libs" = yes; then - $echo "enable shared libraries" - else - $echo "disable shared libraries" - fi - if test "$build_old_libs" = yes; then - $echo "enable static libraries" - else - $echo "disable static libraries" - fi - exit 0 - ;; - - --finish) mode="finish" ;; - - --mode) prevopt="--mode" prev=mode ;; - --mode=*) mode="$optarg" ;; - - --preserve-dup-deps) duplicate_deps="yes" ;; - - --quiet | --silent) - show=: - ;; - - --tag) prevopt="--tag" prev=tag ;; - --tag=*) - set tag "$optarg" ${1+"$@"} - shift - prev=tag - ;; - - -dlopen) - prevopt="-dlopen" - prev=execute_dlfiles - ;; - - -*) - $echo "$modename: unrecognized option \`$arg'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - - *) - nonopt="$arg" - break - ;; - esac -done - -if test -n "$prevopt"; then - $echo "$modename: option \`$prevopt' requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 -fi - -# If this variable is set in any of the actions, the command in it -# will be execed at the end. This prevents here-documents from being -# left over by shells. -exec_cmd= - -if test -z "$show_help"; then - - # Infer the operation mode. - if test -z "$mode"; then - $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 - $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 - case $nonopt in - *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) - mode=link - for arg - do - case $arg in - -c) - mode=compile - break - ;; - esac - done - ;; - *db | *dbx | *strace | *truss) - mode=execute - ;; - *install*|cp|mv) - mode=install - ;; - *rm) - mode=uninstall - ;; - *) - # If we have no mode, but dlfiles were specified, then do execute mode. - test -n "$execute_dlfiles" && mode=execute - - # Just use the default operation mode. - if test -z "$mode"; then - if test -n "$nonopt"; then - $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 - else - $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 - fi - fi - ;; - esac - fi - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$execute_dlfiles" && test "$mode" != execute; then - $echo "$modename: unrecognized option \`-dlopen'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$modename --help --mode=$mode' for more information." - - # These modes are in order of execution frequency so that they run quickly. - case $mode in - # libtool compile mode - compile) - modename="$modename: compile" - # Get the compilation command and the source file. - base_compile= - srcfile="$nonopt" # always keep a non-empty value in "srcfile" - suppress_output= - arg_mode=normal - libobj= - - for arg - do - case "$arg_mode" in - arg ) - # do not "continue". Instead, add this to base_compile - lastarg="$arg" - arg_mode=normal - ;; - - target ) - libobj="$arg" - arg_mode=normal - continue - ;; - - normal ) - # Accept any command-line options. - case $arg in - -o) - if test -n "$libobj" ; then - $echo "$modename: you cannot specify \`-o' more than once" 1>&2 - exit 1 - fi - arg_mode=target - continue - ;; - - -static) - build_old_libs=yes - continue - ;; - - -prefer-pic) - pic_mode=yes - continue - ;; - - -prefer-non-pic) - pic_mode=no - continue - ;; - - -Xcompiler) - arg_mode=arg # the next one goes into the "base_compile" arg list - continue # The current "srcfile" will either be retained or - ;; # replaced later. I would guess that would be a bug. - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` - lastarg= - save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - lastarg="$lastarg $arg" - done - IFS="$save_ifs" - lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` - - # Add the arguments to base_compile. - base_compile="$base_compile $lastarg" - continue - ;; - - * ) - # Accept the current argument as the source file. - # The previous "srcfile" becomes the current argument. - # - lastarg="$srcfile" - srcfile="$arg" - ;; - esac # case $arg - ;; - esac # case $arg_mode - - # Aesthetically quote the previous argument. - lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` - - case $lastarg in - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - lastarg="\"$lastarg\"" - ;; - esac - - base_compile="$base_compile $lastarg" - done # for arg - - case $arg_mode in - arg) - $echo "$modename: you must specify an argument for -Xcompile" - exit 1 - ;; - target) - $echo "$modename: you must specify a target with \`-o'" 1>&2 - exit 1 - ;; - *) - # Get the name of the library object. - [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - xform='[cCFSifmso]' - case $libobj in - *.ada) xform=ada ;; - *.adb) xform=adb ;; - *.ads) xform=ads ;; - *.asm) xform=asm ;; - *.c++) xform=c++ ;; - *.cc) xform=cc ;; - *.ii) xform=ii ;; - *.class) xform=class ;; - *.cpp) xform=cpp ;; - *.cxx) xform=cxx ;; - *.f90) xform=f90 ;; - *.for) xform=for ;; - *.java) xform=java ;; - esac - - libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` - - case $libobj in - *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; - *) - $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 - exit 1 - ;; - esac - - # Infer tagged configuration to use if any are available and - # if one wasn't chosen via the "--tag" command line option. - # Only attempt this if the compiler in the base compile - # command doesn't match the default compiler. - if test -n "$available_tags" && test -z "$tagname"; then - case $base_compile in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" - case "$base_compile " in - "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) - # The compiler in the base compile command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - $echo "$modename: unable to infer tagged configuration" - $echo "$modename: specify a tag with \`--tag'" 1>&2 - exit 1 -# else -# $echo "$modename: using $tagname tagged configuration" - fi - ;; - esac - fi - - objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir= - else - xdir=$xdir/ - fi - lobj=${xdir}$objdir/$objname - - if test -z "$base_compile"; then - $echo "$modename: you must specify a compilation command" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then - removelist="$obj $lobj $libobj ${libobj}T" - else - removelist="$lobj $libobj ${libobj}T" - fi - - $run $rm $removelist - trap "$run $rm $removelist; exit 1" 1 2 15 - - # On Cygwin there's no "real" PIC flag so we must build both object types - case $host_os in - cygwin* | mingw* | pw32* | os2*) - pic_mode=default - ;; - esac - if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then - # non-PIC code in shared libraries is not supported - pic_mode=default - fi - - # Calculate the filename of the output object if compiler does - # not support -o with -c - if test "$compiler_c_o" = no; then - output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} - lockfile="$output_obj.lock" - removelist="$removelist $output_obj $lockfile" - trap "$run $rm $removelist; exit 1" 1 2 15 - else - output_obj= - need_locks=no - lockfile= - fi - - # Lock this critical section if it is needed - # We use this script file to make the link, it avoids creating a new file - if test "$need_locks" = yes; then - until $run ln "$0" "$lockfile" 2>/dev/null; do - $show "Waiting for $lockfile to be removed" - sleep 2 - done - elif test "$need_locks" = warn; then - if test -f "$lockfile"; then - $echo "\ -*** ERROR, $lockfile exists and contains: -`cat $lockfile 2>/dev/null` - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit 1 - fi - $echo $srcfile > "$lockfile" - fi - - if test -n "$fix_srcfile_path"; then - eval srcfile=\"$fix_srcfile_path\" - fi - - $run $rm "$libobj" "${libobj}T" - - # Create a libtool object file (analogous to a ".la" file), - # but don't create it if we're doing a dry run. - test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then - $echo "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit 1 - fi - - # Just move the object if needed, then go on to compile the next one - if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then - $show "$mv $output_obj $lobj" - if $run $mv $output_obj $lobj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # Append the name of the PIC object to the libtool object file. - test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then - $echo "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit 1 - fi - - # Just move the object if needed - if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then - $show "$mv $output_obj $obj" - if $run $mv $output_obj $obj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # Append the name of the non-PIC object the libtool object file. - # Only append if the libtool object file exists. - test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 - fi - if test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - else - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - fi - build_libtool_libs=no - build_old_libs=yes - prefer_static_libs=yes - break - ;; - esac - done - - # See if our shared archives depend on static archives. - test -n "$old_archive_from_new_cmds" && build_old_libs=yes - - # Go through the arguments, transforming them on the way. - while test "$#" -gt 0; do - arg="$1" - base_compile="$base_compile $arg" - shift - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test - ;; - *) qarg=$arg ;; - esac - libtool_args="$libtool_args $qarg" - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - output) - compile_command="$compile_command @OUTPUT@" - finalize_command="$finalize_command @OUTPUT@" - ;; - esac - - case $prev in - dlfiles|dlprefiles) - if test "$preload" = no; then - # Add the symbol object into the linking commands. - compile_command="$compile_command @SYMFILE@" - finalize_command="$finalize_command @SYMFILE@" - preload=yes - fi - case $arg in - *.la | *.lo) ;; # We handle these cases below. - force) - if test "$dlself" = no; then - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - self) - if test "$prev" = dlprefiles; then - dlself=yes - elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then - dlself=yes - else - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - *) - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - else - dlprefiles="$dlprefiles $arg" - fi - prev= - continue - ;; - esac - ;; - expsyms) - export_symbols="$arg" - if test ! -f "$arg"; then - $echo "$modename: symbol file \`$arg' does not exist" - exit 1 - fi - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - inst_prefix) - inst_prefix_dir="$arg" - prev= - continue - ;; - release) - release="-$arg" - prev= - continue - ;; - objectlist) - if test -f "$arg"; then - save_arg=$arg - moreargs= - for fil in `cat $save_arg` - do -# moreargs="$moreargs $fil" - arg=$fil - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - pic_object= - non_pic_object= - - # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$pic_object" || \ - test -z "$non_pic_object" || - test "$pic_object" = none && \ - test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit 1 - fi - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - libobjs="$libobjs $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - non_pic_objects="$non_pic_objects $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - fi - else - # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit 1 - else - # Dry-run case. - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" - fi - fi - done - else - $echo "$modename: link input file \`$save_arg' does not exist" - exit 1 - fi - arg=$save_arg - prev= - continue - ;; - rpath | xrpath) - # We need an absolute path. - case $arg in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit 1 - ;; - esac - if test "$prev" = rpath; then - case "$rpath " in - *" $arg "*) ;; - *) rpath="$rpath $arg" ;; - esac - else - case "$xrpath " in - *" $arg "*) ;; - *) xrpath="$xrpath $arg" ;; - esac - fi - prev= - continue - ;; - xcompiler) - compiler_flags="$compiler_flags $qarg" - prev= - compile_command="$compile_command $qarg" - finalize_command="$finalize_command $qarg" - continue - ;; - xlinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $wl$qarg" - prev= - compile_command="$compile_command $wl$qarg" - finalize_command="$finalize_command $wl$qarg" - continue - ;; - xcclinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $qarg" - prev= - compile_command="$compile_command $qarg" - finalize_command="$finalize_command $qarg" - continue - ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac - fi # test -n "$prev" - - prevarg="$arg" - - case $arg in - -all-static) - if test -n "$link_static_flag"; then - compile_command="$compile_command $link_static_flag" - finalize_command="$finalize_command $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 - continue - ;; - - -avoid-version) - avoid_version=yes - continue - ;; - - -dlopen) - prev=dlfiles - continue - ;; - - -dlpreopen) - prev=dlprefiles - continue - ;; - - -export-dynamic) - export_dynamic=yes - continue - ;; - - -export-symbols | -export-symbols-regex) - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: more than one -exported-symbols argument is not allowed" - exit 1 - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi - continue - ;; - - -inst-prefix-dir) - prev=inst_prefix - continue - ;; - - # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* - # so, if we see these flags be careful not to treat them like -L - -L[A-Z][A-Z]*:*) - case $with_gcc/$host in - no/*-*-irix* | /*-*-irix*) - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - ;; - esac - continue - ;; - - -L*) - dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 - exit 1 - fi - dir="$absdir" - ;; - esac - case "$deplibs " in - *" -L$dir "*) ;; - *) - deplibs="$deplibs -L$dir" - lib_search_path="$lib_search_path $dir" - ;; - esac - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - case :$dllsearchpath: in - *":$dir:"*) ;; - *) dllsearchpath="$dllsearchpath:$dir";; - esac - ;; - esac - continue - ;; - - -l*) - if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then - case $host in - *-*-cygwin* | *-*-pw32* | *-*-beos*) - # These systems don't actually have a C or math library (as such) - continue - ;; - *-*-mingw* | *-*-os2*) - # These systems don't actually have a C library (as such) - test "X$arg" = "X-lc" && continue - ;; - *-*-openbsd* | *-*-freebsd*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C and math libraries are in the System framework - deplibs="$deplibs -framework System" - continue - esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-openbsd* | *-*-freebsd*) - # Do not include libc_r directly, use -pthread flag. - continue - ;; - esac - fi - deplibs="$deplibs $arg" - continue - ;; - - -module) - module=yes - continue - ;; - - # gcc -m* arguments should be passed to the linker via $compiler_flags - # in order to pass architecture information to the linker - # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo - # but this is not reliable with gcc because gcc may use -mfoo to - # select a different linker, different libraries, etc, while - # -Wl,-mfoo simply passes -mfoo to the linker. - -m*) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - if test "$with_gcc" = "yes" ; then - compiler_flags="$compiler_flags $arg" - fi - continue - ;; - - -shrext) - prev=shrext - continue - ;; - - -no-fast-install) - fast_install=no - continue - ;; - - -no-install) - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - # The PATH hackery in wrapper scripts is required on Windows - # in order for the loader to find any dlls it needs. - $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 - $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 - fast_install=no - ;; - *) no_install=yes ;; - esac - continue - ;; - - -no-undefined) - allow_undefined=no - continue - ;; - - -objectlist) - prev=objectlist - continue - ;; - - -o) prev=output ;; - - -release) - prev=release - continue - ;; - - -rpath) - prev=rpath - continue - ;; - - -R) - prev=xrpath - continue - ;; - - -R*) - dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit 1 - ;; - esac - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - continue - ;; - - -static) - # The effects of -static are defined in a previous loop. - # We used to do the same as -all-static on platforms that - # didn't have a PIC flag, but the assumption that the effects - # would be equivalent was wrong. It would break on at least - # Digital Unix and AIX. - continue - ;; - - -thread-safe) - thread_safe=yes - continue - ;; - - -version-info) - prev=vinfo - continue - ;; - -version-number) - prev=vinfo - vinfo_number=yes - continue - ;; - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - case $flag in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - flag="\"$flag\"" - ;; - esac - arg="$arg $wl$flag" - compiler_flags="$compiler_flags $flag" - done - IFS="$save_ifs" - arg=`$echo "X$arg" | $Xsed -e "s/^ //"` - ;; - - -Wl,*) - args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - case $flag in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - flag="\"$flag\"" - ;; - esac - arg="$arg $wl$flag" - compiler_flags="$compiler_flags $wl$flag" - linker_flags="$linker_flags $flag" - done - IFS="$save_ifs" - arg=`$echo "X$arg" | $Xsed -e "s/^ //"` - ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Xlinker) - prev=xlinker - continue - ;; - - -XCClinker) - prev=xcclinker - continue - ;; - - # Some other compiler flag. - -* | +*) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - ;; - - *.$objext) - # A standard object. - objs="$objs $arg" - ;; - - *.lo) - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - pic_object= - non_pic_object= - - # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$pic_object" || \ - test -z "$non_pic_object" || - test "$pic_object" = none && \ - test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit 1 - fi - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - libobjs="$libobjs $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - non_pic_objects="$non_pic_objects $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - fi - else - # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit 1 - else - # Dry-run case. - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" - fi - fi - ;; - - *.$libext) - # An archive. - deplibs="$deplibs $arg" - old_deplibs="$old_deplibs $arg" - continue - ;; - - *.la) - # A libtool-controlled library. - - if test "$prev" = dlfiles; then - # This library was specified with -dlopen. - dlfiles="$dlfiles $arg" - prev= - elif test "$prev" = dlprefiles; then - # The library was specified with -dlpreopen. - dlprefiles="$dlprefiles $arg" - prev= - else - deplibs="$deplibs $arg" - fi - continue - ;; - - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - ;; - esac # arg - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - done # argument parsing loop - - if test -n "$prev"; then - $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Infer tagged configuration to use if any are available and - # if one wasn't chosen via the "--tag" command line option. - # Only attempt this if the compiler in the base link - # command doesn't match the default compiler. - if test -n "$available_tags" && test -z "$tagname"; then - case $base_compile in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" - case $base_compile in - "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) - # The compiler in $compile_command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - $echo "$modename: unable to infer tagged configuration" - $echo "$modename: specify a tag with \`--tag'" 1>&2 - exit 1 -# else -# $echo "$modename: using $tagname tagged configuration" - fi - ;; - esac - fi - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - - oldlibs= - # calculate the name of the file, without its directory - outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` - libobjs_save="$libobjs" - - if test -n "$shlibpath_var"; then - # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` - else - shlib_search_path= - fi - eval sys_lib_search_path=\"$sys_lib_search_path_spec\" - eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" - - output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` - if test "X$output_objdir" = "X$output"; then - output_objdir="$objdir" - else - output_objdir="$output_objdir/$objdir" - fi - # Create the object directory. - if test ! -d "$output_objdir"; then - $show "$mkdir $output_objdir" - $run $mkdir $output_objdir - status=$? - if test "$status" -ne 0 && test ! -d "$output_objdir"; then - exit $status - fi - fi - - # Determine the type of output - case $output in - "") - $echo "$modename: you must specify an output file" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - *.$libext) linkmode=oldlib ;; - *.lo | *.$objext) linkmode=obj ;; - *.la) linkmode=lib ;; - *) linkmode=prog ;; # Anything else should be a program. - esac - - case $host in - *cygwin* | *mingw* | *pw32*) - # don't eliminate duplcations in $postdeps and $predeps - duplicate_compiler_generated_deps=yes - ;; - *) - duplicate_compiler_generated_deps=$duplicate_deps - ;; - esac - specialdeplibs= - - libs= - # Find all interdependent deplibs by searching for libraries - # that are linked more than once (e.g. -la -lb -la) - for deplib in $deplibs; do - if test "X$duplicate_deps" = "Xyes" ; then - case "$libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - libs="$libs $deplib" - done - - if test "$linkmode" = lib; then - libs="$predeps $libs $compiler_lib_search_path $postdeps" - - # Compute libraries that are listed more than once in $predeps - # $postdeps and mark them as special (i.e., whose duplicates are - # not to be eliminated). - pre_post_deps= - if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then - for pre_post_dep in $predeps $postdeps; do - case "$pre_post_deps " in - *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; - esac - pre_post_deps="$pre_post_deps $pre_post_dep" - done - fi - pre_post_deps= - fi - - deplibs= - newdependency_libs= - newlib_search_path= - need_relink=no # whether we're linking any uninstalled libtool libraries - notinst_deplibs= # not-installed libtool libraries - notinst_path= # paths that contain not-installed libtool libraries - case $linkmode in - lib) - passes="conv link" - for file in $dlfiles $dlprefiles; do - case $file in - *.la) ;; - *) - $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 - exit 1 - ;; - esac - done - ;; - prog) - compile_deplibs= - finalize_deplibs= - alldeplibs=no - newdlfiles= - newdlprefiles= - passes="conv scan dlopen dlpreopen link" - ;; - *) passes="conv" - ;; - esac - for pass in $passes; do - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan"; then - libs="$deplibs" - deplibs= - fi - if test "$linkmode" = prog; then - case $pass in - dlopen) libs="$dlfiles" ;; - dlpreopen) libs="$dlprefiles" ;; - link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; - esac - fi - if test "$pass" = dlopen; then - # Collect dlpreopened libraries - save_deplibs="$deplibs" - deplibs= - fi - for deplib in $libs; do - lib= - found=no - case $deplib in - -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 - continue - fi - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` - for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do - # Search the libtool library - lib="$searchdir/lib${name}.la" - if test -f "$lib"; then - found=yes - break - fi - done - if test "$found" != yes; then - # deplib doesn't seem to be a libtool library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - else # deplib is a libtool library - # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, - # We need to do some special things here, and not later. - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $deplib "*) - if (${SED} -e '2q' $lib | - grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - library_names= - old_library= - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - for l in $old_library $library_names; do - ll="$l" - done - if test "X$ll" = "X$old_library" ; then # only static version available - found=no - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$lib" && ladir="." - lib=$ladir/$old_library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - fi - fi - ;; - *) ;; - esac - fi - fi - ;; # -l - -L*) - case $linkmode in - lib) - deplibs="$deplib $deplibs" - test "$pass" = conv && continue - newdependency_libs="$deplib $newdependency_libs" - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` - ;; - prog) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - if test "$pass" = scan; then - deplibs="$deplib $deplibs" - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - ;; - *) - $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 - ;; - esac # linkmode - continue - ;; # -L - -R*) - if test "$pass" = link; then - dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` - # Make sure the xrpath contains only unique directories. - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - fi - deplibs="$deplib $deplibs" - continue - ;; - *.la) lib="$deplib" ;; - *.$libext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - case $linkmode in - lib) - if test "$deplibs_check_method" != pass_all; then - $echo - $echo "*** Warning: Trying to link with static lib archive $deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because the file extensions .$libext of this argument makes me believe" - $echo "*** that it is just a static archive that I should not used here." - else - $echo - $echo "*** Warning: Linking the shared library $output against the" - $echo "*** static library $deplib is not portable!" - deplibs="$deplib $deplibs" - fi - continue - ;; - prog) - if test "$pass" != link; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - continue - ;; - esac # linkmode - ;; # *.$libext - *.lo | *.$objext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - elif test "$linkmode" = prog; then - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - newdlprefiles="$newdlprefiles $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - newdlfiles="$newdlfiles $deplib" - fi - fi - continue - ;; - %DEPLIBS%) - alldeplibs=yes - continue - ;; - esac # case $deplib - if test "$found" = yes || test -f "$lib"; then : - else - $echo "$modename: cannot find the library \`$lib'" 1>&2 - exit 1 - fi - - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 - fi - - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$lib" && ladir="." - - dlname= - dlopen= - dlpreopen= - libdir= - library_names= - old_library= - # If the library was installed with an old release of libtool, - # it will not redefine variables installed, or shouldnotlink - installed=yes - shouldnotlink=no - - # Read the .la file - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && dlfiles="$dlfiles $dlopen" - test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" - fi - - if test "$pass" = conv; then - # Only check for convenience libraries - deplibs="$lib $deplibs" - if test -z "$libdir"; then - if test -z "$old_library"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit 1 - fi - # It is a libtool convenience library, so add in its objects. - convenience="$convenience $ladir/$objdir/$old_library" - old_convenience="$old_convenience $ladir/$objdir/$old_library" - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done - elif test "$linkmode" != prog && test "$linkmode" != lib; then - $echo "$modename: \`$lib' is not a convenience library" 1>&2 - exit 1 - fi - continue - fi # $pass = conv - - - # Get the name of the library we link against. - linklib= - for l in $old_library $library_names; do - linklib="$l" - done - if test -z "$linklib"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit 1 - fi - - # This library was specified with -dlopen. - if test "$pass" = dlopen; then - if test -z "$libdir"; then - $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 - exit 1 - fi - if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. We also need to preload any - # dependent libraries so libltdl's deplib preloader doesn't - # bomb out in the load deplibs phase. - dlprefiles="$dlprefiles $lib $dependency_libs" - else - newdlfiles="$newdlfiles $lib" - fi - continue - fi # $pass = dlopen - - # We need an absolute path. - case $ladir in - [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; - *) - abs_ladir=`cd "$ladir" && pwd` - if test -z "$abs_ladir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 - $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 - abs_ladir="$ladir" - fi - ;; - esac - laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - - # Find the relevant object directory and library name. - if test "X$installed" = Xyes; then - if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - $echo "$modename: warning: library \`$lib' was moved." 1>&2 - dir="$ladir" - absdir="$abs_ladir" - libdir="$abs_ladir" - else - dir="$libdir" - absdir="$libdir" - fi - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - fi # $installed = yes - name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - - # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then - if test -z "$libdir"; then - $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 - exit 1 - fi - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - newdlprefiles="$newdlprefiles $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - newdlprefiles="$newdlprefiles $dir/$dlname" - else - newdlprefiles="$newdlprefiles $dir/$linklib" - fi - fi # $pass = dlpreopen - - if test -z "$libdir"; then - # Link the convenience library - if test "$linkmode" = lib; then - deplibs="$dir/$old_library $deplibs" - elif test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$dir/$old_library $compile_deplibs" - finalize_deplibs="$dir/$old_library $finalize_deplibs" - else - deplibs="$lib $deplibs" # used for prog,scan pass - fi - continue - fi - - - if test "$linkmode" = prog && test "$pass" != link; then - newlib_search_path="$newlib_search_path $ladir" - deplibs="$lib $deplibs" - - linkalldeplibs=no - if test "$link_all_deplibs" != no || test -z "$library_names" || - test "$build_libtool_libs" = no; then - linkalldeplibs=yes - fi - - tmp_libs= - for deplib in $dependency_libs; do - case $deplib in - -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test - esac - # Need to link against all dependency_libs? - if test "$linkalldeplibs" = yes; then - deplibs="$deplib $deplibs" - else - # Need to hardcode shared library paths - # or/and link against static libraries - newdependency_libs="$deplib $newdependency_libs" - fi - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done # for deplib - continue - fi # $linkmode = prog... - - if test "$linkmode,$pass" = "prog,link"; then - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - # We need to hardcode the library path - if test -n "$shlibpath_var"; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *" $absdir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; - esac - fi - - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi # $linkmode,$pass = prog,link... - - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - fi - - link_static=no # Whether the deplib will be linked statically - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - if test "$installed" = no; then - notinst_deplibs="$notinst_deplibs $lib" - need_relink=yes - fi - # This is a shared library - - # Warn about portability, can't link against -module's on some systems (darwin) - if test "$shouldnotlink" = yes && test "$pass" = link ; then - $echo - if test "$linkmode" = prog; then - $echo "*** Warning: Linking the executable $output against the loadable module" - else - $echo "*** Warning: Linking the shared library $output against the loadable module" - fi - $echo "*** $linklib is not portable!" - fi - if test "$linkmode" = lib && - test "$hardcode_into_libs" = yes; then - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi - - if test -n "$old_archive_from_expsyms_cmds"; then - # figure out the soname - set dummy $library_names - realname="$2" - shift; shift - libname=`eval \\$echo \"$libname_spec\"` - # use dlname if we got it. it's perfectly good, no? - if test -n "$dlname"; then - soname="$dlname" - elif test -n "$soname_spec"; then - # bleh windows - case $host in - *cygwin* | mingw*) - major=`expr $current - $age` - versuffix="-$major" - ;; - esac - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - # Make a new name for the extract_expsyms_cmds to use - soroot="$soname" - soname=`$echo $soroot | ${SED} -e 's/^.*\///'` - newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" - - # If the library has no export list, then create one now - if test -f "$output_objdir/$soname-def"; then : - else - $show "extracting exported symbol list from \`$soname'" - save_ifs="$IFS"; IFS='~' - eval cmds=\"$extract_expsyms_cmds\" - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Create $newlib - if test -f "$output_objdir/$newlib"; then :; else - $show "generating import library for \`$soname'" - save_ifs="$IFS"; IFS='~' - eval cmds=\"$old_archive_from_expsyms_cmds\" - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - # make sure the library variables are pointing to the new library - dir=$output_objdir - linklib=$newlib - fi # test -n "$old_archive_from_expsyms_cmds" - - if test "$linkmode" = prog || test "$mode" != relink; then - add_shlibpath= - add_dir= - add= - lib_linked=yes - case $hardcode_action in - immediate | unsupported) - if test "$hardcode_direct" = no; then - add="$dir/$linklib" - case $host in - *-*-sco3.2v5* ) add_dir="-L$dir" ;; - *-*-darwin* ) - # if the lib is a module then we can not link against it, someone - # is ignoring the new warnings I added - if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then - $echo "** Warning, lib $linklib is a module, not a shared library" - if test -z "$old_library" ; then - $echo - $echo "** And there doesn't seem to be a static archive available" - $echo "** The link will probably fail, sorry" - else - add="$dir/$old_library" - fi - fi - esac - elif test "$hardcode_minus_L" = no; then - case $host in - *-*-sunos*) add_shlibpath="$dir" ;; - esac - add_dir="-L$dir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = no; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - relink) - if test "$hardcode_direct" = yes; then - add="$dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$dir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case "$libdir" in - [\\/]*) - add_dir="-L$inst_prefix_dir$libdir $add_dir" - ;; - esac - fi - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - *) lib_linked=no ;; - esac - - if test "$lib_linked" != yes; then - $echo "$modename: configuration error: unsupported hardcode properties" - exit 1 - fi - - if test -n "$add_shlibpath"; then - case :$compile_shlibpath: in - *":$add_shlibpath:"*) ;; - *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; - esac - fi - if test "$linkmode" = prog; then - test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" - test -n "$add" && compile_deplibs="$add $compile_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - if test "$hardcode_direct" != yes && \ - test "$hardcode_minus_L" != yes && \ - test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - fi - fi - fi - - if test "$linkmode" = prog || test "$mode" = relink; then - add_shlibpath= - add_dir= - add= - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes; then - add="$libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$libdir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - add="-l$name" - elif test "$hardcode_automatic" = yes; then - if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then - add="$inst_prefix_dir$libdir/$linklib" - else - add="$libdir/$linklib" - fi - else - # We cannot seem to hardcode it, guess we'll fake it. - add_dir="-L$libdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case "$libdir" in - [\\/]*) - add_dir="-L$inst_prefix_dir$libdir $add_dir" - ;; - esac - fi - add="-l$name" - fi - - if test "$linkmode" = prog; then - test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" - test -n "$add" && finalize_deplibs="$add $finalize_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - fi - fi - elif test "$linkmode" = prog; then - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_deplibs="$dir/$linklib $compile_deplibs" - finalize_deplibs="$dir/$linklib $finalize_deplibs" - else - compile_deplibs="-l$name -L$dir $compile_deplibs" - finalize_deplibs="-l$name -L$dir $finalize_deplibs" - fi - elif test "$build_libtool_libs" = yes; then - # Not a shared library - if test "$deplibs_check_method" != pass_all; then - # We're trying link a shared library against a static one - # but the system doesn't support it. - - # Just print a warning and add the library to dependency_libs so - # that the program can be linked against the static library. - $echo - $echo "*** Warning: This system can not link to static lib archive $lib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have." - if test "$module" = yes; then - $echo "*** But as you try to build a module library, libtool will still create " - $echo "*** a static module, that should work as long as the dlopening application" - $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." - if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - else - convenience="$convenience $dir/$old_library" - old_convenience="$old_convenience $dir/$old_library" - deplibs="$dir/$old_library $deplibs" - link_static=yes - fi - fi # link shared/static library? - - if test "$linkmode" = lib; then - if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || - test "$link_static" = yes; }; then - # Extract -R from dependency_libs - temp_deplibs= - for libdir in $dependency_libs; do - case $libdir in - -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` - case " $xrpath " in - *" $temp_xrpath "*) ;; - *) xrpath="$xrpath $temp_xrpath";; - esac;; - *) temp_deplibs="$temp_deplibs $libdir";; - esac - done - dependency_libs="$temp_deplibs" - fi - - newlib_search_path="$newlib_search_path $absdir" - # Link against this library - test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" - # ... and its dependency_libs - tmp_libs= - for deplib in $dependency_libs; do - newdependency_libs="$deplib $newdependency_libs" - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done - - if test "$link_all_deplibs" != no; then - # Add the search paths of all dependency libraries - for deplib in $dependency_libs; do - case $deplib in - -L*) path="$deplib" ;; - *.la) - dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$deplib" && dir="." - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 - absdir="$dir" - fi - ;; - esac - if grep "^installed=no" $deplib > /dev/null; then - path="$absdir/$objdir" - else - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - if test -z "$libdir"; then - $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit 1 - fi - if test "$absdir" != "$libdir"; then - $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 - fi - path="$absdir" - fi - depdepl= - case $host in - *-*-darwin*) - # we do not want to link against static libs, but need to link against shared - eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` - if test -n "$deplibrary_names" ; then - for tmp in $deplibrary_names ; do - depdepl=$tmp - done - if test -f "$path/$depdepl" ; then - depdepl="$path/$depdepl" - fi - newlib_search_path="$newlib_search_path $path" - path="" - fi - ;; - *) - path="-L$path" - ;; - esac - - ;; - -l*) - case $host in - *-*-darwin*) - # Again, we only want to link against shared libraries - eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` - for tmp in $newlib_search_path ; do - if test -f "$tmp/lib$tmp_libs.dylib" ; then - eval depdepl="$tmp/lib$tmp_libs.dylib" - break - fi - done - path="" - ;; - *) continue ;; - esac - ;; - *) continue ;; - esac - case " $deplibs " in - *" $depdepl "*) ;; - *) deplibs="$deplibs $depdepl" ;; - esac - case " $deplibs " in - *" $path "*) ;; - *) deplibs="$deplibs $path" ;; - esac - done - fi # link_all_deplibs != no - fi # linkmode = lib - done # for deplib in $libs - dependency_libs="$newdependency_libs" - if test "$pass" = dlpreopen; then - # Link the dlpreopened libraries before other libraries - for deplib in $save_deplibs; do - deplibs="$deplib $deplibs" - done - fi - if test "$pass" != dlopen; then - if test "$pass" != conv; then - # Make sure lib_search_path contains only unique directories. - lib_search_path= - for dir in $newlib_search_path; do - case "$lib_search_path " in - *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir" ;; - esac - done - newlib_search_path= - fi - - if test "$linkmode,$pass" != "prog,link"; then - vars="deplibs" - else - vars="compile_deplibs finalize_deplibs" - fi - for var in $vars dependency_libs; do - # Add libraries to $var in reverse order - eval tmp_libs=\"\$$var\" - new_libs= - for deplib in $tmp_libs; do - # FIXME: Pedantically, this is the right thing to do, so - # that some nasty dependency loop isn't accidentally - # broken: - #new_libs="$deplib $new_libs" - # Pragmatically, this seems to cause very few problems in - # practice: - case $deplib in - -L*) new_libs="$deplib $new_libs" ;; - -R*) ;; - *) - # And here is the reason: when a library appears more - # than once as an explicit dependence of a library, or - # is implicitly linked in more than once by the - # compiler, it is considered special, and multiple - # occurrences thereof are not removed. Compare this - # with having the same library being listed as a - # dependency of multiple other libraries: in this case, - # we know (pedantically, we assume) the library does not - # need to be listed more than once, so we keep only the - # last copy. This is not always right, but it is rare - # enough that we require users that really mean to play - # such unportable linking tricks to link the library - # using -Wl,-lname, so that libtool does not consider it - # for duplicate removal. - case " $specialdeplibs " in - *" $deplib "*) new_libs="$deplib $new_libs" ;; - *) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$deplib $new_libs" ;; - esac - ;; - esac - ;; - esac - done - tmp_libs= - for deplib in $new_libs; do - case $deplib in - -L*) - case " $tmp_libs " in - *" $deplib "*) ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - done - eval $var=\"$tmp_libs\" - done # for var - fi - # Last step: remove runtime libs from dependency_libs (they stay in deplibs) - tmp_libs= - for i in $dependency_libs ; do - case " $predeps $postdeps $compiler_lib_search_path " in - *" $i "*) - i="" - ;; - esac - if test -n "$i" ; then - tmp_libs="$tmp_libs $i" - fi - done - dependency_libs=$tmp_libs - done # for pass - if test "$linkmode" = prog; then - dlfiles="$newdlfiles" - dlprefiles="$newdlprefiles" - fi - - case $linkmode in - oldlib) - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 - fi - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 - fi - - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 - fi - - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 - fi - - # Now set the variables for building old libraries. - build_libtool_libs=no - oldlibs="$output" - objs="$objs$old_deplibs" - ;; - - lib) - # Make sure we only generate libraries of the form `libNAME.la'. - case $outputname in - lib*) - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - eval shared_ext=\"$shrext\" - eval libname=\"$libname_spec\" - ;; - *) - if test "$module" = no; then - $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - if test "$need_lib_prefix" != no; then - # Add the "lib" prefix for modules if required - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - eval shared_ext=\"$shrext\" - eval libname=\"$libname_spec\" - else - libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - fi - ;; - esac - - if test -n "$objs"; then - if test "$deplibs_check_method" != pass_all; then - $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 - exit 1 - else - $echo - $echo "*** Warning: Linking the shared library $output against the non-libtool" - $echo "*** objects $objs is not portable!" - libobjs="$libobjs $objs" - fi - fi - - if test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 - fi - - set dummy $rpath - if test "$#" -gt 2; then - $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 - fi - install_libdir="$2" - - oldlibs= - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. - # Some compilers have problems with a `.al' extension so - # convenience libraries should have the same extension an - # archive normally would. - oldlibs="$output_objdir/$libname.$libext $oldlibs" - build_libtool_libs=convenience - build_old_libs=yes - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 - fi - else - - # Parse the version information argument. - save_ifs="$IFS"; IFS=':' - set dummy $vinfo 0 0 0 - IFS="$save_ifs" - - if test -n "$8"; then - $echo "$modename: too many parameters to \`-version-info'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # convert absolute version numbers to libtool ages - # this retains compatibility with .la files and attempts - # to make the code below a bit more comprehensible - - case $vinfo_number in - yes) - number_major="$2" - number_minor="$3" - number_revision="$4" - # - # There are really only two kinds -- those that - # use the current revision as the major version - # and those that subtract age and use age as - # a minor version. But, then there is irix - # which has an extra 1 added just for fun - # - case $version_type in - darwin|linux|osf|windows) - current=`expr $number_major + $number_minor` - age="$number_minor" - revision="$number_revision" - ;; - freebsd-aout|freebsd-elf|sunos) - current="$number_major" - revision="$number_minor" - age="0" - ;; - irix|nonstopux) - current=`expr $number_major + $number_minor - 1` - age="$number_minor" - revision="$number_minor" - ;; - esac - ;; - no) - current="$2" - revision="$3" - age="$4" - ;; - esac - - # Check that each of the things are valid numbers. - case $current in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; - *) - $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - case $revision in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; - *) - $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - case $age in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; - *) - $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - if test "$age" -gt "$current"; then - $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - fi - - # Calculate the version variables. - major= - versuffix= - verstring= - case $version_type in - none) ;; - - darwin) - # Like Linux, but with the current version available in - # verstring for coding it into the library header - major=.`expr $current - $age` - versuffix="$major.$age.$revision" - # Darwin ld doesn't like 0 for these options... - minor_current=`expr $current + 1` - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" - ;; - - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; - - freebsd-elf) - major=".$current" - versuffix=".$current"; - ;; - - irix | nonstopux) - major=`expr $current - $age + 1` - - case $version_type in - nonstopux) verstring_prefix=nonstopux ;; - *) verstring_prefix=sgi ;; - esac - verstring="$verstring_prefix$major.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$revision - while test "$loop" -ne 0; do - iface=`expr $revision - $loop` - loop=`expr $loop - 1` - verstring="$verstring_prefix$major.$iface:$verstring" - done - - # Before this point, $major must not contain `.'. - major=.$major - versuffix="$major.$revision" - ;; - - linux) - major=.`expr $current - $age` - versuffix="$major.$age.$revision" - ;; - - osf) - major=.`expr $current - $age` - versuffix=".$current.$age.$revision" - verstring="$current.$age.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$age - while test "$loop" -ne 0; do - iface=`expr $current - $loop` - loop=`expr $loop - 1` - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - verstring="$verstring:${current}.0" - ;; - - sunos) - major=".$current" - versuffix=".$current.$revision" - ;; - - windows) - # Use '-' rather than '.', since we only want one - # extension on DOS 8.3 filesystems. - major=`expr $current - $age` - versuffix="-$major" - ;; - - *) - $echo "$modename: unknown library version type \`$version_type'" 1>&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 - ;; - esac - - # Clear the version info if we defaulted, and they specified a release. - if test -z "$vinfo" && test -n "$release"; then - major= - case $version_type in - darwin) - # we can't check for "0.0" in archive_cmds due to quoting - # problems, so we reset it completely - verstring= - ;; - *) - verstring="0.0" - ;; - esac - if test "$need_version" = no; then - versuffix= - else - versuffix=".0.0" - fi - fi - - # Remove version info from name if versioning should be avoided - if test "$avoid_version" = yes && test "$need_version" = no; then - major= - versuffix= - verstring="" - fi - - # Check to see if the archive will have undefined symbols. - if test "$allow_undefined" = yes; then - if test "$allow_undefined_flag" = unsupported; then - $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - fi - - if test "$mode" != relink; then - # Remove our outputs, but don't remove object files since they - # may have been created when compiling PIC objects. - removelist= - tempremovelist=`$echo "$output_objdir/*"` - for p in $tempremovelist; do - case $p in - *.$objext) - ;; - $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) - removelist="$removelist $p" - ;; - *) ;; - esac - done - if test -n "$removelist"; then - $show "${rm}r $removelist" - $run ${rm}r $removelist - fi - fi - - # Now set the variables for building old libraries. - if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - oldlibs="$oldlibs $output_objdir/$libname.$libext" - - # Transform .lo files to .o files. - oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` - fi - - # Eliminate all temporary directories. - for path in $notinst_path; do - lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` - deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` - dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` - done - - if test -n "$xrpath"; then - # If the user specified any rpath flags, then add them. - temp_xrpath= - for libdir in $xrpath; do - temp_xrpath="$temp_xrpath -R$libdir" - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then - dependency_libs="$temp_xrpath $dependency_libs" - fi - fi - - # Make sure dlfiles contains only unique files that won't be dlpreopened - old_dlfiles="$dlfiles" - dlfiles= - for lib in $old_dlfiles; do - case " $dlprefiles $dlfiles " in - *" $lib "*) ;; - *) dlfiles="$dlfiles $lib" ;; - esac - done - - # Make sure dlprefiles contains only unique files - old_dlprefiles="$dlprefiles" - dlprefiles= - for lib in $old_dlprefiles; do - case "$dlprefiles " in - *" $lib "*) ;; - *) dlprefiles="$dlprefiles $lib" ;; - esac - done - - if test "$build_libtool_libs" = yes; then - if test -n "$rpath"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) - # these systems don't actually have a c library (as such)! - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C library is in the System framework - deplibs="$deplibs -framework System" - ;; - *-*-netbsd*) - # Don't link with libc until the a.out ld.so is fixed. - ;; - *-*-openbsd* | *-*-freebsd*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *) - # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then - deplibs="$deplibs -lc" - fi - ;; - esac - fi - - # Transform deplibs into only deplibs that can be linked in shared. - name_save=$name - libname_save=$libname - release_save=$release - versuffix_save=$versuffix - major_save=$major - # I'm not sure if I'm treating the release correctly. I think - # release should show up in the -l (ie -lgmp5) so we don't want to - # add it in twice. Is that correct? - release="" - versuffix="" - major="" - newdeplibs= - droppeddeps=no - case $deplibs_check_method in - pass_all) - # Don't check for shared/static. Everything works. - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behavior. - newdeplibs=$deplibs - ;; - test_compile) - # This code stresses the "libraries are programs" paradigm to its - # limits. Maybe even breaks it. We compile a program, linking it - # against the deplibs as a proxy for the library. Then we can check - # whether they linked in statically or dynamically with ldd. - $rm conftest.c - cat > conftest.c </dev/null` - for potent_lib in $potential_libs; do - # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null \ - | grep " -> " >/dev/null; then - continue - fi - # The statement above tries to avoid entering an - # endless loop below, in case of cyclic links. - # We might still enter an endless loop, since a link - # loop can be closed while we follow links, - # but so what? - potlib="$potent_lib" - while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` - case $potliblink in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ - | ${SED} 10q \ - | $EGREP "$file_magic_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for file magic test)" - else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a file magic. Last file checked: $potlib" - fi - fi - else - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi - done # Gone through all deplibs. - ;; - match_pattern*) - set dummy $deplibs_check_method - match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` - for a_deplib in $deplibs; do - name="`expr $a_deplib : '-l\(.*\)'`" - # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check above in file_magic test - if eval $echo \"$potent_lib\" 2>/dev/null \ - | ${SED} 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for regex pattern test)" - else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a regex pattern. Last file checked: $potlib" - fi - fi - else - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi - done # Gone through all deplibs. - ;; - none | unknown | *) - newdeplibs="" - tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ - -e 's/ -[LR][^ ]*//g'` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - for i in $predeps $postdeps ; do - # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` - done - fi - if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ - | grep . >/dev/null; then - $echo - if test "X$deplibs_check_method" = "Xnone"; then - $echo "*** Warning: inter-library dependencies are not supported in this platform." - else - $echo "*** Warning: inter-library dependencies are not known to be supported." - fi - $echo "*** All declared inter-library dependencies are being dropped." - droppeddeps=yes - fi - ;; - esac - versuffix=$versuffix_save - major=$major_save - release=$release_save - libname=$libname_save - name=$name_save - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` - ;; - esac - - if test "$droppeddeps" = yes; then - if test "$module" = yes; then - $echo - $echo "*** Warning: libtool could not satisfy all declared inter-library" - $echo "*** dependencies of module $libname. Therefore, libtool will create" - $echo "*** a static module, that should work as long as the dlopening" - $echo "*** application is linked with the -dlopen flag." - if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - else - $echo "*** The inter-library dependencies that have been dropped here will be" - $echo "*** automatically added whenever a program is linked with this library" - $echo "*** or is declared to -dlopen it." - - if test "$allow_undefined" = no; then - $echo - $echo "*** Since this library must not contain undefined symbols," - $echo "*** because either the platform does not support them or" - $echo "*** it was explicitly requested with -no-undefined," - $echo "*** libtool will only create a static version of it." - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - fi - fi - # Done checking deplibs! - deplibs=$newdeplibs - fi - - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - - # Test again, we may have decided not to build it any more - if test "$build_libtool_libs" = yes; then - if test "$hardcode_into_libs" = yes; then - # Hardcode the library paths - hardcode_libdirs= - dep_rpath= - rpath="$finalize_rpath" - test "$mode" != relink && rpath="$compile_rpath$rpath" - for libdir in $rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - dep_rpath="$dep_rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - if test -n "$hardcode_libdir_flag_spec_ld"; then - eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" - else - eval dep_rpath=\"$hardcode_libdir_flag_spec\" - fi - fi - if test -n "$runpath_var" && test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" - fi - test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" - fi - - shlibpath="$finalize_shlibpath" - test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" - if test -n "$shlibpath"; then - eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" - fi - - # Get the real and link names of the library. - eval shared_ext=\"$shrext\" - eval library_names=\"$library_names_spec\" - set dummy $library_names - realname="$2" - shift; shift - - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - if test -z "$dlname"; then - dlname=$soname - fi - - lib="$output_objdir/$realname" - for link - do - linknames="$linknames $link" - done - - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols - eval cmds=\"$export_symbols_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - if len=`expr "X$cmd" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - $show "$cmd" - $run eval "$cmd" || exit $? - skipped_export=false - else - # The command line is too long to execute in one step. - $show "using reloadable object file for export list..." - skipped_export=: - fi - done - IFS="$save_ifs" - if test -n "$export_symbols_regex"; then - $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" - $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - $show "$mv \"${export_symbols}T\" \"$export_symbols\"" - $run eval '$mv "${export_symbols}T" "$export_symbols"' - fi - fi - fi - - if test -n "$export_symbols" && test -n "$include_expsyms"; then - $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' - fi - - tmp_deplibs= - for test_deplib in $deplibs; do - case " $convenience " in - *" $test_deplib "*) ;; - *) - tmp_deplibs="$tmp_deplibs $test_deplib" - ;; - esac - done - deplibs="$tmp_deplibs" - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - for xlib in $convenience; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done - fi - fi - - if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then - eval flag=\"$thread_safe_flag_spec\" - linker_flags="$linker_flags $flag" - fi - - # Make a backup of the uninstalled library when relinking - if test "$mode" = relink; then - $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? - fi - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - eval cmds=\"$module_expsym_cmds\" - else - eval cmds=\"$module_cmds\" - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval cmds=\"$archive_expsym_cmds\" - else - eval cmds=\"$archive_cmds\" - fi - fi - - if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - : - else - # The command line is too long to link in one step, link piecewise. - $echo "creating reloadable object files..." - - # Save the value of $output and $libobjs because we want to - # use them later. If we have whole_archive_flag_spec, we - # want to use save_libobjs as it was before - # whole_archive_flag_spec was expanded, because we can't - # assume the linker understands whole_archive_flag_spec. - # This may have to be revisited, in case too many - # convenience libraries get linked in and end up exceeding - # the spec. - if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - fi - save_output=$output - - # Clear the reloadable object creation command queue and - # initialize k to one. - test_cmds= - concat_cmds= - objlist= - delfiles= - last_robj= - k=1 - output=$output_objdir/$save_output-${k}.$objext - # Loop over the list of objects to be linked. - for obj in $save_libobjs - do - eval test_cmds=\"$reload_cmds $objlist $last_robj\" - if test "X$objlist" = X || - { len=`expr "X$test_cmds" : ".*"` && - test "$len" -le "$max_cmd_len"; }; then - objlist="$objlist $obj" - else - # The command $test_cmds is almost too long, add a - # command to the queue. - if test "$k" -eq 1 ; then - # The first file doesn't have a previous command to add. - eval concat_cmds=\"$reload_cmds $objlist $last_robj\" - else - # All subsequent reloadable object files will link in - # the last one created. - eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" - fi - last_robj=$output_objdir/$save_output-${k}.$objext - k=`expr $k + 1` - output=$output_objdir/$save_output-${k}.$objext - objlist=$obj - len=1 - fi - done - # Handle the remaining objects by creating one last - # reloadable object file. All subsequent reloadable object - # files will link in the last one created. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" - - if ${skipped_export-false}; then - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols - libobjs=$output - # Append the command to create the export file. - eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" - fi - - # Set up a command to remove the reloadale object files - # after they are used. - i=0 - while test "$i" -lt "$k" - do - i=`expr $i + 1` - delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" - done - - $echo "creating a temporary reloadable object file: $output" - - # Loop through the commands generated above and execute them. - save_ifs="$IFS"; IFS='~' - for cmd in $concat_cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - libobjs=$output - # Restore the value of output. - output=$save_output - - if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - fi - # Expand the library linking commands again to reset the - # value of $libobjs for piecewise linking. - - # Do each of the archive commands. - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval cmds=\"$archive_expsym_cmds\" - else - eval cmds=\"$archive_cmds\" - fi - - # Append the command to remove the reloadable object files - # to the just-reset $cmds. - eval cmds=\"\$cmds~$rm $delfiles\" - fi - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? - exit 0 - fi - - # Create links to the real library. - for linkname in $linknames; do - if test "$realname" != "$linkname"; then - $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" - $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? - fi - done - - # If -module or -export-dynamic was specified, set the dlname. - if test "$module" = yes || test "$export_dynamic" = yes; then - # On all known operating systems, these are identical. - dlname="$soname" - fi - fi - ;; - - obj) - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 - fi - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 - fi - - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 - fi - - case $output in - *.lo) - if test -n "$objs$old_deplibs"; then - $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 - exit 1 - fi - libobj="$output" - obj=`$echo "X$output" | $Xsed -e "$lo2o"` - ;; - *) - libobj= - obj="$output" - ;; - esac - - # Delete the old objects. - $run $rm $obj $libobj - - # Objects from convenience libraries. This assumes - # single-version convenience libraries. Whenever we create - # different ones for PIC/non-PIC, this we'll have to duplicate - # the extraction. - reload_conv_objs= - gentop= - # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${obj}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - for xlib in $convenience; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done - fi - fi - - # Create the old-style object. - reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test - - output="$obj" - eval cmds=\"$reload_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - # Exit if we aren't doing a library object file. - if test -z "$libobj"; then - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - exit 0 - fi - - if test "$build_libtool_libs" != yes; then - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - # Create an invalid libtool object if no PIC, so that we don't - # accidentally link it into a program. - # $show "echo timestamp > $libobj" - # $run eval "echo timestamp > $libobj" || exit $? - exit 0 - fi - - if test -n "$pic_flag" || test "$pic_mode" != default; then - # Only do commands if we really have different PIC objects. - reload_objs="$libobjs $reload_conv_objs" - output="$libobj" - eval cmds=\"$reload_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - exit 0 - ;; - - prog) - case $host in - *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; - esac - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 - fi - - if test "$preload" = yes; then - if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && - test "$dlopen_self_static" = unknown; then - $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." - fi - fi - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` - finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` - ;; - esac - - case $host in - *darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - if test "$tagname" = CXX ; then - compile_command="$compile_command ${wl}-bind_at_load" - finalize_command="$finalize_command ${wl}-bind_at_load" - fi - ;; - esac - - compile_command="$compile_command $compile_deplibs" - finalize_command="$finalize_command $finalize_deplibs" - - if test -n "$rpath$xrpath"; then - # If the user specified any rpath flags, then add them. - for libdir in $rpath $xrpath; do - # This is the magic to use -rpath. - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - fi - - # Now hardcode the library paths - rpath= - hardcode_libdirs= - for libdir in $compile_rpath $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - case :$dllsearchpath: in - *":$libdir:"*) ;; - *) dllsearchpath="$dllsearchpath:$libdir";; - esac - ;; - esac - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - compile_rpath="$rpath" - - rpath= - hardcode_libdirs= - for libdir in $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$finalize_perm_rpath " in - *" $libdir "*) ;; - *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - finalize_rpath="$rpath" - - if test -n "$libobjs" && test "$build_old_libs" = yes; then - # Transform all the library objects into standard objects. - compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - fi - - dlsyms= - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - if test -n "$NM" && test -n "$global_symbol_pipe"; then - dlsyms="${outputname}S.c" - else - $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 - fi - fi - - if test -n "$dlsyms"; then - case $dlsyms in - "") ;; - *.c) - # Discover the nlist of each of the dlfiles. - nlist="$output_objdir/${outputname}.nm" - - $show "$rm $nlist ${nlist}S ${nlist}T" - $run $rm "$nlist" "${nlist}S" "${nlist}T" - - # Parse the name list into a source file. - $show "creating $output_objdir/$dlsyms" - - test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ -/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ -/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ - -#ifdef __cplusplus -extern \"C\" { -#endif - -/* Prevent the only kind of declaration conflicts we can make. */ -#define lt_preloaded_symbols some_other_symbol - -/* External symbol declarations for the compiler. */\ -" - - if test "$dlself" = yes; then - $show "generating symbol list for \`$output'" - - test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" - - # Add our own program objects to the symbol list. - progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - for arg in $progfiles; do - $show "extracting global C symbols from \`$arg'" - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - if test -n "$exclude_expsyms"; then - $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - if test -n "$export_symbols_regex"; then - $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - export_symbols="$output_objdir/$output.exp" - $run $rm $export_symbols - $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - else - $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' - $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' - $run eval 'mv "$nlist"T "$nlist"' - fi - fi - - for arg in $dlprefiles; do - $show "extracting global C symbols from \`$arg'" - name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` - $run eval '$echo ": $name " >> "$nlist"' - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - if test -z "$run"; then - # Make sure we have at least an empty file. - test -f "$nlist" || : > "$nlist" - - if test -n "$exclude_expsyms"; then - $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T - $mv "$nlist"T "$nlist" - fi - - # Try sorting and uniquifying the output. - if grep -v "^: " < "$nlist" | - if sort -k 3 /dev/null 2>&1; then - sort -k 3 - else - sort +2 - fi | - uniq > "$nlist"S; then - : - else - grep -v "^: " < "$nlist" > "$nlist"S - fi - - if test -f "$nlist"S; then - eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' - else - $echo '/* NONE */' >> "$output_objdir/$dlsyms" - fi - - $echo >> "$output_objdir/$dlsyms" "\ - -#undef lt_preloaded_symbols - -#if defined (__STDC__) && __STDC__ -# define lt_ptr void * -#else -# define lt_ptr char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr address; -} -lt_preloaded_symbols[] = -{\ -" - - eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" - - $echo >> "$output_objdir/$dlsyms" "\ - {0, (lt_ptr) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif\ -" - fi - - pic_flag_for_symtable= - case $host in - # compiling the symbol table file with pic_flag works around - # a FreeBSD bug that causes programs to crash when -lm is - # linked before any other PIC object. But we must not use - # pic_flag when linking with -static. The problem exists in - # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. - *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; - esac;; - *-*-hpux*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag";; - esac - esac - - # Now compile the dynamic symbol file. - $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? - - # Clean up the generated files. - $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" - $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" - - # Transform the symbol file into the correct name. - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - ;; - *) - $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 - exit 1 - ;; - esac - else - # We keep going just in case the user didn't refer to - # lt_preloaded_symbols. The linker will fail if global_symbol_pipe - # really was required. - - # Nullify the symbol file. - compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` - fi - - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then - # Replace the output file specification. - compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - link_command="$compile_command$compile_rpath" - - # We have no uninstalled library dependencies, so finalize right now. - $show "$link_command" - $run eval "$link_command" - status=$? - - # Delete the generated files. - if test -n "$dlsyms"; then - $show "$rm $output_objdir/${outputname}S.${objext}" - $run $rm "$output_objdir/${outputname}S.${objext}" - fi - - exit $status - fi - - if test -n "$shlibpath_var"; then - # We should set the shlibpath_var - rpath= - for dir in $temp_rpath; do - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) - # Absolute path. - rpath="$rpath$dir:" - ;; - *) - # Relative path: add a thisdir entry. - rpath="$rpath\$thisdir/$dir:" - ;; - esac - done - temp_rpath="$rpath" - fi - - if test -n "$compile_shlibpath$finalize_shlibpath"; then - compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" - fi - if test -n "$finalize_shlibpath"; then - finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" - fi - - compile_var= - finalize_var= - if test -n "$runpath_var"; then - if test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - compile_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - if test -n "$finalize_perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $finalize_perm_rpath; do - rpath="$rpath$dir:" - done - finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - fi - - if test "$no_install" = yes; then - # We don't need to create a wrapper script. - link_command="$compile_var$compile_command$compile_rpath" - # Replace the output file specification. - link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - # Delete the old output file. - $run $rm $output - # Link the executable and exit - $show "$link_command" - $run eval "$link_command" || exit $? - exit 0 - fi - - if test "$hardcode_action" = relink; then - # Fast installation is not supported - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - - $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 - $echo "$modename: \`$output' will be relinked during installation" 1>&2 - else - if test "$fast_install" != no; then - link_command="$finalize_var$compile_command$finalize_rpath" - if test "$fast_install" = yes; then - relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` - else - # fast_install is set to needless - relink_command= - fi - else - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - fi - fi - - # Replace the output file specification. - link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` - - # Delete the old output files. - $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname - - $show "$link_command" - $run eval "$link_command" || exit $? - - # Now create the wrapper script. - $show "creating $output" - - # Quote the relink command for shipping. - if test -n "$relink_command"; then - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` - relink_command="$var=\"$var_value\"; export $var; $relink_command" - fi - done - relink_command="(cd `pwd`; $relink_command)" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - fi - - # Quote $echo for shipping. - if test "X$echo" = "X$SHELL $0 --fallback-echo"; then - case $0 in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; - *) qecho="$SHELL `pwd`/$0 --fallback-echo";; - esac - qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` - else - qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` - fi - - # Only actually do things if our run command is non-null. - if test -z "$run"; then - # win32 will think the script is a binary if it has - # a .exe suffix, so we strip it off here. - case $output in - *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; - esac - # test for cygwin because mv fails w/o .exe extensions - case $host in - *cygwin*) - exeext=.exe - outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; - *) exeext= ;; - esac - case $host in - *cygwin* | *mingw* ) - cwrappersource=`$echo ${objdir}/lt-${output}.c` - cwrapper=`$echo ${output}.exe` - $rm $cwrappersource $cwrapper - trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15 - - cat > $cwrappersource <> $cwrappersource<<"EOF" -#include -#include -#include -#include -#include -#include - -#if defined(PATH_MAX) -# define LT_PATHMAX PATH_MAX -#elif defined(MAXPATHLEN) -# define LT_PATHMAX MAXPATHLEN -#else -# define LT_PATHMAX 1024 -#endif - -#ifndef DIR_SEPARATOR -#define DIR_SEPARATOR '/' -#endif - -#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ - defined (__OS2__) -#define HAVE_DOS_BASED_FILE_SYSTEM -#ifndef DIR_SEPARATOR_2 -#define DIR_SEPARATOR_2 '\\' -#endif -#endif - -#ifndef DIR_SEPARATOR_2 -# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) -#else /* DIR_SEPARATOR_2 */ -# define IS_DIR_SEPARATOR(ch) \ - (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) -#endif /* DIR_SEPARATOR_2 */ - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -const char *program_name = NULL; - -void * xmalloc (size_t num); -char * xstrdup (const char *string); -char * basename (const char *name); -char * fnqualify(const char *path); -char * strendzap(char *str, const char *pat); -void lt_fatal (const char *message, ...); - -int -main (int argc, char *argv[]) -{ - char **newargz; - int i; - - program_name = (char *) xstrdup ((char *) basename (argv[0])); - newargz = XMALLOC(char *, argc+2); -EOF - - cat >> $cwrappersource <> $cwrappersource <<"EOF" - newargz[1] = fnqualify(argv[0]); - /* we know the script has the same name, without the .exe */ - /* so make sure newargz[1] doesn't end in .exe */ - strendzap(newargz[1],".exe"); - for (i = 1; i < argc; i++) - newargz[i+1] = xstrdup(argv[i]); - newargz[argc+1] = NULL; -EOF - - cat >> $cwrappersource <> $cwrappersource <<"EOF" -} - -void * -xmalloc (size_t num) -{ - void * p = (void *) malloc (num); - if (!p) - lt_fatal ("Memory exhausted"); - - return p; -} - -char * -xstrdup (const char *string) -{ - return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL -; -} - -char * -basename (const char *name) -{ - const char *base; - -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - /* Skip over the disk name in MSDOS pathnames. */ - if (isalpha (name[0]) && name[1] == ':') - name += 2; -#endif - - for (base = name; *name; name++) - if (IS_DIR_SEPARATOR (*name)) - base = name + 1; - return (char *) base; -} - -char * -fnqualify(const char *path) -{ - size_t size; - char *p; - char tmp[LT_PATHMAX + 1]; - - assert(path != NULL); - - /* Is it qualified already? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha (path[0]) && path[1] == ':') - return xstrdup (path); -#endif - if (IS_DIR_SEPARATOR (path[0])) - return xstrdup (path); - - /* prepend the current directory */ - /* doesn't handle '~' */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); - size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ - p = XMALLOC(char, size); - sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); - return p; -} - -char * -strendzap(char *str, const char *pat) -{ - size_t len, patlen; - - assert(str != NULL); - assert(pat != NULL); - - len = strlen(str); - patlen = strlen(pat); - - if (patlen <= len) - { - str += len - patlen; - if (strcmp(str, pat) == 0) - *str = '\0'; - } - return str; -} - -static void -lt_error_core (int exit_status, const char * mode, - const char * message, va_list ap) -{ - fprintf (stderr, "%s: %s: ", program_name, mode); - vfprintf (stderr, message, ap); - fprintf (stderr, ".\n"); - - if (exit_status >= 0) - exit (exit_status); -} - -void -lt_fatal (const char *message, ...) -{ - va_list ap; - va_start (ap, message); - lt_error_core (EXIT_FAILURE, "FATAL", message, ap); - va_end (ap); -} -EOF - # we should really use a build-platform specific compiler - # here, but OTOH, the wrappers (shell script and this C one) - # are only useful if you want to execute the "real" binary. - # Since the "real" binary is built for $host, then this - # wrapper might as well be built for $host, too. - $run $LTCC -s -o $cwrapper $cwrappersource - ;; - esac - $rm $output - trap "$rm $output; exit 1" 1 2 15 - - $echo > $output "\ -#! $SHELL - -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# The $output program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='${SED} -e 1s/^X//' -sed_quote_subst='$sed_quote_subst' - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variable: - notinst_deplibs='$notinst_deplibs' -else - # When we are sourced in execute mode, \$file and \$echo are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - echo=\"$qecho\" - file=\"\$0\" - # Make sure echo works. - if test \"X\$1\" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift - elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then - # Yippee, \$echo works! - : - else - # Restart under the correct shell, and then maybe \$echo will work. - exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} - fi - fi\ -" - $echo >> $output "\ - - # Find the directory that this script lives in. - thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` - done - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - $echo >> $output "\ - program=lt-'$outputname'$exeext - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || \\ - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" - - if test ! -d \"\$progdir\"; then - $mkdir \"\$progdir\" - else - $rm \"\$progdir/\$file\" - fi" - - $echo >> $output "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if relink_command_output=\`eval \$relink_command 2>&1\`; then : - else - $echo \"\$relink_command_output\" >&2 - $rm \"\$progdir/\$file\" - exit 1 - fi - fi - - $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $rm \"\$progdir/\$program\"; - $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $rm \"\$progdir/\$file\" - fi" - else - $echo >> $output "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - $echo >> $output "\ - - if test -f \"\$progdir/\$program\"; then" - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $echo >> $output "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` - - export $shlibpath_var -" - fi - - # fixup the dll searchpath if we need to. - if test -n "$dllsearchpath"; then - $echo >> $output "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - $echo >> $output "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2*) - $echo >> $output "\ - exec \$progdir\\\\\$program \${1+\"\$@\"} -" - ;; - - *) - $echo >> $output "\ - exec \$progdir/\$program \${1+\"\$@\"} -" - ;; - esac - $echo >> $output "\ - \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" - exit 1 - fi - else - # The program doesn't exist. - \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 - \$echo \"This script is just a wrapper for \$program.\" 1>&2 - $echo \"See the $PACKAGE documentation for more information.\" 1>&2 - exit 1 - fi -fi\ -" - chmod +x $output - fi - exit 0 - ;; - esac - - # See if we need to build an old-fashioned archive. - for oldlib in $oldlibs; do - - if test "$build_libtool_libs" = convenience; then - oldobjs="$libobjs_save" - addlibs="$convenience" - build_libtool_libs=no - else - if test "$build_libtool_libs" = module; then - oldobjs="$libobjs_save" - build_libtool_libs=no - else - oldobjs="$old_deplibs $non_pic_objects" - fi - addlibs="$old_convenience" - fi - - if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - # Add in members from convenience archives. - for xlib in $addlibs; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` - done - fi - - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - eval cmds=\"$old_archive_from_new_cmds\" - else - eval cmds=\"$old_archive_cmds\" - - if len=`expr "X$cmds" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - : - else - # the command line is too long to link in one step, link in parts - $echo "using piecewise archive linking..." - save_RANLIB=$RANLIB - RANLIB=: - objlist= - concat_cmds= - save_oldobjs=$oldobjs - # GNU ar 2.10+ was changed to match POSIX; thus no paths are - # encoded into archives. This makes 'ar r' malfunction in - # this piecewise linking case whenever conflicting object - # names appear in distinct ar calls; check, warn and compensate. - if (for obj in $save_oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 - $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 - AR_FLAGS=cq - fi - # Is there a better way of finding the last object in the list? - for obj in $save_oldobjs - do - last_oldobj=$obj - done - for obj in $save_oldobjs - do - oldobjs="$objlist $obj" - objlist="$objlist $obj" - eval test_cmds=\"$old_archive_cmds\" - if len=`expr "X$test_cmds" : ".*"` && - test "$len" -le "$max_cmd_len"; then - : - else - # the above command should be used before it gets too long - oldobjs=$objlist - if test "$obj" = "$last_oldobj" ; then - RANLIB=$save_RANLIB - fi - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" - objlist= - fi - done - RANLIB=$save_RANLIB - oldobjs=$objlist - if test "X$oldobjs" = "X" ; then - eval cmds=\"\$concat_cmds\" - else - eval cmds=\"\$concat_cmds~$old_archive_cmds\" - fi - fi - fi - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$generated"; then - $show "${rm}r$generated" - $run ${rm}r$generated - fi - - # Now create the libtool archive. - case $output in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.$libext" - $show "creating $output" - - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` - relink_command="$var=\"$var_value\"; export $var; $relink_command" - fi - done - # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - - # Only create the output if not a dry run. - if test -z "$run"; then - for installed in no yes; do - if test "$installed" = yes; then - if test -z "$install_libdir"; then - break - fi - output="$output_objdir/$outputname"i - # Replace all uninstalled libtool libraries with the installed ones - newdependency_libs= - for deplib in $dependency_libs; do - case $deplib in - *.la) - name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - if test -z "$libdir"; then - $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit 1 - fi - newdependency_libs="$newdependency_libs $libdir/$name" - ;; - *) newdependency_libs="$newdependency_libs $deplib" ;; - esac - done - dependency_libs="$newdependency_libs" - newdlfiles= - for lib in $dlfiles; do - name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - if test -z "$libdir"; then - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 - fi - newdlfiles="$newdlfiles $libdir/$name" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - if test -z "$libdir"; then - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 - fi - newdlprefiles="$newdlprefiles $libdir/$name" - done - dlprefiles="$newdlprefiles" - fi - $rm $output - # place dlname in correct position for cygwin - tdlname=$dlname - case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; - esac - $echo > $output "\ -# $outputname - a libtool library file -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='$tdlname' - -# Names of this library. -library_names='$library_names' - -# The name of the static archive. -old_library='$old_library' - -# Libraries that this one depends upon. -dependency_libs='$dependency_libs' - -# Version information for $libname. -current=$current -age=$age -revision=$revision - -# Is this an already installed library? -installed=$installed - -# Should we warn about portability when linking against -modules? -shouldnotlink=$module - -# Files to dlopen/dlpreopen -dlopen='$dlfiles' -dlpreopen='$dlprefiles' - -# Directory that this library needs to be installed in: -libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then - $echo >> $output "\ -relink_command=\"$relink_command\"" - fi - done - fi - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" - $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? - ;; - esac - exit 0 - ;; - - # libtool install mode - install) - modename="$modename: install" - - # There may be an optional sh(1) argument at the beginning of - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || - # Allow the use of GNU shtool's install command. - $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then - # Aesthetically quote it. - arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$arg " - arg="$1" - shift - else - install_prog= - arg="$nonopt" - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog$arg" - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir=no - stripme= - for arg - do - if test -n "$dest"; then - files="$files $dest" - dest="$arg" - continue - fi - - case $arg in - -d) isdir=yes ;; - -f) prev="-f" ;; - -g) prev="-g" ;; - -m) prev="-m" ;; - -o) prev="-o" ;; - -s) - stripme=" -s" - continue - ;; - -*) ;; - - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - prev= - else - dest="$arg" - continue - fi - ;; - esac - - # Aesthetically quote the argument. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog $arg" - done - - if test -z "$install_prog"; then - $echo "$modename: you must specify an install program" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - if test -n "$prev"; then - $echo "$modename: the \`$prev' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - if test -z "$files"; then - if test -z "$dest"; then - $echo "$modename: no file or destination specified" 1>&2 - else - $echo "$modename: you must specify a destination" 1>&2 - fi - $echo "$help" 1>&2 - exit 1 - fi - - # Strip any trailing slash from the destination. - dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" - destname= - else - destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` - test "X$destdir" = "X$dest" && destdir=. - destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` - - # Not a directory, so check to see that there is only one file specified. - set dummy $files - if test "$#" -gt 2; then - $echo "$modename: \`$dest' is not a directory" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - fi - case $destdir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - for file in $files; do - case $file in - *.lo) ;; - *) - $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - esac - done - ;; - esac - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - staticlibs= - future_libdirs= - current_libdirs= - for file in $files; do - - # Do each installation. - case $file in - *.$libext) - # Do the static libraries later. - staticlibs="$staticlibs $file" - ;; - - *.la) - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - library_names= - old_library= - relink_command= - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) current_libdirs="$current_libdirs $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) future_libdirs="$future_libdirs $libdir" ;; - esac - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ - test "X$dir" = "X$file/" && dir= - dir="$dir$objdir" - - if test -n "$relink_command"; then - # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` - - # Don't allow the user to place us outside of our expected - # location b/c this prevents finding dependent libraries that - # are installed to the same prefix. - # At present, this check doesn't affect windows .dll's that - # are installed into $libdir/../bin (currently, that works fine) - # but it's something to keep an eye on. - if test "$inst_prefix_dir" = "$destdir"; then - $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 - exit 1 - fi - - if test -n "$inst_prefix_dir"; then - # Stick the inst_prefix_dir data into the link command. - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` - else - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` - fi - - $echo "$modename: warning: relinking \`$file'" 1>&2 - $show "$relink_command" - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - exit 1 - fi - fi - - # See the names of the shared library. - set dummy $library_names - if test -n "$2"; then - realname="$2" - shift - shift - - srcname="$realname" - test -n "$relink_command" && srcname="$realname"T - - # Install the shared library and build the symlinks. - $show "$install_prog $dir/$srcname $destdir/$realname" - $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? - if test -n "$stripme" && test -n "$striplib"; then - $show "$striplib $destdir/$realname" - $run eval "$striplib $destdir/$realname" || exit $? - fi - - if test "$#" -gt 0; then - # Delete the old symlinks, and create new ones. - for linkname - do - if test "$linkname" != "$realname"; then - $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" - $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" - fi - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - eval cmds=\"$postinstall_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Install the pseudo-library for information purposes. - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - instname="$dir/$name"i - $show "$install_prog $instname $destdir/$name" - $run eval "$install_prog $instname $destdir/$name" || exit $? - - # Maybe install the static library, too. - test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" - ;; - - *.lo) - # Install (i.e. copy) a libtool object. - - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case $destfile in - *.lo) - staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` - ;; - *.$objext) - staticdest="$destfile" - destfile= - ;; - *) - $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - esac - - # Install the libtool object if requested. - if test -n "$destfile"; then - $show "$install_prog $file $destfile" - $run eval "$install_prog $file $destfile" || exit $? - fi - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` - - $show "$install_prog $staticobj $staticdest" - $run eval "$install_prog \$staticobj \$staticdest" || exit $? - fi - exit 0 - ;; - - *) - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # If the file is missing, and there is a .exe on the end, strip it - # because it is most likely a libtool script we actually want to - # install - stripped_ext="" - case $file in - *.exe) - if test ! -f "$file"; then - file=`$echo $file|${SED} 's,.exe$,,'` - stripped_ext=".exe" - fi - ;; - esac - - # Do a test to see if this is really a libtool program. - case $host in - *cygwin*|*mingw*) - wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` - ;; - *) - wrapper=$file - ;; - esac - if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then - notinst_deplibs= - relink_command= - - # To insure that "foo" is sourced, and not "foo.exe", - # finese the cygwin/MSYS system by explicitly sourcing "foo." - # which disallows the automatic-append-.exe behavior. - case $build in - *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; - *) wrapperdot=${wrapper} ;; - esac - # If there is no directory component, then add one. - case $file in - */* | *\\*) . ${wrapperdot} ;; - *) . ./${wrapperdot} ;; - esac - - # Check the variables that should have been set. - if test -z "$notinst_deplibs"; then - $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 - exit 1 - fi - - finalize=yes - for lib in $notinst_deplibs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - # If there is no directory component, then add one. - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - fi - libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test - if test -n "$libdir" && test ! -f "$libfile"; then - $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 - finalize=no - fi - done - - relink_command= - # To insure that "foo" is sourced, and not "foo.exe", - # finese the cygwin/MSYS system by explicitly sourcing "foo." - # which disallows the automatic-append-.exe behavior. - case $build in - *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; - *) wrapperdot=${wrapper} ;; - esac - # If there is no directory component, then add one. - case $file in - */* | *\\*) . ${wrapperdot} ;; - *) . ./${wrapperdot} ;; - esac - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - if test "$finalize" = yes && test -z "$run"; then - tmpdir="/tmp" - test -n "$TMPDIR" && tmpdir="$TMPDIR" - tmpdir="$tmpdir/libtool-$$" - if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : - else - $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 - continue - fi - file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` - - $show "$relink_command" - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - ${rm}r "$tmpdir" - continue - fi - file="$outputname" - else - $echo "$modename: warning: cannot relink \`$file'" 1>&2 - fi - else - # Install the binary that we compiled earlier. - file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - # remove .exe since cygwin /usr/bin/install will append another - # one anyways - case $install_prog,$host in - */usr/bin/install*,*cygwin*) - case $file:$destfile in - *.exe:*.exe) - # this is ok - ;; - *.exe:*) - destfile=$destfile.exe - ;; - *:*.exe) - destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` - ;; - esac - ;; - esac - $show "$install_prog$stripme $file $destfile" - $run eval "$install_prog\$stripme \$file \$destfile" || exit $? - test -n "$outputname" && ${rm}r "$tmpdir" - ;; - esac - done - - for file in $staticlibs; do - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - - $show "$install_prog $file $oldlib" - $run eval "$install_prog \$file \$oldlib" || exit $? - - if test -n "$stripme" && test -n "$striplib"; then - $show "$old_striplib $oldlib" - $run eval "$old_striplib $oldlib" || exit $? - fi - - # Do each command in the postinstall commands. - eval cmds=\"$old_postinstall_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$future_libdirs"; then - $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 - fi - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - test -n "$run" && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $0 --finish$current_libdirs' - else - exit 0 - fi - ;; - - # libtool finish mode - finish) - modename="$modename: finish" - libdirs="$nonopt" - admincmds= - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for dir - do - libdirs="$libdirs $dir" - done - - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - eval cmds=\"$finish_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || admincmds="$admincmds - $cmd" - done - IFS="$save_ifs" - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $run eval "$cmds" || admincmds="$admincmds - $cmds" - fi - done - fi - - # Exit here if they wanted silent mode. - test "$show" = : && exit 0 - - $echo "----------------------------------------------------------------------" - $echo "Libraries have been installed in:" - for libdir in $libdirs; do - $echo " $libdir" - done - $echo - $echo "If you ever happen to want to link against installed libraries" - $echo "in a given directory, LIBDIR, you must either use libtool, and" - $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - $echo "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - $echo " during execution" - fi - if test -n "$runpath_var"; then - $echo " - add LIBDIR to the \`$runpath_var' environment variable" - $echo " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - $echo " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - $echo " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - $echo - $echo "See any operating system documentation about shared libraries for" - $echo "more information, such as the ld(1) and ld.so(8) manual pages." - $echo "----------------------------------------------------------------------" - exit 0 - ;; - - # libtool execute mode - execute) - modename="$modename: execute" - - # The first argument is the command name. - cmd="$nonopt" - if test -z "$cmd"; then - $echo "$modename: you must specify a COMMAND" 1>&2 - $echo "$help" - exit 1 - fi - - # Handle -dlopen flags immediately. - for file in $execute_dlfiles; do - if test ! -f "$file"; then - $echo "$modename: \`$file' is not a file" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - dir= - case $file in - *.la) - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Read the libtool library. - dlname= - library_names= - - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" - continue - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - - if test -f "$dir/$objdir/$dlname"; then - dir="$dir/$objdir" - else - $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit 1 - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - ;; - - *) - $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 - continue - ;; - esac - - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" - - # Now add the directory to shlibpath_var. - if eval "test -z \"\$$shlibpath_var\""; then - eval "$shlibpath_var=\"\$dir\"" - else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" - fi - done - - # This variable tells wrapper scripts just to set shlibpath_var - # rather than running their programs. - libtool_execute_magic="$magic" - - # Check if any of the arguments is a wrapper script. - args= - for file - do - case $file in - -*) ;; - *) - # Do a test to see if this is really a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` - args="$args \"$file\"" - done - - if test -z "$run"; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi - - # Restore saved environment variables - if test "${save_LC_ALL+set}" = set; then - LC_ALL="$save_LC_ALL"; export LC_ALL - fi - if test "${save_LANG+set}" = set; then - LANG="$save_LANG"; export LANG - fi - - # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" - else - # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" - $echo "export $shlibpath_var" - fi - $echo "$cmd$args" - exit 0 - fi - ;; - - # libtool clean and uninstall mode - clean | uninstall) - modename="$modename: $mode" - rm="$nonopt" - files= - rmforce= - exit_status=0 - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - for arg - do - case $arg in - -f) rm="$rm $arg"; rmforce=yes ;; - -*) rm="$rm $arg" ;; - *) files="$files $arg" ;; - esac - done - - if test -z "$rm"; then - $echo "$modename: you must specify an RM program" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - rmdirs= - - origobjdir="$objdir" - for file in $files; do - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - if test "X$dir" = "X$file"; then - dir=. - objdir="$origobjdir" - else - objdir="$dir/$origobjdir" - fi - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - test "$mode" = uninstall && objdir="$dir" - - # Remember objdir for removal later, being careful to avoid duplicates - if test "$mode" = clean; then - case " $rmdirs " in - *" $objdir "*) ;; - *) rmdirs="$rmdirs $objdir" ;; - esac - fi - - # Don't error if the file doesn't exist and rm -f was used. - if (test -L "$file") >/dev/null 2>&1 \ - || (test -h "$file") >/dev/null 2>&1 \ - || test -f "$file"; then - : - elif test -d "$file"; then - exit_status=1 - continue - elif test "$rmforce" = yes; then - continue - fi - - rmfiles="$file" - - case $name in - *.la) - # Possibly a libtool archive, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - . $dir/$name - - # Delete the libtool libraries and symlinks. - for n in $library_names; do - rmfiles="$rmfiles $objdir/$n" - done - test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - - if test "$mode" = uninstall; then - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - eval cmds=\"$postuninstall_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then - exit_status=1 - fi - done - IFS="$save_ifs" - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - eval cmds=\"$old_postuninstall_cmds\" - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then - exit_status=1 - fi - done - IFS="$save_ifs" - fi - # FIXME: should reinstall the best remaining shared library. - fi - fi - ;; - - *.lo) - # Possibly a libtool object, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - - # Read the .lo file - . $dir/$name - - # Add PIC object to the list of files to remove. - if test -n "$pic_object" \ - && test "$pic_object" != none; then - rmfiles="$rmfiles $dir/$pic_object" - fi - - # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" \ - && test "$non_pic_object" != none; then - rmfiles="$rmfiles $dir/$non_pic_object" - fi - fi - ;; - - *) - if test "$mode" = clean ; then - noexename=$name - case $file in - *.exe) - file=`$echo $file|${SED} 's,.exe$,,'` - noexename=`$echo $name|${SED} 's,.exe$,,'` - # $file with .exe has already been added to rmfiles, - # add $file without .exe - rmfiles="$rmfiles $file" - ;; - esac - # Do a test to see if this is a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - relink_command= - . $dir/$noexename - - # note $name still contains .exe if it was in $file originally - # as does the version of $file that was added into $rmfiles - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" - fi - if test "X$noexename" != "X$name" ; then - rmfiles="$rmfiles $objdir/lt-${noexename}.c" - fi - fi - fi - ;; - esac - $show "$rm $rmfiles" - $run $rm $rmfiles || exit_status=1 - done - objdir="$origobjdir" - - # Try to remove the ${objdir}s in the directories where we deleted files - for dir in $rmdirs; do - if test -d "$dir"; then - $show "rmdir $dir" - $run rmdir $dir >/dev/null 2>&1 - fi - done - - exit $exit_status - ;; - - "") - $echo "$modename: you must specify a MODE" 1>&2 - $echo "$generic_help" 1>&2 - exit 1 - ;; - esac - - if test -z "$exec_cmd"; then - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$generic_help" 1>&2 - exit 1 - fi -fi # test -z "$show_help" - -if test -n "$exec_cmd"; then - eval exec $exec_cmd - exit 1 -fi - -# We need to display help for each of the modes. -case $mode in -"") $echo \ -"Usage: $modename [OPTION]... [MODE-ARG]... - -Provide generalized library-building support services. - - --config show all configuration variables - --debug enable verbose shell tracing --n, --dry-run display commands without modifying any files - --features display basic configuration information and exit - --finish same as \`--mode=finish' - --help display this help message and exit - --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] - --quiet same as \`--silent' - --silent don't print informational messages - --tag=TAG use configuration variables from tag TAG - --version print version information - -MODE must be one of the following: - - clean remove files from the build directory - compile compile a source file into a libtool object - execute automatically set library path, then run a program - finish complete the installation of libtool libraries - install install libraries or executables - link create a library or an executable - uninstall remove libraries from an installed directory - -MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for -a more detailed description of MODE. - -Report bugs to ." - exit 0 - ;; - -clean) - $echo \ -"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... - -Remove files from the build directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, object or program, all the files associated -with it are deleted. Otherwise, only FILE itself is deleted using RM." - ;; - -compile) - $echo \ -"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE - -Compile a source file into a libtool library object. - -This mode accepts the following additional options: - - -o OUTPUT-FILE set the output file name to OUTPUT-FILE - -prefer-pic try to building PIC objects only - -prefer-non-pic try to building non-PIC objects only - -static always build a \`.o' file suitable for static linking - -COMPILE-COMMAND is a command to be used in creating a \`standard' object file -from the given SOURCEFILE. - -The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." - ;; - -execute) - $echo \ -"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... - -Automatically set library path, then run a program. - -This mode accepts the following additional options: - - -dlopen FILE add the directory containing FILE to the library path - -This mode sets the library path environment variable according to \`-dlopen' -flags. - -If any of the ARGS are libtool executable wrappers, then they are translated -into their corresponding uninstalled binary, and any of their required library -directories are added to the library path. - -Then, COMMAND is executed, with ARGS as arguments." - ;; - -finish) - $echo \ -"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... - -Complete the installation of libtool libraries. - -Each LIBDIR is a directory that contains libtool libraries. - -The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." - ;; - -install) - $echo \ -"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... - -Install executables or libraries. - -INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - -link) - $echo \ -"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... - -Link object files or libraries together to form another library, or to -create an executable program. - -LINK-COMMAND is a command using the C compiler that you would use to create -a program from several object files. - -The following components of LINK-COMMAND are treated specially: - - -all-static do not do any dynamic linking at all - -avoid-version do not add a version suffix if possible - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime - -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols - -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) - -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE - -export-symbols-regex REGEX - try to export only the symbols matching REGEX - -LLIBDIR search LIBDIR for required installed libraries - -lNAME OUTPUT-FILE requires the installed library libNAME - -module build a library that can dlopened - -no-fast-install disable the fast-install mode - -no-install link a not-installable executable - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects - -release RELEASE specify package release information - -rpath LIBDIR the created library will eventually be installed in LIBDIR - -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -static do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -All other options (arguments beginning with \`-') are ignored. - -Every other argument is treated as a filename. Files ending in \`.la' are -treated as uninstalled libtool libraries, other files are standard or library -object files. - -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, -only library objects (\`.lo' files) may be specified, and \`-rpath' is -required, except when creating a convenience library. - -If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created -using \`ar' and \`ranlib', or on Windows using \`lib'. - -If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file -is created, otherwise an executable program is created." - ;; - -uninstall) - $echo \ -"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... - -Remove libraries from an installation directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." - ;; - -*) - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; -esac - -$echo -$echo "Try \`$modename --help' for more information about other modes." - -exit 0 - -# The TAGs below are defined such that we never get into a situation -# in which we disable both kinds of libraries. Given conflicting -# choices, we go for a static library, that is the most portable, -# since we can't tell whether shared libraries were disabled because -# the user asked for that or because the platform doesn't support -# them. This is particularly important on AIX, because we don't -# support having both static and shared libraries enabled at the same -# time on that platform, so we default to a shared-only configuration. -# If a disable-shared tag is given, we'll fallback to a static-only -# configuration. But we'll never go from static-only to shared-only. - -# ### BEGIN LIBTOOL TAG CONFIG: disable-shared -build_libtool_libs=no -build_old_libs=yes -# ### END LIBTOOL TAG CONFIG: disable-shared - -# ### BEGIN LIBTOOL TAG CONFIG: disable-static -build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` -# ### END LIBTOOL TAG CONFIG: disable-static - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: diff --git a/nx-X11/lib/Xft/missing b/nx-X11/lib/Xft/missing deleted file mode 100755 index fc54c64ec..000000000 --- a/nx-X11/lib/Xft/missing +++ /dev/null @@ -1,336 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. -# Originally by Fran,cois Pinard , 1996. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -run=: - -# In the cases where this matters, `missing' is being run in the -# srcdir already. -if test -f configure.ac; then - configure_ac=configure.ac -else - configure_ac=configure.in -fi - -case "$1" in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case "$1" in - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - --run try to run the given command, and emulate it if it fails - -Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c - help2man touch the output file - lex create \`lex.yy.c', if possible, from existing .c - makeinfo touch the output file - tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch]" - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing 0.4 - GNU automake" - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - - aclocal*) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`acinclude.m4' or \`${configure_ac}'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`${configure_ac}'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`acconfig.h' or \`${configure_ac}'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case "$f" in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files - ;; - - automake*) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print | - sed 's/\.am$/.in/' | - while read f; do touch "$f"; done - ;; - - autom4te) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is needed, and you do not seem to have it handy on your - system. You might have modified some files without having the - proper tools for further handling them. - You can get \`$1' as part of \`Autoconf' from any GNU - archive site." - - file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` - test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo "#! /bin/sh" - echo "# Created by GNU Automake missing as a replacement of" - echo "# $ $@" - echo "exit 0" - chmod +x $file - exit 1 - fi - ;; - - bison|yacc) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - rm -f y.tab.c y.tab.h - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if [ ! -f y.tab.h ]; then - echo >y.tab.h - fi - if [ ! -f y.tab.c ]; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex|flex) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package - in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." - rm -f lex.yy.c - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if [ ! -f lex.yy.c ]; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a dependency of a manual page. You may need the - \`Help2man' package in order for those modifications to take - effect. You can get \`Help2man' from any GNU archive site." - - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` - fi - if [ -f "$file" ]; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit 1 - fi - ;; - - makeinfo) - if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then - # We have makeinfo, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` - fi - touch $file - ;; - - tar) - shift - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - fi - - # We have already tried tar in the generic part. - # Look for gnutar/gtar before invocation to avoid ugly error - # messages. - if (gnutar --version > /dev/null 2>&1); then - gnutar "$@" && exit 0 - fi - if (gtar --version > /dev/null 2>&1); then - gtar "$@" && exit 0 - fi - firstarg="$1" - if shift; then - case "$firstarg" in - *o*) - firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - case "$firstarg" in - *h*) - firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - fi - - echo 1>&2 "\ -WARNING: I can't seem to be able to run \`tar' with the given arguments. - You may want to install GNU tar or Free paxutils, or check the - command line arguments." - exit 1 - ;; - - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and you do not seem to have it handy on your - system. You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequisites for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 - ;; -esac - -exit 0 diff --git a/nx-X11/lib/Xft/mkinstalldirs b/nx-X11/lib/Xft/mkinstalldirs deleted file mode 100755 index d2d5f21b6..000000000 --- a/nx-X11/lib/Xft/mkinstalldirs +++ /dev/null @@ -1,111 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman -# Created: 1993-05-16 -# Public domain - -errstatus=0 -dirmode="" - -usage="\ -Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." - -# process command line arguments -while test $# -gt 0 ; do - case $1 in - -h | --help | --h*) # -h for help - echo "$usage" 1>&2 - exit 0 - ;; - -m) # -m PERM arg - shift - test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } - dirmode=$1 - shift - ;; - --) # stop option processing - shift - break - ;; - -*) # unknown option - echo "$usage" 1>&2 - exit 1 - ;; - *) # first non-opt arg - break - ;; - esac -done - -for file -do - if test -d "$file"; then - shift - else - break - fi -done - -case $# in - 0) exit 0 ;; -esac - -case $dirmode in - '') - if mkdir -p -- . 2>/dev/null; then - echo "mkdir -p -- $*" - exec mkdir -p -- "$@" - fi - ;; - *) - if mkdir -m "$dirmode" -p -- . 2>/dev/null; then - echo "mkdir -m $dirmode -p -- $*" - exec mkdir -m "$dirmode" -p -- "$@" - fi - ;; -esac - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case $pathcomp in - -*) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - else - if test ! -z "$dirmode"; then - echo "chmod $dirmode $pathcomp" - lasterr="" - chmod "$dirmode" "$pathcomp" || lasterr=$? - - if test ! -z "$lasterr"; then - errstatus=$lasterr - fi - fi - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# End: -# mkinstalldirs ends here diff --git a/nx-X11/lib/Xft/xft-config.1.in b/nx-X11/lib/Xft/xft-config.1.in deleted file mode 100644 index 904c2439a..000000000 --- a/nx-X11/lib/Xft/xft-config.1.in +++ /dev/null @@ -1,120 +0,0 @@ -.\" Copyright 2005 Branden Robinson -.\" -.\" Permission is hereby granted, free of charge, to any person obtaining a copy -.\" of this document (the "Document"), to deal in the Document without -.\" restriction, including without limitation the rights to use, copy, modify, -.\" merge, publish, distribute, sublicense, and/or sell copies of the Document, -.\" and to permit persons to whom the Document 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 Document. -.\" -.\" THE DOCUMENT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -.\" THE AUTHOR(S) OR 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 DOCUMENT OR THE USE OR OTHER -.\" DEALINGS IN THE DOCUMENT. -.TH xft-config 1 "Version @VERSION@" "Xft" -.SH NAME -xft\-config \- report Xft version, compiler, linker, and/or installation \ -directory information -.SH SYNOPSIS -.B xft\-config -{ -.BR \-\-exec\-prefix [ =\fIlocal_prefix\fR ] -| -.BR \-\-prefix [ =\fIlocal_prefix\fR ] -| -.B \-\-cflags -| -.B \-\-libs -} ... -.PP -.B xft\-config \-\-version -.SH DESCRIPTION -.B xft\-config -reports information of interest to users and developers about the installed -version of the X FreeType library, -.BR Xft (3). -Depending on how it is invoked, -.B xft\-config -reports the installed version of Xft, the compiler and linker flags -that are required to successfully compile and link C (or C-compatible) code -that uses the library, and/or the directories used by the GNU Autotools to -install its files. -Note that if the system's installed version of Xft came from an OS vendor -or other third party, the actual location of its files may differ from -those reported by -.BR xft\-config . -The system adminstrator can also relocate Xft's files. -.PP -If invoked without any arguments, -.B xft\-config -will print a usage message on standard error and exit. -.SH OPTIONS -.TP -.B \-\-cflags -Report the compiler flags that are required to compile code that uses Xft -symbols. -.TP -.BR \-\-exec\-prefix [ =\fIlocal_prefix\fR ] -If specified without the parameter -.IR local_prefix , -report the file specification prefix that Xft uses for installation of -executable files. -If -.I local_prefix -is specified, it is used instead of the file specification prefix used for -installation of executable files by Xft and the value of the option -argument specified with -.BR \-\-prefix , -if any, when compile and linker flags are reported (with -.B \-\-cflags -and -.BR \-\-libs , -respectively). -.TP -.B \-\-libs -Report the linker flags that are required to link code that uses Xft -symbols. -.TP -.BR \-\-prefix [ =\fIlocal_prefix\fR ] -If specified without the parameter -.IR local_prefix , -report the file specification prefix that Xft uses for installation of -files. -If -.I local_prefix -is specified, it is used instead of the file specification prefix used for -installation of files by Xft when compile and linker flags are reported -(with -.B \-\-cflags -and -.BR \-\-libs , -respectively); also see -.BR \-\-exec\-prefix . -.TP -.B \-\-version -Report the version of the Xft library installed on the system and exit. -.SH OPERANDS -.B xft\-config -does not recognize any non-option arguments. -At least one option must be specified. -.SH "EXIT STATUS" -.TP -0 -Information was successfully reported. -.TP -1 -.B xft\-config -was invoked with invalid arguments, or no arguments at all. -.SH AUTHOR -.B xft\-config -was written by Keith Packard. -This manual page was written by Branden Robinson. -.SH "SEE ALSO" -.BR Xft (3) -.\" vim:set et tw=80 diff --git a/nx-X11/lib/Xft/xft-config.in b/nx-X11/lib/Xft/xft-config.in deleted file mode 100644 index 549b73ae0..000000000 --- a/nx-X11/lib/Xft/xft-config.in +++ /dev/null @@ -1,100 +0,0 @@ -#! /bin/sh - -prefix="@prefix@" -exec_prefix="@exec_prefix@" -libdir="@libdir@" -includedir="@includedir@" -version="@VERSION@" -freetypelibs="@FREETYPE_LIBS@" -freetypecflags="@FREETYPE_CFLAGS@" -fontconfiglibs="@FONTCONFIG_LIBS@" -fontconfigcflags="@FONTCONFIG_CFLAGS@" -xrenderlibs="@XRENDER_LIBS@" -xrendercflags="@XRENDER_CFLAGS@" - -usage() -{ - cat <&2 -fi - -while test $# -gt 0 ; do - case "$1" in - -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - case $1 in - --prefix=*) - prefix=$optarg - local_prefix=yes - ;; - --prefix) - echo_prefix=yes - ;; - --exec-prefix=*) - exec_prefix=$optarg - exec_prefix_set=yes - local_prefix=yes - ;; - --exec-prefix) - echo_exec_prefix=yes - ;; - --version) - echo $version - exit 0 - ;; - --cflags) - echo_cflags=yes - ;; - --libs) - echo_libs=yes - ;; - *) - usage 1 1>&2 - ;; - esac - shift -done - -if test "$local_prefix" = "yes" ; then - if test "$exec_prefix_set" != "yes" ; then - exec_prefix=$prefix - fi -fi - -if test "$echo_prefix" = "yes" ; then - echo $prefix -fi - -if test "$echo_exec_prefix" = "yes" ; then - echo $exec_prefix -fi - -if test "$echo_cflags" = "yes" ; then - cflags="-I${includedir} ${freetypecflags} ${fontconfigcflags} ${xrendercflags}" - echo $cflags -fi - -if test "$echo_libs" = "yes" ; then - libs="-lXft -lX11 ${freetypelibs} ${fontconfiglibs} ${xrenderlibs}" - if test "${libdir}" != "/usr/lib" ; then - echo -L${libdir} $libs - else - echo $libs - fi -fi - -# EOF diff --git a/nx-X11/lib/Xft/xft.pc.in b/nx-X11/lib/Xft/xft.pc.in deleted file mode 100644 index 45db8813b..000000000 --- a/nx-X11/lib/Xft/xft.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: Xft -Description: X FreeType library -Version: @VERSION@ -Requires: xrender, fontconfig, freetype2 -Requires.private: xrender, fontconfig, freetype2 -Cflags: -I${includedir} -Libs: -L${libdir} -lXft diff --git a/nx-X11/lib/Xft/xftcolor.c b/nx-X11/lib/Xft/xftcolor.c deleted file mode 100644 index 1a28d63fa..000000000 --- a/nx-X11/lib/Xft/xftcolor.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * $Id: xftcolor.c,v 1.4 2005/07/03 07:00:57 daniels Exp $ - * - * Copyright © 2000 Keith Packard - * - * 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, - _Xconst Visual *visual, - Colormap cmap, - _Xconst 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, - _Xconst 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 = color->alpha; - 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/nx-X11/lib/Xft/xftcore.c b/nx-X11/lib/Xft/xftcore.c deleted file mode 100644 index 1052a1d09..000000000 --- a/nx-X11/lib/Xft/xftcore.c +++ /dev/null @@ -1,1375 +0,0 @@ -/* - * $Id: xftcore.c,v 1.4 2005/07/03 07:00:57 daniels Exp $ - * - * Copyright © 2000 Keith Packard - * - * 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" - -void -XftRectCore (XftDraw *draw, - _Xconst XftColor *color, - int x, - int y, - unsigned int width, - unsigned int height) -{ - if (color->color.alpha >= 0x8000) - { - XSetForeground (draw->dpy, draw->core.gc, color->pixel); - XFillRectangle (draw->dpy, draw->drawable, draw->core.gc, - x, y, width, height); - } -} - -/* - * Use the core protocol to draw the glyphs - */ - -static void -_XftSharpGlyphMono (XftDraw *draw, - XftGlyph *glyph, - int x, - int y) -{ - unsigned char *srcLine = glyph->bitmap, *src; - unsigned char bits, bitsMask; - int width = glyph->metrics.width; - int stride = ((width + 31) & ~31) >> 3; - int height = glyph->metrics.height; - int w; - int xspan, lenspan; - - x -= glyph->metrics.x; - y -= glyph->metrics.y; - while (height--) - { - src = srcLine; - srcLine += stride; - w = width; - - bitsMask = 0x80; /* FreeType is always MSB first */ - bits = *src++; - - xspan = x; - while (w) - { - if (bits & bitsMask) - { - lenspan = 0; - do - { - lenspan++; - if (lenspan == w) - break; - bitsMask = bitsMask >> 1; - if (!bitsMask) - { - bits = *src++; - bitsMask = 0x80; - } - } while (bits & bitsMask); - XFillRectangle (draw->dpy, draw->drawable, - draw->core.gc, xspan, y, lenspan, 1); - xspan += lenspan; - w -= lenspan; - } - else - { - do - { - w--; - xspan++; - if (!w) - break; - bitsMask = bitsMask >> 1; - if (!bitsMask) - { - bits = *src++; - bitsMask = 0x80; - } - } while (!(bits & bitsMask)); - } - } - y++; - } -} - -/* - * Draw solid color text from an anti-aliased bitmap. This is a - * fallback for cases where a particular drawable has no AA code - */ -static void -_XftSharpGlyphGray (XftDraw *draw, - XftGlyph *glyph, - int x, - int y) -{ - unsigned char *srcLine = glyph->bitmap, *src, bits; - int width = glyph->metrics.width; - int stride = ((width + 3) & ~3); - int height = glyph->metrics.height; - int w; - int xspan, lenspan; - - x -= glyph->metrics.x; - y -= glyph->metrics.y; - while (height--) - { - src = srcLine; - srcLine += stride; - w = width; - - bits = *src++; - xspan = x; - while (w) - { - if (bits >= 0x80) - { - lenspan = 0; - do - { - lenspan++; - if (lenspan == w) - break; - bits = *src++; - } while (bits >= 0x80); - XFillRectangle (draw->dpy, draw->drawable, - draw->core.gc, xspan, y, lenspan, 1); - xspan += lenspan; - w -= lenspan; - } - else - { - do - { - w--; - xspan++; - if (!w) - break; - bits = *src++; - } while (bits < 0x80); - } - } - y++; - } -} - -static void -_XftSharpGlyphRgba (XftDraw *draw, - XftGlyph *glyph, - int x, - int y) -{ - CARD32 *srcLine = glyph->bitmap, *src, bits; - int width = glyph->metrics.width; - int stride = ((width + 3) & ~3); - int height = glyph->metrics.height; - int w; - int xspan, lenspan; - - x -= glyph->metrics.x; - y -= glyph->metrics.y; - while (height--) - { - src = srcLine; - srcLine += stride; - w = width; - - bits = *src++; - xspan = x; - while (w) - { - if (bits >= 0x80000000) - { - lenspan = 0; - do - { - lenspan++; - if (lenspan == w) - break; - bits = *src++; - } while (bits >= 0x80000000); - XFillRectangle (draw->dpy, draw->drawable, - draw->core.gc, xspan, y, lenspan, 1); - xspan += lenspan; - w -= lenspan; - } - else - { - do - { - w--; - xspan++; - if (!w) - break; - bits = *src++; - } while (bits < 0x80000000); - } - } - y++; - } -} - -typedef void (*XftSharpGlyph) (XftDraw *draw, - XftGlyph *glyph, - int x, - int y); - -static XftSharpGlyph -_XftSharpGlyphFind (XftDraw *draw, XftFont *public) -{ - XftFontInt *font = (XftFontInt *) public; - - if (!font->info.antialias) - return _XftSharpGlyphMono; - else switch (font->info.rgba) { - case FC_RGBA_RGB: - case FC_RGBA_BGR: - case FC_RGBA_VRGB: - case FC_RGBA_VBGR: - return _XftSharpGlyphRgba; - default: - return _XftSharpGlyphGray; - } -} - -/* - * Draw glyphs to a target that supports anti-aliasing - */ - -/* - * Primitives for converting between RGB values and TrueColor pixels - */ - -static void -_XftExamineBitfield (unsigned long mask, int *shift, int *len) -{ - int s, l; - - s = 0; - while ((mask & 1) == 0) - { - mask >>= 1; - s++; - } - l = 0; - while ((mask & 1) == 1) - { - mask >>= 1; - l++; - } - *shift = s; - *len = l; -} - -static CARD32 -_XftGetField (unsigned long l_pixel, int shift, int len) -{ - CARD32 pixel = (CARD32) l_pixel; - - pixel = pixel & (((1 << (len)) - 1) << shift); - pixel = pixel << (32 - (shift + len)) >> 24; - while (len < 8) - { - pixel |= (pixel >> len); - len <<= 1; - } - return pixel; -} - -static unsigned long -_XftPutField (CARD32 pixel, int shift, int len) -{ - unsigned long l_pixel = (unsigned long) pixel; - - shift = shift - (8 - len); - if (len <= 8) - l_pixel &= (((1 << len) - 1) << (8 - len)); - if (shift < 0) - l_pixel >>= -shift; - else - l_pixel <<= shift; - return l_pixel; -} - -/* - * This is used when doing XftCharFontSpec/XftGlyphFontSpec where - * some of the fonts are bitmaps and some are anti-aliased to handle - * the bitmap portions - */ -static void -_XftSmoothGlyphMono (XImage *image, - _Xconst XftGlyph *xftg, - int x, - int y, - _Xconst XftColor *color) -{ - unsigned char *srcLine = xftg->bitmap, *src; - unsigned char bits, bitsMask; - int width = xftg->metrics.width; - int stride = ((width + 31) & ~31) >> 3; - int height = xftg->metrics.height; - int w; - int xspan; - int r_shift, r_len; - int g_shift, g_len; - int b_shift, b_len; - unsigned long pixel; - - _XftExamineBitfield (image->red_mask, &r_shift, &r_len); - _XftExamineBitfield (image->green_mask, &g_shift, &g_len); - _XftExamineBitfield (image->blue_mask, &b_shift, &b_len); - pixel = (_XftPutField (color->color.red >> 8, r_shift, r_len) | - _XftPutField (color->color.green >> 8, g_shift, g_len) | - _XftPutField (color->color.blue >> 8, b_shift, b_len)); - x -= xftg->metrics.x; - y -= xftg->metrics.y; - while (height--) - { - src = srcLine; - srcLine += stride; - w = width; - - bitsMask = 0x80; /* FreeType is always MSB first */ - bits = *src++; - - xspan = x; - while (w--) - { - if (bits & bitsMask) - XPutPixel (image, xspan, y, pixel); - bitsMask = bitsMask >> 1; - if (!bitsMask) - { - bits = *src++; - bitsMask = 0x80; - } - xspan++; - } - y++; - } -} - -/* - * As simple anti-aliasing is likely to be common, there are three - * optimized versions for the usual true color pixel formats (888, 565, 555). - * Other formats are handled by the general case - */ - -#define cvt8888to0565(s) ((((s) >> 3) & 0x001f) | \ - (((s) >> 5) & 0x07e0) | \ - (((s) >> 8) & 0xf800)) - -#define cvt0565to8888(s) (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \ - ((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \ - ((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000))) - -#define cvt8888to0555(s) ((((s) >> 3) & 0x001f) | \ - (((s) >> 6) & 0x03e0) | \ - (((s) >> 7) & 0x7c00)) - -#define cvt0555to8888(s) (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \ - ((((s) << 6) & 0xf800) | (((s) >> 0) & 0x300)) | \ - ((((s) << 9) & 0xf80000) | (((s) << 4) & 0x70000))) - - -#define XftIntMult(a,b,t) ( (t) = (a) * (b) + 0x80, ( ( ( (t)>>8 ) + (t) )>>8 ) ) -#define XftIntDiv(a,b) (((CARD16) (a) * 255) / (b)) - -#define XftGet8(v,i) ((CARD16) (CARD8) ((v) >> i)) - -/* - * There are two ways of handling alpha -- either as a single unified value or - * a separate value for each component, hence each macro must have two - * versions. The unified alpha version has a 'U' at the end of the name, - * the component version has a 'C'. Similarly, functions which deal with - * this difference will have two versions using the same convention. - */ - -#define XftOverU(x,y,i,a,t) ((t) = XftIntMult(XftGet8(y,i),(a),(t)) + XftGet8(x,i),\ - (CARD32) ((CARD8) ((t) | (0 - ((t) >> 8)))) << (i)) - -#define XftOverC(x,y,i,a,t) ((t) = XftIntMult(XftGet8(y,i),XftGet8(a,i),(t)) + XftGet8(x,i),\ - (CARD32) ((CARD8) ((t) | (0 - ((t) >> 8)))) << (i)) - -#define XftInU(x,i,a,t) ((CARD32) XftIntMult(XftGet8(x,i),(a),(t)) << (i)) - -#define XftInC(x,i,a,t) ((CARD32) XftIntMult(XftGet8(x,i),XftGet8(a,i),(t)) << (i)) - -#define XftGen(x,y,i,ax,ay,t,u,v) ((t) = (XftIntMult(XftGet8(y,i),ay,(u)) + \ - XftIntMult(XftGet8(x,i),ax,(v))),\ - (CARD32) ((CARD8) ((t) | \ - (0 - ((t) >> 8)))) << (i)) - -#define XftAdd(x,y,i,t) ((t) = XftGet8(x,i) + XftGet8(y,i), \ - (CARD32) ((CARD8) ((t) | (0 - ((t) >> 8)))) << (i)) - - -static CARD32 -fbOver24 (CARD32 x, CARD32 y) -{ - CARD16 a = ~x >> 24; - CARD16 t; - CARD32 m,n,o; - - m = XftOverU(x,y,0,a,t); - n = XftOverU(x,y,8,a,t); - o = XftOverU(x,y,16,a,t); - return m|n|o; -} - -static CARD32 -fbIn (CARD32 x, CARD8 y) -{ - CARD16 a = y; - CARD16 t; - CARD32 m,n,o,p; - - m = XftInU(x,0,a,t); - n = XftInU(x,8,a,t); - o = XftInU(x,16,a,t); - p = XftInU(x,24,a,t); - return m|n|o|p; -} - -static void -_XftSmoothGlyphGray8888 (XImage *image, - _Xconst XftGlyph *xftg, - int x, - int y, - _Xconst XftColor *color) -{ - CARD32 src, srca; - CARD32 r, g, b; - CARD32 *dstLine, *dst, d; - CARD8 *maskLine, *mask, m; - int dstStride, maskStride; - int width, height; - int w; - - srca = color->color.alpha >> 8; - - /* This handles only RGB and BGR */ - g = (color->color.green & 0xff00); - if (image->red_mask == 0xff0000) - { - r = (color->color.red & 0xff00) << 8; - b = color->color.blue >> 8; - } - else - { - r = color->color.red >> 8; - b = (color->color.blue & 0xff00) << 8; - } - src = (srca << 24) | r | g | b; - - width = xftg->metrics.width; - height = xftg->metrics.height; - - x -= xftg->metrics.x; - y -= xftg->metrics.y; - - dstLine = (CARD32 *) (image->data + image->bytes_per_line * y + (x << 2)); - dstStride = image->bytes_per_line >> 2; - maskLine = (unsigned char *) xftg->bitmap; - maskStride = (width + 3) & ~3; - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - mask = maskLine; - maskLine += maskStride; - w = width; - - while (w--) - { - m = *mask++; - if (m == 0xff) - { - if (srca == 0xff) - *dst = src; - else - *dst = fbOver24 (src, *dst); - } - else if (m) - { - d = fbIn (src, m); - *dst = fbOver24 (d, *dst); - } - dst++; - } - } -} - -static void -_XftSmoothGlyphGray565 (XImage *image, - _Xconst XftGlyph *xftg, - int x, - int y, - _Xconst XftColor *color) -{ - CARD32 src, srca; - CARD32 r, g, b; - CARD32 d; - CARD16 *dstLine, *dst; - CARD8 *maskLine, *mask, m; - int dstStride, maskStride; - int width, height; - int w; - - srca = color->color.alpha >> 8; - - /* This handles only RGB and BGR */ - g = (color->color.green & 0xff00); - if (image->red_mask == 0xf800) - { - r = (color->color.red & 0xff00) << 8; - b = color->color.blue >> 8; - } - else - { - r = color->color.red >> 8; - b = (color->color.blue & 0xff00) << 8; - } - src = (srca << 24) | r | g | b; - - width = xftg->metrics.width; - height = xftg->metrics.height; - - x -= xftg->metrics.x; - y -= xftg->metrics.y; - - dstLine = (CARD16 *) (image->data + image->bytes_per_line * y + (x << 1)); - dstStride = image->bytes_per_line >> 1; - maskLine = (unsigned char *) xftg->bitmap; - maskStride = (width + 3) & ~3; - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - mask = maskLine; - maskLine += maskStride; - w = width; - - while (w--) - { - m = *mask++; - if (m == 0xff) - { - if (srca == 0xff) - d = src; - else - { - d = *dst; - d = fbOver24 (src, cvt0565to8888(d)); - } - *dst = cvt8888to0565(d); - } - else if (m) - { - d = *dst; - d = fbOver24 (fbIn(src,m), cvt0565to8888(d)); - *dst = cvt8888to0565(d); - } - dst++; - } - } -} - -static void -_XftSmoothGlyphGray555 (XImage *image, - _Xconst XftGlyph *xftg, - int x, - int y, - _Xconst XftColor *color) -{ - CARD32 src, srca; - CARD32 r, g, b; - CARD32 d; - CARD16 *dstLine, *dst; - CARD8 *maskLine, *mask, m; - int dstStride, maskStride; - int width, height; - int w; - - srca = color->color.alpha >> 8; - - /* This handles only RGB and BGR */ - g = (color->color.green & 0xff00); - if (image->red_mask == 0xf800) - { - r = (color->color.red & 0xff00) << 8; - b = color->color.blue >> 8; - } - else - { - r = color->color.red >> 8; - b = (color->color.blue & 0xff00) << 8; - } - src = (srca << 24) | r | g | b; - - width = xftg->metrics.width; - height = xftg->metrics.height; - - x -= xftg->metrics.x; - y -= xftg->metrics.y; - - dstLine = (CARD16 *) (image->data + image->bytes_per_line * y + (x << 1)); - dstStride = image->bytes_per_line >> 1; - maskLine = (unsigned char *) xftg->bitmap; - maskStride = (width + 3) & ~3; - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - mask = maskLine; - maskLine += maskStride; - w = width; - - while (w--) - { - m = *mask++; - if (m == 0xff) - { - if (srca == 0xff) - d = src; - else - { - d = *dst; - d = fbOver24 (src, cvt0555to8888(d)); - } - *dst = cvt8888to0555(d); - } - else if (m) - { - d = *dst; - d = fbOver24 (fbIn(src,m), cvt0555to8888(d)); - *dst = cvt8888to0555(d); - } - dst++; - } - } -} - -static void -_XftSmoothGlyphGray (XImage *image, - _Xconst XftGlyph *xftg, - int x, - int y, - _Xconst XftColor *color) -{ - CARD32 src, srca; - int r_shift, r_len; - int g_shift, g_len; - int b_shift, b_len; - CARD8 *maskLine, *mask, m; - int maskStride; - CARD32 d; - unsigned long pixel; - int width, height; - int w, tx; - - srca = color->color.alpha >> 8; - src = (srca << 24 | - (color->color.red & 0xff00) << 8 | - (color->color.green & 0xff00) | - (color->color.blue) >> 8); - x -= xftg->metrics.x; - y -= xftg->metrics.y; - width = xftg->metrics.width; - height = xftg->metrics.height; - - maskLine = (unsigned char *) xftg->bitmap; - maskStride = (width + 3) & ~3; - - _XftExamineBitfield (image->red_mask, &r_shift, &r_len); - _XftExamineBitfield (image->green_mask, &g_shift, &g_len); - _XftExamineBitfield (image->blue_mask, &b_shift, &b_len); - while (height--) - { - mask = maskLine; - maskLine += maskStride; - w = width; - tx = x; - - while (w--) - { - m = *mask++; - if (m == 0xff) - { - if (srca == 0xff) - d = src; - else - { - pixel = XGetPixel (image, tx, y); - d = (_XftGetField (pixel, r_shift, r_len) << 16 | - _XftGetField (pixel, g_shift, g_len) << 8 | - _XftGetField (pixel, b_shift, b_len)); - d = fbOver24 (src, d); - } - pixel = (_XftPutField ((d >> 16) & 0xff, r_shift, r_len) | - _XftPutField ((d >> 8) & 0xff, g_shift, g_len) | - _XftPutField ((d ) & 0xff, b_shift, b_len)); - XPutPixel (image, tx, y, pixel); - } - else if (m) - { - pixel = XGetPixel (image, tx, y); - d = (_XftGetField (pixel, r_shift, r_len) << 16 | - _XftGetField (pixel, g_shift, g_len) << 8 | - _XftGetField (pixel, b_shift, b_len)); - d = fbOver24 (fbIn(src,m), d); - pixel = (_XftPutField ((d >> 16) & 0xff, r_shift, r_len) | - _XftPutField ((d >> 8) & 0xff, g_shift, g_len) | - _XftPutField ((d ) & 0xff, b_shift, b_len)); - XPutPixel (image, tx, y, pixel); - } - tx++; - } - y++; - } -} - -static void -_XftSmoothGlyphRgba (XImage *image, - _Xconst XftGlyph *xftg, - int x, - int y, - _Xconst XftColor *color) -{ - CARD32 src, srca; - int r_shift, r_len; - int g_shift, g_len; - int b_shift, b_len; - CARD32 *mask, ma; - CARD32 d; - unsigned long pixel; - int width, height; - int w, tx; - - srca = color->color.alpha >> 8; - src = (srca << 24 | - (color->color.red & 0xff00) << 8 | - (color->color.green & 0xff00) | - (color->color.blue) >> 8); - x -= xftg->metrics.x; - y -= xftg->metrics.y; - width = xftg->metrics.width; - height = xftg->metrics.height; - - mask = (CARD32 *) xftg->bitmap; - - _XftExamineBitfield (image->red_mask, &r_shift, &r_len); - _XftExamineBitfield (image->green_mask, &g_shift, &g_len); - _XftExamineBitfield (image->blue_mask, &b_shift, &b_len); - while (height--) - { - w = width; - tx = x; - - while (w--) - { - ma = *mask++; - if (ma == 0xffffffff) - { - if (srca == 0xff) - d = src; - else - { - pixel = XGetPixel (image, tx, y); - d = (_XftGetField (pixel, r_shift, r_len) << 16 | - _XftGetField (pixel, g_shift, g_len) << 8 | - _XftGetField (pixel, b_shift, b_len)); - d = fbOver24 (src, d); - } - pixel = (_XftPutField ((d >> 16) & 0xff, r_shift, r_len) | - _XftPutField ((d >> 8) & 0xff, g_shift, g_len) | - _XftPutField ((d ) & 0xff, b_shift, b_len)); - XPutPixel (image, tx, y, pixel); - } - else if (ma) - { - CARD32 m,n,o; - pixel = XGetPixel (image, tx, y); - d = (_XftGetField (pixel, r_shift, r_len) << 16 | - _XftGetField (pixel, g_shift, g_len) << 8 | - _XftGetField (pixel, b_shift, b_len)); -#define XftInOverC(src,srca,msk,dst,i,result) { \ - CARD16 __a = XftGet8(msk,i); \ - CARD32 __t, __ta; \ - CARD32 __i; \ - __t = XftIntMult (XftGet8(src,i), __a,__i); \ - __ta = (CARD8) ~XftIntMult (srca, __a,__i); \ - __t = __t + XftIntMult(XftGet8(dst,i),__ta,__i); \ - __t = (CARD32) (CARD8) (__t | (-(__t >> 8))); \ - result = __t << (i); \ -} - XftInOverC(src,srca,ma,d,0,m); - XftInOverC(src,srca,ma,d,8,n); - XftInOverC(src,srca,ma,d,16,o); - d = m | n | o; - pixel = (_XftPutField ((d >> 16) & 0xff, r_shift, r_len) | - _XftPutField ((d >> 8) & 0xff, g_shift, g_len) | - _XftPutField ((d ) & 0xff, b_shift, b_len)); - XPutPixel (image, tx, y, pixel); - } - tx++; - } - y++; - } -} - -static FcBool -_XftSmoothGlyphPossible (XftDraw *draw) -{ - if (!draw->visual) - return FcFalse; - if (draw->visual->class != TrueColor) - return FcFalse; - return FcTrue; -} - -typedef void (*XftSmoothGlyph) (XImage *image, - _Xconst XftGlyph *xftg, - int x, - int y, - _Xconst XftColor *color); - -static XftSmoothGlyph -_XftSmoothGlyphFind (XftDraw *draw, XftFont *public) -{ - XftFontInt *font = (XftFontInt *) public; - - if (!font->info.antialias) - return _XftSmoothGlyphMono; - else switch (font->info.rgba) { - case FC_RGBA_RGB: - case FC_RGBA_BGR: - case FC_RGBA_VRGB: - case FC_RGBA_VBGR: - return _XftSmoothGlyphRgba; - default: - switch (XftDrawBitsPerPixel (draw)) { - case 32: - if ((draw->visual->red_mask == 0xff0000 && - draw->visual->green_mask == 0x00ff00 && - draw->visual->blue_mask == 0x0000ff) || - (draw->visual->red_mask == 0x0000ff && - draw->visual->green_mask == 0x00ff00 && - draw->visual->blue_mask == 0xff0000)) - { - return _XftSmoothGlyphGray8888; - } - break; - case 16: - if ((draw->visual->red_mask == 0xf800 && - draw->visual->green_mask == 0x07e0 && - draw->visual->blue_mask == 0x001f) || - (draw->visual->red_mask == 0x001f && - draw->visual->green_mask == 0x07e0 && - draw->visual->blue_mask == 0xf800)) - { - return _XftSmoothGlyphGray565; - } - if ((draw->visual->red_mask == 0x7c00 && - draw->visual->green_mask == 0x03e0 && - draw->visual->blue_mask == 0x001f) || - (draw->visual->red_mask == 0x001f && - draw->visual->green_mask == 0x03e0 && - draw->visual->blue_mask == 0x7c00)) - { - return _XftSmoothGlyphGray555; - } - break; - default: - break; - } - return _XftSmoothGlyphGray; - } -} - -static XftGlyph * -_XftGlyphDefault (Display *dpy, XftFont *public) -{ - XftFontInt *font = (XftFontInt *) public; - FT_UInt missing[XFT_NMISSING]; - int nmissing; - FcBool glyphs_loaded = FcFalse; - - if (XftFontCheckGlyph (dpy, public, FcTrue, 0, missing, &nmissing)) - glyphs_loaded = FcTrue; - if (nmissing) - XftFontLoadGlyphs (dpy, public, FcTrue, missing, nmissing); - return font->glyphs[0]; -} - -static int XftGetImageErrorHandler (Display *dpy, XErrorEvent *error_event) -{ - return 0; -} - -void -XftGlyphCore (XftDraw *draw, - _Xconst XftColor *color, - XftFont *public, - int x, - int y, - _Xconst FT_UInt *glyphs, - int nglyphs) -{ - Display *dpy = draw->dpy; - XftFontInt *font = (XftFontInt *) public; - XftGlyph *xftg; - FT_UInt glyph; - _Xconst FT_UInt *g; - FT_UInt missing[XFT_NMISSING]; - FcBool glyphs_loaded; - int nmissing; - int n; - XErrorHandler prev_error; - - /* - * Load missing glyphs - */ - g = glyphs; - n = nglyphs; - nmissing = 0; - glyphs_loaded = FcFalse; - while (n--) - if (XftFontCheckGlyph (dpy, public, FcTrue, *g++, missing, &nmissing)) - glyphs_loaded = FcTrue; - if (nmissing) - XftFontLoadGlyphs (dpy, public, FcTrue, missing, nmissing); - - g = glyphs; - n = nglyphs; - if ((font->info.antialias || color->color.alpha != 0xffff) && - _XftSmoothGlyphPossible (draw)) - { - XGlyphInfo gi; - XImage *image; - unsigned int depth; - int ox, oy; - XftSmoothGlyph smooth = _XftSmoothGlyphFind (draw, public); - - XftGlyphExtents (dpy, public, glyphs, nglyphs, &gi); - if (!gi.width || !gi.height) - goto bail1; - ox = x - gi.x; - oy = y - gi.y; - /* - * Try to get bits directly from the drawable; if that fails, - * use a temporary pixmap. When it does fail, assume it - * will probably fail for a while and keep using temporary - * pixmaps for a while to avoid double round trips. - */ - if (draw->core.use_pixmap == 0) - { - prev_error = XSetErrorHandler (XftGetImageErrorHandler); - image = XGetImage (dpy, draw->drawable, - ox, oy, - gi.width, gi.height, AllPlanes, - ZPixmap); - XSetErrorHandler (prev_error); - if (!image) - draw->core.use_pixmap = XFT_ASSUME_PIXMAP; - } - else - { - draw->core.use_pixmap--; - image = 0; - } - if (!image && (depth = XftDrawDepth (draw))) - { - Pixmap pix; - GC gc; - XGCValues gcv; - - pix = XCreatePixmap (dpy, draw->drawable, - gi.width, gi.height, depth); - gcv.graphics_exposures = False; - gc = XCreateGC (dpy, pix, GCGraphicsExposures, &gcv); - XCopyArea (dpy, draw->drawable, pix, gc, ox, oy, - gi.width, gi.height, 0, 0); - XFreeGC (dpy, gc); - image = XGetImage (dpy, pix, 0, 0, gi.width, gi.height, AllPlanes, - ZPixmap); - XFreePixmap (dpy, pix); - } - if (!image) - goto bail1; - image->red_mask = draw->visual->red_mask; - image->green_mask = draw->visual->green_mask; - image->blue_mask = draw->visual->blue_mask; - if (image->byte_order != XftNativeByteOrder ()) - XftSwapImage (image); - while (n--) - { - glyph = *g++; - if (glyph >= font->num_glyphs || !(xftg = font->glyphs[glyph])) - xftg = _XftGlyphDefault (dpy, public); - if (xftg) - { - (*smooth) (image, xftg, x - ox, y - oy, color); - x += xftg->metrics.xOff; - y += xftg->metrics.yOff; - } - } - if (image->byte_order != XftNativeByteOrder ()) - XftSwapImage (image); - XPutImage (dpy, draw->drawable, draw->core.gc, image, 0, 0, ox, oy, - gi.width, gi.height); - XDestroyImage (image); - } - else - { - XftSharpGlyph sharp = _XftSharpGlyphFind (draw, public); - while (n--) - { - glyph = *g++; - if (glyph >= font->num_glyphs || !(xftg = font->glyphs[glyph])) - xftg = _XftGlyphDefault (dpy, public); - if (xftg) - { - (*sharp) (draw, xftg, x, y); - x += xftg->metrics.xOff; - y += xftg->metrics.yOff; - } - } - } -bail1: - if (glyphs_loaded) - _XftFontManageMemory (dpy, public); -} - -#define NUM_LOCAL 1024 - -void -XftGlyphSpecCore (XftDraw *draw, - _Xconst XftColor *color, - XftFont *public, - _Xconst XftGlyphSpec *glyphs, - int nglyphs) -{ - Display *dpy = draw->dpy; - XftFontInt *font = (XftFontInt *) public; - XftGlyph *xftg; - FT_UInt missing[XFT_NMISSING]; - FcBool glyphs_loaded; - int nmissing; - int i; - XErrorHandler prev_error; - int x1, y1, x2, y2; - - /* - * Load missing glyphs - */ - glyphs_loaded = FcFalse; - x1 = y1 = x2 = y2 = 0; - for (i = 0; i < nglyphs; i++) - { - XGlyphInfo gi; - int g_x1, g_x2, g_y1, g_y2; - - nmissing = 0; - if (XftFontCheckGlyph (dpy, public, FcTrue, glyphs[i].glyph, missing, &nmissing)) - glyphs_loaded = FcTrue; - if (nmissing) - XftFontLoadGlyphs (dpy, public, FcTrue, missing, nmissing); - - XftGlyphExtents (dpy, public, &glyphs[i].glyph, 1, &gi); - g_x1 = glyphs[i].x - gi.x; - g_y1 = glyphs[i].y - gi.y; - g_x2 = g_x1 + gi.width; - g_y2 = g_y1 + gi.height; - if (i) - { - if (g_x1 < x1) - x1 = g_x1; - if (g_y1 < y1) - y1 = g_y1; - if (g_x2 > x2) - x2 = g_x2; - if (g_y2 > y2) - y2 = g_y2; - } - else - { - x1 = g_x1; - y1 = g_y1; - x2 = g_x2; - y2 = g_y2; - } - } - - if (x1 == x2 || y1 == y2) - goto bail1; - - if ((font->info.antialias || color->color.alpha != 0xffff) && - _XftSmoothGlyphPossible (draw)) - { - XImage *image; - unsigned int depth; - int width = x2 - x1, height = y2 - y1; - XftSmoothGlyph smooth = _XftSmoothGlyphFind (draw, public); - - /* - * Try to get bits directly from the drawable; if that fails, - * use a temporary pixmap. When it does fail, assume it - * will probably fail for a while and keep using temporary - * pixmaps for a while to avoid double round trips. - */ - if (draw->core.use_pixmap == 0) - { - prev_error = XSetErrorHandler (XftGetImageErrorHandler); - image = XGetImage (dpy, draw->drawable, - x1, y1, - width, height, AllPlanes, - ZPixmap); - XSetErrorHandler (prev_error); - if (!image) - draw->core.use_pixmap = XFT_ASSUME_PIXMAP; - } - else - { - draw->core.use_pixmap--; - image = 0; - } - if (!image && (depth = XftDrawDepth (draw))) - { - Pixmap pix; - GC gc; - XGCValues gcv; - - pix = XCreatePixmap (dpy, draw->drawable, - width, height, depth); - gcv.graphics_exposures = False; - gc = XCreateGC (dpy, pix, GCGraphicsExposures, &gcv); - XCopyArea (dpy, draw->drawable, pix, gc, x1, y1, - width, height, 0, 0); - XFreeGC (dpy, gc); - image = XGetImage (dpy, pix, 0, 0, width, height, AllPlanes, - ZPixmap); - XFreePixmap (dpy, pix); - } - if (!image) - goto bail1; - image->red_mask = draw->visual->red_mask; - image->green_mask = draw->visual->green_mask; - image->blue_mask = draw->visual->blue_mask; - if (image->byte_order != XftNativeByteOrder ()) - XftSwapImage (image); - for (i = 0; i < nglyphs; i++) - { - FT_UInt glyph = glyphs[i].glyph; - if (glyph >= font->num_glyphs || !(xftg = font->glyphs[glyph])) - xftg = _XftGlyphDefault (dpy, public); - if (xftg) - { - (*smooth) (image, xftg, glyphs[i].x - x1, - glyphs[i].y - y1, color); - } - } - if (image->byte_order != XftNativeByteOrder ()) - XftSwapImage (image); - XPutImage (dpy, draw->drawable, draw->core.gc, image, 0, 0, x1, y1, - width, height); - XDestroyImage (image); - } - else - { - XftSharpGlyph sharp = _XftSharpGlyphFind (draw, public); - for (i = 0; i < nglyphs; i++) - { - FT_UInt glyph = glyphs[i].glyph; - if (glyph >= font->num_glyphs || !(xftg = font->glyphs[glyph])) - xftg = _XftGlyphDefault (dpy, public); - if (xftg) - (*sharp) (draw, xftg, glyphs[i].x, glyphs[i].y); - } - } -bail1: - if (glyphs_loaded) - _XftFontManageMemory (dpy, public); -} - -void -XftGlyphFontSpecCore (XftDraw *draw, - _Xconst XftColor *color, - _Xconst XftGlyphFontSpec *glyphs, - int nglyphs) -{ - Display *dpy = draw->dpy; - XftGlyph *xftg; - FT_UInt missing[XFT_NMISSING]; - FcBool glyphs_loaded; - int nmissing; - int i; - XErrorHandler prev_error; - int x1, y1, x2, y2; - - /* - * Load missing glyphs - */ - glyphs_loaded = FcFalse; - x1 = y1 = x2 = y2 = 0; - for (i = 0; i < nglyphs; i++) - { - XftFont *public = glyphs[i].font; - XGlyphInfo gi; - int g_x1, g_x2, g_y1, g_y2; - - nmissing = 0; - if (XftFontCheckGlyph (dpy, public, FcTrue, glyphs[i].glyph, missing, &nmissing)) - glyphs_loaded = FcTrue; - if (nmissing) - XftFontLoadGlyphs (dpy, public, FcTrue, missing, nmissing); - - XftGlyphExtents (dpy, public, &glyphs[i].glyph, 1, &gi); - g_x1 = glyphs[i].x - gi.x; - g_y1 = glyphs[i].y - gi.y; - g_x2 = g_x1 + gi.width; - g_y2 = g_y1 + gi.height; - if (i) - { - if (g_x1 < x1) - x1 = g_x1; - if (g_y1 < y1) - y1 = g_y1; - if (g_x2 > x2) - x2 = g_x2; - if (g_y2 > y2) - y2 = g_y2; - } - else - { - x1 = g_x1; - y1 = g_y1; - x2 = g_x2; - y2 = g_y2; - } - } - - if (x1 == x2 || y1 == y2) - goto bail1; - - for (i = 0; i < nglyphs; i++) - if (((XftFontInt *) glyphs[i].font)->info.antialias) - break; - - if ((i != nglyphs || color->color.alpha != 0xffff) && - _XftSmoothGlyphPossible (draw)) - { - XImage *image; - unsigned int depth; - int width = x2 - x1, height = y2 - y1; - - /* - * Try to get bits directly from the drawable; if that fails, - * use a temporary pixmap. When it does fail, assume it - * will probably fail for a while and keep using temporary - * pixmaps for a while to avoid double round trips. - */ - if (draw->core.use_pixmap == 0) - { - prev_error = XSetErrorHandler (XftGetImageErrorHandler); - image = XGetImage (dpy, draw->drawable, - x1, y1, - width, height, AllPlanes, - ZPixmap); - XSetErrorHandler (prev_error); - if (!image) - draw->core.use_pixmap = XFT_ASSUME_PIXMAP; - } - else - { - draw->core.use_pixmap--; - image = 0; - } - if (!image && (depth = XftDrawDepth (draw))) - { - Pixmap pix; - GC gc; - XGCValues gcv; - - pix = XCreatePixmap (dpy, draw->drawable, - width, height, depth); - gcv.graphics_exposures = False; - gc = XCreateGC (dpy, pix, GCGraphicsExposures, &gcv); - XCopyArea (dpy, draw->drawable, pix, gc, x1, y1, - width, height, 0, 0); - XFreeGC (dpy, gc); - image = XGetImage (dpy, pix, 0, 0, width, height, AllPlanes, - ZPixmap); - XFreePixmap (dpy, pix); - } - if (!image) - goto bail1; - image->red_mask = draw->visual->red_mask; - image->green_mask = draw->visual->green_mask; - image->blue_mask = draw->visual->blue_mask; - if (image->byte_order != XftNativeByteOrder ()) - XftSwapImage (image); - for (i = 0; i < nglyphs; i++) - { - XftFont *public = glyphs[i].font; - XftFontInt *font = (XftFontInt *) public; - XftSmoothGlyph smooth = _XftSmoothGlyphFind (draw, public); - FT_UInt glyph = glyphs[i].glyph; - - if (glyph >= font->num_glyphs || !(xftg = font->glyphs[glyph])) - xftg = _XftGlyphDefault (dpy, public); - if (xftg) - { - (*smooth) (image, xftg, glyphs[i].x - x1, - glyphs[i].y - y1, color); - } - } - if (image->byte_order != XftNativeByteOrder ()) - XftSwapImage (image); - XPutImage (dpy, draw->drawable, draw->core.gc, image, 0, 0, x1, y1, - width, height); - XDestroyImage (image); - } - else - { - for (i = 0; i < nglyphs; i++) - { - XftFont *public = glyphs[i].font; - XftFontInt *font = (XftFontInt *) public; - XftSharpGlyph sharp = _XftSharpGlyphFind (draw, public); - FT_UInt glyph = glyphs[i].glyph; - - if (glyph >= font->num_glyphs || !(xftg = font->glyphs[glyph])) - xftg = _XftGlyphDefault (dpy, public); - if (xftg) - (*sharp) (draw, xftg, glyphs[i].x, glyphs[i].y); - } - } -bail1: - if (glyphs_loaded) - for (i = 0; i < nglyphs; i++) - _XftFontManageMemory (dpy, glyphs[i].font); -} diff --git a/nx-X11/lib/Xft/xftdbg.c b/nx-X11/lib/Xft/xftdbg.c deleted file mode 100644 index 1d5604698..000000000 --- a/nx-X11/lib/Xft/xftdbg.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * $Id: xftdbg.c,v 1.4 2005/07/03 07:00:57 daniels Exp $ - * - * Copyright © 2000 Keith Packard - * - * 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" - -int -XftDebug (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; -} diff --git a/nx-X11/lib/Xft/xftdpy.c b/nx-X11/lib/Xft/xftdpy.c deleted file mode 100644 index 9eb32ba9e..000000000 --- a/nx-X11/lib/Xft/xftdpy.c +++ /dev/null @@ -1,554 +0,0 @@ -/* - * $Id: xftdpy.c,v 1.4 2005/07/03 07:00:57 daniels Exp $ - * - * Copyright © 2000 Keith Packard - * - * 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" - -XftDisplayInfo *_XftDisplayInfo; - -static int -_XftCloseDisplay (Display *dpy, XExtCodes *codes) -{ - XftDisplayInfo *info, **prev; - - info = _XftDisplayInfoGet (dpy, FcFalse); - if (!info) - return 0; - - /* - * Get rid of any dangling unreferenced fonts - */ - info->max_unref_fonts = 0; - XftFontManageMemory (dpy); - - /* - * Clean up the default values - */ - if (info->defaults) - FcPatternDestroy (info->defaults); - - /* - * Unhook from the global list - */ - for (prev = &_XftDisplayInfo; (info = *prev); prev = &(*prev)->next) - if (info->display == dpy) - break; - *prev = info->next; - - free (info); - return 0; -} - - -XftDisplayInfo * -_XftDisplayInfoGet (Display *dpy, FcBool createIfNecessary) -{ - XftDisplayInfo *info, **prev; - XRenderPictFormat pf; - int i; - int event_base, error_base; - - 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; - } - } - if (!createIfNecessary) - return 0; - - 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->solidFormat = 0; - info->hasRender = (XRenderQueryExtension (dpy, &event_base, &error_base) && - (XRenderFindVisualFormat (dpy, DefaultVisual (dpy, DefaultScreen (dpy))) != 0)); - info->use_free_glyphs = FcTrue; - if (info->hasRender) - { - int major, minor; - XRenderQueryVersion (dpy, &major, &minor); - if (major < 0 || (major == 0 && minor <= 2)) - info->use_free_glyphs = FcFalse; - - pf.type = PictTypeDirect; - pf.depth = 32; - pf.direct.redMask = 0xff; - pf.direct.greenMask = 0xff; - pf.direct.blueMask = 0xff; - pf.direct.alphaMask = 0xff; - info->solidFormat = XRenderFindFormat (dpy, - (PictFormatType| - PictFormatDepth| - PictFormatRedMask| - PictFormatGreenMask| - PictFormatBlueMask| - PictFormatAlphaMask), - &pf, - 0); - } - if (XftDebug () & 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"); - } - for (i = 0; i < XFT_NUM_SOLID_COLOR; i++) - { - info->colors[i].screen = -1; - info->colors[i].pict = 0; - } - info->fonts = 0; - - info->next = _XftDisplayInfo; - _XftDisplayInfo = info; - - info->glyph_memory = 0; - info->max_glyph_memory = XftDefaultGetInteger (dpy, - XFT_MAX_GLYPH_MEMORY, 0, - XFT_DPY_MAX_GLYPH_MEMORY); - if (XftDebug () & XFT_DBG_CACHE) - printf ("global max cache memory %ld\n", info->max_glyph_memory); - - - info->num_unref_fonts = 0; - info->max_unref_fonts = XftDefaultGetInteger (dpy, - XFT_MAX_UNREF_FONTS, 0, - XFT_DPY_MAX_UNREF_FONTS); - if (XftDebug() & XFT_DBG_CACHE) - printf ("global max unref fonts %d\n", info->max_unref_fonts); - - memset (info->fontHash, '\0', sizeof (XftFont *) * XFT_NUM_FONT_HASH); - return info; - -bail1: - free (info); -bail0: - if (XftDebug () & XFT_DBG_RENDER) - { - printf ("XftDisplayInfoGet failed to initialize, Xft unhappy\n"); - } - return 0; -} - -/* - * Reduce memory usage in X server - */ - -static void -_XftDisplayValidateMemory (XftDisplayInfo *info) -{ - XftFont *public; - XftFontInt *font; - unsigned long glyph_memory; - - glyph_memory = 0; - for (public = info->fonts; public; public = font->next) - { - font = (XftFontInt *) public; - glyph_memory += font->glyph_memory; - } - if (glyph_memory != info->glyph_memory) - printf ("Display glyph cache incorrect has %ld bytes, should have %ld\n", - info->glyph_memory, glyph_memory); -} - -void -_XftDisplayManageMemory (Display *dpy) -{ - XftDisplayInfo *info = _XftDisplayInfoGet (dpy, False); - unsigned long glyph_memory; - XftFont *public; - XftFontInt *font; - - if (!info || !info->max_glyph_memory) - return; - if (XftDebug () & XFT_DBG_CACHE) - { - if (info->glyph_memory > info->max_glyph_memory) - printf ("Reduce global memory from %ld to %ld\n", - info->glyph_memory, info->max_glyph_memory); - _XftDisplayValidateMemory (info); - } - while (info->glyph_memory > info->max_glyph_memory) - { - glyph_memory = rand () % info->glyph_memory; - public = info->fonts; - while (public) - { - font = (XftFontInt *) public; - - if (font->glyph_memory > glyph_memory) - { - _XftFontUncacheGlyph (dpy, public); - break; - } - public = font->next; - glyph_memory -= font->glyph_memory; - } - } - if (XftDebug () & XFT_DBG_CACHE) - _XftDisplayValidateMemory (info); -} - -Bool -XftDefaultHasRender (Display *dpy) -{ - XftDisplayInfo *info = _XftDisplayInfoGet (dpy, True); - - if (!info) - return False; - return info->hasRender; -} - -Bool -XftDefaultSet (Display *dpy, FcPattern *defaults) -{ - XftDisplayInfo *info = _XftDisplayInfoGet (dpy, True); - - if (!info) - return False; - if (info->defaults) - FcPatternDestroy (info->defaults); - info->defaults = defaults; - if (!info->max_glyph_memory) - info->max_glyph_memory = XFT_DPY_MAX_GLYPH_MEMORY; - info->max_glyph_memory = XftDefaultGetInteger (dpy, - XFT_MAX_GLYPH_MEMORY, 0, - info->max_glyph_memory); - if (!info->max_unref_fonts) - info->max_unref_fonts = XFT_DPY_MAX_UNREF_FONTS; - info->max_unref_fonts = XftDefaultGetInteger (dpy, - XFT_MAX_UNREF_FONTS, 0, - info->max_unref_fonts); - return True; -} - -int -XftDefaultParseBool (char *v) -{ - char c0, c1; - - c0 = *v; - if (isupper ((int)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 ((int)c1)) - c1 = tolower (c1); - if (c1 == 'n') - return 1; - if (c1 == 'f') - return 0; - } - return -1; -} - -static Bool -_XftDefaultInitBool (Display *dpy, FcPattern *pat, char *option) -{ - char *v; - int i; - - v = XGetDefault (dpy, "Xft", option); - if (v && (i = XftDefaultParseBool (v)) >= 0) - return FcPatternAddBool (pat, option, i != 0); - return True; -} - -static Bool -_XftDefaultInitDouble (Display *dpy, FcPattern *pat, char *option) -{ - char *v, *e; - double d; - - v = XGetDefault (dpy, "Xft", option); - if (v) - { - d = strtod (v, &e); - if (e != v) - return FcPatternAddDouble (pat, option, d); - } - return True; -} - -static Bool -_XftDefaultInitInteger (Display *dpy, FcPattern *pat, char *option) -{ - char *v, *e; - int i; - - v = XGetDefault (dpy, "Xft", option); - if (v) - { - if (FcNameConstant ((FcChar8 *) v, &i)) - return FcPatternAddInteger (pat, option, i); - i = strtol (v, &e, 0); - if (e != v) - return FcPatternAddInteger (pat, option, i); - } - return True; -} - -static FcPattern * -_XftDefaultInit (Display *dpy) -{ - FcPattern *pat; - - pat = FcPatternCreate (); - if (!pat) - goto bail0; - - if (!_XftDefaultInitDouble (dpy, pat, FC_SCALE)) - goto bail1; - if (!_XftDefaultInitDouble (dpy, pat, FC_DPI)) - goto bail1; - if (!_XftDefaultInitBool (dpy, pat, XFT_RENDER)) - goto bail1; - if (!_XftDefaultInitInteger (dpy, pat, FC_RGBA)) - goto bail1; - if (!_XftDefaultInitBool (dpy, pat, FC_ANTIALIAS)) - goto bail1; -#ifdef FC_EMBOLDEN - if (!_XftDefaultInitBool (dpy, pat, FC_EMBOLDEN)) - goto bail1; -#endif - if (!_XftDefaultInitBool (dpy, pat, FC_AUTOHINT)) - goto bail1; -#ifdef FC_HINT_STYLE - if (!_XftDefaultInitInteger (dpy, pat, FC_HINT_STYLE)) - goto bail1; -#endif - if (!_XftDefaultInitBool (dpy, pat, FC_HINTING)) - goto bail1; - if (!_XftDefaultInitBool (dpy, pat, FC_MINSPACE)) - goto bail1; - if (!_XftDefaultInitInteger (dpy, pat, XFT_MAX_GLYPH_MEMORY)) - goto bail1; - - return pat; - -bail1: - FcPatternDestroy (pat); -bail0: - return 0; -} - -static FcResult -_XftDefaultGet (Display *dpy, const char *object, int screen, FcValue *v) -{ - XftDisplayInfo *info = _XftDisplayInfoGet (dpy, True); - FcResult r; - - if (!info) - return FcResultNoMatch; - - if (!info->defaults) - { - info->defaults = _XftDefaultInit (dpy); - if (!info->defaults) - return FcResultNoMatch; - } - r = FcPatternGet (info->defaults, object, screen, v); - if (r == FcResultNoId && screen > 0) - r = FcPatternGet (info->defaults, object, 0, v); - return r; -} - -Bool -XftDefaultGetBool (Display *dpy, const char *object, int screen, Bool def) -{ - FcResult r; - FcValue v; - - r = _XftDefaultGet (dpy, object, screen, &v); - if (r != FcResultMatch || v.type != FcTypeBool) - return def; - return v.u.b; -} - -int -XftDefaultGetInteger (Display *dpy, const char *object, int screen, int def) -{ - FcResult r; - FcValue v; - - r = _XftDefaultGet (dpy, object, screen, &v); - if (r != FcResultMatch || v.type != FcTypeInteger) - return def; - return v.u.i; -} - -double -XftDefaultGetDouble (Display *dpy, const char *object, int screen, double def) -{ - FcResult r; - FcValue v; - - r = _XftDefaultGet (dpy, object, screen, &v); - if (r != FcResultMatch || v.type != FcTypeDouble) - return def; - return v.u.d; -} - -void -XftDefaultSubstitute (Display *dpy, int screen, FcPattern *pattern) -{ - FcValue v; - double dpi; - - if (FcPatternGet (pattern, XFT_RENDER, 0, &v) == FcResultNoMatch) - { - FcPatternAddBool (pattern, XFT_RENDER, - XftDefaultGetBool (dpy, XFT_RENDER, screen, - XftDefaultHasRender (dpy))); - } - if (FcPatternGet (pattern, FC_ANTIALIAS, 0, &v) == FcResultNoMatch) - { - FcPatternAddBool (pattern, FC_ANTIALIAS, - XftDefaultGetBool (dpy, FC_ANTIALIAS, screen, - True)); - } -#ifdef FC_EMBOLDEN - if (FcPatternGet (pattern, FC_EMBOLDEN, 0, &v) == FcResultNoMatch) - { - FcPatternAddBool (pattern, FC_EMBOLDEN, - XftDefaultGetBool (dpy, FC_EMBOLDEN, screen, - False)); - } -#endif - if (FcPatternGet (pattern, FC_HINTING, 0, &v) == FcResultNoMatch) - { - FcPatternAddBool (pattern, FC_HINTING, - XftDefaultGetBool (dpy, FC_HINTING, screen, - True)); - } -#ifdef FC_HINT_STYLE - if (FcPatternGet (pattern, FC_HINT_STYLE, 0, &v) == FcResultNoMatch) - { - FcPatternAddInteger (pattern, FC_HINT_STYLE, - XftDefaultGetInteger (dpy, FC_HINT_STYLE, screen, - FC_HINT_FULL)); - } -#endif - if (FcPatternGet (pattern, FC_AUTOHINT, 0, &v) == FcResultNoMatch) - { - FcPatternAddBool (pattern, FC_AUTOHINT, - XftDefaultGetBool (dpy, FC_AUTOHINT, screen, - False)); - } - if (FcPatternGet (pattern, FC_RGBA, 0, &v) == FcResultNoMatch) - { - int subpixel = FC_RGBA_UNKNOWN; -#if RENDER_MAJOR > 0 || RENDER_MINOR >= 6 - if (XftDefaultHasRender (dpy)) - { - int render_order = XRenderQuerySubpixelOrder (dpy, screen); - switch (render_order) { - default: - case SubPixelUnknown: subpixel = FC_RGBA_UNKNOWN; break; - case SubPixelHorizontalRGB: subpixel = FC_RGBA_RGB; break; - case SubPixelHorizontalBGR: subpixel = FC_RGBA_BGR; break; - case SubPixelVerticalRGB: subpixel = FC_RGBA_VRGB; break; - case SubPixelVerticalBGR: subpixel = FC_RGBA_VBGR; break; - case SubPixelNone: subpixel = FC_RGBA_NONE; break; - } - } -#endif - FcPatternAddInteger (pattern, FC_RGBA, - XftDefaultGetInteger (dpy, FC_RGBA, screen, - subpixel)); - } - if (FcPatternGet (pattern, FC_MINSPACE, 0, &v) == FcResultNoMatch) - { - FcPatternAddBool (pattern, FC_MINSPACE, - XftDefaultGetBool (dpy, FC_MINSPACE, screen, - False)); - } - if (FcPatternGet (pattern, FC_DPI, 0, &v) == FcResultNoMatch) - { - dpi = (((double) DisplayHeight (dpy, screen) * 25.4) / - (double) DisplayHeightMM (dpy, screen)); - FcPatternAddDouble (pattern, FC_DPI, - XftDefaultGetDouble (dpy, FC_DPI, screen, - dpi)); - } - if (FcPatternGet (pattern, FC_SCALE, 0, &v) == FcResultNoMatch) - { - FcPatternAddDouble (pattern, FC_SCALE, - XftDefaultGetDouble (dpy, FC_SCALE, screen, 1.0)); - } - if (FcPatternGet (pattern, XFT_MAX_GLYPH_MEMORY, 0, &v) == FcResultNoMatch) - { - FcPatternAddInteger (pattern, XFT_MAX_GLYPH_MEMORY, - XftDefaultGetInteger (dpy, XFT_MAX_GLYPH_MEMORY, - screen, - XFT_FONT_MAX_GLYPH_MEMORY)); - } - FcDefaultSubstitute (pattern); -} - diff --git a/nx-X11/lib/Xft/xftdraw.c b/nx-X11/lib/Xft/xftdraw.c deleted file mode 100644 index f9c1cbd6f..000000000 --- a/nx-X11/lib/Xft/xftdraw.c +++ /dev/null @@ -1,993 +0,0 @@ -/* - * $Id: xftdraw.c,v 1.4 2005/07/03 07:00:57 daniels Exp $ - * - * Copyright © 2000 Keith Packard - * - * 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" - -/* - * Ok, this is a pain. To share source pictures across multiple destinations, - * the screen for each drawable must be discovered. - */ - -static int -_XftDrawScreen (Display *dpy, Drawable drawable, Visual *visual) -{ - int s; - Window root; - int x, y; - unsigned int width, height, borderWidth, depth; - /* Special case the most common environment */ - if (ScreenCount (dpy) == 1) - return 0; - /* - * If we've got a visual, look for the screen that points at it. - * This requires no round trip. - */ - if (visual) - { - for (s = 0; s < ScreenCount (dpy); s++) - { - XVisualInfo template, *ret; - int nret; - - template.visualid = visual->visualid; - template.screen = s; - ret = XGetVisualInfo (dpy, VisualIDMask|VisualScreenMask, - &template, &nret); - if (ret) - { - XFree (ret); - return s; - } - } - } - /* - * Otherwise, as the server for the drawable geometry and find - * the screen from the root window. - * This takes a round trip. - */ - if (XGetGeometry (dpy, drawable, &root, &x, &y, &width, &height, - &borderWidth, &depth)) - { - for (s = 0; s < ScreenCount (dpy); s++) - { - if (RootWindow (dpy, s) == root) - return s; - } - } - /* - * Make a guess -- it's probably wrong, but then the app probably - * handed us a bogus drawable in this case - */ - return 0; -} - -unsigned int -XftDrawDepth (XftDraw *draw) -{ - if (!draw->depth) - { - Window root; - int x, y; - unsigned int width, height, borderWidth, depth; - if (XGetGeometry (draw->dpy, draw->drawable, - &root, &x, &y, &width, &height, - &borderWidth, &depth)) - draw->depth = depth; - } - return draw->depth; -} - -unsigned int -XftDrawBitsPerPixel (XftDraw *draw) -{ - if (!draw->bits_per_pixel) - { - XPixmapFormatValues *formats; - int nformats; - unsigned int depth; - - if ((depth = XftDrawDepth (draw)) && - (formats = XListPixmapFormats (draw->dpy, &nformats))) - { - int i; - - for (i = 0; i < nformats; i++) - { - if (formats[i].depth == depth) - { - draw->bits_per_pixel = formats[i].bits_per_pixel; - break; - } - } - XFree (formats); - } - } - return draw->bits_per_pixel; -} - -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->screen = _XftDrawScreen (dpy, drawable, visual); - draw->depth = 0; /* don't find out unless we need to know */ - draw->bits_per_pixel = 0; /* don't find out unless we need to know */ - draw->visual = visual; - draw->colormap = colormap; - draw->render.pict = 0; - draw->core.gc = 0; - draw->core.use_pixmap = 0; - draw->clip_type = XftClipTypeNone; - draw->subwindow_mode = ClipByChildren; - XftMemAlloc (XFT_MEM_DRAW, sizeof (XftDraw)); - 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->screen = _XftDrawScreen (dpy, bitmap, 0); - draw->depth = 1; - draw->bits_per_pixel = 1; - draw->visual = 0; - draw->colormap = 0; - draw->render.pict = 0; - draw->core.gc = 0; - draw->core.use_pixmap = 0; - draw->clip_type = XftClipTypeNone; - draw->subwindow_mode = ClipByChildren; - XftMemAlloc (XFT_MEM_DRAW, sizeof (XftDraw)); - return draw; -} - -XftDraw * -XftDrawCreateAlpha (Display *dpy, - Pixmap pixmap, - int depth) -{ - XftDraw *draw; - - draw = (XftDraw *) malloc (sizeof (XftDraw)); - if (!draw) - return 0; - draw->dpy = dpy; - draw->drawable = (Drawable) pixmap; - draw->screen = _XftDrawScreen (dpy, pixmap, 0); - draw->depth = depth; - draw->bits_per_pixel = 0; /* don't find out until we need it */ - draw->visual = 0; - draw->colormap = 0; - draw->render.pict = 0; - draw->core.gc = 0; - draw->core.use_pixmap = 0; - draw->clip_type = XftClipTypeNone; - draw->subwindow_mode = ClipByChildren; - XftMemAlloc (XFT_MEM_DRAW, sizeof (XftDraw)); - return draw; -} - -static XRenderPictFormat * -_XftDrawFormat (XftDraw *draw) -{ - XftDisplayInfo *info = _XftDisplayInfoGet (draw->dpy, True); - - if (!info->hasRender) - return 0; - - if (draw->visual == 0) - { - XRenderPictFormat pf; - - pf.type = PictTypeDirect; - pf.depth = XftDrawDepth (draw); - pf.direct.alpha = 0; - pf.direct.alphaMask = (1 << pf.depth) - 1; - return XRenderFindFormat (draw->dpy, - (PictFormatType| - PictFormatDepth| - PictFormatAlpha| - PictFormatAlphaMask), - &pf, - 0); - } - else - return XRenderFindVisualFormat (draw->dpy, draw->visual); -} - -void -XftDrawChange (XftDraw *draw, - Drawable drawable) -{ - draw->drawable = drawable; - if (draw->render.pict) - { - XRenderFreePicture (draw->dpy, draw->render.pict); - draw->render.pict = 0; - } - if (draw->core.gc) - { - XFreeGC (draw->dpy, draw->core.gc); - draw->core.gc = 0; - } -} - -Display * -XftDrawDisplay (XftDraw *draw) -{ - return draw->dpy; -} - -Drawable -XftDrawDrawable (XftDraw *draw) -{ - return draw->drawable; -} - -Colormap -XftDrawColormap (XftDraw *draw) -{ - return draw->colormap; -} - -Visual * -XftDrawVisual (XftDraw *draw) -{ - return draw->visual; -} - -void -XftDrawDestroy (XftDraw *draw) -{ - if (draw->render.pict) - XRenderFreePicture (draw->dpy, draw->render.pict); - if (draw->core.gc) - XFreeGC (draw->dpy, draw->core.gc); - switch (draw->clip_type) { - case XftClipTypeRegion: - XDestroyRegion (draw->clip.region); - break; - case XftClipTypeRectangles: - free (draw->clip.rect); - break; - case XftClipTypeNone: - break; - } - XftMemFree (XFT_MEM_DRAW, sizeof (XftDraw)); - free (draw); -} - -Picture -XftDrawSrcPicture (XftDraw *draw, _Xconst XftColor *color) -{ - Display *dpy = draw->dpy; - XftDisplayInfo *info = _XftDisplayInfoGet (dpy, True); - int i; - XftColor bitmapColor; - - if (!info) - return 0; - - /* - * Monochrome targets require special handling; the PictOp controls - * the color, and the color must be opaque - */ - if (!draw->visual && draw->depth == 1) - { - bitmapColor.color.alpha = 0xffff; - bitmapColor.color.red = 0xffff; - bitmapColor.color.green = 0xffff; - bitmapColor.color.blue = 0xffff; - color = &bitmapColor; - } - - /* - * See if there's one already available - */ - for (i = 0; i < XFT_NUM_SOLID_COLOR; i++) - { - if (info->colors[i].pict && - info->colors[i].screen == draw->screen && - !memcmp ((void *) &color->color, - (void *) &info->colors[i].color, - sizeof (XRenderColor))) - return info->colors[i].pict; - } - /* - * Pick one to replace at random - */ - i = (unsigned int) rand () % XFT_NUM_SOLID_COLOR; - /* - * Recreate if it was for the wrong screen - */ - if (info->colors[i].screen != draw->screen && info->colors[i].pict) - { - XRenderFreePicture (dpy, info->colors[i].pict); - info->colors[i].pict = 0; - } - /* - * Create picture if necessary - */ - if (!info->colors[i].pict) - { - Pixmap pix; - XRenderPictureAttributes pa; - - pix = XCreatePixmap (dpy, RootWindow (dpy, draw->screen), 1, 1, - info->solidFormat->depth); - pa.repeat = True; - info->colors[i].pict = XRenderCreatePicture (draw->dpy, - pix, - info->solidFormat, - CPRepeat, &pa); - XFreePixmap (dpy, pix); - } - /* - * Set to the new color - */ - info->colors[i].color = color->color; - info->colors[i].screen = draw->screen; - XRenderFillRectangle (dpy, PictOpSrc, - info->colors[i].pict, - &color->color, 0, 0, 1, 1); - return info->colors[i].pict; -} - -static int -_XftDrawOp (_Xconst XftDraw *draw, _Xconst XftColor *color) -{ - if (draw->visual || draw->depth != 1) - return PictOpOver; - if (color->color.alpha >= 0x8000) - return PictOpOver; - return PictOpOutReverse; -} - -static FcBool -_XftDrawRenderPrepare (XftDraw *draw) -{ - if (!draw->render.pict) - { - XRenderPictFormat *format; - XRenderPictureAttributes pa; - unsigned long mask = 0; - - format = _XftDrawFormat (draw); - if (!format) - return FcFalse; - - if (draw->subwindow_mode == IncludeInferiors) - { - pa.subwindow_mode = IncludeInferiors; - mask |= CPSubwindowMode; - } - draw->render.pict = XRenderCreatePicture (draw->dpy, draw->drawable, - format, mask, &pa); - if (!draw->render.pict) - return FcFalse; - switch (draw->clip_type) { - case XftClipTypeRegion: - XRenderSetPictureClipRegion (draw->dpy, draw->render.pict, - draw->clip.region); - break; - case XftClipTypeRectangles: - XRenderSetPictureClipRectangles (draw->dpy, draw->render.pict, - draw->clip.rect->xOrigin, - draw->clip.rect->yOrigin, - XftClipRects(draw->clip.rect), - draw->clip.rect->n); - break; - case XftClipTypeNone: - break; - } - } - return FcTrue; -} - -static FcBool -_XftDrawCorePrepare (XftDraw *draw, _Xconst XftColor *color) -{ - if (!draw->core.gc) - { - XGCValues gcv; - unsigned long mask = 0; - if (draw->subwindow_mode == IncludeInferiors) - { - gcv.subwindow_mode = IncludeInferiors; - mask |= GCSubwindowMode; - } - draw->core.gc = XCreateGC (draw->dpy, draw->drawable, mask, &gcv); - if (!draw->core.gc) - return FcFalse; - switch (draw->clip_type) { - case XftClipTypeRegion: - XSetRegion (draw->dpy, draw->core.gc, draw->clip.region); - break; - case XftClipTypeRectangles: - XSetClipRectangles (draw->dpy, draw->core.gc, - draw->clip.rect->xOrigin, - draw->clip.rect->yOrigin, - XftClipRects (draw->clip.rect), - draw->clip.rect->n, - Unsorted); - break; - case XftClipTypeNone: - break; - } - } - XSetForeground (draw->dpy, draw->core.gc, color->pixel); - return FcTrue; -} - -Picture -XftDrawPicture (XftDraw *draw) -{ - if (!_XftDrawRenderPrepare (draw)) - return 0; - return draw->render.pict; -} - -#define NUM_LOCAL 1024 - -void -XftDrawGlyphs (XftDraw *draw, - _Xconst XftColor *color, - XftFont *pub, - int x, - int y, - _Xconst FT_UInt *glyphs, - int nglyphs) -{ - XftFontInt *font = (XftFontInt *) pub; - - if (font->format) - { - Picture src; - - if (_XftDrawRenderPrepare (draw) && - (src = XftDrawSrcPicture (draw, color))) - XftGlyphRender (draw->dpy, _XftDrawOp (draw, color), - src, pub, draw->render.pict, - 0, 0, x, y, glyphs, nglyphs); - } - else - { - if (_XftDrawCorePrepare (draw, color)) - XftGlyphCore (draw, color, pub, x, y, glyphs, nglyphs); - } -} - -void -XftDrawString8 (XftDraw *draw, - _Xconst XftColor *color, - XftFont *pub, - int x, - int y, - _Xconst FcChar8 *string, - int len) -{ - FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; - int i; - - if (XftDebug () & XFT_DBG_DRAW) - printf ("DrawString \"%*.*s\"\n", len, len, string); - - if (len <= NUM_LOCAL) - glyphs = glyphs_local; - else - { - glyphs = malloc (len * sizeof (FT_UInt)); - if (!glyphs) - return; - } - for (i = 0; i < len; i++) - glyphs[i] = XftCharIndex (draw->dpy, pub, string[i]); - XftDrawGlyphs (draw, color, pub, x, y, glyphs, len); - if (glyphs != glyphs_local) - free (glyphs); -} - -void -XftDrawString16 (XftDraw *draw, - _Xconst XftColor *color, - XftFont *pub, - int x, - int y, - _Xconst FcChar16 *string, - int len) -{ - FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; - int i; - - if (len <= NUM_LOCAL) - glyphs = glyphs_local; - else - { - glyphs = malloc (len * sizeof (FT_UInt)); - if (!glyphs) - return; - } - for (i = 0; i < len; i++) - glyphs[i] = XftCharIndex (draw->dpy, pub, string[i]); - - XftDrawGlyphs (draw, color, pub, x, y, glyphs, len); - if (glyphs != glyphs_local) - free (glyphs); -} - -void -XftDrawString32 (XftDraw *draw, - _Xconst XftColor *color, - XftFont *pub, - int x, - int y, - _Xconst FcChar32 *string, - int len) -{ - FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; - int i; - - if (len <= NUM_LOCAL) - glyphs = glyphs_local; - else - { - glyphs = malloc (len * sizeof (FT_UInt)); - if (!glyphs) - return; - } - for (i = 0; i < len; i++) - glyphs[i] = XftCharIndex (draw->dpy, pub, string[i]); - - XftDrawGlyphs (draw, color, pub, x, y, glyphs, len); - if (glyphs != glyphs_local) - free (glyphs); -} - -void -XftDrawStringUtf8 (XftDraw *draw, - _Xconst XftColor *color, - XftFont *pub, - int x, - int y, - _Xconst FcChar8 *string, - int len) -{ - FT_UInt *glyphs, *glyphs_new, glyphs_local[NUM_LOCAL]; - FcChar32 ucs4; - int i; - int l; - int size; - - i = 0; - glyphs = glyphs_local; - size = NUM_LOCAL; - while (len && (l = FcUtf8ToUcs4 (string, &ucs4, len)) > 0) - { - if (i == size) - { - glyphs_new = malloc (size * 2 * sizeof (FT_UInt)); - if (!glyphs_new) - { - if (glyphs != glyphs_local) - free (glyphs); - return; - } - memcpy (glyphs_new, glyphs, size * sizeof (FT_UInt)); - size *= 2; - if (glyphs != glyphs_local) - free (glyphs); - glyphs = glyphs_new; - } - glyphs[i++] = XftCharIndex (draw->dpy, pub, ucs4); - string += l; - len -= l; - } - XftDrawGlyphs (draw, color, pub, x, y, glyphs, i); - if (glyphs != glyphs_local) - free (glyphs); -} - -void -XftDrawStringUtf16 (XftDraw *draw, - _Xconst XftColor *color, - XftFont *pub, - int x, - int y, - _Xconst FcChar8 *string, - FcEndian endian, - int len) -{ - FT_UInt *glyphs, *glyphs_new, glyphs_local[NUM_LOCAL]; - FcChar32 ucs4; - int i; - int l; - int size; - - i = 0; - glyphs = glyphs_local; - size = NUM_LOCAL; - while (len && (l = FcUtf16ToUcs4 (string, endian, &ucs4, len)) > 0) - { - if (i == size) - { - glyphs_new = malloc (size * 2 * sizeof (FT_UInt)); - if (!glyphs_new) - { - if (glyphs != glyphs_local) - free (glyphs); - return; - } - memcpy (glyphs_new, glyphs, size * sizeof (FT_UInt)); - size *= 2; - if (glyphs != glyphs_local) - free (glyphs); - glyphs = glyphs_new; - } - glyphs[i++] = XftCharIndex (draw->dpy, pub, ucs4); - string += l; - len -= l; - } - XftDrawGlyphs (draw, color, pub, x, y, glyphs, i); - if (glyphs != glyphs_local) - free (glyphs); -} - -void -XftDrawGlyphSpec (XftDraw *draw, - _Xconst XftColor *color, - XftFont *pub, - _Xconst XftGlyphSpec *glyphs, - int len) -{ - XftFontInt *font = (XftFontInt *) pub; - - if (font->format) - { - Picture src; - - if (_XftDrawRenderPrepare (draw) && - (src = XftDrawSrcPicture (draw, color))) - { - XftGlyphSpecRender (draw->dpy, _XftDrawOp (draw, color), - src, pub, draw->render.pict, - 0, 0, glyphs, len); - } - } - else - { - if (_XftDrawCorePrepare (draw, color)) - XftGlyphSpecCore (draw, color, pub, glyphs, len); - } -} - -void -XftDrawGlyphFontSpec (XftDraw *draw, - _Xconst XftColor *color, - _Xconst XftGlyphFontSpec *glyphs, - int len) -{ - int i; - int start; - - i = 0; - while (i < len) - { - start = i; - if (((XftFontInt *) glyphs[i].font)->format) - { - Picture src; - while (i < len && ((XftFontInt *) glyphs[i].font)->format) - i++; - if (_XftDrawRenderPrepare (draw) && - (src = XftDrawSrcPicture (draw, color))) - { - XftGlyphFontSpecRender (draw->dpy, _XftDrawOp (draw, color), - src, draw->render.pict, - 0, 0, glyphs + start , i - start); - } - } - else - { - while (i < len && !((XftFontInt *) glyphs[i].font)->format) - i++; - if (_XftDrawCorePrepare (draw, color)) - XftGlyphFontSpecCore (draw, color, glyphs + start, i - start); - } - } -} - -void -XftDrawCharSpec (XftDraw *draw, - _Xconst XftColor *color, - XftFont *pub, - _Xconst XftCharSpec *chars, - int len) -{ - XftGlyphSpec *glyphs, glyphs_local[NUM_LOCAL]; - int i; - - if (len <= NUM_LOCAL) - glyphs = glyphs_local; - else - { - glyphs = malloc (len * sizeof (XftGlyphSpec)); - if (!glyphs) - return; - } - for (i = 0; i < len; i++) - { - glyphs[i].glyph = XftCharIndex(draw->dpy, pub, chars[i].ucs4); - glyphs[i].x = chars[i].x; - glyphs[i].y = chars[i].y; - } - - XftDrawGlyphSpec (draw, color, pub, glyphs, len); - if (glyphs != glyphs_local) - free (glyphs); -} - -void -XftDrawCharFontSpec (XftDraw *draw, - _Xconst XftColor *color, - _Xconst XftCharFontSpec *chars, - int len) -{ - XftGlyphFontSpec *glyphs, glyphs_local[NUM_LOCAL]; - int i; - - if (len <= NUM_LOCAL) - glyphs = glyphs_local; - else - { - glyphs = malloc (len * sizeof (XftGlyphFontSpec)); - if (!glyphs) - return; - } - for (i = 0; i < len; i++) - { - glyphs[i].font = chars[i].font; - glyphs[i].glyph = XftCharIndex(draw->dpy, glyphs[i].font, chars[i].ucs4); - glyphs[i].x = chars[i].x; - glyphs[i].y = chars[i].y; - } - - XftDrawGlyphFontSpec (draw, color, glyphs, len); - if (glyphs != glyphs_local) - free (glyphs); -} - -void -XftDrawRect (XftDraw *draw, - _Xconst XftColor *color, - int x, - int y, - unsigned int width, - unsigned int height) -{ - if (_XftDrawRenderPrepare (draw)) - { - XRenderFillRectangle (draw->dpy, PictOpSrc, draw->render.pict, - &color->color, x, y, width, height); - } - else if (_XftDrawCorePrepare (draw, color)) - { - XftRectCore (draw, color, x, y, width, height); - } -} - -Bool -XftDrawSetClip (XftDraw *draw, - Region r) -{ - Region n = 0; - - /* - * Check for quick exits - */ - if (!r && draw->clip_type == XftClipTypeNone) - return True; - - if (r && - draw->clip_type == XftClipTypeRegion && - XEqualRegion (r, draw->clip.region)) - { - return True; - } - - /* - * Duplicate the region so future changes can be short circuited - */ - if (r) - { - n = XCreateRegion (); - if (n) - { - if (!XUnionRegion (n, r, n)) - { - XDestroyRegion (n); - return False; - } - } - } - - /* - * Destroy existing clip - */ - switch (draw->clip_type) { - case XftClipTypeRegion: - XDestroyRegion (draw->clip.region); - break; - case XftClipTypeRectangles: - free (draw->clip.rect); - break; - case XftClipTypeNone: - break; - } - - /* - * Set the clip - */ - if (n) - { - draw->clip_type = XftClipTypeRegion; - draw->clip.region = n; - } - else - { - draw->clip_type = XftClipTypeNone; - } - /* - * Apply new clip to existing objects - */ - if (draw->render.pict) - { - if (n) - XRenderSetPictureClipRegion (draw->dpy, draw->render.pict, n); - else - { - XRenderPictureAttributes pa; - pa.clip_mask = None; - XRenderChangePicture (draw->dpy, draw->render.pict, - CPClipMask, &pa); - } - } - if (draw->core.gc) - { - if (n) - XSetRegion (draw->dpy, draw->core.gc, draw->clip.region); - else - XSetClipMask (draw->dpy, draw->core.gc, None); - } - return True; -} - -Bool -XftDrawSetClipRectangles (XftDraw *draw, - int xOrigin, - int yOrigin, - _Xconst XRectangle *rects, - int n) -{ - XftClipRect *new = 0; - - /* - * Check for quick exit - */ - if (draw->clip_type == XftClipTypeRectangles && - draw->clip.rect->n == n && - (n == 0 || (draw->clip.rect->xOrigin == xOrigin && - draw->clip.rect->yOrigin == yOrigin)) && - !memcmp (XftClipRects (draw->clip.rect), rects, n * sizeof (XRectangle))) - { - return True; - } - - /* - * Duplicate the region so future changes can be short circuited - */ - new = malloc (sizeof (XftClipRect) + n * sizeof (XRectangle)); - if (!new) - return False; - - new->n = n; - new->xOrigin = xOrigin; - new->yOrigin = yOrigin; - memcpy (XftClipRects (new), rects, n * sizeof (XRectangle)); - - /* - * Destroy existing clip - */ - switch (draw->clip_type) { - case XftClipTypeRegion: - XDestroyRegion (draw->clip.region); - break; - case XftClipTypeRectangles: - free (draw->clip.rect); - break; - case XftClipTypeNone: - break; - } - - /* - * Set the clip - */ - draw->clip_type = XftClipTypeRectangles; - draw->clip.rect = new; - /* - * Apply new clip to existing objects - */ - if (draw->render.pict) - { - XRenderSetPictureClipRectangles (draw->dpy, draw->render.pict, - new->xOrigin, - new->yOrigin, - XftClipRects(new), - new->n); - } - if (draw->core.gc) - { - XSetClipRectangles (draw->dpy, draw->core.gc, - new->xOrigin, - new->yOrigin, - XftClipRects (new), - new->n, - Unsorted); - } - return True; -} - -void -XftDrawSetSubwindowMode (XftDraw *draw, int mode) -{ - if (mode == draw->subwindow_mode) - return; - draw->subwindow_mode = mode; - if (draw->render.pict) - { - XRenderPictureAttributes pa; - - pa.subwindow_mode = mode; - XRenderChangePicture (draw->dpy, draw->render.pict, - CPSubwindowMode, &pa); - } - if (draw->core.gc) - XSetSubwindowMode (draw->dpy, draw->core.gc, mode); -} diff --git a/nx-X11/lib/Xft/xftextent.c b/nx-X11/lib/Xft/xftextent.c deleted file mode 100644 index bc746bebe..000000000 --- a/nx-X11/lib/Xft/xftextent.c +++ /dev/null @@ -1,287 +0,0 @@ -/* - * $Id: xftextent.c,v 1.4 2005/07/03 07:00:57 daniels Exp $ - * - * Copyright © 2000 Keith Packard - * - * 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" - -void -XftGlyphExtents (Display *dpy, - XftFont *pub, - _Xconst FT_UInt *glyphs, - int nglyphs, - XGlyphInfo *extents) -{ - XftFontInt *font = (XftFontInt *) pub; - FT_UInt missing[XFT_NMISSING]; - int nmissing; - int n; - _Xconst FT_UInt *g; - FT_UInt glyph; - XftGlyph *xftg; - FcBool glyphs_loaded; - int x, y; - int left, right, top, bottom; - int overall_left, overall_right; - int overall_top, overall_bottom; - - g = glyphs; - n = nglyphs; - nmissing = 0; - glyphs_loaded = FcFalse; - while (n--) - if (XftFontCheckGlyph (dpy, pub, FcFalse, *g++, missing, &nmissing)) - glyphs_loaded = FcTrue; - if (nmissing) - XftFontLoadGlyphs (dpy, pub, FcFalse, missing, nmissing); - g = glyphs; - n = nglyphs; - xftg = 0; - while (n) - { - glyph = *g++; - n--; - if (glyph < font->num_glyphs && - (xftg = font->glyphs[glyph])) - break; - } - if (n == 0) - { - if (xftg) - *extents = xftg->metrics; - else - memset (extents, '\0', sizeof (*extents)); - } - else - { - x = 0; - y = 0; - overall_left = x - xftg->metrics.x; - overall_top = y - xftg->metrics.y; - overall_right = overall_left + (int) xftg->metrics.width; - overall_bottom = overall_top + (int) xftg->metrics.height; - x += xftg->metrics.xOff; - y += xftg->metrics.yOff; - while (n--) - { - glyph = *g++; - if (glyph < font->num_glyphs && (xftg = font->glyphs[glyph])) - { - left = x - xftg->metrics.x; - top = y - xftg->metrics.y; - right = left + (int) xftg->metrics.width; - bottom = top + (int) xftg->metrics.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 += xftg->metrics.xOff; - y += xftg->metrics.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; - } - if (glyphs_loaded) - _XftFontManageMemory (dpy, pub); -} - -#define NUM_LOCAL 1024 - -void -XftTextExtents8 (Display *dpy, - XftFont *pub, - _Xconst FcChar8 *string, - int len, - XGlyphInfo *extents) -{ - FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; - int i; - - if (len <= NUM_LOCAL) - glyphs = glyphs_local; - else - { - glyphs = malloc (len * sizeof (FT_UInt)); - if (!glyphs) - { - memset (extents, '\0', sizeof (XGlyphInfo)); - return; - } - } - for (i = 0; i < len; i++) - glyphs[i] = XftCharIndex (dpy, pub, string[i]); - XftGlyphExtents (dpy, pub, glyphs, len, extents); - if (glyphs != glyphs_local) - free (glyphs); -} - -void -XftTextExtents16 (Display *dpy, - XftFont *pub, - _Xconst FcChar16 *string, - int len, - XGlyphInfo *extents) -{ - FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; - int i; - - if (len <= NUM_LOCAL) - glyphs = glyphs_local; - else - { - glyphs = malloc (len * sizeof (FT_UInt)); - if (!glyphs) - { - memset (extents, '\0', sizeof (XGlyphInfo)); - return; - } - } - for (i = 0; i < len; i++) - glyphs[i] = XftCharIndex (dpy, pub, string[i]); - XftGlyphExtents (dpy, pub, glyphs, len, extents); - if (glyphs != glyphs_local) - free (glyphs); -} - -void -XftTextExtents32 (Display *dpy, - XftFont *pub, - _Xconst FcChar32 *string, - int len, - XGlyphInfo *extents) -{ - FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; - int i; - - if (len <= NUM_LOCAL) - glyphs = glyphs_local; - else - { - glyphs = malloc (len * sizeof (FT_UInt)); - if (!glyphs) - { - memset (extents, '\0', sizeof (XGlyphInfo)); - return; - } - } - for (i = 0; i < len; i++) - glyphs[i] = XftCharIndex (dpy, pub, string[i]); - XftGlyphExtents (dpy, pub, glyphs, len, extents); - if (glyphs != glyphs_local) - free (glyphs); -} - -void -XftTextExtentsUtf8 (Display *dpy, - XftFont *pub, - _Xconst FcChar8 *string, - int len, - XGlyphInfo *extents) -{ - FT_UInt *glyphs, *glyphs_new, glyphs_local[NUM_LOCAL]; - FcChar32 ucs4; - int i; - int l; - int size; - - i = 0; - glyphs = glyphs_local; - size = NUM_LOCAL; - while (len && (l = FcUtf8ToUcs4 (string, &ucs4, len)) > 0) - { - if (i == size) - { - glyphs_new = malloc (size * 2 * sizeof (FT_UInt)); - if (!glyphs_new) - { - if (glyphs != glyphs_local) - free (glyphs); - memset (extents, '\0', sizeof (XGlyphInfo)); - return; - } - memcpy (glyphs_new, glyphs, size * sizeof (FT_UInt)); - size *= 2; - if (glyphs != glyphs_local) - free (glyphs); - glyphs = glyphs_new; - } - glyphs[i++] = XftCharIndex (dpy, pub, ucs4); - string += l; - len -= l; - } - XftGlyphExtents (dpy, pub, glyphs, i, extents); - if (glyphs != glyphs_local) - free (glyphs); -} - -void -XftTextExtentsUtf16 (Display *dpy, - XftFont *pub, - _Xconst FcChar8 *string, - FcEndian endian, - int len, - XGlyphInfo *extents) -{ - FT_UInt *glyphs, *glyphs_new, glyphs_local[NUM_LOCAL]; - FcChar32 ucs4; - int i; - int l; - int size; - - i = 0; - glyphs = glyphs_local; - size = NUM_LOCAL; - while (len && (l = FcUtf16ToUcs4 (string, endian, &ucs4, len)) > 0) - { - if (i == size) - { - glyphs_new = malloc (size * 2 * sizeof (FT_UInt)); - if (!glyphs_new) - { - if (glyphs != glyphs_local) - free (glyphs); - memset (extents, '\0', sizeof (XGlyphInfo)); - return; - } - memcpy (glyphs_new, glyphs, size * sizeof (FT_UInt)); - size *= 2; - if (glyphs != glyphs_local) - free (glyphs); - glyphs = glyphs_new; - } - glyphs[i++] = XftCharIndex (dpy, pub, ucs4); - string += l; - len -= l; - } - XftGlyphExtents (dpy, pub, glyphs, i, extents); - if (glyphs != glyphs_local) - free (glyphs); -} diff --git a/nx-X11/lib/Xft/xftfont.c b/nx-X11/lib/Xft/xftfont.c deleted file mode 100644 index b68fa7d26..000000000 --- a/nx-X11/lib/Xft/xftfont.c +++ /dev/null @@ -1,208 +0,0 @@ -/* - * $Id: xftfont.c,v 1.4 2005/07/03 07:00:57 daniels Exp $ - * - * Copyright © 2000 Keith Packard - * - * 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" - -FcPattern * -XftFontMatch (Display *dpy, - int screen, - _Xconst FcPattern *pattern, - FcResult *result) -{ - FcPattern *new; - FcPattern *match; - - if (!XftInit (0)) - return 0; - - new = FcPatternDuplicate (pattern); - if (!new) - return 0; - - if (XftDebug () & XFT_DBG_OPENV) - { - printf ("XftFontMatch pattern "); - FcPatternPrint (new); - } - FcConfigSubstitute (0, new, FcMatchPattern); - if (XftDebug () & XFT_DBG_OPENV) - { - printf ("XftFontMatch after FcConfig substitutions "); - FcPatternPrint (new); - } - XftDefaultSubstitute (dpy, screen, new); - if (XftDebug () & XFT_DBG_OPENV) - { - printf ("XftFontMatch after X resource substitutions "); - FcPatternPrint (new); - } - - match = FcFontMatch (0, new, result); - if (XftDebug () & XFT_DBG_OPENV) - { - printf ("XftFontMatch result "); - FcPatternPrint (match); - } - FcPatternDestroy (new); - return match; -} - -XftFont * -XftFontOpen (Display *dpy, int screen, ...) -{ - va_list va; - FcPattern *pat; - FcPattern *match; - FcResult result; - XftFont *font; - - va_start (va, screen); - pat = FcPatternVaBuild (0, va); - va_end (va); - if (!pat) - { - if (XftDebug () & XFT_DBG_OPEN) - printf ("XftFontOpen: Invalid pattern argument\n"); - return 0; - } - match = XftFontMatch (dpy, screen, pat, &result); - if (XftDebug () & XFT_DBG_OPEN) - { - printf ("Pattern "); - FcPatternPrint (pat); - if (match) - { - printf ("Match "); - FcPatternPrint (match); - } - else - printf ("No Match\n"); - } - FcPatternDestroy (pat); - if (!match) - return 0; - - font = XftFontOpenPattern (dpy, match); - if (!font) - { - if (XftDebug () & XFT_DBG_OPEN) - printf ("No Font\n"); - FcPatternDestroy (match); - } - - return font; -} - -XftFont * -XftFontOpenName (Display *dpy, int screen, const char *name) -{ - FcPattern *pat; - FcPattern *match; - FcResult result; - XftFont *font; - - pat = FcNameParse ((FcChar8 *) name); - if (XftDebug () & XFT_DBG_OPEN) - { - printf ("XftFontOpenName \"%s\": ", name); - if (pat) - FcPatternPrint (pat); - else - printf ("Invalid name\n"); - } - - if (!pat) - return 0; - match = XftFontMatch (dpy, screen, pat, &result); - if (XftDebug () & XFT_DBG_OPEN) - { - if (match) - { - printf ("Match "); - FcPatternPrint (match); - } - else - printf ("No Match\n"); - } - FcPatternDestroy (pat); - if (!match) - return 0; - - font = XftFontOpenPattern (dpy, match); - if (!font) - { - if (XftDebug () & XFT_DBG_OPEN) - printf ("No Font\n"); - FcPatternDestroy (match); - } - - return font; -} - -XftFont * -XftFontOpenXlfd (Display *dpy, int screen, const char *xlfd) -{ - FcPattern *pat; - FcPattern *match; - FcResult result; - XftFont *font; - - pat = XftXlfdParse (xlfd, FcFalse, FcFalse); - if (XftDebug () & XFT_DBG_OPEN) - { - printf ("XftFontOpenXlfd \"%s\": ", xlfd); - if (pat) - printf ("Invalid xlfd\n"); - else - FcPatternPrint (pat); - } - - if (!pat) - return 0; - match = XftFontMatch (dpy, screen, pat, &result); - if (XftDebug () & XFT_DBG_OPEN) - { - if (match) - { - printf ("Match "); - FcPatternPrint (match); - } - else - printf ("No Match\n"); - } - FcPatternDestroy (pat); - if (!match) - return 0; - - font = XftFontOpenPattern (dpy, match); - if (!font) - { - if (XftDebug () & XFT_DBG_OPEN) - printf ("No Font\n"); - FcPatternDestroy (match); - } - - return font; -} - diff --git a/nx-X11/lib/Xft/xftfreetype.c b/nx-X11/lib/Xft/xftfreetype.c deleted file mode 100644 index abc7c8556..000000000 --- a/nx-X11/lib/Xft/xftfreetype.c +++ /dev/null @@ -1,1156 +0,0 @@ -/* - * $Id: xftfreetype.c,v 1.5 2005/07/03 07:00:57 daniels Exp $ - * - * Copyright © 2000 Keith Packard - * - * 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" - -FT_Library _XftFTlibrary; - -#define FT_Matrix_Equal(a,b) ((a)->xx == (b)->xx && \ - (a)->yy == (b)->yy && \ - (a)->xy == (b)->xy && \ - (a)->yx == (b)->yx) -/* - * List of all open files (each face in a file is managed separately) - */ - -static XftFtFile *_XftFtFiles; -int XftMaxFreeTypeFiles = 5; - -static XftFtFile * -_XftGetFile (const FcChar8 *file, int id) -{ - XftFtFile *f; - - if (!XftInitFtLibrary ()) - return 0; - - for (f = _XftFtFiles; f; f = f->next) - { - if (!strcmp (f->file, (char *) file) && f->id == id) - { - ++f->ref; - if (XftDebug () & XFT_DBG_REF) - printf ("FontFile %s/%d matches existing (%d)\n", - file, id, f->ref); - return f; - } - } - f = malloc (sizeof (XftFtFile) + strlen ((char *) file) + 1); - if (!f) - return 0; - - XftMemAlloc (XFT_MEM_FILE, sizeof (XftFtFile) + strlen ((char *) file) + 1); - if (XftDebug () & 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, (char *) file); - f->id = id; - - f->lock = 0; - f->face = 0; - f->xsize = 0; - f->ysize = 0; - f->matrix.xx = f->matrix.xy = f->matrix.yx = f->matrix.yy = 0; - return f; -} - -static XftFtFile * -_XftGetFaceFile (FT_Face face) -{ - XftFtFile *f; - - f = malloc (sizeof (XftFtFile)); - if (!f) - return 0; - XftMemAlloc (XFT_MEM_FILE, sizeof(XftFtFile)); - f->next = 0; - - f->ref = 1; - - f->file = 0; - f->id = 0; - f->lock = 0; - f->face = face; - f->xsize = 0; - f->ysize = 0; - f->matrix.xx = f->matrix.xy = f->matrix.yx = f->matrix.yy = 0; - return f; -} - -static int -_XftNumFiles (void) -{ - XftFtFile *f; - int count = 0; - for (f = _XftFtFiles; f; f = f->next) - if (f->face && !f->lock) - ++count; - return count; -} - -static XftFtFile * -_XftNthFile (int n) -{ - XftFtFile *f; - int count = 0; - for (f = _XftFtFiles; f; f = f->next) - if (f->face && !f->lock) - if (count++ == n) - break; - return f; -} - -static void -_XftUncacheFiles (void) -{ - int n; - XftFtFile *f; - while ((n = _XftNumFiles ()) > XftMaxFreeTypeFiles) - { - f = _XftNthFile (rand () % n); - if (f) - { - if (XftDebug() & XFT_DBG_REF) - printf ("Discard file %s/%d from cache\n", - f->file, f->id); - FT_Done_Face (f->face); - f->face = 0; - } - } -} - -static FT_Face -_XftLockFile (XftFtFile *f) -{ - ++f->lock; - if (!f->face) - { - if (XftDebug() & XFT_DBG_REF) - printf ("Loading file %s/%d\n", f->file, f->id); - if (FT_New_Face (_XftFTlibrary, f->file, f->id, &f->face)) - --f->lock; - - f->xsize = 0; - f->ysize = 0; - f->matrix.xx = f->matrix.xy = f->matrix.yx = f->matrix.yy = 0; - _XftUncacheFiles (); - } - return f->face; -} - -static void -_XftLockError (char *reason) -{ - fprintf (stderr, "Xft: locking error %s\n", reason); -} - -static void -_XftUnlockFile (XftFtFile *f) -{ - if (--f->lock < 0) - _XftLockError ("too many file unlocks"); -} - -#if HAVE_FT_BITMAP_SIZE_Y_PPEM -#define X_SIZE(face,i) ((face)->available_sizes[i].x_ppem) -#define Y_SIZE(face,i) ((face)->available_sizes[i].y_ppem) -#else -#define X_SIZE(face,i) ((face)->available_sizes[i].width << 6) -#define Y_SIZE(face,i) ((face)->available_sizes[i].height << 6) -#endif - -FcBool -_XftSetFace (XftFtFile *f, FT_F26Dot6 xsize, FT_F26Dot6 ysize, FT_Matrix *matrix) -{ - FT_Face face = f->face; - - if (f->xsize != xsize || f->ysize != ysize) - { - if (XftDebug() & XFT_DBG_GLYPH) - printf ("Set face size to %dx%d (%dx%d)\n", - (int) (xsize >> 6), (int) (ysize >> 6), (int) xsize, (int) ysize); - /* - * Bitmap only faces must match exactly, so find the closest - * one (height dominant search) - */ - if (!(face->face_flags & FT_FACE_FLAG_SCALABLE)) - { - int i, best = 0; - -#define xft_abs(a) ((a) < 0 ? -(a) : (a)) -#define dist(a,b) (xft_abs((a)-(b))) - - for (i = 1; i < face->num_fixed_sizes; i++) - { - if (dist (ysize, Y_SIZE(face,i)) < - dist (ysize, Y_SIZE(face, best)) || - (dist (ysize, Y_SIZE(face, i)) == - dist (ysize, Y_SIZE(face, best)) && - dist (xsize, X_SIZE(face, i)) < - dist (xsize, X_SIZE(face, best)))) - { - best = i; - } - } - /* - * Freetype 2.1.7 and earlier used width/height - * for matching sizes in the BDF and PCF loaders. - * This has been fixed for 2.1.8. Because BDF and PCF - * files have but a single strike per file, we can - * simply try both sizes. - */ - if ( -#if HAVE_FT_BITMAP_SIZE_Y_PPEM - FT_Set_Char_Size (face, face->available_sizes[best].x_ppem, - face->available_sizes[best].y_ppem, 0, 0) != 0 - && -#endif - FT_Set_Char_Size (face, face->available_sizes[best].width << 6, - face->available_sizes[best].height << 6, - 0, 0) != 0) - { - return False; - } - } - else - { - if (FT_Set_Char_Size (face, xsize, ysize, 0, 0)) - { - return False; - } - } - f->xsize = xsize; - f->ysize = ysize; - } - if (!FT_Matrix_Equal (&f->matrix, matrix)) - { - if (XftDebug() & 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; - } - return True; -} - -static void -_XftReleaseFile (XftFtFile *f) -{ - XftFtFile **prev; - - if (--f->ref != 0) - return; - if (f->lock) - _XftLockError ("Attempt to close locked file"); - if (f->file) - { - for (prev = &_XftFtFiles; *prev; prev = &(*prev)->next) - { - if (*prev == f) - { - *prev = f->next; - break; - } - } - if (f->face) - FT_Done_Face (f->face); - } - XftMemFree (XFT_MEM_FILE, - sizeof (XftFtFile) + (f->file ? strlen (f->file) + 1 : 0)); - free (f); -} - -/* - * Find a prime larger than the minimum reasonable hash size - */ - -static FcChar32 -_XftSqrt (FcChar32 a) -{ - FcChar32 l, h, m; - - l = 2; - h = a/2; - while ((h-l) > 1) - { - m = (h+l) >> 1; - if (m * m < a) - l = m; - else - h = m; - } - return h; -} - -static FcBool -_XftIsPrime (FcChar32 i) -{ - FcChar32 l, t; - - if (i < 2) - return FcFalse; - if ((i & 1) == 0) - { - if (i == 2) - return FcTrue; - return FcFalse; - } - l = _XftSqrt (i) + 1; - for (t = 3; t <= l; t += 2) - if (i % t == 0) - return FcFalse; - return FcTrue; -} - -static FcChar32 -_XftHashSize (FcChar32 num_unicode) -{ - /* at least 31.25 % extra space */ - FcChar32 hash = num_unicode + (num_unicode >> 2) + (num_unicode >> 4); - - if ((hash & 1) == 0) - hash++; - while (!_XftIsPrime (hash)) - hash += 2; - return hash; -} - -FT_Face -XftLockFace (XftFont *public) -{ - XftFontInt *font = (XftFontInt *) public; - XftFontInfo *fi = &font->info; - FT_Face face; - - face = _XftLockFile (fi->file); - /* - * Make sure the face is usable at the requested size - */ - if (face && !_XftSetFace (fi->file, fi->xsize, fi->ysize, &fi->matrix)) - { - _XftUnlockFile (fi->file); - face = 0; - } - return face; -} - -void -XftUnlockFace (XftFont *public) -{ - XftFontInt *font = (XftFontInt *) public; - _XftUnlockFile (font->info.file); -} - -static FcBool -XftFontInfoFill (Display *dpy, _Xconst FcPattern *pattern, XftFontInfo *fi) -{ - XftDisplayInfo *info = _XftDisplayInfoGet (dpy, True); - FcChar8 *filename; - int id; - double dsize; - double aspect; - FcMatrix *font_matrix; - FcBool hinting, vertical_layout, autohint, global_advance; -#ifdef FC_HINT_STYLE - int hint_style; -#endif - FcChar32 hash, *hashp; - FT_Face face; - int nhash; - - if (!info) - return FcFalse; - - /* - * Find the associated file - */ - switch (FcPatternGetString (pattern, FC_FILE, 0, &filename)) { - case FcResultNoMatch: - filename = 0; - break; - case FcResultMatch: - break; - default: - goto bail0; - } - - switch (FcPatternGetInteger (pattern, FC_INDEX, 0, &id)) { - case FcResultNoMatch: - id = 0; - break; - case FcResultMatch: - break; - default: - goto bail0; - } - - if (filename) - fi->file = _XftGetFile (filename, id); - else if (FcPatternGetFTFace (pattern, FC_FT_FACE, 0, &face) == FcResultMatch - && face) - fi->file = _XftGetFaceFile (face); - else - fi->file = 0; - if (!fi->file) - goto bail0; - - /* - * Compute pixel size - */ - if (FcPatternGetDouble (pattern, FC_PIXEL_SIZE, 0, &dsize) != FcResultMatch) - goto bail1; - - if (FcPatternGetDouble (pattern, FC_ASPECT, 0, &aspect) != FcResultMatch) - aspect = 1.0; - - fi->ysize = (FT_F26Dot6) (dsize * 64.0); - fi->xsize = (FT_F26Dot6) (dsize * aspect * 64.0); - - if (XftDebug() & XFT_DBG_OPEN) - printf ("XftFontInfoFill: %s: %d (%g pixels)\n", - (filename ? filename : (FcChar8 *) ""), id, dsize); - /* - * Get antialias value - */ - switch (FcPatternGetBool (pattern, FC_ANTIALIAS, 0, &fi->antialias)) { - case FcResultNoMatch: - fi->antialias = True; - break; - case FcResultMatch: - break; - default: - goto bail1; - } - - /* - * Get rgba value - */ - switch (FcPatternGetInteger (pattern, FC_RGBA, 0, &fi->rgba)) { - case FcResultNoMatch: - fi->rgba = FC_RGBA_UNKNOWN; - break; - case FcResultMatch: - break; - default: - goto bail1; - } - - /* - * Get matrix and transform values - */ - switch (FcPatternGetMatrix (pattern, FC_MATRIX, 0, &font_matrix)) { - case FcResultNoMatch: - fi->matrix.xx = fi->matrix.yy = 0x10000; - fi->matrix.xy = fi->matrix.yx = 0; - break; - case FcResultMatch: - fi->matrix.xx = 0x10000L * font_matrix->xx; - fi->matrix.yy = 0x10000L * font_matrix->yy; - fi->matrix.xy = 0x10000L * font_matrix->xy; - fi->matrix.yx = 0x10000L * font_matrix->yx; - break; - default: - goto bail1; - } - - fi->transform = (fi->matrix.xx != 0x10000 || fi->matrix.xy != 0 || - fi->matrix.yx != 0 || fi->matrix.yy != 0x10000); - - /* - * Get render value, set to false if no Render extension present - */ - if (info->hasRender) - { - switch (FcPatternGetBool (pattern, XFT_RENDER, 0, &fi->render)) { - case FcResultNoMatch: - fi->render = info->hasRender; - break; - case FcResultMatch: - break; - default: - goto bail1; - } - } - else - fi->render = FcFalse; - - /* - * Compute glyph load flags - */ - fi->load_flags = FT_LOAD_DEFAULT; - - /* disable bitmaps when anti-aliasing or transforming glyphs */ - if (fi->antialias || fi->transform) - fi->load_flags |= FT_LOAD_NO_BITMAP; - - /* disable hinting if requested */ - switch (FcPatternGetBool (pattern, FC_HINTING, 0, &hinting)) { - case FcResultNoMatch: - hinting = FcTrue; - break; - case FcResultMatch: - break; - default: - goto bail1; - } - -#ifdef FC_EMBOLDEN - switch (FcPatternGetBool (pattern, FC_EMBOLDEN, 0, &fi->embolden)) { - case FcResultNoMatch: - fi->embolden = FcFalse; - break; - case FcResultMatch: - break; - default: - goto bail1; - } -#else - fi->embolden = FcFalse; -#endif - -#ifdef FC_HINT_STYLE - switch (FcPatternGetInteger (pattern, FC_HINT_STYLE, 0, &hint_style)) { - case FcResultNoMatch: - hint_style = FC_HINT_FULL; - break; - case FcResultMatch: - break; - default: - goto bail1; - } -#endif - - if (!hinting -#ifdef FC_HINT_STYLE - || hint_style == FC_HINT_NONE -#endif - ) - { - fi->load_flags |= FT_LOAD_NO_HINTING; - } - - /* Figure out the load target, which modifies the hinting - * behavior of FreeType based on the intended use of the glyphs. - */ - if (fi->antialias) - { -#ifdef FC_HINT_STYLE -#ifdef FT_LOAD_TARGET_LIGHT - if (FC_HINT_NONE < hint_style && hint_style < FC_HINT_FULL) - { - fi->load_flags |= FT_LOAD_TARGET_LIGHT; - } - else -#endif -#endif - { - /* autohinter will snap stems to integer widths, when - * the LCD targets are used. - */ - switch (fi->rgba) { - case FC_RGBA_RGB: - case FC_RGBA_BGR: -#ifdef FT_LOAD_TARGET_LCD - fi->load_flags |= FT_LOAD_TARGET_LCD; -#endif - break; - case FC_RGBA_VRGB: - case FC_RGBA_VBGR: -#ifdef FT_LOAD_TARGET_LCD_V - fi->load_flags |= FT_LOAD_TARGET_LCD_V; -#endif - break; - } - } - } -#ifdef FT_LOAD_TARGET_MONO - else - fi->load_flags |= FT_LOAD_TARGET_MONO; -#endif - - /* set vertical layout if requested */ - switch (FcPatternGetBool (pattern, FC_VERTICAL_LAYOUT, 0, &vertical_layout)) { - case FcResultNoMatch: - vertical_layout = FcFalse; - break; - case FcResultMatch: - break; - default: - goto bail1; - } - - if (vertical_layout) - fi->load_flags |= FT_LOAD_VERTICAL_LAYOUT; - - /* force autohinting if requested */ - switch (FcPatternGetBool (pattern, FC_AUTOHINT, 0, &autohint)) { - case FcResultNoMatch: - autohint = FcFalse; - break; - case FcResultMatch: - break; - default: - goto bail1; - } - - if (autohint) - fi->load_flags |= FT_LOAD_FORCE_AUTOHINT; - - /* disable global advance width (for broken DynaLab TT CJK fonts) */ - switch (FcPatternGetBool (pattern, FC_GLOBAL_ADVANCE, 0, &global_advance)) { - case FcResultNoMatch: - global_advance = FcTrue; - break; - case FcResultMatch: - break; - default: - goto bail1; - } - - if (!global_advance) - fi->load_flags |= FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH; - - /* - * Get requested spacing value - */ - switch (FcPatternGetInteger (pattern, FC_SPACING, 0, &fi->spacing)) { - case FcResultNoMatch: - fi->spacing = FC_PROPORTIONAL; - break; - case FcResultMatch: - break; - default: - goto bail1; - } - - /* - * Check for minspace - */ - - switch (FcPatternGetBool (pattern, FC_MINSPACE, 0, &fi->minspace)) { - case FcResultNoMatch: - fi->minspace = FcFalse; - break; - case FcResultMatch: - break; - default: - goto bail1; - } - /* - * Check for fixed pixel spacing - */ - switch (FcPatternGetInteger (pattern, FC_CHAR_WIDTH, 0, &fi->char_width)) { - case FcResultNoMatch: - fi->char_width = 0; - break; - case FcResultMatch: - if (fi->char_width) - fi->spacing = FC_MONO; - break; - default: - goto bail1; - } - - /* - * Step over hash value in the structure - */ - hash = 0; - hashp = (FcChar32 *) fi + 1; - nhash = (sizeof (XftFontInfo) / sizeof (FcChar32)) - 1; - - while (nhash--) - hash += *hashp++; - fi->hash = hash; - - /* - * All done - */ - return FcTrue; - -bail1: - _XftReleaseFile (fi->file); - fi->file = 0; -bail0: - return FcFalse; -} - -static void -XftFontInfoEmpty (Display *dpy, XftFontInfo *fi) -{ - if (fi->file) - _XftReleaseFile (fi->file); -} - -XftFontInfo * -XftFontInfoCreate (Display *dpy, _Xconst FcPattern *pattern) -{ - XftFontInfo *fi = malloc (sizeof (XftFontInfo)); - - if (!fi) - return 0; - - if (!XftFontInfoFill (dpy, pattern, fi)) - { - free (fi); - fi = 0; - } - XftMemAlloc (XFT_MEM_FONT, sizeof (XftFontInfo)); - return fi; -} - -void -XftFontInfoDestroy (Display *dpy, XftFontInfo *fi) -{ - XftFontInfoEmpty (dpy, fi); - XftMemFree (XFT_MEM_FONT, sizeof (XftFontInfo)); - free (fi); -} - -FcChar32 -XftFontInfoHash (_Xconst XftFontInfo *fi) -{ - return fi->hash; -} - -FcBool -XftFontInfoEqual (_Xconst XftFontInfo *a, _Xconst XftFontInfo *b) -{ - return memcmp ((void *) a, (void *) b, sizeof (XftFontInfo)) == 0; -} - -XftFont * -XftFontOpenInfo (Display *dpy, - FcPattern *pattern, - XftFontInfo *fi) -{ - XftDisplayInfo *info = _XftDisplayInfoGet (dpy, True); - FT_Face face; - XftFont **bucket; - XftFontInt *font; - XRenderPictFormat *format; - FcCharSet *charset; - FcChar32 num_unicode; - FcChar32 hash_value; - FcChar32 rehash_value; - FcBool antialias; - int max_glyph_memory; - int alloc_size; - int ascent, descent, height; - int i; - int num_glyphs; - - if (!info) - return 0; - /* - * Find a matching previously opened font - */ - bucket = &info->fontHash[fi->hash % XFT_NUM_FONT_HASH]; - for (font = (XftFontInt *) *bucket; font; font = (XftFontInt *) font->hash_next) - if (XftFontInfoEqual (&font->info, fi)) - { - if (!font->ref++) - --info->num_unref_fonts; - FcPatternDestroy (pattern); - return &font->public; - } - - /* - * No existing font, create another. - */ - - if (XftDebug () & XFT_DBG_CACHE) - printf ("New font %s/%d size %dx%d\n", - fi->file->file, fi->file->id, - (int) fi->xsize >> 6, (int) fi->ysize >> 6); - - if (FcPatternGetInteger (pattern, XFT_MAX_GLYPH_MEMORY, 0, - &max_glyph_memory) != FcResultMatch) - max_glyph_memory = XFT_FONT_MAX_GLYPH_MEMORY; - - face = _XftLockFile (fi->file); - if (!face) - goto bail0; - - if (!_XftSetFace (fi->file, fi->xsize, fi->ysize, &fi->matrix)) - goto bail1; - - /* - * Get the set of Unicode codepoints covered by the font. - * If the incoming pattern doesn't provide this data, go - * off and compute it. Yes, this is expensive, but it's - * required to map Unicode to glyph indices. - */ - if (FcPatternGetCharSet (pattern, FC_CHARSET, 0, &charset) == FcResultMatch) - charset = FcCharSetCopy (charset); - else - charset = FcFreeTypeCharSet (face, FcConfigGetBlanks (0)); - - antialias = fi->antialias; - if (!(face->face_flags & FT_FACE_FLAG_SCALABLE)) - antialias = FcFalse; - - /* - * Find the appropriate picture format - */ - if (fi->render) - { - if (antialias) - { - switch (fi->rgba) { - case FC_RGBA_RGB: - case FC_RGBA_BGR: - case FC_RGBA_VRGB: - case FC_RGBA_VBGR: - format = XRenderFindStandardFormat (dpy, PictStandardARGB32); - break; - default: - format = XRenderFindStandardFormat (dpy, PictStandardA8); - break; - } - } - else - { - format = XRenderFindStandardFormat (dpy, PictStandardA1); - } - - if (!format) - goto bail2; - } - else - format = 0; - - if (charset) - { - num_unicode = FcCharSetCount (charset); - hash_value = _XftHashSize (num_unicode); - rehash_value = hash_value - 2; - } - else - { - num_unicode = 0; - hash_value = 0; - rehash_value = 0; - } - - /* - * Sometimes the glyphs are numbered 1..n, other times 0..n-1, - * accept either numbering scheme by making room in the table - */ - num_glyphs = face->num_glyphs + 1; - alloc_size = (sizeof (XftFontInt) + - num_glyphs * sizeof (XftGlyph *) + - hash_value * sizeof (XftUcsHash)); - font = malloc (alloc_size); - - if (!font) - goto bail2; - - XftMemAlloc (XFT_MEM_FONT, alloc_size); - - /* - * Public fields - */ - if (fi->transform) - { - FT_Vector vector; - - vector.x = 0; - vector.y = face->size->metrics.descender; - FT_Vector_Transform (&vector, &fi->matrix); - descent = -(vector.y >> 6); - - vector.x = 0; - vector.y = face->size->metrics.ascender; - FT_Vector_Transform (&vector, &fi->matrix); - ascent = vector.y >> 6; - - if (fi->minspace) - height = ascent + descent; - else - { - vector.x = 0; - vector.y = face->size->metrics.height; - FT_Vector_Transform (&vector, &fi->matrix); - height = vector.y >> 6; - } - } - else - { - descent = -(face->size->metrics.descender >> 6); - ascent = face->size->metrics.ascender >> 6; - if (fi->minspace) - height = ascent + descent; - else - height = face->size->metrics.height >> 6; - } - font->public.ascent = ascent; - font->public.descent = descent; - font->public.height = height; - - if (fi->char_width) - font->public.max_advance_width = fi->char_width; - else - { - if (fi->transform) - { - FT_Vector vector; - vector.x = face->size->metrics.max_advance; - vector.y = 0; - FT_Vector_Transform (&vector, &fi->matrix); - font->public.max_advance_width = vector.x >> 6; - } - else - font->public.max_advance_width = face->size->metrics.max_advance >> 6; - } - font->public.charset = charset; - font->public.pattern = pattern; - - /* - * Management fields - */ - font->ref = 1; - - font->next = info->fonts; - info->fonts = &font->public; - - font->hash_next = *bucket; - *bucket = &font->public; - - /* - * Copy the info over - */ - font->info = *fi; - /* - * reset the antialias field. It can't - * be set correctly until the font is opened, - * which doesn't happen in XftFontInfoFill - */ - font->info.antialias = antialias; - /* - * bump XftFile reference count - */ - font->info.file->ref++; - - /* - * Per glyph information - */ - font->glyphs = (XftGlyph **) (font + 1); - memset (font->glyphs, '\0', num_glyphs * sizeof (XftGlyph *)); - font->num_glyphs = num_glyphs; - /* - * Unicode hash table information - */ - font->hash_table = (XftUcsHash *) (font->glyphs + font->num_glyphs); - for (i = 0; i < hash_value; i++) - { - font->hash_table[i].ucs4 = ((FcChar32) ~0); - font->hash_table[i].glyph = 0; - } - font->hash_value = hash_value; - font->rehash_value = rehash_value; - /* - * X specific fields - */ - font->glyphset = 0; - font->format = format; - - /* - * Glyph memory management fields - */ - font->glyph_memory = 0; - font->max_glyph_memory = max_glyph_memory; - font->use_free_glyphs = info->use_free_glyphs; - - _XftUnlockFile (fi->file); - - return &font->public; - -bail2: - FcCharSetDestroy (charset); -bail1: - _XftUnlockFile (fi->file); -bail0: - return 0; -} - -XftFont * -XftFontOpenPattern (Display *dpy, FcPattern *pattern) -{ - XftFontInfo info; - XftFont *font; - - if (!XftFontInfoFill (dpy, pattern, &info)) - return 0; - - font = XftFontOpenInfo (dpy, pattern, &info); - XftFontInfoEmpty (dpy, &info); - return font; -} - -XftFont * -XftFontCopy (Display *dpy, XftFont *public) -{ - XftFontInt *font = (XftFontInt *) public; - - font->ref++; - return public; -} - -static void -XftFontDestroy (Display *dpy, XftFont *public) -{ - XftDisplayInfo *info = _XftDisplayInfoGet (dpy, False); - XftFontInt *font = (XftFontInt *) public; - int i; - - /* note reduction in memory use */ - if (info) - info->glyph_memory -= font->glyph_memory; - /* Clean up the info */ - XftFontInfoEmpty (dpy, &font->info); - /* Free the glyphset */ - if (font->glyphset) - XRenderFreeGlyphSet (dpy, font->glyphset); - /* Free the glyphs */ - for (i = 0; i < font->num_glyphs; i++) - { - XftGlyph *xftg = font->glyphs[i]; - if (xftg) - { - if (xftg->bitmap) - free (xftg->bitmap); - free (xftg); - } - } - - /* Free the pattern and the charset */ - FcPatternDestroy (font->public.pattern); - FcCharSetDestroy (font->public.charset); - - /* Finally, free the font structure */ - XftMemFree (XFT_MEM_FONT, sizeof (XftFontInt) + - font->num_glyphs * sizeof (XftGlyph *) + - font->hash_value * sizeof (XftUcsHash)); - free (font); -} - -static XftFont * -XftFontFindNthUnref (XftDisplayInfo *info, int n) -{ - XftFont *public; - XftFontInt *font; - - for (public = info->fonts; public; public = font->next) - { - font = (XftFontInt*) public; - if (!font->ref && !n--) - break; - } - return public; -} - -void -XftFontManageMemory (Display *dpy) -{ - XftDisplayInfo *info = _XftDisplayInfoGet (dpy, False); - XftFont **prev; - XftFont *public; - XftFontInt *font; - - if (!info) - return; - while (info->num_unref_fonts > info->max_unref_fonts) - { - public = XftFontFindNthUnref (info, rand() % info->num_unref_fonts); - font = (XftFontInt *) public; - - if (XftDebug () & XFT_DBG_CACHE) - printf ("freeing unreferenced font %s/%d size %dx%d\n", - font->info.file->file, font->info.file->id, - (int) font->info.xsize >> 6, (int) font->info.ysize >> 6); - - /* Unhook from display list */ - for (prev = &info->fonts; *prev; prev = &(*(XftFontInt **) prev)->next) - { - if (*prev == public) - { - *prev = font->next; - break; - } - } - /* Unhook from hash list */ - for (prev = &info->fontHash[font->info.hash % XFT_NUM_FONT_HASH]; - *prev; - prev = &(*(XftFontInt **) prev)->hash_next) - { - if (*prev == public) - { - *prev = font->hash_next; - break; - } - } - /* Destroy the font */ - XftFontDestroy (dpy, public); - --info->num_unref_fonts; - } -} - -void -XftFontClose (Display *dpy, XftFont *public) -{ - XftDisplayInfo *info = _XftDisplayInfoGet (dpy, False); - XftFontInt *font = (XftFontInt *) public; - - if (--font->ref != 0) - return; - - if (info) - { - ++info->num_unref_fonts; - XftFontManageMemory (dpy); - } - else - { - XftFontDestroy (dpy, public); - } -} - -FcBool -XftInitFtLibrary (void) -{ - if (_XftFTlibrary) - return FcTrue; - if (FT_Init_FreeType (&_XftFTlibrary)) - return FcFalse; - return FcTrue; -} diff --git a/nx-X11/lib/Xft/xftglyphs.c b/nx-X11/lib/Xft/xftglyphs.c deleted file mode 100644 index c1ee42142..000000000 --- a/nx-X11/lib/Xft/xftglyphs.c +++ /dev/null @@ -1,825 +0,0 @@ -/* - * $Id: xftglyphs.c,v 1.4 2005/07/03 07:00:57 daniels Exp $ - * - * Copyright © 2000 Keith Packard - * - * 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 - -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 }, -}; - -/* - * Validate the memory info for a font - */ - -static void -_XftFontValidateMemory (Display *dpy, XftFont *public) -{ - XftFontInt *font = (XftFontInt *) public; - unsigned long glyph_memory; - FT_UInt glyphindex; - XftGlyph *xftg; - - glyph_memory = 0; - for (glyphindex = 0; glyphindex < font->num_glyphs; glyphindex++) - { - xftg = font->glyphs[glyphindex]; - if (xftg) - { - glyph_memory += xftg->glyph_memory; - } - } - if (glyph_memory != font->glyph_memory) - printf ("Font glyph cache incorrect has %ld bytes, should have %ld\n", - font->glyph_memory, glyph_memory); -} - -void -XftFontLoadGlyphs (Display *dpy, - XftFont *pub, - FcBool need_bitmaps, - _Xconst FT_UInt *glyphs, - int nglyph) -{ - XftDisplayInfo *info = _XftDisplayInfoGet (dpy, True); - XftFontInt *font = (XftFontInt *) pub; - FT_Error error; - FT_UInt glyphindex; - FT_GlyphSlot glyphslot; - XftGlyph *xftg; - Glyph glyph; - unsigned char bufLocal[4096]; - unsigned char *bufBitmap = bufLocal; - 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 left, right, top, bottom; - int hmul = 1; - int vmul = 1; - FT_Bitmap ftbit; - FT_Matrix matrix; - FT_Vector vector; - Bool subpixel = False; - FT_Face face; - - if (!info) - return; - - face = XftLockFace (&font->public); - - if (!face) - return; - - matrix.xx = matrix.yy = 0x10000L; - matrix.xy = matrix.yx = 0; - - if (font->info.antialias) - { - switch (font->info.rgba) { - case FC_RGBA_RGB: - case FC_RGBA_BGR: - matrix.xx *= 3; - subpixel = True; - hmul = 3; - break; - case FC_RGBA_VRGB: - case FC_RGBA_VBGR: - matrix.yy *= 3; - vmul = 3; - subpixel = True; - break; - } - } - - while (nglyph--) - { - glyphindex = *glyphs++; - xftg = font->glyphs[glyphindex]; - if (!xftg) - continue; - - if (XftDebug() & XFT_DBG_CACHE) - _XftFontValidateMemory (dpy, pub); - /* - * Check to see if this glyph has just been loaded, - * this happens when drawing the same glyph twice - * in a single string - */ - if (xftg->glyph_memory) - continue; - - error = FT_Load_Glyph (face, glyphindex, font->info.load_flags); - if (error) - { - /* - * If anti-aliasing or transforming glyphs and - * no outline version exists, fallback to the - * bitmap and let things look bad instead of - * missing the glyph - */ - if (font->info.load_flags & FT_LOAD_NO_BITMAP) - error = FT_Load_Glyph (face, glyphindex, - font->info.load_flags & ~FT_LOAD_NO_BITMAP); - 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) - - glyphslot = face->glyph; - -#if HAVE_FT_GLYPHSLOT_EMBOLDEN - /* - * Embolden if required - */ - if (font->info.embolden) FT_GlyphSlot_Embolden(glyphslot); -#endif - - /* - * Compute glyph metrics from FreeType information - */ - if(font->info.transform && glyphslot->format != ft_glyph_format_bitmap) - { - /* - * 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 = glyphslot->metrics.horiBearingX + xc * glyphslot->metrics.width; - vector.y = glyphslot->metrics.horiBearingY - yc * glyphslot->metrics.height; - FT_Vector_Transform(&vector, &font->info.matrix); - if (XftDebug() & 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( glyphslot->metrics.horiBearingX ); - right = CEIL( glyphslot->metrics.horiBearingX + glyphslot->metrics.width ); - - top = CEIL( glyphslot->metrics.horiBearingY ); - bottom = FLOOR( glyphslot->metrics.horiBearingY - glyphslot->metrics.height ); - } - - width = TRUNC(right - left); - height = TRUNC( top - bottom ); - - /* - * Clip charcell glyphs to the bounding box - * XXX transformed? - */ - if (font->info.spacing >= FC_CHARCELL && !font->info.transform) - { - if (font->info.load_flags & FT_LOAD_VERTICAL_LAYOUT) - { - if (TRUNC(bottom) > font->public.max_advance_width) - { - int adjust; - - adjust = bottom - (font->public.max_advance_width << 6); - if (adjust > top) - adjust = top; - top -= adjust; - bottom -= adjust; - height = font->public.max_advance_width; - } - } - else - { - if (TRUNC(right) > font->public.max_advance_width) - { - int adjust; - - adjust = right - (font->public.max_advance_width << 6); - if (adjust > left) - adjust = left; - left -= adjust; - right -= adjust; - width = font->public.max_advance_width; - } - } - } - - if (font->info.antialias) - pitch = (width * hmul + 3) & ~3; - else - pitch = ((width + 31) & ~31) >> 3; - - size = pitch * height * vmul; - - xftg->metrics.width = width; - xftg->metrics.height = height; - xftg->metrics.x = -TRUNC(left); - xftg->metrics.y = TRUNC(top); - - if (font->info.spacing >= FC_MONO) - { - if (font->info.transform) - { - if (font->info.load_flags & FT_LOAD_VERTICAL_LAYOUT) - { - vector.x = 0; - vector.y = -face->size->metrics.max_advance; - } - else - { - vector.x = face->size->metrics.max_advance; - vector.y = 0; - } - FT_Vector_Transform (&vector, &font->info.matrix); - xftg->metrics.xOff = vector.x >> 6; - xftg->metrics.yOff = -(vector.y >> 6); - } - else - { - if (font->info.load_flags & FT_LOAD_VERTICAL_LAYOUT) - { - xftg->metrics.xOff = 0; - xftg->metrics.yOff = -font->public.max_advance_width; - } - else - { - xftg->metrics.xOff = font->public.max_advance_width; - xftg->metrics.yOff = 0; - } - } - } - else - { - xftg->metrics.xOff = TRUNC(ROUND(glyphslot->advance.x)); - xftg->metrics.yOff = -TRUNC(ROUND(glyphslot->advance.y)); - } - - /* - * If the glyph is relatively large (> 1% of server memory), - * don't send it until necessary - */ - if (!need_bitmaps && size > info->max_glyph_memory / 100) - continue; - - /* - * Make sure there's enough buffer space for the glyph - */ - if (size > bufSize) - { - if (bufBitmap != bufLocal) - free (bufBitmap); - bufBitmap = (unsigned char *) malloc (size); - if (!bufBitmap) - continue; - bufSize = size; - } - memset (bufBitmap, 0, size); - - /* - * Rasterize into the local buffer - */ - switch (glyphslot->format) { - case ft_glyph_format_outline: - ftbit.width = width * hmul; - ftbit.rows = height * vmul; - ftbit.pitch = pitch; - if (font->info.antialias) - ftbit.pixel_mode = ft_pixel_mode_grays; - else - ftbit.pixel_mode = ft_pixel_mode_mono; - - ftbit.buffer = bufBitmap; - - if (subpixel) - FT_Outline_Transform (&glyphslot->outline, &matrix); - - FT_Outline_Translate ( &glyphslot->outline, -left*hmul, -bottom*vmul ); - - FT_Outline_Get_Bitmap( _XftFTlibrary, &glyphslot->outline, &ftbit ); - break; - case ft_glyph_format_bitmap: - if (font->info.antialias) - { - unsigned char *srcLine, *dstLine; - int height; - int x; - int h, v; - - srcLine = glyphslot->bitmap.buffer; - dstLine = bufBitmap; - height = glyphslot->bitmap.rows; - while (height--) - { - for (x = 0; x < glyphslot->bitmap.width; x++) - { - /* always MSB bitmaps */ - unsigned char a = ((srcLine[x >> 3] & (0x80 >> (x & 7))) ? - 0xff : 0x00); - if (subpixel) - { - for (v = 0; v < vmul; v++) - for (h = 0; h < hmul; h++) - dstLine[v * pitch + x*hmul + h] = a; - } - else - dstLine[x] = a; - } - dstLine += pitch * vmul; - srcLine += glyphslot->bitmap.pitch; - } - } - else - { - unsigned char *srcLine, *dstLine; - int h, bytes; - - srcLine = glyphslot->bitmap.buffer; - dstLine = bufBitmap; - h = glyphslot->bitmap.rows; - bytes = (glyphslot->bitmap.width + 7) >> 3; - while (h--) - { - memcpy (dstLine, srcLine, bytes); - dstLine += pitch; - srcLine += glyphslot->bitmap.pitch; - } - } - break; - default: - if (XftDebug() & XFT_DBG_GLYPH) - printf ("glyph %d is not in a usable format\n", - (int) glyphindex); - continue; - } - - if (XftDebug() & XFT_DBG_GLYPH) - { - printf ("glyph %d:\n", (int) glyphindex); - printf (" xywh (%d %d %d %d), trans (%d %d %d %d) wh (%d %d)\n", - (int) glyphslot->metrics.horiBearingX, - (int) glyphslot->metrics.horiBearingY, - (int) glyphslot->metrics.width, - (int) glyphslot->metrics.height, - left, right, top, bottom, - width, height); - if (XftDebug() & XFT_DBG_GLYPHV) - { - int x, y; - unsigned char *line; - - line = bufBitmap; - for (y = 0; y < height * vmul; y++) - { - if (font->info.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"); - } - } - - /* - * Use the glyph index as the wire encoding; it - * might be more efficient for some locales to map - * these by first usage to smaller values, but that - * would require persistently storing the map when - * glyphs were freed. - */ - glyph = (Glyph) glyphindex; - - 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; - - /* - * Filter the glyph to soften the color fringes - */ - widthrgba = width; - pitchrgba = (widthrgba * 4 + 3) & ~3; - sizergba = pitchrgba * height; - - os = 1; - switch (font->info.rgba) { - case FC_RGBA_VRGB: - os = pitch; - case FC_RGBA_RGB: - default: - rf = 0; - gf = 1; - bf = 2; - break; - case FC_RGBA_VBGR: - os = pitch; - case FC_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; - } - } - - xftg->glyph_memory = sizergba + sizeof (XftGlyph); - if (font->format) - { - if (!font->glyphset) - font->glyphset = XRenderCreateGlyphSet (dpy, font->format); - if (ImageByteOrder (dpy) != XftNativeByteOrder ()) - XftSwapCARD32 ((CARD32 *) bufBitmapRgba, sizergba >> 2); - XRenderAddGlyphs (dpy, font->glyphset, &glyph, - &xftg->metrics, 1, - (char *) bufBitmapRgba, sizergba); - } - else - { - if (sizergba) - { - xftg->bitmap = malloc (sizergba); - if (xftg->bitmap) - memcpy (xftg->bitmap, bufBitmapRgba, sizergba); - } - else - xftg->bitmap = 0; - } - } - else - { - xftg->glyph_memory = size + sizeof (XftGlyph); - if (font->format) - { - /* - * swap bit order around; FreeType is always MSBFirst - */ - if (!font->info.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 (!font->glyphset) - font->glyphset = XRenderCreateGlyphSet (dpy, font->format); - XRenderAddGlyphs (dpy, font->glyphset, &glyph, - &xftg->metrics, 1, - (char *) bufBitmap, size); - } - else - { - if (size) - { - xftg->bitmap = malloc (size); - if (xftg->bitmap) - memcpy (xftg->bitmap, bufBitmap, size); - } - else - xftg->bitmap = 0; - } - } - font->glyph_memory += xftg->glyph_memory; - info->glyph_memory += xftg->glyph_memory; - if (XftDebug() & XFT_DBG_CACHE) - _XftFontValidateMemory (dpy, pub); - if (XftDebug() & XFT_DBG_CACHEV) - printf ("Caching glyph 0x%x size %ld\n", glyphindex, - xftg->glyph_memory); - } - if (bufBitmap != bufLocal) - free (bufBitmap); - if (bufBitmapRgba != bufLocalRgba) - free (bufBitmapRgba); - XftUnlockFace (&font->public); -} - -void -XftFontUnloadGlyphs (Display *dpy, - XftFont *pub, - _Xconst FT_UInt *glyphs, - int nglyph) -{ - XftDisplayInfo *info = _XftDisplayInfoGet (dpy, False); - XftFontInt *font = (XftFontInt *) pub; - XftGlyph *xftg; - FT_UInt glyphindex; - Glyph glyphBuf[1024]; - int nused; - - nused = 0; - while (nglyph--) - { - glyphindex = *glyphs++; - xftg = font->glyphs[glyphindex]; - if (!xftg) - continue; - if (xftg->glyph_memory) - { - if (font->format) - { - if (font->glyphset) - { - glyphBuf[nused++] = (Glyph) glyphindex; - if (nused == sizeof (glyphBuf) / sizeof (glyphBuf[0])) - { - XRenderFreeGlyphs (dpy, font->glyphset, glyphBuf, nused); - nused = 0; - } - } - } - else - { - if (xftg->bitmap) - free (xftg->bitmap); - } - font->glyph_memory -= xftg->glyph_memory; - if (info) - info->glyph_memory -= xftg->glyph_memory; - } - free (xftg); - XftMemFree (XFT_MEM_GLYPH, sizeof (XftGlyph)); - font->glyphs[glyphindex] = 0; - } - if (font->glyphset && nused) - XRenderFreeGlyphs (dpy, font->glyphset, glyphBuf, nused); -} - -FcBool -XftFontCheckGlyph (Display *dpy, - XftFont *pub, - FcBool need_bitmaps, - FT_UInt glyph, - FT_UInt *missing, - int *nmissing) -{ - XftFontInt *font = (XftFontInt *) pub; - XftGlyph *xftg; - int n; - - if (glyph >= font->num_glyphs) - return FcFalse; - xftg = font->glyphs[glyph]; - if (!xftg || (need_bitmaps && !xftg->glyph_memory)) - { - if (!xftg) - { - xftg = (XftGlyph *) malloc (sizeof (XftGlyph)); - if (!xftg) - return FcFalse; - XftMemAlloc (XFT_MEM_GLYPH, sizeof (XftGlyph)); - xftg->bitmap = 0; - xftg->glyph_memory = 0; - font->glyphs[glyph] = xftg; - } - n = *nmissing; - missing[n++] = glyph; - if (n == XFT_NMISSING) - { - XftFontLoadGlyphs (dpy, pub, need_bitmaps, missing, n); - n = 0; - } - *nmissing = n; - return FcTrue; - } - else - return FcFalse; -} - -FcBool -XftCharExists (Display *dpy, - XftFont *pub, - FcChar32 ucs4) -{ - if (pub->charset) - return FcCharSetHasChar (pub->charset, ucs4); - return FcFalse; -} - -#define Missing ((FT_UInt) ~0) - -FT_UInt -XftCharIndex (Display *dpy, - XftFont *pub, - FcChar32 ucs4) -{ - XftFontInt *font = (XftFontInt *) pub; - FcChar32 ent, offset; - FT_Face face; - - if (!font->hash_value) - return 0; - - ent = ucs4 % font->hash_value; - offset = 0; - while (font->hash_table[ent].ucs4 != ucs4) - { - if (font->hash_table[ent].ucs4 == (FcChar32) ~0) - { - if (!XftCharExists (dpy, pub, ucs4)) - return 0; - face = XftLockFace (pub); - if (!face) - return 0; - font->hash_table[ent].ucs4 = ucs4; - font->hash_table[ent].glyph = FcFreeTypeCharIndex (face, ucs4); - XftUnlockFace (pub); - break; - } - if (!offset) - { - offset = ucs4 % font->rehash_value; - if (!offset) - offset = 1; - } - ent = ent + offset; - if (ent >= font->hash_value) - ent -= font->hash_value; - } - return font->hash_table[ent].glyph; -} - -/* - * Pick a random glyph from the font and remove it from the cache - */ -void -_XftFontUncacheGlyph (Display *dpy, XftFont *pub) -{ - XftFontInt *font = (XftFontInt *) pub; - unsigned long glyph_memory; - FT_UInt glyphindex; - XftGlyph *xftg; - - if (!font->glyph_memory) - return; - if (font->use_free_glyphs) - { - glyph_memory = rand() % font->glyph_memory; - } - else - { - if (font->glyphset) - { - XRenderFreeGlyphSet (dpy, font->glyphset); - font->glyphset = 0; - } - glyph_memory = 0; - } - - if (XftDebug() & XFT_DBG_CACHE) - _XftFontValidateMemory (dpy, pub); - for (glyphindex = 0; glyphindex < font->num_glyphs; glyphindex++) - { - xftg = font->glyphs[glyphindex]; - if (xftg) - { - if (xftg->glyph_memory > glyph_memory) - { - if (XftDebug() & XFT_DBG_CACHEV) - printf ("Uncaching glyph 0x%x size %ld\n", - glyphindex, xftg->glyph_memory); - XftFontUnloadGlyphs (dpy, pub, &glyphindex, 1); - if (!font->use_free_glyphs) - continue; - break; - } - glyph_memory -= xftg->glyph_memory; - } - } - if (XftDebug() & XFT_DBG_CACHE) - _XftFontValidateMemory (dpy, pub); -} - -void -_XftFontManageMemory (Display *dpy, XftFont *pub) -{ - XftFontInt *font = (XftFontInt *) pub; - - if (font->max_glyph_memory) - { - if (XftDebug() & XFT_DBG_CACHE) - { - if (font->glyph_memory > font->max_glyph_memory) - printf ("Reduce memory for font 0x%lx from %ld to %ld\n", - font->glyphset ? font->glyphset : (unsigned long) font, - font->glyph_memory, font->max_glyph_memory); - } - while (font->glyph_memory > font->max_glyph_memory) - _XftFontUncacheGlyph (dpy, pub); - } - _XftDisplayManageMemory (dpy); -} diff --git a/nx-X11/lib/Xft/xftinit.c b/nx-X11/lib/Xft/xftinit.c deleted file mode 100644 index 83724ce5a..000000000 --- a/nx-X11/lib/Xft/xftinit.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * $Id: xftinit.c,v 1.4 2005/07/03 07:00:57 daniels Exp $ - * - * Copyright © 2000 Keith Packard - * - * 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 _XftConfigInitialized; - -Bool -XftInit (_Xconst char *config) -{ - if (_XftConfigInitialized) - return True; - _XftConfigInitialized = True; - if (!FcInit ()) - return False; - _XftNameInit (); - return True; -} - -int -XftGetVersion (void) -{ - return XftVersion; -} - -static struct { - char *name; - int alloc_count; - int alloc_mem; - int free_count; - int free_mem; -} XftInUse[XFT_MEM_NUM] = { - { "XftDraw", 0, 0 }, - { "XftFont", 0 ,0 }, - { "XftFtFile", 0, 0 }, - { "XftGlyph", 0, 0 }, -}; - -static int XftAllocCount, XftAllocMem; -static int XftFreeCount, XftFreeMem; - -static int XftMemNotice = 1*1024*1024; - -static int XftAllocNotify, XftFreeNotify; - -void -XftMemReport (void) -{ - int i; - printf ("Xft Memory Usage:\n"); - printf ("\t Which Alloc Free\n"); - printf ("\t count bytes count bytes\n"); - for (i = 0; i < XFT_MEM_NUM; i++) - printf ("\t%8.8s%8d%8d%8d%8d\n", - XftInUse[i].name, - XftInUse[i].alloc_count, XftInUse[i].alloc_mem, - XftInUse[i].free_count, XftInUse[i].free_mem); - printf ("\t%8.8s%8d%8d%8d%8d\n", - "Total", - XftAllocCount, XftAllocMem, - XftFreeCount, XftFreeMem); - XftAllocNotify = 0; - XftFreeNotify = 0; -} - -void -XftMemAlloc (int kind, int size) -{ - if (XftDebug() & XFT_DBG_MEMORY) - { - XftInUse[kind].alloc_count++; - XftInUse[kind].alloc_mem += size; - XftAllocCount++; - XftAllocMem += size; - XftAllocNotify += size; - if (XftAllocNotify > XftMemNotice) - XftMemReport (); - } -} - -void -XftMemFree (int kind, int size) -{ - if (XftDebug() & XFT_DBG_MEMORY) - { - XftInUse[kind].free_count++; - XftInUse[kind].free_mem += size; - XftFreeCount++; - XftFreeMem += size; - XftFreeNotify += size; - if (XftFreeNotify > XftMemNotice) - XftMemReport (); - } -} diff --git a/nx-X11/lib/Xft/xftint.h b/nx-X11/lib/Xft/xftint.h deleted file mode 100644 index 824313ec5..000000000 --- a/nx-X11/lib/Xft/xftint.h +++ /dev/null @@ -1,459 +0,0 @@ -/* - * $Id: xftint.h,v 1.6 2005/07/03 07:00:57 daniels Exp $ - * - * Copyright © 2000 Keith Packard - * - * 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. - */ - -/* - * These definitions are solely for use by the implementation of Xft - * and constitute no kind of standard. If you need any of these functions, - * please drop me a note. Either the library needs new functionality, - * or there's a way to do what you need using the existing published - * interfaces. keithp@freedesktop.org - */ - -#ifndef _XFTINT_H_ -#define _XFTINT_H_ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#else /* X monolithic tree */ -#define HAVE_STDLIB_H 1 /* assumed since all ANSI C platforms require it */ -#include /* get string.h or strings.h as appropriate */ -#endif - -#include -#if HAVE_STDLIB_H -#include -#endif -#if HAVE_STRING_H -#include -#else -#if HAVE_STRINGS_H -#include -#endif -#endif -#include - -#include -#include -#include -#include -#define _XFT_NO_COMPAT_ -#include "Xft.h" -#include -#include - -#ifndef HAVE_CONFIG_H -# if (FREETYPE_MAJOR > 2 || \ - (FREETYPE_MAJOR == 2 && (FREETYPE_MINOR > 1 || \ - (FREETYPE_MINOR == 1 && FREETYPE_PATCH >= 5)))) -# define HAVE_FT_BITMAP_SIZE_Y_PPEM 1 -# else -# define HAVE_FT_BITMAP_SIZE_Y_PPEM 0 -# endif -#endif - -typedef struct _XftMatcher { - char *object; - double (*compare) (char *object, FcValue value1, FcValue value2); -} XftMatcher; - -typedef struct _XftSymbolic { - const char *name; - int value; -} XftSymbolic; - -/* - * Glyphs are stored in this structure - */ -typedef struct _XftGlyph { - XGlyphInfo metrics; - void *bitmap; - unsigned long glyph_memory; -} XftGlyph; - -/* - * A hash table translates Unicode values into glyph indicies - */ -typedef struct _XftUcsHash { - FcChar32 ucs4; - FT_UInt glyph; -} XftUcsHash; - -/* - * Many fonts can share the same underlying face data; this - * structure references that. Note that many faces may in fact - * live in the same font file; that is irrelevant to this structure - * which is concerned only with the individual faces themselves - */ - -typedef struct _XftFtFile { - struct _XftFtFile *next; - int ref; /* number of font infos using this file */ - - char *file; /* file name */ - int id; /* font index within that file */ - - FT_F26Dot6 xsize; /* current xsize setting */ - FT_F26Dot6 ysize; /* current ysize setting */ - FT_Matrix matrix; /* current matrix setting */ - - int lock; /* lock count; can't unload unless 0 */ - FT_Face face; /* pointer to face; only valid when lock */ -} XftFtFile; - -/* - * This structure holds the data extracted from a pattern - * needed to create a unique font object. - */ - -struct _XftFontInfo { - /* - * Hash value (not include in hash value computation) - */ - FcChar32 hash; - XftFtFile *file; /* face source */ - /* - * Rendering options - */ - FT_F26Dot6 xsize, ysize; /* pixel size */ - FcBool antialias; /* doing antialiasing */ - FcBool embolden; /* force emboldening */ - int rgba; /* subpixel order */ - FT_Matrix matrix; /* glyph transformation matrix */ - FcBool transform; /* non-identify matrix? */ - FT_Int load_flags; /* glyph load flags */ - FcBool render; /* whether to use the Render extension */ - /* - * Internal fields - */ - int spacing; - FcBool minspace; - int char_width; -}; - -/* - * Internal version of the font with private data - */ - -typedef struct _XftFontInt { - XftFont public; /* public fields */ - XftFont *next; /* all fonts on display */ - XftFont *hash_next; /* fonts in this hash chain */ - XftFontInfo info; /* Data from pattern */ - int ref; /* reference count */ - /* - * Per-glyph information, indexed by glyph ID - * This array follows the font in memory - */ - XftGlyph **glyphs; - int num_glyphs; /* size of glyphs/bitmaps arrays */ - /* - * Hash table to get from Unicode value to glyph ID - * This array follows the glyphs in memory - */ - XftUcsHash *hash_table; - int hash_value; - int rehash_value; - /* - * X specific fields - */ - GlyphSet glyphset; /* Render glyphset */ - XRenderPictFormat *format; /* Render format for glyphs */ - /* - * Glyph memory management fields - */ - unsigned long glyph_memory; - unsigned long max_glyph_memory; - FcBool use_free_glyphs; /* Use XRenderFreeGlyphs */ -} XftFontInt; - -typedef enum _XftClipType { - XftClipTypeNone, XftClipTypeRegion, XftClipTypeRectangles -} XftClipType; - -typedef struct _XftClipRect { - int xOrigin; - int yOrigin; - int n; -} XftClipRect; - -#define XftClipRects(cr) ((XRectangle *) ((cr) + 1)) - -typedef union _XftClip { - XftClipRect *rect; - Region region; -} XftClip; - -struct _XftDraw { - Display *dpy; - int screen; - unsigned int bits_per_pixel; - unsigned int depth; - Drawable drawable; - Visual *visual; /* NULL for bitmaps */ - Colormap colormap; - XftClipType clip_type; - XftClip clip; - int subwindow_mode; - struct { - Picture pict; - } render; - struct { - GC gc; - int use_pixmap; - } core; -}; - -/* - * Instead of taking two round trips for each blending request, - * assume that if a particular drawable fails GetImage that it will - * fail for a "while"; use temporary pixmaps to avoid the errors - */ - -#define XFT_ASSUME_PIXMAP 20 - -typedef struct _XftSolidColor { - XRenderColor color; - int screen; - Picture pict; -} XftSolidColor; - -#define XFT_NUM_SOLID_COLOR 16 - -#define XFT_NUM_FONT_HASH 127 - -typedef struct _XftDisplayInfo { - struct _XftDisplayInfo *next; - Display *display; - XExtCodes *codes; - FcPattern *defaults; - FcBool hasRender; - XftFont *fonts; - XRenderPictFormat *solidFormat; - unsigned long glyph_memory; - unsigned long max_glyph_memory; - FcBool use_free_glyphs; - int num_unref_fonts; - int max_unref_fonts; - XftSolidColor colors[XFT_NUM_SOLID_COLOR]; - XftFont *fontHash[XFT_NUM_FONT_HASH]; -} XftDisplayInfo; - -/* - * By default, use no more than 4 meg of server memory total, and no - * more than 1 meg for any one font - */ -#define XFT_DPY_MAX_GLYPH_MEMORY (4 * 1024 * 1024) -#define XFT_FONT_MAX_GLYPH_MEMORY (1024 * 1024) - -/* - * By default, keep the last 16 unreferenced fonts around to - * speed reopening them. Note that the glyph caching code - * will keep the global memory usage reasonably limited - */ -#define XFT_DPY_MAX_UNREF_FONTS 16 - -extern XftDisplayInfo *_XftDisplayInfo; - -#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_MEMORY 512 - -#define XFT_MEM_DRAW 0 -#define XFT_MEM_FONT 1 -#define XFT_MEM_FILE 2 -#define XFT_MEM_GLYPH 3 -#define XFT_MEM_NUM 4 - -/* xftcompat.c */ -void XftFontSetDestroy (FcFontSet *s); -FcBool XftMatrixEqual (_Xconst FcMatrix *mat1, _Xconst FcMatrix *mat2); -void XftMatrixMultiply (FcMatrix *result, FcMatrix *a, FcMatrix *b); -void XftMatrixRotate (FcMatrix *m, double c, double s); -void XftMatrixScale (FcMatrix *m, double sx, double sy); -void XftMatrixShear (FcMatrix *m, double sh, double sv); -FcPattern *XftPatternCreate (void); -void XftValueDestroy (FcValue v); -void XftPatternDestroy (FcPattern *p); -FcBool XftPatternAdd (FcPattern *p, _Xconst char *object, FcValue value, FcBool append); -FcBool XftPatternDel (FcPattern *p, _Xconst char *object); -FcBool XftPatternAddInteger (FcPattern *p, _Xconst char *object, int i); -FcBool XftPatternAddDouble (FcPattern *p, _Xconst char *object, double i); -FcBool XftPatternAddMatrix (FcPattern *p, _Xconst char *object, FcMatrix *i); -FcBool XftPatternAddString (FcPattern *p, _Xconst char *object, char *i); -FcBool XftPatternAddBool (FcPattern *p, _Xconst char *object, FcBool i); -FcResult XftPatternGet (FcPattern *p, _Xconst char *object, int id, FcValue *v); -FcResult XftPatternGetInteger (FcPattern *p, _Xconst char *object, int id, int *i); -FcResult XftPatternGetDouble (FcPattern *p, _Xconst char *object, int id, double *i); -FcResult XftPatternGetString (FcPattern *p, _Xconst char *object, int id, char **i); -FcResult XftPatternGetMatrix (FcPattern *p, _Xconst char *object, int id, FcMatrix **i); -FcResult XftPatternGetBool (FcPattern *p, _Xconst char *object, int id, FcBool *i); -FcPattern *XftPatternDuplicate (FcPattern *orig); -FcPattern *XftPatternVaBuild (FcPattern *orig, va_list va); -FcPattern *XftPatternBuild (FcPattern *orig, ...); -FcBool XftNameUnparse (FcPattern *pat, char *dest, int len); -FcBool XftGlyphExists (Display *dpy, XftFont *font, FcChar32 ucs4); -FcObjectSet *XftObjectSetCreate (void); -Bool XftObjectSetAdd (FcObjectSet *os, _Xconst char *object); -void XftObjectSetDestroy (FcObjectSet *os); -FcObjectSet *XftObjectSetVaBuild (_Xconst char *first, va_list va); -FcObjectSet *XftObjectSetBuild (_Xconst char *first, ...); -FcFontSet *XftListFontSets (FcFontSet **sets, int nsets, FcPattern *p, FcObjectSet *os); - -/* xftcore.c */ -void -XftRectCore (XftDraw *draw, - _Xconst XftColor *color, - int x, - int y, - unsigned int width, - unsigned int height); - -void -XftGlyphCore (XftDraw *draw, - _Xconst XftColor *color, - XftFont *public, - int x, - int y, - _Xconst FT_UInt *glyphs, - int nglyphs); - -void -XftGlyphSpecCore (XftDraw *draw, - _Xconst XftColor *color, - XftFont *public, - _Xconst XftGlyphSpec *glyphs, - int nglyphs); - -void -XftGlyphFontSpecCore (XftDraw *draw, - _Xconst XftColor *color, - _Xconst XftGlyphFontSpec *glyphs, - int nglyphs); - -/* xftdbg.c */ -int -XftDebug (void); - -/* xftdpy.c */ -XftDisplayInfo * -_XftDisplayInfoGet (Display *dpy, FcBool createIfNecessary); - -void -_XftDisplayManageMemory (Display *dpy); - -int -XftDefaultParseBool (char *v); - -FcBool -XftDefaultGetBool (Display *dpy, const char *object, int screen, FcBool def); - -int -XftDefaultGetInteger (Display *dpy, const char *object, int screen, int def); - -double -XftDefaultGetDouble (Display *dpy, const char *object, int screen, double def); - -FcFontSet * -XftDisplayGetFontSet (Display *dpy); - -/* xftdraw.c */ -unsigned int -XftDrawDepth (XftDraw *draw); - -unsigned int -XftDrawBitsPerPixel (XftDraw *draw); - -FcBool -XftDrawRenderPrepare (XftDraw *draw); - -/* xftextent.c */ - -/* xftfont.c */ - -/* xftfreetype.c */ -FcBool -_XftSetFace (XftFtFile *f, FT_F26Dot6 xsize, FT_F26Dot6 ysize, FT_Matrix *matrix); - -void -XftFontManageMemory (Display *dpy); - -/* xftglyph.c */ -void -_XftFontUncacheGlyph (Display *dpy, XftFont *public); - -void -_XftFontManageMemory (Display *dpy, XftFont *public); - -/* xftinit.c */ -void -XftMemReport (void); - -void -XftMemAlloc (int kind, int size); - -void -XftMemFree (int kind, int size); - -/* xftlist.c */ -FcFontSet * -XftListFontsPatternObjects (Display *dpy, - int screen, - FcPattern *pattern, - FcObjectSet *os); - -/* xftname.c */ -void -_XftNameInit (void); - -/* xftrender.c */ - -/* xftstr.c */ -int -_XftMatchSymbolic (XftSymbolic *s, int n, const char *name, int def); - -/* xftswap.c */ -int -XftNativeByteOrder (void); - -void -XftSwapCARD32 (CARD32 *data, int n); - -void -XftSwapCARD24 (CARD8 *data, int width, int height); - -void -XftSwapCARD16 (CARD16 *data, int n); - -void -XftSwapImage (XImage *image); - -/* xftxlfd.c */ -#endif /* _XFT_INT_H_ */ diff --git a/nx-X11/lib/Xft/xftlist.c b/nx-X11/lib/Xft/xftlist.c deleted file mode 100644 index e2102b438..000000000 --- a/nx-X11/lib/Xft/xftlist.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * $Id: xftlist.c,v 1.4 2005/07/03 07:00:57 daniels Exp $ - * - * Copyright © 2000 Keith Packard - * - * 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" - -FcFontSet * -XftListFontsPatternObjects (Display *dpy, - int screen, - FcPattern *pattern, - FcObjectSet *os) -{ - return FcFontList (0, pattern, os); -} - -FcFontSet * -XftListFonts (Display *dpy, - int screen, - ...) -{ - va_list va; - FcFontSet *fs; - FcObjectSet *os; - FcPattern *pattern; - const char *first; - - va_start (va, screen); - - FcPatternVapBuild (pattern, 0, va); - - first = va_arg (va, const char *); - FcObjectSetVapBuild (os, first, va); - - va_end (va); - - fs = XftListFontsPatternObjects (dpy, screen, pattern, os); - FcPatternDestroy (pattern); - FcObjectSetDestroy (os); - return fs; -} diff --git a/nx-X11/lib/Xft/xftname.c b/nx-X11/lib/Xft/xftname.c deleted file mode 100644 index 16b7fc678..000000000 --- a/nx-X11/lib/Xft/xftname.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * $Id: xftname.c,v 1.4 2005/07/03 07:00:57 daniels Exp $ - * - * Copyright © 2000 Keith Packard - * - * 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" - -static const FcObjectType _XftObjectTypes[] = { - { XFT_CORE, FcTypeBool, }, - { XFT_XLFD, FcTypeString, }, - { XFT_RENDER, FcTypeBool, }, -}; - -#define NUM_OBJECT_TYPES (sizeof _XftObjectTypes / sizeof _XftObjectTypes[0]) - -FcBool _XftNameInitialized; - -void -_XftNameInit (void) -{ - if (_XftNameInitialized) - return; - _XftNameInitialized = FcTrue; - FcNameRegisterObjectTypes (_XftObjectTypes, NUM_OBJECT_TYPES); -} - -FcPattern -*XftNameParse (const char *name) -{ - _XftNameInit (); - return FcNameParse ((FcChar8 *) name); -} - -FcBool -XftNameUnparse (FcPattern *pat, char *dest, int len) -{ - FcChar8 *name; - - _XftNameInit (); - name = FcNameUnparse (pat); - if (!name) - return FcFalse; - if (strlen ((char *) name) + 1 > len) - { - FcPattern *new = FcPatternDuplicate (pat); - free (name); - FcPatternDel (new, FC_LANG); - FcPatternDel (new, FC_CHARSET); - name = FcNameUnparse (new); - FcPatternDestroy (new); - if (!name) - return FcFalse; - if (strlen ((char *) name) + 1 > len) - { - strncpy (dest, ((char *) name), (size_t) len - 1); - dest[len - 1] = '\0'; - free (name); - return FcFalse; - } - } - strcpy (dest, ((char *) name)); - free (name); - return FcTrue; -} diff --git a/nx-X11/lib/Xft/xftrender.c b/nx-X11/lib/Xft/xftrender.c deleted file mode 100644 index 5569bc70a..000000000 --- a/nx-X11/lib/Xft/xftrender.c +++ /dev/null @@ -1,1009 +0,0 @@ -/* - * $Id: xftrender.c,v 1.4 2005/07/03 07:00:57 daniels Exp $ - * - * Copyright © 2000 Keith Packard - * - * 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" - -#define NUM_LOCAL 1024 -#define NUM_ELT_LOCAL 128 - -/* - * Use the Render extension to draw the glyphs - */ - -void -XftGlyphRender (Display *dpy, - int op, - Picture src, - XftFont *pub, - Picture dst, - int srcx, - int srcy, - int x, - int y, - _Xconst FT_UInt *glyphs, - int nglyphs) -{ - XftFontInt *font = (XftFontInt *) pub; - int i; - FT_UInt missing[XFT_NMISSING]; - int nmissing; - FT_UInt g, max; - int size, width; - Glyph wire; - char *char8; - unsigned short *char16; - unsigned int *char32; - unsigned int char_local[NUM_LOCAL]; - unsigned int *chars; - FcBool glyphs_loaded; - - if (!font->format) - return; - - /* - * Load missing glyphs - */ - nmissing = 0; - max = 0; - glyphs_loaded = FcFalse; - for (i = 0; i < nglyphs; i++) - { - g = glyphs[i]; - if (g > max) - max = g; - if (XftFontCheckGlyph (dpy, pub, FcTrue, g, missing, &nmissing)) - glyphs_loaded = FcTrue; - } - if (nmissing) - XftFontLoadGlyphs (dpy, pub, FcTrue, missing, nmissing); - - if (!font->glyphset) - goto bail1; - if (max < 0x100) - { - width = 1; - size = sizeof (char); - } - else if (max < 0x10000) - { - width = 2; - size = sizeof (unsigned short); - } - else - { - width = 4; - size = sizeof (unsigned int); - } - chars = char_local; - if (nglyphs * size > sizeof (char_local)) - { - chars = malloc (nglyphs * size); - if (!chars) - goto bail1; - } - char8 = (char *) chars; - char16 = (unsigned short *) chars; - char32 = (unsigned int *) chars; - for (i = 0; i < nglyphs; i++) - { - wire = (Glyph) glyphs[i]; - if (wire >= font->num_glyphs || !font->glyphs[wire]) - wire = 0; - switch (width) { - case 1: char8[i] = (char) wire; break; - case 2: char16[i] = (unsigned short) wire; break; - case 4: char32[i] = (unsigned long) wire; break; - } - } - switch (width) { - case 1: - default: - XRenderCompositeString8 (dpy, op, - src, dst, font->format, font->glyphset, - srcx, srcy, x, y, char8, nglyphs); - break; - case 2: - XRenderCompositeString16(dpy, op, - src, dst, font->format, font->glyphset, - srcx, srcy, x, y, char16, nglyphs); - break; - case 4: - XRenderCompositeString32(dpy, op, - src, dst, font->format, font->glyphset, - srcx, srcy, x, y, char32, nglyphs); - break; - } - if (chars != char_local) - free (chars); -bail1: - if (glyphs_loaded) - _XftFontManageMemory (dpy, pub); -} - -void -XftGlyphSpecRender (Display *dpy, - int op, - Picture src, - XftFont *pub, - Picture dst, - int srcx, - int srcy, - _Xconst XftGlyphSpec *glyphs, - int nglyphs) -{ - XftFontInt *font = (XftFontInt *) pub; - int i, j; - FT_UInt missing[XFT_NMISSING]; - int nmissing; - int n; - FT_UInt g; - XftGlyph *glyph; - FT_UInt max; - int size, width; - char *char8; - unsigned short *char16; - unsigned int *char32; - unsigned int char_local[NUM_LOCAL]; - unsigned int *chars; - XGlyphElt8 *elts; - XGlyphElt8 elts_local[NUM_ELT_LOCAL]; - FcBool glyphs_loaded; - int nelt; - int x, y; - - if (!font->format) - return; - if (!nglyphs) - return; - - /* - * Load missing glyphs - */ - max = 0; - nmissing = 0; - glyphs_loaded = FcFalse; - g = glyphs[0].glyph; - for (i = 0; i < nglyphs; i++) - { - g = glyphs[i].glyph; - if (g > max) - max = g; - if (XftFontCheckGlyph (dpy, pub, FcTrue, g, missing, &nmissing)) - glyphs_loaded = FcTrue; - } - if (nmissing) - XftFontLoadGlyphs (dpy, pub, FcTrue, missing, nmissing); - - if (!font->glyphset) - goto bail1; - - /* - * See what encoding size is needed - */ - if (max < 0x100) - { - size = sizeof (char); - width = 1; - } - else if (max < 0x10000) - { - size = sizeof (unsigned short); - width = 2; - } - else - { - size = sizeof (unsigned int); - width = 4; - } - chars = char_local; - if (nglyphs * size > NUM_LOCAL) - { - chars = malloc (nglyphs * size); - if (!chars) - goto bail1; - } - char8 = (char *) chars; - char16 = (unsigned short *) chars; - char32 = (unsigned int *) chars; - - /* - * Compute the number of glyph elts needed - */ - nelt = 1; - for (i = 0; i < nglyphs; i++) - { - g = glyphs[i].glyph; - /* Substitute default for non-existant glyphs */ - if (g >= font->num_glyphs || !font->glyphs[g]) - g = 0; - if (font->glyphs[g]) - break; - } - if (i == nglyphs) - goto bail2; - glyph = font->glyphs[g]; - x = glyphs[i].x + glyph->metrics.xOff; - y = glyphs[i].y + glyph->metrics.yOff; - while (++i < nglyphs) - { - g = glyphs[i].glyph; - /* Substitute default for non-existant glyphs */ - if (g >= font->num_glyphs || !font->glyphs[g]) - g = 0; - /* - * check to see if the glyph is placed where it would - * fall using the normal spacing - */ - if ((glyph = font->glyphs[g])) - { - if (x != glyphs[i].x || y != glyphs[i].y) - { - x = glyphs[i].x; - y = glyphs[i].y; - ++nelt; - } - x += glyph->metrics.xOff; - y += glyph->metrics.yOff; - } - } - - elts = elts_local; - if (nelt > NUM_ELT_LOCAL) - { - elts = malloc (nelt * sizeof (XGlyphElt8)); - if (!elts) - goto bail2; - } - - /* - * Generate the list of glyph elts - */ - nelt = 0; - x = y = 0; - n = 0; - j = 0; - for (i = 0; i < nglyphs; i++) - { - g = glyphs[i].glyph; - /* Substitute default for non-existant glyphs */ - if (g >= font->num_glyphs || !font->glyphs[g]) - g = 0; - if ((glyph = font->glyphs[g])) - { - if (!i || x != glyphs[i].x || y != glyphs[i].y) - { - if (n) - { - elts[nelt].nchars = n; - nelt++; - } - elts[nelt].glyphset = font->glyphset; - elts[nelt].chars = char8 + size * j; - elts[nelt].xOff = glyphs[i].x - x; - elts[nelt].yOff = glyphs[i].y - y; - x = glyphs[i].x; - y = glyphs[i].y; - n = 0; - } - switch (width) { - case 1: char8[j] = (char) g; break; - case 2: char16[j] = (unsigned short) g; break; - case 4: char32[j] = (unsigned int) g; break; - } - x += glyph->metrics.xOff; - y += glyph->metrics.yOff; - j++; - n++; - } - } - if (n) - { - elts[nelt].nchars = n; - nelt++; - } - switch (width) { - case 1: - XRenderCompositeText8 (dpy, op, src, dst, font->format, - srcx, srcy, glyphs[0].x, glyphs[0].y, - elts, nelt); - break; - case 2: - XRenderCompositeText16 (dpy, op, src, dst, font->format, - srcx, srcy, glyphs[0].x, glyphs[0].y, - (XGlyphElt16 *) elts, nelt); - break; - case 4: - XRenderCompositeText32 (dpy, op, src, dst, font->format, - srcx, srcy, glyphs[0].x, glyphs[0].y, - (XGlyphElt32 *) elts, nelt); - break; - } - - if (elts != elts_local) - free (elts); -bail2: - if (chars != char_local) - free (chars); -bail1: - if (glyphs_loaded) - _XftFontManageMemory (dpy, pub); -} - -void -XftCharSpecRender (Display *dpy, - int op, - Picture src, - XftFont *pub, - Picture dst, - int srcx, - int srcy, - _Xconst XftCharSpec *chars, - int len) -{ - XftGlyphSpec *glyphs, glyphs_local[NUM_LOCAL]; - int i; - - if (len <= NUM_LOCAL) - glyphs = glyphs_local; - else - { - glyphs = malloc (len * sizeof (XftGlyphSpec)); - if (!glyphs) - return; - } - for (i = 0; i < len; i++) - { - glyphs[i].glyph = XftCharIndex(dpy, pub, chars[i].ucs4); - glyphs[i].x = chars[i].x; - glyphs[i].y = chars[i].y; - } - - XftGlyphSpecRender (dpy, op, src, pub, dst, srcx, srcy, glyphs, len); - - if (glyphs != glyphs_local) - free (glyphs); -} - -/* - * Choose which format to draw text in when drawing with fonts - * of different formats. The trick is that ARGB formats aren't - * compatible with A formats as PictOpAdd does the wrong thing, so - * fall back to an A format when presented with an ARGB and A format - */ - -#define XftIsARGBFormat(a) ((a)->depth == 32) - -static XRenderPictFormat * -XftPreferFormat (Display *dpy, XRenderPictFormat *a, XRenderPictFormat *b) -{ - XRenderPictFormat *prefer = 0; - - if (a == b) - prefer = a; - else if (XftIsARGBFormat(a) != XftIsARGBFormat(b)) - prefer = XRenderFindStandardFormat (dpy, PictStandardA8); - else if (a->depth > b->depth) - prefer = a; - else - prefer = b; - return prefer; -} - -void -XftGlyphFontSpecRender (Display *dpy, - int op, - Picture src, - Picture dst, - int srcx, - int srcy, - _Xconst XftGlyphFontSpec *glyphs, - int nglyphs) -{ - int i, j; - XftFont *prevPublic; - XftFontInt *firstFont; - XRenderPictFormat *format; - FT_UInt missing[XFT_NMISSING]; - int nmissing; - int n; - FT_UInt g; - XftGlyph *glyph; - FT_UInt max; - int size, width; - char *char8; - unsigned short *char16; - unsigned int *char32; - unsigned int char_local[NUM_LOCAL]; - unsigned int *chars; - XGlyphElt8 *elts; - XGlyphElt8 elts_local[NUM_ELT_LOCAL]; - FcBool glyphs_loaded; - int nelt; - int x, y; - - if (!nglyphs) - return; - - /* - * Load missing glyphs. Have to load them - * one at a time in case the font changes - */ - max = 0; - glyphs_loaded = FcFalse; - g = glyphs[0].glyph; - for (i = 0; i < nglyphs; i++) - { - XftFont *pub = glyphs[i].font; - XftFontInt *font = (XftFontInt *) pub; - g = glyphs[i].glyph; - if (g > max) - max = g; - nmissing = 0; - if (XftFontCheckGlyph (dpy, pub, FcTrue, g, missing, &nmissing)) - glyphs_loaded = FcTrue; - if (nmissing) - XftFontLoadGlyphs (dpy, pub, FcTrue, missing, nmissing); - if (!font->format) - goto bail1; - if (!font->glyphset) - goto bail1; - } - - /* - * See what encoding size is needed - */ - if (max < 0x100) - { - size = sizeof (char); - width = 1; - } - else if (max < 0x10000) - { - size = sizeof (unsigned short); - width = 2; - } - else - { - size = sizeof (unsigned int); - width = 4; - } - chars = char_local; - if (nglyphs * size > NUM_LOCAL) - { - chars = malloc (nglyphs * size); - if (!chars) - goto bail1; - } - char8 = (char *) chars; - char16 = (unsigned short *) chars; - char32 = (unsigned int *) chars; - - /* - * Compute the number of glyph elts needed - */ - nelt = 1; - firstFont = 0; - for (i = 0; i < nglyphs; i++) - { - XftFont *pub = glyphs[i].font; - XftFontInt *font = (XftFontInt *) pub; - g = glyphs[i].glyph; - /* Substitute default for non-existant glyphs */ - if (g >= font->num_glyphs || !font->glyphs[g]) - g = 0; - if (font->glyphs[g]) - { - firstFont = font; - break; - } - } - if (i == nglyphs) - goto bail2; - glyph = firstFont->glyphs[g]; - format = firstFont->format; - x = glyphs[i].x + glyph->metrics.xOff; - y = glyphs[i].y + glyph->metrics.yOff; - prevPublic = 0; - while (++i < nglyphs) - { - XftFont *pub = glyphs[i].font; - XftFontInt *font = (XftFontInt *) pub; - g = glyphs[i].glyph; - /* Substitute default for non-existant glyphs */ - if (g >= font->num_glyphs || !font->glyphs[g]) - g = 0; - /* - * check to see if the glyph is placed where it would - * fall using the normal spacing - */ - if ((glyph = font->glyphs[g])) - { - if (pub != prevPublic || x != glyphs[i].x || y != glyphs[i].y) - { - prevPublic = pub; - if (font->format != format) - format = XftPreferFormat (dpy, font->format, format); - x = glyphs[i].x; - y = glyphs[i].y; - ++nelt; - } - x += glyph->metrics.xOff; - y += glyph->metrics.yOff; - } - } - - elts = elts_local; - if (nelt > NUM_ELT_LOCAL) - { - elts = malloc (nelt * sizeof (XGlyphElt8)); - if (!elts) - goto bail2; - } - - /* - * Generate the list of glyph elts - */ - nelt = 0; - x = y = 0; - n = 0; - j = 0; - prevPublic = 0; - for (i = 0; i < nglyphs; i++) - { - XftFont *pub = glyphs[i].font; - XftFontInt *font = (XftFontInt *) pub; - - g = glyphs[i].glyph; - /* Substitute default for non-existant glyphs */ - if (g >= font->num_glyphs || !font->glyphs[g]) - g = 0; - if ((glyph = font->glyphs[g])) - { - if (!i || pub != prevPublic || x != glyphs[i].x || y != glyphs[i].y) - { - if (n) - { - elts[nelt].nchars = n; - nelt++; - } - elts[nelt].glyphset = font->glyphset; - elts[nelt].chars = char8 + size * j; - elts[nelt].xOff = glyphs[i].x - x; - elts[nelt].yOff = glyphs[i].y - y; - prevPublic = pub; - x = glyphs[i].x; - y = glyphs[i].y; - n = 0; - } - switch (width) { - case 1: char8[j] = (char) g; break; - case 2: char16[j] = (unsigned short) g; break; - case 4: char32[j] = (unsigned int) g; break; - } - x += glyph->metrics.xOff; - y += glyph->metrics.yOff; - j++; - n++; - } - } - if (n) - { - elts[nelt].nchars = n; - nelt++; - } - switch (width) { - case 1: - XRenderCompositeText8 (dpy, op, src, dst, format, - srcx, srcy, glyphs[0].x, glyphs[0].y, - elts, nelt); - break; - case 2: - XRenderCompositeText16 (dpy, op, src, dst, format, - srcx, srcy, glyphs[0].x, glyphs[0].y, - (XGlyphElt16 *) elts, nelt); - break; - case 4: - XRenderCompositeText32 (dpy, op, src, dst, format, - srcx, srcy, glyphs[0].x, glyphs[0].y, - (XGlyphElt32 *) elts, nelt); - break; - } - - if (elts != elts_local) - free (elts); -bail2: - if (chars != char_local) - free (chars); -bail1: - if (glyphs_loaded) - for (i = 0; i < nglyphs; i++) - _XftFontManageMemory (dpy, glyphs[i].font); -} - -void -XftCharFontSpecRender (Display *dpy, - int op, - Picture src, - Picture dst, - int srcx, - int srcy, - _Xconst XftCharFontSpec *chars, - int len) -{ - XftGlyphFontSpec *glyphs, glyphs_local[NUM_LOCAL]; - int i; - - if (len <= NUM_LOCAL) - glyphs = glyphs_local; - else - { - glyphs = malloc (len * sizeof (XftGlyphFontSpec)); - if (!glyphs) - return; - } - for (i = 0; i < len; i++) - { - glyphs[i].font = chars[i].font; - glyphs[i].glyph = XftCharIndex(dpy, glyphs[i].font, chars[i].ucs4); - glyphs[i].x = chars[i].x; - glyphs[i].y = chars[i].y; - } - - XftGlyphFontSpecRender (dpy, op, src, dst, srcx, srcy, glyphs, len); - if (glyphs != glyphs_local) - free (glyphs); -} - -void -XftTextRender8 (Display *dpy, - int op, - Picture src, - XftFont *pub, - Picture dst, - int srcx, - int srcy, - int x, - int y, - _Xconst FcChar8 *string, - int len) -{ - FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; - int i; - - if (len <= NUM_LOCAL) - glyphs = glyphs_local; - else - { - glyphs = malloc (len * sizeof (FT_UInt)); - if (!glyphs) - return; - } - for (i = 0; i < len; i++) - glyphs[i] = XftCharIndex (dpy, pub, string[i]); - XftGlyphRender (dpy, op, src, pub, dst, - srcx, srcy, x, y, glyphs, len); - if (glyphs != glyphs_local) - free (glyphs); -} - -void -XftTextRender16 (Display *dpy, - int op, - Picture src, - XftFont *pub, - Picture dst, - int srcx, - int srcy, - int x, - int y, - _Xconst FcChar16 *string, - int len) -{ - FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; - int i; - - if (len <= NUM_LOCAL) - glyphs = glyphs_local; - else - { - glyphs = malloc (len * sizeof (FT_UInt)); - if (!glyphs) - return; - } - for (i = 0; i < len; i++) - glyphs[i] = XftCharIndex (dpy, pub, string[i]); - XftGlyphRender (dpy, op, src, pub, dst, - srcx, srcy, x, y, glyphs, len); - if (glyphs != glyphs_local) - free (glyphs); -} - -void -XftTextRender16BE (Display *dpy, - int op, - Picture src, - XftFont *pub, - Picture dst, - int srcx, - int srcy, - int x, - int y, - _Xconst FcChar8 *string, - int len) -{ - FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; - int i; - - if (len <= NUM_LOCAL) - glyphs = glyphs_local; - else - { - glyphs = malloc (len * sizeof (FT_UInt)); - if (!glyphs) - return; - } - for (i = 0; i < len; i++) - glyphs[i] = XftCharIndex (dpy, pub, - (string[i*2]<<8) | string[i*2+1]); - XftGlyphRender (dpy, op, src, pub, dst, - srcx, srcy, x, y, glyphs, len); - if (glyphs != glyphs_local) - free (glyphs); -} - -void -XftTextRender16LE (Display *dpy, - int op, - Picture src, - XftFont *pub, - Picture dst, - int srcx, - int srcy, - int x, - int y, - _Xconst FcChar8 *string, - int len) -{ - FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; - int i; - - if (len <= NUM_LOCAL) - glyphs = glyphs_local; - else - { - glyphs = malloc (len * sizeof (FT_UInt)); - if (!glyphs) - return; - } - for (i = 0; i < len; i++) - glyphs[i] = XftCharIndex (dpy, pub, - string[i*2] | (string[i*2+1]<<8)); - XftGlyphRender (dpy, op, src, pub, dst, - srcx, srcy, x, y, glyphs, len); - if (glyphs != glyphs_local) - free (glyphs); -} - -void -XftTextRender32 (Display *dpy, - int op, - Picture src, - XftFont *pub, - Picture dst, - int srcx, - int srcy, - int x, - int y, - _Xconst FcChar32 *string, - int len) -{ - FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; - int i; - - if (len <= NUM_LOCAL) - glyphs = glyphs_local; - else - { - glyphs = malloc (len * sizeof (FT_UInt)); - if (!glyphs) - return; - } - for (i = 0; i < len; i++) - glyphs[i] = XftCharIndex (dpy, pub, string[i]); - XftGlyphRender (dpy, op, src, pub, dst, - srcx, srcy, x, y, glyphs, len); - if (glyphs != glyphs_local) - free (glyphs); -} - -void -XftTextRender32BE (Display *dpy, - int op, - Picture src, - XftFont *pub, - Picture dst, - int srcx, - int srcy, - int x, - int y, - _Xconst FcChar8 *string, - int len) -{ - FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; - int i; - - if (len <= NUM_LOCAL) - glyphs = glyphs_local; - else - { - glyphs = malloc (len * sizeof (FT_UInt)); - if (!glyphs) - return; - } - for (i = 0; i < len; i++) - glyphs[i] = XftCharIndex (dpy, pub, - (string[i*4] << 24) | - (string[i*4+1] << 16) | - (string[i*4+2] << 8) | - (string[i*4+3])); - XftGlyphRender (dpy, op, src, pub, dst, - srcx, srcy, x, y, glyphs, len); - if (glyphs != glyphs_local) - free (glyphs); -} - -void -XftTextRender32LE (Display *dpy, - int op, - Picture src, - XftFont *pub, - Picture dst, - int srcx, - int srcy, - int x, - int y, - _Xconst FcChar8 *string, - int len) -{ - FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; - int i; - - if (len <= NUM_LOCAL) - glyphs = glyphs_local; - else - { - glyphs = malloc (len * sizeof (FT_UInt)); - if (!glyphs) - return; - } - for (i = 0; i < len; i++) - glyphs[i] = XftCharIndex (dpy, pub, - (string[i*4]) | - (string[i*4+1] << 8) | - (string[i*4+2] << 16) | - (string[i*4+3] << 24)); - XftGlyphRender (dpy, op, src, pub, dst, - srcx, srcy, x, y, glyphs, len); - if (glyphs != glyphs_local) - free (glyphs); -} - -void -XftTextRenderUtf8 (Display *dpy, - int op, - Picture src, - XftFont *pub, - Picture dst, - int srcx, - int srcy, - int x, - int y, - _Xconst FcChar8 *string, - int len) -{ - FT_UInt *glyphs, *glyphs_new, glyphs_local[NUM_LOCAL]; - FcChar32 ucs4; - int i; - int l; - int size; - - i = 0; - glyphs = glyphs_local; - size = NUM_LOCAL; - while (len && (l = FcUtf8ToUcs4 (string, &ucs4, len)) > 0) - { - if (i == size) - { - glyphs_new = malloc (size * 2 * sizeof (FT_UInt)); - if (!glyphs_new) - { - if (glyphs != glyphs_local) - free (glyphs); - return; - } - memcpy (glyphs_new, glyphs, size * sizeof (FT_UInt)); - size *= 2; - if (glyphs != glyphs_local) - free (glyphs); - glyphs = glyphs_new; - } - glyphs[i++] = XftCharIndex (dpy, pub, ucs4); - string += l; - len -= l; - } - XftGlyphRender (dpy, op, src, pub, dst, - srcx, srcy, x, y, glyphs, i); - if (glyphs != glyphs_local) - free (glyphs); -} - -void -XftTextRenderUtf16 (Display *dpy, - int op, - Picture src, - XftFont *pub, - Picture dst, - int srcx, - int srcy, - int x, - int y, - _Xconst FcChar8 *string, - FcEndian endian, - int len) -{ - FT_UInt *glyphs, *glyphs_new, glyphs_local[NUM_LOCAL]; - FcChar32 ucs4; - int i; - int l; - int size; - - i = 0; - glyphs = glyphs_local; - size = NUM_LOCAL; - while (len && (l = FcUtf16ToUcs4 (string, endian, &ucs4, len)) > 0) - { - if (i == size) - { - glyphs_new = malloc (size * 2 * sizeof (FT_UInt)); - if (!glyphs_new) - { - if (glyphs != glyphs_local) - free (glyphs); - return; - } - memcpy (glyphs_new, glyphs, size * sizeof (FT_UInt)); - size *= 2; - if (glyphs != glyphs_local) - free (glyphs); - glyphs = glyphs_new; - } - glyphs[i++] = XftCharIndex (dpy, pub, ucs4); - string += l; - len -= l; - } - XftGlyphRender (dpy, PictOpOver, src, pub, dst, - srcx, srcy, x, y, glyphs, i); - if (glyphs != glyphs_local) - free (glyphs); -} diff --git a/nx-X11/lib/Xft/xftstr.c b/nx-X11/lib/Xft/xftstr.c deleted file mode 100644 index 2aec82df7..000000000 --- a/nx-X11/lib/Xft/xftstr.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * $Id: xftstr.c,v 1.4 2005/07/03 07:00:57 daniels Exp $ - * - * Copyright © 2000 Keith Packard - * - * 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" - -int -_XftMatchSymbolic (XftSymbolic *s, int n, const char *name, int def) -{ - while (n--) - { - if (!FcStrCmpIgnoreCase ((FcChar8 *) s->name, (FcChar8 *) name)) - return s->value; - s++; - } - return def; -} diff --git a/nx-X11/lib/Xft/xftswap.c b/nx-X11/lib/Xft/xftswap.c deleted file mode 100644 index 9e3ac6495..000000000 --- a/nx-X11/lib/Xft/xftswap.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * $Id: xftswap.c,v 1.4 2005/07/03 07:00:57 daniels Exp $ - * - * Copyright © 2002 Keith Packard - * - * 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" - -int -XftNativeByteOrder (void) -{ - int whichbyte = 1; - - if (*((char *) &whichbyte)) - return LSBFirst; - return MSBFirst; -} - -/* byte swap a 32-bit value */ -#define swapl(x, n) { \ - n = ((char *) (x))[0];\ - ((char *) (x))[0] = ((char *) (x))[3];\ - ((char *) (x))[3] = n;\ - n = ((char *) (x))[1];\ - ((char *) (x))[1] = ((char *) (x))[2];\ - ((char *) (x))[2] = n; } - -/* byte swap a short */ -#define swaps(x, n) { \ - n = ((char *) (x))[0];\ - ((char *) (x))[0] = ((char *) (x))[1];\ - ((char *) (x))[1] = n; } - -/* byte swap a three-byte unit */ -#define swapt(x, n) { \ - n = ((char *) (x))[0];\ - ((char *) (x))[0] = ((char *) (x))[2];\ - ((char *) (x))[2] = n; } - -void -XftSwapCARD32 (CARD32 *data, int u) -{ - char n; - while (u--) - { - swapl (data, n); - data++; - } -} - -void -XftSwapCARD24 (CARD8 *data, int width, int height) -{ - int units, u; - char n; - CARD8 *d; - - units = width / 3; - while (height--) - { - d = data; - data += width; - u = units; - while (u--) - { - swapt (d, n); - d += 3; - } - } -} - -void -XftSwapCARD16 (CARD16 *data, int u) -{ - char n; - while (u--) - { - swaps (data, n); - data++; - } -} - -void -XftSwapImage (XImage *image) -{ - switch (image->bits_per_pixel) { - case 32: - XftSwapCARD32 ((CARD32 *) image->data, - image->height * image->bytes_per_line >> 2); - break; - case 24: - XftSwapCARD24 ((CARD8 *) image->data, - image->bytes_per_line, - image->height); - break; - case 16: - XftSwapCARD16 ((CARD16 *) image->data, - image->height * image->bytes_per_line >> 1); - break; - default: - break; - } -} diff --git a/nx-X11/lib/Xft/xftxlfd.c b/nx-X11/lib/Xft/xftxlfd.c deleted file mode 100644 index 05899dbba..000000000 --- a/nx-X11/lib/Xft/xftxlfd.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * $Id: xftxlfd.c,v 1.4 2005/07/03 07:00:57 daniels Exp $ - * - * Copyright © 2000 Keith Packard - * - * 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" - -static XftSymbolic XftXlfdWeights[] = { - { "light", FC_WEIGHT_LIGHT }, - { "medium", FC_WEIGHT_MEDIUM }, - { "regular", FC_WEIGHT_MEDIUM }, - { "demibold", FC_WEIGHT_DEMIBOLD }, - { "bold", FC_WEIGHT_BOLD }, - { "black", FC_WEIGHT_BLACK }, -}; - -#define NUM_XLFD_WEIGHTS (sizeof XftXlfdWeights/sizeof XftXlfdWeights[0]) - -static XftSymbolic XftXlfdSlants[] = { - { "r", FC_SLANT_ROMAN }, - { "i", FC_SLANT_ITALIC }, - { "o", FC_SLANT_OBLIQUE }, -}; - -#define NUM_XLFD_SLANTS (sizeof XftXlfdSlants/sizeof XftXlfdSlants[0]) - -/* - * Cut out one XLFD field, placing it in 'save' and return - * the start of 'save' - */ -static 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; -} - -/* - * convert one XLFD numeric field. Return -1 if the field is '*' - */ - -static 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; -} - -FcPattern * -XftXlfdParse (const char *xlfd_orig, FcBool ignore_scalable, FcBool complete) -{ - FcPattern *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; - 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 (!pixel) - return 0; - - pat = FcPatternCreate (); - if (!pat) - return 0; - - save = (char *) malloc (strlen (foundry) + 1); - - if (!save) - return 0; - - if (!FcPatternAddString (pat, XFT_XLFD, (FcChar8 *) xlfd_orig)) goto bail; - - XftSplitStr (foundry, save); - if (save[0] && strcmp (save, "*") != 0) - if (!FcPatternAddString (pat, FC_FOUNDRY, (FcChar8 *) save)) goto bail; - - XftSplitStr (family, save); - if (save[0] && strcmp (save, "*") != 0) - if (!FcPatternAddString (pat, FC_FAMILY, (FcChar8 *) save)) goto bail; - - weight_value = _XftMatchSymbolic (XftXlfdWeights, NUM_XLFD_WEIGHTS, - XftSplitStr (weight_name, save), - FC_WEIGHT_MEDIUM); - if (!FcPatternAddInteger (pat, FC_WEIGHT, weight_value)) - goto bail; - - slant_value = _XftMatchSymbolic (XftXlfdSlants, NUM_XLFD_SLANTS, - XftSplitStr (slant, save), - FC_SLANT_ROMAN); - if (!FcPatternAddInteger (pat, FC_SLANT, slant_value)) - goto bail; - - dpixel = (double) pixel; - - if (point > 0) - { - if (!FcPatternAddDouble (pat, FC_SIZE, ((double) point) / 10.0)) goto bail; - if (pixel <= 0 && resy > 0) - { - dpixel = (double) point * (double) resy / 720.0; - } - } - - if (dpixel > 0) - if (!FcPatternAddDouble (pat, FC_PIXEL_SIZE, dpixel)) goto bail; - - free (save); - return pat; - -bail: - free (save); - FcPatternDestroy (pat); - return 0; -} diff --git a/nx-X11/lib/Xft1/Imakefile b/nx-X11/lib/Xft1/Imakefile deleted file mode 100644 index dbb48cf45..000000000 --- a/nx-X11/lib/Xft1/Imakefile +++ /dev/null @@ -1,150 +0,0 @@ -XCOMM $XFree86: xc/lib/Xft1/Imakefile,v 1.13tsi Exp $ - -XCOMM Allow for builds against old installed bits -#ifdef UseInstalled - -#ifndef SharedLibXft1 -#define SharedLibXft1 YES -#endif - -#ifndef NormalLibXft1 -#define NormalLibXft1 (!SharedLibXft1 | ForceNormalLib) -#endif - -#ifndef DebugLibXft1 -#define DebugLibXft1 NO -#endif - -#ifndef ProfileLibXft1 -#define ProfileLibXft1 NO -#endif - -#ifndef FontconfigClientDepLibs -#define FontconfigClientDepLibs $(DEPFONTCONFIGLIB) -#endif -#ifndef FontconfigClientLibs -#define FontconfigClientLibs $(FONTCONFIGLIB) -#endif - -#if SharedLibFontconfig -#define SharedFontconfigRev 1.0 - -SharedLibReferences(FONTCONFIG,fontconfig,$(FONTCONFIGSRC),SOXLIBREV,SharedFontconfigRev) -#else - -ProjectUnsharedLibReferences(FONTCONFIG,fontconfig,$(FONTCONFIGSRC),BuildLibDir) -#endif - -#if SharedLibXft1 -#define SharedXft1Rev 1.2 -SharedLibReferences(XFT1,Xft,$(XFT1SRC),SOXFT1REV,SharedXft1Rev) -#else -ProjectUnsharedLibReferences(XFT1,Xft,$(XFT1SRC),BuildLibDir) -#endif - -#undef LinkBuildLibrary -#define LinkBuildLibrary(lib) MakeDir($(BUILDLIBDIR)) @@\ - RemoveFile($(BUILDLIBDIR)/lib) @@\ - cd $(BUILDLIBDIR) && $(LN) $(BUILDLIBTOP)/$(CURRENT_DIR)/lib . -#undef _LinkBuildLibrary -#define _LinkBuildLibrary(lib) LinkBuildLibrary(lib) - -#undef LinkBuildLibraryMaybe -#define LinkBuildLibraryMaybe(lib,doit) MakeDir($(BUILDLIBDIR)) @@\ - @if doit; then (set -x; \ @@\ - RemoveFile($(BUILDLIBDIR)/lib); \ @@\ - cd $(BUILDLIBDIR) && $(LN) $(BUILDLIBTOP)/$(CURRENT_DIR)/lib .); fi - -#ifdef LdPreLibs -# undef LdPreLibs -#endif -#define LdPreLibs -L$(BUILDLIBDIR) LdPreLib XLdPreLibs - -LDPRELIBS=LdPreLibs -#endif - - -#define DoNormalLib NO -#define DoSharedLib SharedLibXft1 -#define DoExtraLib NO -#define DoDebugLib NO -#define DoProfileLib NO -#define HasSharedData YES -#define LibName Xft -#define SoRev SOXFT1REV -#define LibHeaders NO -#define NoSoSymlink - -#include - -YFLAGS = -d - -#ifndef XftLibDir -#define XftLibDir $(LIBDIR) -#endif - -XFTLIBDIR=XftLibDir - -INCLUDES=$(FONTCONFIGINCLUDES) $(FREETYPE2INCLUDES) -I$(XBUILDINCDIR) -DEFINES=$(FREETYPE2DEFINES) $(RENDERDEFINES) -DXFREE86_FT2 - -#if UseFreetype2 -FREETYPE2REQLIB = $(FREETYPE2LIB) -#endif - -REQUIREDLIBS=$(LDPRELIBS) $(XRENDERLIB) $(XLIB) $(FONTCONFIGLIB) $(EXPATLIB) $(FREETYPE2REQLIB) - -#if UseFreetype2 -FT_OLD = xftcache.c -FT_HEADERS = XftFreetype.h - FT_SRCS = xftfreetype.c xftglyphs.c xftrender.c xftdir.c - FT_OBJS = xftfreetype.o xftglyphs.o xftrender.o xftdir.o -#endif - -HEADERS = Xft.h $(FT_HEADERS) - -OLD = xftgram.c xftlex.c - - SRCS = xftcfg.c xftcolor.c xftcore.c xftdbg.c xftdpy.c \ - xftdraw.c xftextent.c xftfont.c xftfs.c\ - xftinit.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 \ - xftinit.o xftlist.o xftmatch.o xftmatrix.o \ - xftname.o xftpat.o xftstr.o xftxlfd.o $(FT_OBJS) - -#include - -#if DoSharedLib && SharedDataSeparation -SpecialCObjectRule(sharedlib,NullParameter,$(SHLIBDEF)) -#endif - -/* - * InstallNamedTargetRelated - like InstallNamedTarget, but only - * installs if a related file already exists. Useful for - * annotating older systems with information on the relationship - * with the new system. - */ - -#ifndef InstallNamedTargetRelated -#define InstallNamedTargetRelated(step,srcname,flags,dest,dstname,dstrel)@@\ -step:: srcname @@\ - MakeDir($(DESTDIR)dest) @@\ - @if [ -f $(DESTDIR)dest/dstrel ]; then \ @@\ - set -x; \ @@\ - $(INSTALL) $(INSTALLFLAGS) flags srcname $(DESTDIR)dest/dstname; fi -#endif - -#ifndef InstallNonExecFileRelated -#define InstallNonExecFileRelated(file,dest,rel) @@\ -InstallNamedTargetRelated(install,file,$(INSTDATFLAGS),dest,file,rel) -#endif /* InstallNonExecFileBackup */ - -InstallNonExecFileRelated(XftConfig-OBSOLETE,$(XFTLIBDIR),XftConfig) -InstallNonExecFileRelated(XftConfig-OBSOLETE,$(CONFDIR),XftConfig) - -MANSUFFIX = $(LIBMANSUFFIX) -InstallManPage(Xft,$(LIBMANDIR)) -DependTarget() diff --git a/nx-X11/lib/Xft1/Xft-def.cpp b/nx-X11/lib/Xft1/Xft-def.cpp deleted file mode 100644 index 410b8202b..000000000 --- a/nx-X11/lib/Xft1/Xft-def.cpp +++ /dev/null @@ -1,171 +0,0 @@ -LIBRARY Xft -VERSION LIBRARY_VERSION -EXPORTS - -#ifndef __UNIXOS2__ -XftConfigAddDir -XftConfigAddEdit -XftConfigGetCache -XftConfigSetCache -XftConfigSubstitute -_XftConfigCompareValue -#endif -XftColorAllocName -XftColorAllocValue -XftColorFree -#ifndef __UNIXOS2__ -XftCoreConvert16 -XftCoreConvert32 -XftCoreConvertUtf8 -XftCoreExtents16 -XftCoreExtents32 -XftCoreExtents8 -XftCoreExtentsUtf8 -XftCoreGlyphExists -XftEditPrint -XftExprPrint -XftFontSetPrint -XftOpPrint -XftPatternPrint -XftSubstPrint -XftTestPrint -XftValueListPrint -XftValuePrint -#endif -XftDefaultGetBool -XftDefaultGetDouble -XftDefaultGetInteger -XftDefaultHasRender -XftDefaultParseBool -XftDefaultSet -XftDefaultSubstitute -#ifndef __UNIXOS2__ -XftDisplayGetFontSet -#endif -XftDrawChange -#ifndef __UNIXOS2__ -XftDrawCorePrepare -#endif -XftDrawCreate -XftDrawCreateBitmap -XftDrawDestroy -XftDrawRect -#ifndef __UNIXOS2__ -XftDrawRenderPrepare -#endif -XftDrawSetClip -XftDrawString16 -XftDrawString32 -XftDrawString8 -XftDrawStringUtf8 -XftTextExtents16 -XftTextExtents32 -XftTextExtents8 -XftTextExtentsUtf8 -XftFontClose -XftFontMatch -XftFontOpen -XftFontOpenName -XftFontOpenPattern -XftFontOpenXlfd -#ifndef __UNIXOS2__ -XftGlyphExists -_XftFontDebug -XftFontSetAdd -XftFontSetCreate -XftFontSetDestroy -XftConfigSaveField -XftConfigerror -XftConfigparse -XftConfigwrap -XftEditCreate -XftEditDestroy -XftExprCreateBool -XftExprCreateDouble -XftExprCreateField -XftExprCreateInteger -XftExprCreateNil -XftExprCreateOp -XftExprCreateString -XftExprDestroy -XftTestCreate -#endif -XftInit -#ifndef __UNIXOS2__ -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 -#endif -XftListFonts -XftListFontsPatternObjects -#ifndef __UNIXOS2__ -XftListMatch -XftListValueCompare -XftListValueListCompare -XftObjectSetAdd -XftObjectSetBuild -XftObjectSetCreate -XftObjectSetDestroy -XftObjectSetVaBuild -XftFontSetMatch -XftNameConstant -#endif -XftNameParse -XftNameUnparse -#ifndef __UNIXOS2__ -XftPatternAdd -XftPatternAddBool -XftPatternAddDouble -XftPatternAddInteger -XftPatternAddString -XftPatternBuild -XftPatternCreate -XftPatternDel -XftPatternDestroy -XftPatternDuplicate -XftPatternFind -XftPatternGet -XftPatternGetBool -XftPatternGetDouble -XftPatternGetInteger -XftPatternGetString -XftPatternVaBuild -XftValueDestroy -XftValueListDestroy -XftUtf8Len -XftUtf8ToUcs4 -_XftDownStr -_XftGetInt -#endif -_XftMatchSymbolic -#ifndef __UNIXOS2__ -_XftSaveString -_XftSplitField -_XftSplitStr -_XftSplitValue -_XftStrCmpIgnoreCase -XftCoreAddFonts -XftCoreClose -XftCoreOpen -#endif -XftXlfdParse -XftInitFtLibrary -#ifndef __UNIXOS2__ -XftConfigDirs -XftDirScan -XftDirSave -#endif - -/* $XFree86: xc/lib/Xft/Xft-def.cpp,v 1.4 2002/09/18 01:25:00 dawes Exp $ */ diff --git a/nx-X11/lib/Xft1/Xft.h b/nx-X11/lib/Xft1/Xft.h deleted file mode 100644 index 71ef9b80c..000000000 --- a/nx-X11/lib/Xft1/Xft.h +++ /dev/null @@ -1,486 +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 -#include -#include - -#include -#include - -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 FcType XftType; - -typedef FcMatrix XftMatrix; - -#define XftMatrixInit(m) FcMatrixInit(m) - -typedef FcResult XftResult; - -#define XftResultMatch FcResultMatch -#define XftResultNoMatch FcResultNoMatch -#define XftResultTypeMismatch FcResultTypeMismatch -#define XftResultNoId FcResultNoId - -#define XftTypeVoid FcTypeVoid -#define XftTypeInteger FcTypeInteger -#define XftTypeDouble FcTypeDouble -#define XftTypeString FcTypeString -#define XftTypeBool FcTypeBool -#define XftTypeMatrix FcTypeMatrix - -typedef FcValue XftValue; - - -typedef FcPattern XftPattern; - -typedef FcFontSet 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 FcObjectSet 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 -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 -XftPatternDestroy (XftPattern *p); - -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/nx-X11/lib/Xft1/Xft.man b/nx-X11/lib/Xft1/Xft.man deleted file mode 100644 index 7d62818a2..000000000 --- a/nx-X11/lib/Xft1/Xft.man +++ /dev/null @@ -1,180 +0,0 @@ -.\" -.\" $XFree86: xc/lib/Xft/Xft.man,v 1.2 2000/11/30 06:59:45 keithp Exp $ -.\" -.\" Copyright © 2000 Keith Packard. -.\" 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 __libmansuffix__ __vendorversion__ - -.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 diff --git a/nx-X11/lib/Xft1/XftConfig-OBSOLETE b/nx-X11/lib/Xft1/XftConfig-OBSOLETE deleted file mode 100644 index ec90d1bfe..000000000 --- a/nx-X11/lib/Xft1/XftConfig-OBSOLETE +++ /dev/null @@ -1,2 +0,0 @@ -The XftConfig file is no longer used by Xft. Please see -/etc/fonts/fonts.conf to configure client-side fonts. diff --git a/nx-X11/lib/Xft1/XftFreetype.h b/nx-X11/lib/Xft1/XftFreetype.h deleted file mode 100644 index 07fed47e4..000000000 --- a/nx-X11/lib/Xft1/XftFreetype.h +++ /dev/null @@ -1,167 +0,0 @@ -/* - * $XFree86: xc/lib/Xft1/XftFreetype.h,v 1.3 2002/03/02 22:09:04 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 "Xft.h" -#include -#include FT_FREETYPE_H - -#include -#include - -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; -}; - -#define XftUntestedGlyph ((XGlyphInfo *) 1) - -_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/nx-X11/lib/Xft1/xftcache.c b/nx-X11/lib/Xft1/xftcache.c deleted file mode 100644 index 13e20a92b..000000000 --- a/nx-X11/lib/Xft1/xftcache.c +++ /dev/null @@ -1,608 +0,0 @@ -/* - * $XFree86: xc/lib/Xft/xftcache.c,v 1.2 2001/06/11 22:53:30 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 -#include -#include -#include -#include -#include -#include -#include -#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 + 1; - 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/nx-X11/lib/Xft1/xftcfg.c b/nx-X11/lib/Xft1/xftcfg.c deleted file mode 100644 index b6e9d3a7c..000000000 --- a/nx-X11/lib/Xft1/xftcfg.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * $XFree86: xc/lib/Xft/xftcfg.c,v 1.8 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 -#include -#include -#include "xftint.h" - -Bool -XftConfigSubstitute (XftPattern *p) -{ - FcConfigSubstitute (0, p, FcMatchPattern); - FcConfigSubstitute (0, p, FcMatchFont); - return True; -} diff --git a/nx-X11/lib/Xft1/xftcolor.c b/nx-X11/lib/Xft1/xftcolor.c deleted file mode 100644 index 9c81f50ca..000000000 --- a/nx-X11/lib/Xft1/xftcolor.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * $XFree86: xc/lib/Xft/xftcolor.c,v 1.2 2001/05/16 17:20:06 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 = color->alpha; - 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/nx-X11/lib/Xft1/xftcore.c b/nx-X11/lib/Xft1/xftcore.c deleted file mode 100644 index 331cbd7e3..000000000 --- a/nx-X11/lib/Xft1/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 -#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/nx-X11/lib/Xft1/xftdbg.c b/nx-X11/lib/Xft1/xftdbg.c deleted file mode 100644 index 098fef74b..000000000 --- a/nx-X11/lib/Xft1/xftdbg.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * $XFree86: xc/lib/Xft/xftdbg.c,v 1.3 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 "xftint.h" - -void -XftFontSetPrint (XftFontSet *s) -{ - FcFontSetPrint (s); -} - -void -XftPatternPrint (XftPattern *p) -{ - FcPatternPrint (p); -} - -void -XftValuePrint (XftValue v) -{ - FcValuePrint (v); -} diff --git a/nx-X11/lib/Xft1/xftdir.c b/nx-X11/lib/Xft1/xftdir.c deleted file mode 100644 index 88d89c902..000000000 --- a/nx-X11/lib/Xft1/xftdir.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * $XFree86: xc/lib/Xft1/xftdir.c,v 1.2 2002/03/01 01:00: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 -#include -#include -#include -#include "xftint.h" - -Bool -XftDirScan (XftFontSet *set, const char *dir, Bool force) -{ - return FcFalse; -} - -Bool -XftDirSave (XftFontSet *set, const char *dir) -{ - return FcFalse; -} - diff --git a/nx-X11/lib/Xft1/xftdpy.c b/nx-X11/lib/Xft1/xftdpy.c deleted file mode 100644 index d28c5c88a..000000000 --- a/nx-X11/lib/Xft1/xftdpy.c +++ /dev/null @@ -1,436 +0,0 @@ -/* - * $XFree86: xc/lib/Xft1/xftdpy.c,v 1.2tsi 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 -#include -#include -#include -#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; -} - -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; - info->glyphSets = 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) - { - int subpixel = XFT_RGBA_NONE; -#if RENDER_MAJOR > 0 || RENDER_MINOR >= 6 - int render_order = XRenderQuerySubpixelOrder (dpy, screen); - switch (render_order) { - default: - case SubPixelUnknown: subpixel = XFT_RGBA_NONE; break; - case SubPixelHorizontalRGB: subpixel = XFT_RGBA_RGB; break; - case SubPixelHorizontalBGR: subpixel = XFT_RGBA_BGR; break; - case SubPixelVerticalRGB: subpixel = XFT_RGBA_VRGB; break; - case SubPixelVerticalBGR: subpixel = XFT_RGBA_VBGR; break; - case SubPixelNone: subpixel = XFT_RGBA_NONE; break; - } -#endif - XftPatternAddInteger (pattern, XFT_RGBA, - XftDefaultGetInteger (dpy, XFT_RGBA, screen, - subpixel)); - } - 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) - { - double pixels, mm, 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 = (pixels * 25.4) / mm; - dpi = XftDefaultGetDouble (dpy, XFT_DPI, screen, dpi); - size = size * dpi / 72.0; - XftPatternAddDouble (pattern, XFT_PIXEL_SIZE, size); - } -} diff --git a/nx-X11/lib/Xft1/xftdraw.c b/nx-X11/lib/Xft1/xftdraw.c deleted file mode 100644 index f9c3b8b79..000000000 --- a/nx-X11/lib/Xft1/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 -#include -#include -#include "xftint.h" -#include - -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/nx-X11/lib/Xft1/xftextent.c b/nx-X11/lib/Xft1/xftextent.c deleted file mode 100644 index 8a6cf620a..000000000 --- a/nx-X11/lib/Xft1/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 -#include -#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/nx-X11/lib/Xft1/xftfont.c b/nx-X11/lib/Xft1/xftfont.c deleted file mode 100644 index ab393af81..000000000 --- a/nx-X11/lib/Xft1/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 -#include -#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/nx-X11/lib/Xft1/xftfreetype.c b/nx-X11/lib/Xft1/xftfreetype.c deleted file mode 100644 index 1021c95bf..000000000 --- a/nx-X11/lib/Xft1/xftfreetype.c +++ /dev/null @@ -1,678 +0,0 @@ -/* - * $XFree86: xc/lib/Xft1/xftfreetype.c,v 1.5 2002/08/12 22:17:49 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 -#include -#include -#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; - f->matrix.xx = 0x10000; - f->matrix.xy = 0x0; - f->matrix.yy = 0x10000; - f->matrix.yx = 0x0; - 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; - -XftFontStruct * -XftFreeTypeOpen (Display *dpy, XftPattern *pattern) -{ - XftDisplayInfo *info = _XftDisplayInfoGet (dpy); - 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; - -#if 0 - int extra; -#endif - 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 = info->glyphSets; 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) - { - switch (rgba) { - case FC_RGBA_RGB: - case FC_RGBA_BGR: - case FC_RGBA_VRGB: - case FC_RGBA_VBGR: - 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); - break; - default: - pf.depth = 8; - pf.type = PictTypeDirect; - pf.direct.alpha = 0; - pf.direct.alphaMask = 0xff; - format = XRenderFindFormat(dpy, - PictFormatType| - PictFormatDepth| - PictFormatAlpha| - PictFormatAlphaMask, - &pf, 0); - break; - } - } - 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; -#if 0 - extra = (height - (ascent + descent)); - if (extra > 0) - { - ascent = ascent + extra / 2; - descent = height - ascent; - } - else if (extra < 0) - height = ascent + descent; -#endif - } - 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 = info->glyphSets; - info->glyphSets = 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; - XftDisplayInfo *info = _XftDisplayInfoGet (dpy); - int i; - XGlyphInfo *gi; - - for (prev = &info->glyphSets; (gs = *prev); prev = &gs->next) - { - if (&gs->font == font) - { - if (--gs->ref == 0) - { - XRenderFreeGlyphSet (dpy, font->glyphset); - for (i = 0; i < font->nrealized; i++) - { - gi = font->realized[i]; - if (gi && gi != XftUntestedGlyph) - free (gi); - } - 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) -{ - if (_XftFTlibrary) - return True; - if (FT_Init_FreeType (&_XftFTlibrary)) - return False; - _XftFontSet = FcConfigGetFonts (0, FcSetSystem); - if (!_XftFontSet) - return False; - return True; -} diff --git a/nx-X11/lib/Xft1/xftfs.c b/nx-X11/lib/Xft1/xftfs.c deleted file mode 100644 index a246b2056..000000000 --- a/nx-X11/lib/Xft1/xftfs.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * $XFree86$ - * - * 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 -#include "xftint.h" - -XftFontSet * -XftFontSetCreate (void) -{ - return FcFontSetCreate (); -} - -void -XftFontSetDestroy (XftFontSet *s) -{ - FcFontSetDestroy (s); -} - -Bool -XftFontSetAdd (XftFontSet *s, XftPattern *font) -{ - return FcFontSetAdd (s, font); -} diff --git a/nx-X11/lib/Xft1/xftglyphs.c b/nx-X11/lib/Xft1/xftglyphs.c deleted file mode 100644 index 1e23d0a0b..000000000 --- a/nx-X11/lib/Xft1/xftglyphs.c +++ /dev/null @@ -1,491 +0,0 @@ -/* - * $XFree86: xc/lib/Xft1/xftglyphs.c,v 1.3 2003/05/27 22:26:41 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 -#include -#include -#include "xftint.h" -#include -#include FT_OUTLINE_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 }, -}; - -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; - 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 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, FT_LOAD_NO_BITMAP); - 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 ); - - /* - * 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] = XftUntestedGlyph; - - font->realized = realized; - font->nrealized = nrealized; - } - if (font->realized[glyph] == XftUntestedGlyph) - { - 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/nx-X11/lib/Xft1/xftgram.y b/nx-X11/lib/Xft1/xftgram.y deleted file mode 100644 index 04e231e7c..000000000 --- a/nx-X11/lib/Xft1/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 -#include -#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 INTEGER -%token DOUBLE -%token STRING NAME -%token ANY ALL -%token DIR CACHE INCLUDE INCLUDEIF MATCH EDIT -%token TOK_TRUE TOK_FALSE TOK_NIL -%token EQUAL SEMI OS CS - -%type expr -%type value -%type field -%type edit -%type edits -%type eqop -%type qual -%type compare -%type tests test -%type number - -%right QUEST COLON -%left OROR -%left ANDAND -%left EQEQ NOTEQ -%left LESS LESSEQ MORE MOREEQ -%left PLUS MINUS -%left TIMES DIVIDE -%right 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/nx-X11/lib/Xft1/xftinit.c b/nx-X11/lib/Xft1/xftinit.c deleted file mode 100644 index 79e589160..000000000 --- a/nx-X11/lib/Xft1/xftinit.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * $XFree86: xc/lib/Xft1/xftinit.c,v 1.3 2002/03/01 20:33:33 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 -#include "xftint.h" - -XftFontSet *_XftFontSet; -Bool _XftConfigInitialized; -static char *nodirs[] = { 0 }; -char **XftConfigDirs = nodirs; - -Bool -XftInit (char *config) -{ - if (_XftConfigInitialized) - return True; - if (!FcInit ()) - return False; - _XftConfigInitialized = True; - return True; -} diff --git a/nx-X11/lib/Xft1/xftint.h b/nx-X11/lib/Xft1/xftint.h deleted file mode 100644 index c73fb1723..000000000 --- a/nx-X11/lib/Xft1/xftint.h +++ /dev/null @@ -1,508 +0,0 @@ -/* - * $XFree86: xc/lib/Xft1/xftint.h,v 1.2 2002/03/01 01:00: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. - */ - -#ifndef _XFTINT_H_ -#define _XFTINT_H_ - -#include -#include -#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; - struct _XftFtGlyphSet *glyphSets; -} XftDisplayInfo; - -extern XftFontSet *_XftGlobalFontSet; -extern XftDisplayInfo *_XftDisplayInfo; -extern char **XftConfigDirs; -extern XftFontSet *_XftFontSet; - -typedef struct _FcPatternElt FcPatternElt; - -/* - * Yes, these are stolen from fcint.h - */ -FcPatternElt * -FcPatternFindElt (const FcPattern *p, const char *object); - -FcPatternElt * -FcPatternInsertElt (FcPattern *p, const char *object); - -typedef FcPatternElt XftPatternElt; - -#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 -#define XFT_DBG_EDIT 2048 - -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 */ -XftDisplayInfo * -_XftDisplayInfoGet (Display *dpy); - -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 -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 */ - -extern FcPatternElt * -FcPatternFind (FcPattern *p, const char *object, FcBool insert); - -XftPatternElt * -XftPatternFind (XftPattern *p, const char *object, FcBool insert); - -/* 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/nx-X11/lib/Xft1/xftlex.l b/nx-X11/lib/Xft1/xftlex.l deleted file mode 100644 index 3eff3f429..000000000 --- a/nx-X11/lib/Xft1/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 -#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/nx-X11/lib/Xft1/xftlist.c b/nx-X11/lib/Xft1/xftlist.c deleted file mode 100644 index dca5c42d1..000000000 --- a/nx-X11/lib/Xft1/xftlist.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * $XFree86: xc/lib/Xft1/xftlist.c,v 1.3 2002/06/21 06:15:14 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 -#include "xftint.h" -#include - -XftObjectSet * -XftObjectSetCreate (void) -{ - return FcObjectSetCreate (); -} - -Bool -XftObjectSetAdd (XftObjectSet *os, const char *object) -{ - return FcObjectSetAdd (os, object); -} - -void -XftObjectSetDestroy (XftObjectSet *os) -{ - FcObjectSetDestroy (os); -} - - -XftObjectSet * -XftObjectSetVaBuild (const char *first, va_list va) -{ - XftObjectSet *ret; - - FcObjectSetVapBuild (ret, first, va); - return ret; -} - -XftObjectSet * -XftObjectSetBuild (const char *first, ...) -{ - va_list va; - XftObjectSet *os; - - va_start (va, first); - FcObjectSetVapBuild (os, first, va); - va_end (va); - return os; -} - -XftFontSet * -XftListFontSets (XftFontSet **sets, - int nsets, - XftPattern *p, - XftObjectSet *os) -{ - return FcFontSetList (0, sets, nsets, p, os); -} - -XftFontSet * -XftListFontsPatternObjects (Display *dpy, - int screen, - XftPattern *pattern, - XftObjectSet *os) -{ - XftFontSet *sets[2]; - int nsets = 0; -#ifdef FREETYPE2 - Bool core, render; - XftResult result; -#endif - XftPattern *pattern_trim; - XftFontSet *ret; - - if (!XftInit (0)) - return 0; - - pattern_trim = XftPatternDuplicate (pattern); - if (!pattern_trim) - return 0; - - XftPatternDel (pattern_trim, XFT_CORE); - XftPatternDel (pattern_trim, XFT_RENDER); -#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) - { - /* - * fontconfig fonts never include encoding values. - * deleting it is something of a kludge as it eliminates the - * ability to list core fonts and render fonts of a specific - * encoding. Fortunately, Xft1 apps generally don't want core - * fonts in any case. - */ - XftPatternDel (pattern_trim, XFT_ENCODING); - if (XftInitFtLibrary()) - { - sets[nsets] = _XftFontSet; - if (sets[nsets]) - nsets++; - } - } - if (core) -#endif - { - sets[nsets] = XftDisplayGetFontSet (dpy); - if (sets[nsets]) - nsets++; - } - ret = XftListFontSets (sets, nsets, pattern_trim, os); - XftPatternDestroy (pattern_trim); - return ret; -} - -XftFontSet * -XftListFonts (Display *dpy, - int screen, - ...) -{ - va_list va; - XftFontSet *fs; - XftObjectSet *os; - XftPattern *pattern; - const char *first; - - va_start (va, screen); - - FcPatternVapBuild (pattern, 0, va); - - first = va_arg (va, const char *); - FcObjectSetVapBuild (os, first, va); - - va_end (va); - - fs = XftListFontsPatternObjects (dpy, screen, pattern, os); - XftPatternDestroy (pattern); - XftObjectSetDestroy (os); - return fs; -} diff --git a/nx-X11/lib/Xft1/xftmatch.c b/nx-X11/lib/Xft1/xftmatch.c deleted file mode 100644 index f764abb9a..000000000 --- a/nx-X11/lib/Xft1/xftmatch.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * $XFree86: xc/lib/Xft/xftmatch.c,v 1.6 2001/09/21 19:54: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 -#include -#include "xftint.h" -#include - -XftPattern * -XftFontSetMatch (XftFontSet **sets, - int nsets, - XftPattern *p, - XftResult *result) -{ - return FcFontSetMatch (0, sets, nsets, p, result); -} diff --git a/nx-X11/lib/Xft1/xftmatrix.c b/nx-X11/lib/Xft1/xftmatrix.c deleted file mode 100644 index 7feeccc94..000000000 --- a/nx-X11/lib/Xft1/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 -#include -#include -#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/nx-X11/lib/Xft1/xftname.c b/nx-X11/lib/Xft1/xftname.c deleted file mode 100644 index a28e32cd9..000000000 --- a/nx-X11/lib/Xft1/xftname.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * $XFree86: xc/lib/Xft1/xftname.c,v 1.3tsi 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 -#include -#include -#include - -XftPattern * -XftNameParse (const char *name) -{ - return FcNameParse ((const FcChar8 *) name); -} - - -Bool -XftNameUnparse (XftPattern *pat, char *dest, int len) -{ - FcChar8 *name = FcNameUnparse (pat); - if (!name) - return FcFalse; - if (strlen ((char *) name) > len - 1) - { - free (name); - return FcFalse; - } - strcpy (dest, (char *) name); - free (name); - return FcTrue; -} - -Bool -XftNameConstant (char *string, int *result) -{ - return FcNameConstant ((FcChar8 *) string, result); -} - diff --git a/nx-X11/lib/Xft1/xftpat.c b/nx-X11/lib/Xft1/xftpat.c deleted file mode 100644 index 611144c2d..000000000 --- a/nx-X11/lib/Xft1/xftpat.c +++ /dev/null @@ -1,243 +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 -#include -#include "xftint.h" -#include - -XftPattern * -XftPatternCreate (void) -{ - return FcPatternCreate (); -} - -void -XftValueDestroy (XftValue v) -{ - FcValueDestroy (v); -} - -void -XftPatternDestroy (XftPattern *p) -{ - FcPatternDestroy (p); -} - - -Bool -XftPatternAdd (XftPattern *p, const char *object, XftValue value, Bool append) -{ - return FcPatternAdd (p, object, value, append); -} - -Bool -XftPatternDel (XftPattern *p, const char *object) -{ - return FcPatternDel (p, object); -} - -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 = (FcChar8 *) 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) -{ - return FcPatternGet (p, object, id, v); -} - -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 = (char *) 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 = (XftMatrix *) 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; -} - -XftPatternElt * -XftPatternFind (XftPattern *p, const char *object, FcBool insert) -{ - if (insert) - return FcPatternInsertElt (p, object); - else - return FcPatternFindElt (p, object); -} - - -XftPattern * -XftPatternDuplicate (XftPattern *orig) -{ - return FcPatternDuplicate (orig); -} - -XftPattern * -XftPatternVaBuild (XftPattern *orig, va_list va) -{ - XftPattern *ret; - - FcPatternVapBuild (ret, orig, va); - return ret; -} - -XftPattern * -XftPatternBuild (XftPattern *orig, ...) -{ - va_list va; - - va_start (va, orig); - FcPatternVapBuild (orig, orig, va); - va_end (va); - return orig; -} diff --git a/nx-X11/lib/Xft1/xftrender.c b/nx-X11/lib/Xft1/xftrender.c deleted file mode 100644 index 419ae9f8a..000000000 --- a/nx-X11/lib/Xft1/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 -#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/nx-X11/lib/Xft1/xftstr.c b/nx-X11/lib/Xft1/xftstr.c deleted file mode 100644 index af6013764..000000000 --- a/nx-X11/lib/Xft1/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 -#include -#include -#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/nx-X11/lib/Xft1/xftxlfd.c b/nx-X11/lib/Xft1/xftxlfd.c deleted file mode 100644 index 8de596b47..000000000 --- a/nx-X11/lib/Xft1/xftxlfd.c +++ /dev/null @@ -1,334 +0,0 @@ -/* - * $XFree86: xc/lib/Xft1/xftxlfd.c,v 1.1.1.1tsi 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 -#include -#include -#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; - 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/nx-X11/lib/Xi/Imakefile b/nx-X11/lib/Xi/Imakefile deleted file mode 100644 index 365d78280..000000000 --- a/nx-X11/lib/Xi/Imakefile +++ /dev/null @@ -1,107 +0,0 @@ -XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:45:53 cpqbld Exp $ - - - - -XCOMM $XFree86: xc/lib/Xi/Imakefile,v 1.4 2001/01/17 19:42:47 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 - -#ifdef SharedXiReqs -REQUIREDLIBS = SharedXiReqs -#endif - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - - DEFINES = $(ALLOC_DEFINES) -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 - -DependTarget() diff --git a/nx-X11/lib/Xi/XAllowDv.c b/nx-X11/lib/Xi/XAllowDv.c deleted file mode 100644 index d74504608..000000000 --- a/nx-X11/lib/Xi/XAllowDv.c +++ /dev/null @@ -1,88 +0,0 @@ -/* $Xorg: XAllowDv.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:03 dawes Exp $ */ - -/*********************************************************************** - * - * XAllowDeviceEvents - Thaw a frozen extension device. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XChgDCtl.c b/nx-X11/lib/Xi/XChgDCtl.c deleted file mode 100644 index b1fd7a18b..000000000 --- a/nx-X11/lib/Xi/XChgDCtl.c +++ /dev/null @@ -1,130 +0,0 @@ -/* $Xorg: XChgDCtl.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:03 dawes Exp $ */ - -/*********************************************************************** - * - * XChangeDeviceControl - Change the control attributes of an extension - * input device. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XChgFCtl.c b/nx-X11/lib/Xi/XChgFCtl.c deleted file mode 100644 index 8f4c009c0..000000000 --- a/nx-X11/lib/Xi/XChgFCtl.c +++ /dev/null @@ -1,207 +0,0 @@ -/* $Xorg: XChgFCtl.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:03 dawes Exp $ */ - -/*********************************************************************** - * - * XChangeFeedbackControl - Change the control attributes of feedbacks on - * an extension device. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XChgKMap.c b/nx-X11/lib/Xi/XChgKMap.c deleted file mode 100644 index 8ad77ca2c..000000000 --- a/nx-X11/lib/Xi/XChgKMap.c +++ /dev/null @@ -1,94 +0,0 @@ -/* $Xorg: XChgKMap.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:04 dawes Exp $ */ - -/*********************************************************************** - * - * XChangeDeviceKeyMapping - change the keymap of an extension device. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XChgKbd.c b/nx-X11/lib/Xi/XChgKbd.c deleted file mode 100644 index b3e2c06c1..000000000 --- a/nx-X11/lib/Xi/XChgKbd.c +++ /dev/null @@ -1,88 +0,0 @@ -/* $Xorg: XChgKbd.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:04 dawes Exp $ */ - -/*********************************************************************** - * - * XChangeKeyboardDevice - Change the device used as the X keyboard. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XChgPnt.c b/nx-X11/lib/Xi/XChgPnt.c deleted file mode 100644 index c7248fd64..000000000 --- a/nx-X11/lib/Xi/XChgPnt.c +++ /dev/null @@ -1,92 +0,0 @@ -/* $Xorg: XChgPnt.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:04 dawes Exp $ */ - -/*********************************************************************** - * - * XChangePointerDevice - Change the device used as the X Pointer. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XChgProp.c b/nx-X11/lib/Xi/XChgProp.c deleted file mode 100644 index 3fa68cfde..000000000 --- a/nx-X11/lib/Xi/XChgProp.c +++ /dev/null @@ -1,98 +0,0 @@ -/* $Xorg: XChgProp.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:05 dawes Exp $ */ - -/*********************************************************************** - * - * XChangeDeviceDontPropagateList - Get the dont_propagate_list for a - * window. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XCloseDev.c b/nx-X11/lib/Xi/XCloseDev.c deleted file mode 100644 index 170843b96..000000000 --- a/nx-X11/lib/Xi/XCloseDev.c +++ /dev/null @@ -1,85 +0,0 @@ -/* $Xorg: XCloseDev.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:06 dawes Exp $ */ - -/*********************************************************************** - * - * XCloseDevice - Request the server to close an extension device. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XDevBell.c b/nx-X11/lib/Xi/XDevBell.c deleted file mode 100644 index 2b7669ff5..000000000 --- a/nx-X11/lib/Xi/XDevBell.c +++ /dev/null @@ -1,89 +0,0 @@ -/* $Xorg: XDevBell.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:08 dawes Exp $ */ - -/*********************************************************************** - * - * XDeviceBell - Ring a bell on an extension device. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XExtInt.c b/nx-X11/lib/Xi/XExtInt.c deleted file mode 100644 index 9e569df44..000000000 --- a/nx-X11/lib/Xi/XExtInt.c +++ /dev/null @@ -1,663 +0,0 @@ -/* $Xorg: XExtInt.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.6 2001/12/14 19:55:09 dawes Exp $ */ - -/*********************************************************************** - * - * Input Extension library internal functions. - * - */ - -#define NEED_EVENTS -#define NEED_REPLIES -#include -#include -#include -#include -#include -#include -#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. - * - */ - -int -_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 = - _XiGetExtensionVersion (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; inum_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; inum_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; inum_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/nx-X11/lib/Xi/XExtToWire.c b/nx-X11/lib/Xi/XExtToWire.c deleted file mode 100644 index 30f01408b..000000000 --- a/nx-X11/lib/Xi/XExtToWire.c +++ /dev/null @@ -1,452 +0,0 @@ -/* $Xorg: XExtToWire.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.5 2002/10/16 00:37:28 dawes Exp $ */ - -/**************************************************************** - * - * XExtToWire.c - reformat an XEvent into a wire event. - */ - -#define NEED_EVENTS -#define NEED_REPLIES - -#include -#include -#include -#include -#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; inum_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; inum_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/nx-X11/lib/Xi/XFreeLst.c b/nx-X11/lib/Xi/XFreeLst.c deleted file mode 100644 index 3966f3f0a..000000000 --- a/nx-X11/lib/Xi/XFreeLst.c +++ /dev/null @@ -1,73 +0,0 @@ -/* $Xorg: XFreeLst.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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$ */ - -/*********************************************************************** - * - * XFreeDeviceList - free the input device list. - * - */ - -#include -#include - -/*********************************************************************** - * - * Free the list of input devices. - * - */ - -XFreeDeviceList (list) - XDeviceList *list; - { - if (list != NULL) - { - XFree ((list->name) - sizeof(XDeviceList)); - XFree ((XDeviceList *) list); - } - } diff --git a/nx-X11/lib/Xi/XGMotion.c b/nx-X11/lib/Xi/XGMotion.c deleted file mode 100644 index 4ce41bf99..000000000 --- a/nx-X11/lib/Xi/XGMotion.c +++ /dev/null @@ -1,142 +0,0 @@ -/* $Xorg: XGMotion.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:12 dawes Exp $ */ - -/*********************************************************************** - * - * XGetDeviceMotionEvents - Get the motion history of an input device. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XGetBMap.c b/nx-X11/lib/Xi/XGetBMap.c deleted file mode 100644 index 1c1658fda..000000000 --- a/nx-X11/lib/Xi/XGetBMap.c +++ /dev/null @@ -1,108 +0,0 @@ -/* $Xorg: XGetBMap.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:13 dawes Exp $ */ - -/*********************************************************************** - * - * XGetDeviceButtonMapping - Get the button mapping of an extension device. - * - */ - -#include -#include -#include -#include -#include -#include "XIint.h" - -#ifdef MIN /* some systems define this in */ -#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/nx-X11/lib/Xi/XGetDCtl.c b/nx-X11/lib/Xi/XGetDCtl.c deleted file mode 100644 index 66b352594..000000000 --- a/nx-X11/lib/Xi/XGetDCtl.c +++ /dev/null @@ -1,173 +0,0 @@ -/* $Xorg: XGetDCtl.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:13 dawes Exp $ */ - -/*********************************************************************** - * - * XGetDeviceControl - get the Device control state of an extension device. - * - */ - -#include -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XGetFCtl.c b/nx-X11/lib/Xi/XGetFCtl.c deleted file mode 100644 index e34c7ced5..000000000 --- a/nx-X11/lib/Xi/XGetFCtl.c +++ /dev/null @@ -1,273 +0,0 @@ -/* $Xorg: XGetFCtl.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:14 dawes Exp $ */ - -/*********************************************************************** - * - * XGetFeedbackControl - get the feedback attributes of an extension device. - * - */ - -#include -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XGetKMap.c b/nx-X11/lib/Xi/XGetKMap.c deleted file mode 100644 index c794006a3..000000000 --- a/nx-X11/lib/Xi/XGetKMap.c +++ /dev/null @@ -1,111 +0,0 @@ -/* $Xorg: XGetKMap.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.4 2002/10/16 00:37:28 dawes Exp $ */ - -/*********************************************************************** - * - * XGetDeviceKeyMapping - get the keymap of an extension device. - * - */ - -#include -#include -#include -#include -#include -#include "XIint.h" - -KeySym * -XGetDeviceKeyMapping ( - register Display *dpy, - XDevice *dev, -#if NeedWidePrototypes - unsigned int first, -#else - KeyCode first, -#endif - int keycount, - int *syms_per_code) - { - 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/nx-X11/lib/Xi/XGetMMap.c b/nx-X11/lib/Xi/XGetMMap.c deleted file mode 100644 index 04e89d839..000000000 --- a/nx-X11/lib/Xi/XGetMMap.c +++ /dev/null @@ -1,104 +0,0 @@ -/* $Xorg: XGetMMap.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:16 dawes Exp $ */ - -/*********************************************************************** - * - * XGetDeviceModifierMapping - get the modifier map of an extension device. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XGetProp.c b/nx-X11/lib/Xi/XGetProp.c deleted file mode 100644 index ed5a2d185..000000000 --- a/nx-X11/lib/Xi/XGetProp.c +++ /dev/null @@ -1,120 +0,0 @@ -/* $Xorg: XGetProp.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:17 dawes Exp $ */ - -/*********************************************************************** - * - * XGetDeviceDontPropagateList - Get the dont_propagate_list for a - * window. - * - */ - -#include -#include -#include -#include -#include -#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 (rep.length * sizeof(XEventClass)); - 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/nx-X11/lib/Xi/XGetVers.c b/nx-X11/lib/Xi/XGetVers.c deleted file mode 100644 index 318083735..000000000 --- a/nx-X11/lib/Xi/XGetVers.c +++ /dev/null @@ -1,115 +0,0 @@ -/* $Xorg: XGetVers.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.6 2003/07/08 15:39:47 tsi Exp $ */ - -/*********************************************************************** - * - * XGetExtensionVersion - Get the version of the input extension. - * - */ - -#include -#include -#include -#include -#include -#include "XIint.h" - -XExtensionVersion * -XGetExtensionVersion ( - register Display *dpy, - _Xconst char *name) - { - XExtensionVersion *ext; - - LockDisplay (dpy); - ext = _XiGetExtensionVersion (dpy, name); - if (ext != (XExtensionVersion *) NoSuchExtension) { - UnlockDisplay (dpy); - SyncHandle(); - } - return (ext); - } - -XExtensionVersion * -_XiGetExtensionVersion ( - register Display *dpy, - _Xconst char *name) - { - xGetExtensionVersionReq *req; - xGetExtensionVersionReply rep; - XExtensionVersion *ext; - XExtDisplayInfo *info = XInput_find_display (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)) - { - 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; - } - } - return (ext); - } - diff --git a/nx-X11/lib/Xi/XGrDvBut.c b/nx-X11/lib/Xi/XGrDvBut.c deleted file mode 100644 index 48381f8e5..000000000 --- a/nx-X11/lib/Xi/XGrDvBut.c +++ /dev/null @@ -1,114 +0,0 @@ -/* $Xorg: XGrDvBut.c,v 1.4 2001/02/09 02:03:50 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.4 2001/12/14 19:55:17 dawes Exp $ */ - -/*********************************************************************** - * - * XGrabDeviceBut - Grab a button on an extension device. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XGrDvKey.c b/nx-X11/lib/Xi/XGrDvKey.c deleted file mode 100644 index 94e9ba444..000000000 --- a/nx-X11/lib/Xi/XGrDvKey.c +++ /dev/null @@ -1,117 +0,0 @@ -/* $Xorg: XGrDvKey.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:17 dawes Exp $ */ - -/*********************************************************************** - * - * XGrabDeviceKey - Grab a key on an extension device. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XGrabDev.c b/nx-X11/lib/Xi/XGrabDev.c deleted file mode 100644 index f49a6bd34..000000000 --- a/nx-X11/lib/Xi/XGrabDev.c +++ /dev/null @@ -1,109 +0,0 @@ -/* $Xorg: XGrabDev.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:17 dawes Exp $ */ - -/*********************************************************************** - * - * XGrabDevice - grab an extension input device. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XGtFocus.c b/nx-X11/lib/Xi/XGtFocus.c deleted file mode 100644 index 29e8de7b4..000000000 --- a/nx-X11/lib/Xi/XGtFocus.c +++ /dev/null @@ -1,92 +0,0 @@ -/* $Xorg: XGtFocus.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:18 dawes Exp $ */ - -/*********************************************************************** - * - * XGetDeviceFocus - Get the focus of an input device. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XGtSelect.c b/nx-X11/lib/Xi/XGtSelect.c deleted file mode 100644 index 966365367..000000000 --- a/nx-X11/lib/Xi/XGtSelect.c +++ /dev/null @@ -1,146 +0,0 @@ -/* $Xorg: XGtSelect.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:19 dawes Exp $ */ - -/*********************************************************************** - * - * XGetSelectedExtensionEvents - return a list of currently selected events. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XIint.h b/nx-X11/lib/Xi/XIint.h deleted file mode 100644 index fdca57d6a..000000000 --- a/nx-X11/lib/Xi/XIint.h +++ /dev/null @@ -1,25 +0,0 @@ -/* $XFree86: xc/lib/Xi/XIint.h,v 3.2 2003/07/07 15:34:22 eich Exp $ */ - -/* - * XIint.h - Header definition and support file for the internal - * support routines used by the Xi library. - */ - -#ifndef _XIINT_H_ -#define _XIINT_H_ - -extern XExtDisplayInfo * XInput_find_display( - Display* -); - -extern int _XiCheckExtInit( - Display*, - int -); - -extern XExtensionVersion * _XiGetExtensionVersion( - Display*, - _Xconst char* -); - -#endif diff --git a/nx-X11/lib/Xi/XListDev.c b/nx-X11/lib/Xi/XListDev.c deleted file mode 100644 index 279beded0..000000000 --- a/nx-X11/lib/Xi/XListDev.c +++ /dev/null @@ -1,259 +0,0 @@ -/* $Xorg: XListDev.c,v 1.5 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.4 2001/12/14 19:55:19 dawes Exp $ */ - -/*********************************************************************** - * - * XListInputDevices - Request the server to return a list of - * available input devices. - * - */ - -#define NEED_REPLIES -#define NEED_EVENTS -#include -#include -#include -#include -#include -#include "XIint.h" - -XDeviceInfo -*XListInputDevices(dpy, ndevices) - register Display *dpy; - int *ndevices; - { - int size; - xListInputDevicesReq *req; - xListInputDevicesReply rep; - xDeviceInfo *list, *slist = NULL; - XDeviceInfo *sclist = NULL; - 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/nx-X11/lib/Xi/XOpenDev.c b/nx-X11/lib/Xi/XOpenDev.c deleted file mode 100644 index 7930a9a80..000000000 --- a/nx-X11/lib/Xi/XOpenDev.c +++ /dev/null @@ -1,113 +0,0 @@ -/* $Xorg: XOpenDev.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:20 dawes Exp $ */ - -/*********************************************************************** - * - * XOpenDevice - Request the server to open and extension input device. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XQueryDv.c b/nx-X11/lib/Xi/XQueryDv.c deleted file mode 100644 index 1450c15fb..000000000 --- a/nx-X11/lib/Xi/XQueryDv.c +++ /dev/null @@ -1,198 +0,0 @@ -/* $Xorg: XQueryDv.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:20 dawes Exp $ */ - -/*********************************************************************** - * - * XQueryDeviceState - Query the state of an extension input device. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XSelect.c b/nx-X11/lib/Xi/XSelect.c deleted file mode 100644 index c0a8dc832..000000000 --- a/nx-X11/lib/Xi/XSelect.c +++ /dev/null @@ -1,94 +0,0 @@ -/* $Xorg: XSelect.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:21 dawes Exp $ */ - -/*********************************************************************** - * - * XSelectExtensionEvent - Select input from an extension device. - * - */ - -#include -#include -#include -#include -#include -#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; - Data32 (dpy, (long *) event_list, count); - - UnlockDisplay(dpy); - SyncHandle(); - return (Success); - } diff --git a/nx-X11/lib/Xi/XSetBMap.c b/nx-X11/lib/Xi/XSetBMap.c deleted file mode 100644 index 716d8c5fc..000000000 --- a/nx-X11/lib/Xi/XSetBMap.c +++ /dev/null @@ -1,93 +0,0 @@ -/* $Xorg: XSetBMap.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:21 dawes Exp $ */ - -/*********************************************************************** - * - * XSetDeviceButtonMapping - Set the button mapping of an extension device. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XSetDVal.c b/nx-X11/lib/Xi/XSetDVal.c deleted file mode 100644 index 3cee1a939..000000000 --- a/nx-X11/lib/Xi/XSetDVal.c +++ /dev/null @@ -1,100 +0,0 @@ -/* $Xorg: XSetDVal.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:22 dawes Exp $ */ - -/*********************************************************************** - * - * XSetDeviceValuators - Set the value of valuators on an extension input - * device. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XSetMMap.c b/nx-X11/lib/Xi/XSetMMap.c deleted file mode 100644 index d31197cff..000000000 --- a/nx-X11/lib/Xi/XSetMMap.c +++ /dev/null @@ -1,91 +0,0 @@ -/* $Xorg: XSetMMap.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:22 dawes Exp $ */ - -/*********************************************************************** - * - * XSetDeviceModifierMapping - set the modifier map of an extension device. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XSetMode.c b/nx-X11/lib/Xi/XSetMode.c deleted file mode 100644 index 5f62fb197..000000000 --- a/nx-X11/lib/Xi/XSetMode.c +++ /dev/null @@ -1,88 +0,0 @@ -/* $Xorg: XSetMode.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:23 dawes Exp $ */ - -/*********************************************************************** - * - * XSetDeviceMode - Set the mode of an extension input device. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XSndExEv.c b/nx-X11/lib/Xi/XSndExEv.c deleted file mode 100644 index 28b654ba5..000000000 --- a/nx-X11/lib/Xi/XSndExEv.c +++ /dev/null @@ -1,123 +0,0 @@ -/* $Xorg: XSndExEv.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:23 dawes Exp $ */ - -/*********************************************************************** - * - * XSendExtensionEvent - send an extension event to a client. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XStFocus.c b/nx-X11/lib/Xi/XStFocus.c deleted file mode 100644 index fc61896b6..000000000 --- a/nx-X11/lib/Xi/XStFocus.c +++ /dev/null @@ -1,87 +0,0 @@ -/* $Xorg: XStFocus.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:23 dawes Exp $ */ - -/*********************************************************************** - * - * XSetDeviceFocus - Set the focus of an extension device. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XUngrDev.c b/nx-X11/lib/Xi/XUngrDev.c deleted file mode 100644 index e3aec3606..000000000 --- a/nx-X11/lib/Xi/XUngrDev.c +++ /dev/null @@ -1,86 +0,0 @@ -/* $Xorg: XUngrDev.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:23 dawes Exp $ */ - -/*********************************************************************** - * - * XUngrabDevice - Ungrab an extension device. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XUngrDvB.c b/nx-X11/lib/Xi/XUngrDvB.c deleted file mode 100644 index 7e96665dd..000000000 --- a/nx-X11/lib/Xi/XUngrDvB.c +++ /dev/null @@ -1,93 +0,0 @@ -/* $Xorg: XUngrDvB.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:25 dawes Exp $ */ - -/*********************************************************************** - * - * XUngrabDeviceButton - Ungrab a button on an extension device. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/XUngrDvK.c b/nx-X11/lib/Xi/XUngrDvK.c deleted file mode 100644 index 26a5841de..000000000 --- a/nx-X11/lib/Xi/XUngrDvK.c +++ /dev/null @@ -1,93 +0,0 @@ -/* $Xorg: XUngrDvK.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.3 2001/12/14 19:55:26 dawes Exp $ */ - -/*********************************************************************** - * - * XUngrabDeviceKey - Ungrab a key on an extension device. - * - */ - -#include -#include -#include -#include -#include -#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/nx-X11/lib/Xi/Xi-def.cpp b/nx-X11/lib/Xi/Xi-def.cpp deleted file mode 100644 index 62760066d..000000000 --- a/nx-X11/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 -/* $Xorg: Xi-def.cpp,v 1.3 2000/08/17 19:45:58 cpqbld Exp $ */ diff --git a/nx-X11/lib/Xmu/AllCmap.c b/nx-X11/lib/Xmu/AllCmap.c deleted file mode 100644 index 09ae52aa4..000000000 --- a/nx-X11/lib/Xmu/AllCmap.c +++ /dev/null @@ -1,158 +0,0 @@ -/* $Xorg: AllCmap.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.7 2001/01/17 19:42:53 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include - -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/nx-X11/lib/Xmu/Atoms.c b/nx-X11/lib/Xmu/Atoms.c deleted file mode 100644 index dcdf497a5..000000000 --- a/nx-X11/lib/Xmu/Atoms.c +++ /dev/null @@ -1,154 +0,0 @@ -/* $Xorg: Atoms.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.7 2001/07/25 15:04:50 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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#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(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" ) -DeclareAtom(XA_UTF8_STRING, "UTF8_STRING" ) - -/****************************************************************** - - 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/nx-X11/lib/Xmu/Atoms.h b/nx-X11/lib/Xmu/Atoms.h deleted file mode 100644 index f7b4c8f7e..000000000 --- a/nx-X11/lib/Xmu/Atoms.h +++ /dev/null @@ -1,126 +0,0 @@ -/* $Xorg: Atoms.h,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:53 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 -#include - -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, - _XA_UTF8_STRING; - -#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) -#define XA_UTF8_STRING(d) XmuInternAtom(d, _XA_UTF8_STRING) - -_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/nx-X11/lib/Xmu/CharSet.h b/nx-X11/lib/Xmu/CharSet.h deleted file mode 100644 index 32cebfeda..000000000 --- a/nx-X11/lib/Xmu/CharSet.h +++ /dev/null @@ -1,77 +0,0 @@ -/* $Xorg: CharSet.h,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.7 2001/01/17 19:42:53 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 - -_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/nx-X11/lib/Xmu/ClientWin.c b/nx-X11/lib/Xmu/ClientWin.c deleted file mode 100644 index 7fc273f1f..000000000 --- a/nx-X11/lib/Xmu/ClientWin.c +++ /dev/null @@ -1,100 +0,0 @@ -/* $Xorg: ClientWin.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.7 2001/12/14 19:55:34 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include - -#include - -/* - * 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 = NULL; - 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 (data) - XFree(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++) { - data = NULL; - XGetWindowProperty(dpy, children[i], WM_STATE, 0, 0, False, - AnyPropertyType, &type, &format, &nitems, - &after, &data); - if (data) - XFree(data); - if (type) - inf = children[i]; - } - for (i = 0; !inf && (i < nchildren); i++) - inf = TryChildren(dpy, children[i], WM_STATE); - if (children) - XFree(children); - return inf; -} diff --git a/nx-X11/lib/Xmu/Clip.c b/nx-X11/lib/Xmu/Clip.c deleted file mode 100644 index 8d2c8455e..000000000 --- a/nx-X11/lib/Xmu/Clip.c +++ /dev/null @@ -1,1617 +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.1 1998/08/16 10:25:03 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include - -#include -#include - -#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/nx-X11/lib/Xmu/CloseHook.c b/nx-X11/lib/Xmu/CloseHook.c deleted file mode 100644 index 5e66d0cad..000000000 --- a/nx-X11/lib/Xmu/CloseHook.c +++ /dev/null @@ -1,297 +0,0 @@ -/* $Xorg: CloseHook.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/* -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.5 2001/07/25 15:04:50 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; - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include /* for NULL */ -#include -#include -#include -#include - -/* - * 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/nx-X11/lib/Xmu/CloseHook.h b/nx-X11/lib/Xmu/CloseHook.h deleted file mode 100644 index 1940a793b..000000000 --- a/nx-X11/lib/Xmu/CloseHook.h +++ /dev/null @@ -1,73 +0,0 @@ -/* $Xorg: CloseHook.h,v 1.5 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:53 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 -#include -#include - -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/nx-X11/lib/Xmu/CmapAlloc.c b/nx-X11/lib/Xmu/CmapAlloc.c deleted file mode 100644 index 1f27f1eef..000000000 --- a/nx-X11/lib/Xmu/CmapAlloc.c +++ /dev/null @@ -1,346 +0,0 @@ -/* $Xorg: CmapAlloc.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:53 dawes Exp $ */ - -/* - * Author: Donna Converse, MIT X Consortium - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include - -#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/nx-X11/lib/Xmu/Converters.h b/nx-X11/lib/Xmu/Converters.h deleted file mode 100644 index 11055d950..000000000 --- a/nx-X11/lib/Xmu/Converters.h +++ /dev/null @@ -1,281 +0,0 @@ -/* $Xorg: Converters.h,v 1.5 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.5 2001/01/17 19:42:53 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 -#include - -_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/nx-X11/lib/Xmu/CrCmap.c b/nx-X11/lib/Xmu/CrCmap.c deleted file mode 100644 index 011c71465..000000000 --- a/nx-X11/lib/Xmu/CrCmap.c +++ /dev/null @@ -1,537 +0,0 @@ -/* $Xorg: CrCmap.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:53 dawes Exp $ */ - -/* - * Author: Donna Converse, MIT X Consortium - */ - -/* - * CreateCmap.c - given a standard colormap description, make the map. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include - -/* - * 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/nx-X11/lib/Xmu/CrPixFBit.c b/nx-X11/lib/Xmu/CrPixFBit.c deleted file mode 100644 index c7ff6caf2..000000000 --- a/nx-X11/lib/Xmu/CrPixFBit.c +++ /dev/null @@ -1,85 +0,0 @@ -/* $Xorg: CrPixFBit.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:53 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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include - -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/nx-X11/lib/Xmu/CurUtil.h b/nx-X11/lib/Xmu/CurUtil.h deleted file mode 100644 index 27ab18848..000000000 --- a/nx-X11/lib/Xmu/CurUtil.h +++ /dev/null @@ -1,49 +0,0 @@ -/* $Xorg: CurUtil.h,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.5 2001/01/17 19:42:54 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 - -_XFUNCPROTOBEGIN - -int XmuCursorNameToIndex -( - _Xconst char *name - ); - -_XFUNCPROTOEND - -#endif /* _XMU_CURUTIL_H_ */ diff --git a/nx-X11/lib/Xmu/CursorName.c b/nx-X11/lib/Xmu/CursorName.c deleted file mode 100644 index 17f390246..000000000 --- a/nx-X11/lib/Xmu/CursorName.c +++ /dev/null @@ -1,141 +0,0 @@ -/* $Xorg: CursorName.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.7tsi Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include - -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}, - }; -#define NUM_CURSOR_NAMES (sizeof (cursor_names) / sizeof (cursor_names[0])) - register _Xconst struct _CursorName *table; - register int i; - char tmp[40]; - - if (strlen (name) >= sizeof tmp) return -1; - XmuCopyISOLatin1Lowered (tmp, name); - - for (i=0, table=cursor_names; i < NUM_CURSOR_NAMES; i++, table++ ) { - if (strcmp(tmp, table->name) == 0) return table->shape; - } - - return -1; -} - - - - - diff --git a/nx-X11/lib/Xmu/CvtCache.c b/nx-X11/lib/Xmu/CvtCache.c deleted file mode 100644 index 8dd4602ea..000000000 --- a/nx-X11/lib/Xmu/CvtCache.c +++ /dev/null @@ -1,136 +0,0 @@ -/* $Xorg: CvtCache.c,v 1.5 2001/02/09 02:03:52 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/08/23 00:03:21 dawes Exp $ */ - -/* - * Author: Jim Fulton, MIT X Consortium - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include - -/* - * Prototypes - */ -static int _CloseDisplay(XmuDisplayQueue*, XmuDisplayQueueEntry*); -static int _FreeCCDQ(XmuDisplayQueue*); -static void _InitializeCvtCache(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/nx-X11/lib/Xmu/CvtCache.h b/nx-X11/lib/Xmu/CvtCache.h deleted file mode 100644 index d9b967ab7..000000000 --- a/nx-X11/lib/Xmu/CvtCache.h +++ /dev/null @@ -1,62 +0,0 @@ -/* $Xorg: CvtCache.h,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:54 dawes Exp $ */ - -/* - * Public Interfaces - * - * XmuCvtCache *XmuCvtCacheLookupDisplay (dpy) - * Display *dpy; - */ - -#ifndef _XMU_CVTCACHE_H_ -#define _XMU_CVTCACHE_H_ - -#include -#include - -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/nx-X11/lib/Xmu/CvtStdSel.c b/nx-X11/lib/Xmu/CvtStdSel.c deleted file mode 100644 index e52197f13..000000000 --- a/nx-X11/lib/Xmu/CvtStdSel.c +++ /dev/null @@ -1,347 +0,0 @@ -/* $Xorg: CvtStdSel.c,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */ -/* $XdotOrg: xc/lib/Xmu/CvtStdSel.c,v 1.6 2005/07/03 07:00:57 daniels Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.19 2001/11/21 16:22:59 tsi Exp $ */ - -/* - * This file contains routines to handle common selection targets. - * - * Public entry points: - * - * XmuConvertStandardSelection() return a known selection - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifdef SYSVNET -#include -#define __TYPES__ /* prevent #include in Xlib.h */ -#include -#include -#endif /* SYSVNET */ - -#include -#include -#include -#ifdef XTHREADS -#include -#endif -#include - -#ifndef SYSVNET -#ifdef WIN32 -#include -#define XOS_USE_MTSAFE_NETDBAPI -#else -#ifndef Lynx -#include -#else -#include -#include -#endif -#define XOS_USE_XT_LOCKING -#endif -#define X_INCLUDE_NETDB_H -#include -#endif - -#include -#include -#include "Atoms.h" -#include "StdSel.h" -#include "SysUtil.h" -#include - -#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 -#ifdef CSRG_BASED -#define USE_UNAME -#endif -#endif /*X_OS_FILE*/ -#ifdef USE_UNAME -#include -#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(CSRG_BASED) || 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) - if (*target == XA_IP_ADDRESS(d)) { - char hostname[1024]; -#ifdef XTHREADS_NEEDS_BYNAMEPARAMS - _Xgethostbynameparams hparams; -#endif - 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/nx-X11/lib/Xmu/DefErrMsg.c b/nx-X11/lib/Xmu/DefErrMsg.c deleted file mode 100644 index d1aa9ad9a..000000000 --- a/nx-X11/lib/Xmu/DefErrMsg.c +++ /dev/null @@ -1,173 +0,0 @@ -/* $Xorg: DefErrMsg.c,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.7 2001/01/17 19:42:54 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#define NEED_EVENTS -#include -#include -#include -#include - -/* - * 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/nx-X11/lib/Xmu/DelCmap.c b/nx-X11/lib/Xmu/DelCmap.c deleted file mode 100644 index 1f2c6abe8..000000000 --- a/nx-X11/lib/Xmu/DelCmap.c +++ /dev/null @@ -1,73 +0,0 @@ -/* $Xorg: DelCmap.c,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:54 dawes Exp $ */ - -/* - * Author: Donna Converse, MIT X Consortium - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include - -/* 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/nx-X11/lib/Xmu/DisplayQue.c b/nx-X11/lib/Xmu/DisplayQue.c deleted file mode 100644 index ae9f92e1d..000000000 --- a/nx-X11/lib/Xmu/DisplayQue.c +++ /dev/null @@ -1,194 +0,0 @@ -/* $Xorg: DisplayQue.c,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.4 2001/07/25 15:04:50 dawes Exp $ */ - -/* - * Author: Jim Fulton, MIT X Consortium - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include - -/* - * 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/nx-X11/lib/Xmu/DisplayQue.h b/nx-X11/lib/Xmu/DisplayQue.h deleted file mode 100644 index 9f9013c1e..000000000 --- a/nx-X11/lib/Xmu/DisplayQue.h +++ /dev/null @@ -1,155 +0,0 @@ -/* $Xorg: DisplayQue.h,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */ - -/* - -Copyright 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.5 2001/01/17 19:42:54 dawes Exp $ */ - -#ifndef _XMU_DISPLAYQUE_H_ -#define _XMU_DISPLAYQUE_H_ - -#include -#include - -/* - * 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/nx-X11/lib/Xmu/Distinct.c b/nx-X11/lib/Xmu/Distinct.c deleted file mode 100644 index f00b00b5a..000000000 --- a/nx-X11/lib/Xmu/Distinct.c +++ /dev/null @@ -1,92 +0,0 @@ -/* $Xorg: Distinct.c,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */ - -/* - -Copyright 1990, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.5 2001/07/25 15:04:50 dawes Exp $ */ - -/* - * Author: Keith Packard, MIT X Consortium - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include - -/* - * 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/nx-X11/lib/Xmu/DrRndRect.c b/nx-X11/lib/Xmu/DrRndRect.c deleted file mode 100644 index 7fe5489d0..000000000 --- a/nx-X11/lib/Xmu/DrRndRect.c +++ /dev/null @@ -1,182 +0,0 @@ -/* $Xorg: DrRndRect.c,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:54 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. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include - -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/nx-X11/lib/Xmu/DrawLogo.c b/nx-X11/lib/Xmu/DrawLogo.c deleted file mode 100644 index 74e64d866..000000000 --- a/nx-X11/lib/Xmu/DrawLogo.c +++ /dev/null @@ -1,155 +0,0 @@ -/* $Xorg: DrawLogo.c,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.7 2001/01/17 19:42:54 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include - -/* - * 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/nx-X11/lib/Xmu/Drawing.h b/nx-X11/lib/Xmu/Drawing.h deleted file mode 100644 index 9ffed3bab..000000000 --- a/nx-X11/lib/Xmu/Drawing.h +++ /dev/null @@ -1,161 +0,0 @@ -/* $Xorg: Drawing.h,v 1.5 2001/02/09 02:03:52 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/12/14 19:55:42 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 -#include - -#include -#if ! defined(_XtIntrinsic_h) && ! defined(PIXEL_ALREADY_TYPEDEFED) -typedef unsigned long Pixel; -#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/nx-X11/lib/Xmu/Editres.h b/nx-X11/lib/Xmu/Editres.h deleted file mode 100644 index 2a3f3e250..000000000 --- a/nx-X11/lib/Xmu/Editres.h +++ /dev/null @@ -1,42 +0,0 @@ -/* $Xorg: Editres.h,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */ - -/* - -Copyright 1991, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.5 2001/01/17 19:42:55 dawes Exp $ */ - -#include - -_XFUNCPROTOBEGIN - -void _XEditResCheckMessages -( - Widget w, - XtPointer data, - XEvent *event, - Boolean *cont -); - -_XFUNCPROTOEND diff --git a/nx-X11/lib/Xmu/EditresCom.c b/nx-X11/lib/Xmu/EditresCom.c deleted file mode 100644 index 66da52c9b..000000000 --- a/nx-X11/lib/Xmu/EditresCom.c +++ /dev/null @@ -1,2214 +0,0 @@ -/* $Xorg: EditresCom.c,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.21 2003/10/24 15:44:05 tsi Exp $ */ - -/* - * Author: Chris D. Peterson, Dave Sternlicht, MIT X Consortium - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include /* To get into the composite and core widget - structures. */ -#include /* For XtIs macros. */ -#include /* for XtRString. */ -#include /* for Application Shell Widget class. */ - -#include -#include /* for strcpy declaration */ -#include -#include -#include -#include -#include -#include -#include -#include - -#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, EditResError, 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, EditResError, - 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, (unsigned int) 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, EditResError error, 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)error); - _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, EditResError error, - ProtocolStream *stream) -{ - BuildReturnPacket(ident, error, 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 (char *)*(Widget **)left - (char *)*(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) - { - widget = NULL; - 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) - { - widget = NULL; - 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]) - { - if ((j + 1) < num_extra) - memmove(&extra_widgets[j], &extra_widgets[j + 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((String)info->event->value, XtRString)) - XmuSnprintf(buf, sizeof(buf), - "Could not convert the string '%s' for the `%s' " - "resource.", (String)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%08x", (int)value); - break; -#ifdef LONG_64 - case sizeof(long): - XmuSnprintf(buffer, sizeof(buffer), "0x%016lx", value); - break; -#endif - } - } - } - - if (string == NULL) - string = ""; - - *(char **)(warg->value) = string; - XtFree((char *)res_list); -} diff --git a/nx-X11/lib/Xmu/EditresP.h b/nx-X11/lib/Xmu/EditresP.h deleted file mode 100644 index 886205bf2..000000000 --- a/nx-X11/lib/Xmu/EditresP.h +++ /dev/null @@ -1,409 +0,0 @@ -/* $Xorg: EditresP.h,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.5 2001/01/17 19:42:55 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 - 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 -#include - -#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/nx-X11/lib/Xmu/Error.h b/nx-X11/lib/Xmu/Error.h deleted file mode 100644 index f992930ec..000000000 --- a/nx-X11/lib/Xmu/Error.h +++ /dev/null @@ -1,59 +0,0 @@ -/* $Xorg: Error.h,v 1.5 2001/02/09 02:03:52 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.5 2001/01/17 19:42:55 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 -#include -#include - -_XFUNCPROTOBEGIN - -int XmuPrintDefaultErrorMessage -( - Display *dpy, - XErrorEvent *event, - FILE *fp - ); - -int XmuSimpleErrorHandler -( - Display *dpy, - XErrorEvent *errorp - ); - -_XFUNCPROTOEND - -#endif /* _XMU_ERROR_H_ */ diff --git a/nx-X11/lib/Xmu/ExtAgent.c b/nx-X11/lib/Xmu/ExtAgent.c deleted file mode 100644 index 27955678f..000000000 --- a/nx-X11/lib/Xmu/ExtAgent.c +++ /dev/null @@ -1,46 +0,0 @@ -/* $Xorg: ExtAgent.c,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */ - -/* - -Copyright 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:55 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include - -/* 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/nx-X11/lib/Xmu/ExtAgent.h b/nx-X11/lib/Xmu/ExtAgent.h deleted file mode 100644 index b0caf3699..000000000 --- a/nx-X11/lib/Xmu/ExtAgent.h +++ /dev/null @@ -1,44 +0,0 @@ -/* $Xorg: ExtAgent.h,v 1.5 2001/02/09 02:03:52 xorgcvs Exp $ */ - -/* - -Copyright 1994,1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.5 2001/01/17 19:42:55 dawes Exp $ */ - -#include -#include - -_XFUNCPROTOBEGIN - -extern void XmuRegisterExternalAgent -( - Widget w, - XtPointer data, - XEvent *event, - Boolean *cont - ); - -_XFUNCPROTOEND - diff --git a/nx-X11/lib/Xmu/FToCback.c b/nx-X11/lib/Xmu/FToCback.c deleted file mode 100644 index 6da4826f7..000000000 --- a/nx-X11/lib/Xmu/FToCback.c +++ /dev/null @@ -1,48 +0,0 @@ -/* $Xorg: FToCback.c,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */ - -/* - -Copyright 1988,1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:55 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include - -/* 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/nx-X11/lib/Xmu/GetHost.c b/nx-X11/lib/Xmu/GetHost.c deleted file mode 100644 index 91673b86c..000000000 --- a/nx-X11/lib/Xmu/GetHost.c +++ /dev/null @@ -1,86 +0,0 @@ -/* $Xorg: GetHost.c,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.7 2001/07/25 15:04:50 dawes Exp $ */ - -/* - * Author: Jim Fulton, MIT X Consortium - * - * _XGetHostname - similar to gethostname but allows special processing. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include - -#ifdef WIN32 -#include -#endif - -#ifdef USG -#define NEED_UTSNAME -#endif - -#ifdef NEED_UTSNAME -#include -#endif - -#include - -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/nx-X11/lib/Xmu/GrayPixmap.c b/nx-X11/lib/Xmu/GrayPixmap.c deleted file mode 100644 index 478269f8a..000000000 --- a/nx-X11/lib/Xmu/GrayPixmap.c +++ /dev/null @@ -1,139 +0,0 @@ -/* $Xorg: GrayPixmap.c,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */ - -/* - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.5 2001/01/17 19:42:55 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include - -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/nx-X11/lib/Xmu/Imakefile b/nx-X11/lib/Xmu/Imakefile deleted file mode 100644 index 5d3ac5bb5..000000000 --- a/nx-X11/lib/Xmu/Imakefile +++ /dev/null @@ -1,176 +0,0 @@ -XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:46:02 cpqbld Exp $ - - - - -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 - -#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 - -SpecialCLibObjectRule(CvtStdSel,$(ICONFIGFILES),$(CSSDEFS)) -SpecialCLibObjectRule(LocBitmap,$(ICONFIGFILES),$(BITDEFS)) -#if DoSharedLib && SharedDataSeparation -SpecialCObjectRule(sharedlib,$(_NOOP_),$(SHLIBDEF)) -#endif - -DependTarget() diff --git a/nx-X11/lib/Xmu/Initer.c b/nx-X11/lib/Xmu/Initer.c deleted file mode 100644 index f18492f69..000000000 --- a/nx-X11/lib/Xmu/Initer.c +++ /dev/null @@ -1,117 +0,0 @@ -/* $Xorg: Initer.c,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:56 dawes Exp $ */ - -/* Created By: Chris D. Peterson - * MIT X Consortium - * Date: May 8, 1989 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include - -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/nx-X11/lib/Xmu/Initer.h b/nx-X11/lib/Xmu/Initer.h deleted file mode 100644 index 5e870af8c..000000000 --- a/nx-X11/lib/Xmu/Initer.h +++ /dev/null @@ -1,58 +0,0 @@ -/* $Xorg: Initer.h,v 1.5 2001/02/09 02:03:52 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.5 2001/01/17 19:42:56 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 -#include - -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/nx-X11/lib/Xmu/LocBitmap.c b/nx-X11/lib/Xmu/LocBitmap.c deleted file mode 100644 index 112f3cff4..000000000 --- a/nx-X11/lib/Xmu/LocBitmap.c +++ /dev/null @@ -1,272 +0,0 @@ -/* $Xorg: LocBitmap.c,v 1.7 2001/02/09 02:03:52 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.9 2001/12/14 19:55:47 dawes Exp $ */ - -/* - * Author: Jim Fulton, MIT X Consortium - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef X_NOT_POSIX -#ifdef _POSIX_SOURCE -#include -#else -#define _POSIX_SOURCE -#include -#undef _POSIX_SOURCE -#endif -#endif /* X_NOT_POSIX */ -#ifndef PATH_MAX -#ifdef WIN32 -#define PATH_MAX 512 -#else -#include -#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]; -#if 0 - char* bitmapdir = BITMAPDIR; -#endif - 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 __UNIXOS2__ - 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 __UNIXOS2__ - 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/nx-X11/lib/Xmu/Lookup.c b/nx-X11/lib/Xmu/Lookup.c deleted file mode 100644 index 27676c1da..000000000 --- a/nx-X11/lib/Xmu/Lookup.c +++ /dev/null @@ -1,279 +0,0 @@ -/* $Xorg: Lookup.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.7 2001/01/17 19:42:56 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include - -#define XK_LATIN1 -#define XK_PUBLISHING -#include - -/* bit (1<> 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/nx-X11/lib/Xmu/Lookup.h b/nx-X11/lib/Xmu/Lookup.h deleted file mode 100644 index 3699a2719..000000000 --- a/nx-X11/lib/Xmu/Lookup.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * $XFree86$ - */ - -/************************************************************ - -Copyright 1999 by Thomas E. Dickey - - 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 -#include - -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/nx-X11/lib/Xmu/LookupCmap.c b/nx-X11/lib/Xmu/LookupCmap.c deleted file mode 100644 index e7d7008e5..000000000 --- a/nx-X11/lib/Xmu/LookupCmap.c +++ /dev/null @@ -1,325 +0,0 @@ -/* $Xorg: LookupCmap.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.7 2001/07/25 15:04:50 dawes Exp $ */ - -/* - * Author: Donna Converse, MIT X Consortium - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include - -/* - * 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/nx-X11/lib/Xmu/Lower.c b/nx-X11/lib/Xmu/Lower.c deleted file mode 100644 index 06ad31a29..000000000 --- a/nx-X11/lib/Xmu/Lower.c +++ /dev/null @@ -1,164 +0,0 @@ -/* $Xorg: Lower.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.11 2001/07/25 15:04:50 dawes Exp $ */ - -#define XK_LATIN1 -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include - -#include - -#ifndef HAS_SNPRINTF -#undef SCOPE -#define SCOPE static -#include "snprintf.c" -#endif - -#include - -/* - * 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/nx-X11/lib/Xmu/Misc.h b/nx-X11/lib/Xmu/Misc.h deleted file mode 100644 index b47fbba4b..000000000 --- a/nx-X11/lib/Xmu/Misc.h +++ /dev/null @@ -1,65 +0,0 @@ -/* $Xorg: Misc.h,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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/nx-X11/lib/Xmu/README b/nx-X11/lib/Xmu/README deleted file mode 100644 index d618e2a71..000000000 --- a/nx-X11/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/nx-X11/lib/Xmu/RdBitF.c b/nx-X11/lib/Xmu/RdBitF.c deleted file mode 100644 index eb5fe598d..000000000 --- a/nx-X11/lib/Xmu/RdBitF.c +++ /dev/null @@ -1,401 +0,0 @@ -/* $Xorg: RdBitF.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.12 2001/12/14 19:55:48 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. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include - -#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> 8; - } - } else { - unsigned char *ptr; - int bytes; - - for (bytes=0, ptr=data; bytes -#endif -#include -#include -#include - -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/nx-X11/lib/Xmu/ShapeWidg.c b/nx-X11/lib/Xmu/ShapeWidg.c deleted file mode 100644 index 732018c92..000000000 --- a/nx-X11/lib/Xmu/ShapeWidg.c +++ /dev/null @@ -1,251 +0,0 @@ -/* $Xorg: ShapeWidg.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.7 2001/01/17 19:42:56 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#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/nx-X11/lib/Xmu/StdCmap.c b/nx-X11/lib/Xmu/StdCmap.c deleted file mode 100644 index ffce489ce..000000000 --- a/nx-X11/lib/Xmu/StdCmap.c +++ /dev/null @@ -1,236 +0,0 @@ -/* $Xorg: StdCmap.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.5 2001/01/17 19:42:56 dawes Exp $ */ - -/* - * Author: Donna Converse, MIT X Consortium - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include - -#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/nx-X11/lib/Xmu/StdCmap.h b/nx-X11/lib/Xmu/StdCmap.h deleted file mode 100644 index b268d073c..000000000 --- a/nx-X11/lib/Xmu/StdCmap.h +++ /dev/null @@ -1,119 +0,0 @@ -/* $Xorg: StdCmap.h,v 1.5 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.8 2001/01/23 17:38:14 keithp 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 - -_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/nx-X11/lib/Xmu/StdSel.h b/nx-X11/lib/Xmu/StdSel.h deleted file mode 100644 index f7c9452de..000000000 --- a/nx-X11/lib/Xmu/StdSel.h +++ /dev/null @@ -1,57 +0,0 @@ -/* $Xorg: StdSel.h,v 1.5 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.7 2001/01/17 19:42:56 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 -#include - -_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/nx-X11/lib/Xmu/StrToBS.c b/nx-X11/lib/Xmu/StrToBS.c deleted file mode 100644 index 79fbedda6..000000000 --- a/nx-X11/lib/Xmu/StrToBS.c +++ /dev/null @@ -1,149 +0,0 @@ -/* $Xorg: StrToBS.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:56 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#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/nx-X11/lib/Xmu/StrToBmap.c b/nx-X11/lib/Xmu/StrToBmap.c deleted file mode 100644 index f46a99a1a..000000000 --- a/nx-X11/lib/Xmu/StrToBmap.c +++ /dev/null @@ -1,150 +0,0 @@ -/* $Xorg: StrToBmap.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.5 2001/01/17 19:42:57 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include - - -/* - * 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/nx-X11/lib/Xmu/StrToCurs.c b/nx-X11/lib/Xmu/StrToCurs.c deleted file mode 100644 index 7f13c0d4e..000000000 --- a/nx-X11/lib/Xmu/StrToCurs.c +++ /dev/null @@ -1,351 +0,0 @@ -/* $Xorg: StrToCurs.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.11 2002/09/19 13:21:58 tsi Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include - -#ifndef X_NOT_POSIX -#include -#ifdef _POSIX_SOURCE -#include -#else -#define _POSIX_SOURCE -#include -#undef _POSIX_SOURCE -#endif -#endif /* X_NOT_POSIX */ -#ifndef PATH_MAX -#ifdef WIN32 -#define PATH_MAX 512 -#else -#include -#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 = 0; - /* 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 %%%lds %%d %%%lds %%d", - (unsigned long)sizeof(source_name) - 1, - (unsigned long)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/nx-X11/lib/Xmu/StrToGrav.c b/nx-X11/lib/Xmu/StrToGrav.c deleted file mode 100644 index a0c99687c..000000000 --- a/nx-X11/lib/Xmu/StrToGrav.c +++ /dev/null @@ -1,151 +0,0 @@ -/* $Xorg: StrToGrav.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:57 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include - -#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/nx-X11/lib/Xmu/StrToJust.c b/nx-X11/lib/Xmu/StrToJust.c deleted file mode 100644 index f3b4b7828..000000000 --- a/nx-X11/lib/Xmu/StrToJust.c +++ /dev/null @@ -1,140 +0,0 @@ -/* $Xorg: StrToJust.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:57 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#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/nx-X11/lib/Xmu/StrToLong.c b/nx-X11/lib/Xmu/StrToLong.c deleted file mode 100644 index 6a7539aa9..000000000 --- a/nx-X11/lib/Xmu/StrToLong.c +++ /dev/null @@ -1,83 +0,0 @@ -/* $Xorg: StrToLong.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.8 2001/08/23 00:03:21 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include - -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/nx-X11/lib/Xmu/StrToOrnt.c b/nx-X11/lib/Xmu/StrToOrnt.c deleted file mode 100644 index 209b13a19..000000000 --- a/nx-X11/lib/Xmu/StrToOrnt.c +++ /dev/null @@ -1,130 +0,0 @@ -/* $Xorg: StrToOrnt.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:57 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#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/nx-X11/lib/Xmu/StrToShap.c b/nx-X11/lib/Xmu/StrToShap.c deleted file mode 100644 index 3f17c01e9..000000000 --- a/nx-X11/lib/Xmu/StrToShap.c +++ /dev/null @@ -1,125 +0,0 @@ -/* $Xorg: StrToShap.c,v 1.5 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:57 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#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/nx-X11/lib/Xmu/StrToWidg.c b/nx-X11/lib/Xmu/StrToWidg.c deleted file mode 100644 index 22411de3a..000000000 --- a/nx-X11/lib/Xmu/StrToWidg.c +++ /dev/null @@ -1,225 +0,0 @@ -/* $Xorg: StrToWidg.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:57 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. - */ -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include - -#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/nx-X11/lib/Xmu/SysUtil.h b/nx-X11/lib/Xmu/SysUtil.h deleted file mode 100644 index 9f5b033ac..000000000 --- a/nx-X11/lib/Xmu/SysUtil.h +++ /dev/null @@ -1,60 +0,0 @@ -/* $Xorg: SysUtil.h,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.9 2001/12/14 19:55:55 dawes Exp $ */ - -#ifndef _SYSUTIL_H_ -#define _SYSUTIL_H_ - -#include - -_XFUNCPROTOBEGIN - -int XmuGetHostname -( - char *buf_return, - int maxlen -); - -#ifndef _XMU_H_ -int XmuSnprintf -( - char *str, - int size, - _Xconst char *fmt, - ... - ) -#if defined(__GNUC__) && \ - ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ > 4))) -__attribute((format(printf,3,4))) -#endif -; -#endif - -_XFUNCPROTOEND - -#endif /* _SYSUTIL_H_ */ diff --git a/nx-X11/lib/Xmu/UpdMapHint.c b/nx-X11/lib/Xmu/UpdMapHint.c deleted file mode 100644 index aeba3037f..000000000 --- a/nx-X11/lib/Xmu/UpdMapHint.c +++ /dev/null @@ -1,62 +0,0 @@ -/* $Xorg: UpdMapHint.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:57 dawes Exp $ */ - -/* - * Author: Jim Fulton, MIT X Consortium - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include - -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/nx-X11/lib/Xmu/VisCmap.c b/nx-X11/lib/Xmu/VisCmap.c deleted file mode 100644 index 54022cc9a..000000000 --- a/nx-X11/lib/Xmu/VisCmap.c +++ /dev/null @@ -1,183 +0,0 @@ -/* $Xorg: VisCmap.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:57 dawes Exp $ */ - -/* - * Author: Donna Converse, MIT X Consortium - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include - -/* - * 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/nx-X11/lib/Xmu/WhitePoint.h b/nx-X11/lib/Xmu/WhitePoint.h deleted file mode 100644 index a05bddd4a..000000000 --- a/nx-X11/lib/Xmu/WhitePoint.h +++ /dev/null @@ -1,65 +0,0 @@ -/* $Xorg: WhitePoint.h,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1991, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/nx-X11/lib/Xmu/WidgetNode.c b/nx-X11/lib/Xmu/WidgetNode.c deleted file mode 100644 index e157ccc10..000000000 --- a/nx-X11/lib/Xmu/WidgetNode.c +++ /dev/null @@ -1,310 +0,0 @@ -/* $Xorg: WidgetNode.c,v 1.5 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.12 2002/09/19 13:21:58 tsi Exp $ */ - -/* - * Author: Jim Fulton, MIT X Consortium - */ - - - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include - -/* - * Prototypes - */ -static char *binsearch(char*, char*, int, int, - int (*__compar)(_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, 0); - 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 %ld byte widget node ptrs\n", - "XmuWnFetchResources", wn->nresources, - (unsigned long)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 %ld byte widget node ptrs\n", - "XmuWnFetchResources", wn->nconstraints, - (unsigned long)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/nx-X11/lib/Xmu/WidgetNode.h b/nx-X11/lib/Xmu/WidgetNode.h deleted file mode 100644 index 75050d253..000000000 --- a/nx-X11/lib/Xmu/WidgetNode.h +++ /dev/null @@ -1,98 +0,0 @@ -/* $Xorg: WidgetNode.h,v 1.5 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1990, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.5 2001/01/17 19:42:57 dawes Exp $ */ - -/* - * Author: Jim Fulton, MIT X Consortium - */ - -#ifndef _XmuWidgetNode_h -#define _XmuWidgetNode_h - -#include -#include - -/* - * 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/nx-X11/lib/Xmu/WinUtil.h b/nx-X11/lib/Xmu/WinUtil.h deleted file mode 100644 index 0445bcfa8..000000000 --- a/nx-X11/lib/Xmu/WinUtil.h +++ /dev/null @@ -1,64 +0,0 @@ -/* $Xorg: WinUtil.h,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:57 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 -#include - -_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/nx-X11/lib/Xmu/Xct.c b/nx-X11/lib/Xmu/Xct.c deleted file mode 100644 index b186d27d7..000000000 --- a/nx-X11/lib/Xmu/Xct.c +++ /dev/null @@ -1,687 +0,0 @@ -/* $Xorg: Xct.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.8 2001/07/25 15:04:50 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xct.h" -#include - -#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) - -#include - -#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/nx-X11/lib/Xmu/Xct.h b/nx-X11/lib/Xmu/Xct.h deleted file mode 100644 index b06644ae0..000000000 --- a/nx-X11/lib/Xmu/Xct.h +++ /dev/null @@ -1,168 +0,0 @@ -/* $Xorg: Xct.h,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.6 2001/01/17 19:42:58 dawes Exp $ */ - -#ifndef _Xct_h -#define _Xct_h - -#include - -#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/nx-X11/lib/Xmu/Xmu-def.cpp b/nx-X11/lib/Xmu/Xmu-def.cpp deleted file mode 100644 index 6a5ea4f9c..000000000 --- a/nx-X11/lib/Xmu/Xmu-def.cpp +++ /dev/null @@ -1,145 +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 -XmuCvtGravityToString -XmuCvtBackingStoreToString -_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 -_XA_UTF8_STRING -XmuNewArea -XmuDestroyScanlineList -XmuCvtWidgetToString -XmuOptimizeScanline -XmuAreaOrXor -XmuScanlineXor -XmuDestroySegmentList -XmuCvtJustifyToString -XmuSnprintf -XmuNewScanline -XmuNCopyISOLatin1Lowered -XmuNCopyISOLatin1Uppered -XmuCvtShapeStyleToString -XmuCvtOrientationToString -XmuScanlineOrSegment -#ifdef __UNIXOS2__ -XmuScanlineNot -XmuScanlineAnd -XmuScanlineOr -#endif - -/* $XFree86: xc/lib/Xmu/Xmu-def.cpp,v 1.1 2000/08/09 23:40:13 dawes Exp $ */ diff --git a/nx-X11/lib/Xmu/Xmu.h b/nx-X11/lib/Xmu/Xmu.h deleted file mode 100644 index c503a41b8..000000000 --- a/nx-X11/lib/Xmu/Xmu.h +++ /dev/null @@ -1,128 +0,0 @@ -/* $Xorg: Xmu.h,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.9 2001/12/14 19:55:59 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 -#include /* _XA_... */ -#include /* CopyISOLatin1Lowered */ -#include /* CvtStringTo... */ -#include /* DrawRoundedRect, DrawLogo */ -#include /* PrintDefaultError */ -#include /* 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 */ - -#ifndef _SYSUTIL_H_ -int XmuSnprintf(char *str, int size, _Xconst char *fmt, ...) -#if defined(__GNUC__) && \ - ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ > 4))) -__attribute((format(printf,3,4))) -#endif -; -#endif - -#endif /* _XMU_H_ */ - diff --git a/nx-X11/lib/Xmu/sharedlib.c b/nx-X11/lib/Xmu/sharedlib.c deleted file mode 100644 index 0ef5e3ce9..000000000 --- a/nx-X11/lib/Xmu/sharedlib.c +++ /dev/null @@ -1,76 +0,0 @@ -/* $Xorg: sharedlib.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/* - -Copyright 1991, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/sharedlib.c,v 3.4 2001/07/25 15:04:51 dawes Exp $ */ - -#if defined(SUNSHLIB) && !defined(SHAREDCODE) - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Atoms.h" - -struct _AtomRec { - char *name; - struct _DisplayRec* head; -}; - -#if !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) -DeclareAtom(XA_UTF8_STRING) - -#endif /* SUNSHLIB */ diff --git a/nx-X11/lib/Xmuu/Imakefile b/nx-X11/lib/Xmuu/Imakefile deleted file mode 100644 index 7cd087921..000000000 --- a/nx-X11/lib/Xmuu/Imakefile +++ /dev/null @@ -1,67 +0,0 @@ -XCOMM $XFree86: xc/lib/Xmuu/Imakefile,v 1.2tsi 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 SharedLibXmuu -#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 - -### Commented out following line... -### INCLUDES = -I$(XMUSRC) -### ... it breaks Lower.c (which needs -I../../lib/misc to find snprintf.c) -### - -#include - -#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/nx-X11/lib/Xmuu/Xmuu-def.cpp b/nx-X11/lib/Xmuu/Xmuu-def.cpp deleted file mode 100644 index 243d5fcb2..000000000 --- a/nx-X11/lib/Xmuu/Xmuu-def.cpp +++ /dev/null @@ -1,22 +0,0 @@ -LIBRARY libXmuu -VERSION LIBRARY_VERSION -EXPORTS - - XmuClientWindow - XmuCursorNameToIndex - XmuPrintDefaultErrorMessage - XmuSimpleErrorHandler - XmuGetHostname - XmuCompareISOLatin1 - XmuCopyISOLatin1Lowered - XmuCopyISOLatin1Uppered - XmuNCopyISOLatin1Lowered - XmuNCopyISOLatin1Uppered - XmuSnprintf -#ifndef __UNIXOS2__ - _cygwin_dll_entry@12 - _cygwin_noncygwin_dll_entry@12 - dll_main@12 -#endif - -/* $XFree86: xc/lib/Xmuu/Xmuu-def.cpp,v 1.1 2001/04/18 17:14:00 dawes Exp $ */ diff --git a/nx-X11/lib/Xp/Imakefile b/nx-X11/lib/Xp/Imakefile deleted file mode 100644 index 2b64417a2..000000000 --- a/nx-X11/lib/Xp/Imakefile +++ /dev/null @@ -1,107 +0,0 @@ -XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:46:05 cpqbld Exp $ -/****************************************************************************** - ****************************************************************************** - ** - ** 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.3 2001/01/17 19:43:01 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 - -#ifdef SharedXpReqs -REQUIREDLIBS = SharedXpReqs -#endif - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - -DEFINES = $(ALLOC_DEFINES) - -/* - * 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 - -DependTarget() diff --git a/nx-X11/lib/Xp/Xp-def.cpp b/nx-X11/lib/Xp/Xp-def.cpp deleted file mode 100644 index 253c649ca..000000000 --- a/nx-X11/lib/Xp/Xp-def.cpp +++ /dev/null @@ -1,42 +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 - XpSetImageResolution - XpSetLocaleHinter - XpStartDoc - XpStartJob - XpStartPage -/* $Xorg: Xp-def.cpp,v 1.3 2000/08/17 19:46:05 cpqbld Exp $ */ -/* $XFree86: xc/lib/Xp/Xp-def.cpp,v 1.2 2000/08/09 23:40:13 dawes Exp $ */ diff --git a/nx-X11/lib/Xp/XpAttr.c b/nx-X11/lib/Xp/XpAttr.c deleted file mode 100644 index 9e1fbfd64..000000000 --- a/nx-X11/lib/Xp/XpAttr.c +++ /dev/null @@ -1,208 +0,0 @@ -/* $Xorg: XpAttr.c,v 1.4 2000/08/17 19:46:05 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (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.6 2001/01/17 19:43:01 dawes Exp $ */ - -#define NEED_REPLIES - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.h" - -#define _XpPadOut(len) (((len) + 3) & ~3) - - -#include -#include - -char * -XpGetAttributes ( - Display *dpy, - XPContext print_context, - XPAttributes type -) -{ - char *buf; - - xPrintGetAttributesReq *req; - xPrintGetAttributesReply rep; - 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 -) -{ - char *buf; - - xPrintGetOneAttributeReq *req; - xPrintGetOneAttributeReply rep; - 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 -) -{ - xPrintSetAttributesReq *req; - 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/nx-X11/lib/Xp/XpContext.c b/nx-X11/lib/Xp/XpContext.c deleted file mode 100644 index fc3da9c2b..000000000 --- a/nx-X11/lib/Xp/XpContext.c +++ /dev/null @@ -1,250 +0,0 @@ -/* $Xorg: XpContext.c,v 1.4 2000/08/17 19:46:05 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (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/XpContext.c,v 1.6 2001/10/28 03:32:39 tsi Exp $ */ - -#define NEED_REPLIES - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.h" - -#define _XpPadOut(len) (((len) + 3) & ~3) - -XPContext -XpCreateContext ( - Display *dpy, - char *printer_name -) -{ - xPrintCreateContextReq *req; - 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; - 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; - 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; - 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; - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - int i; - Screen *checkScr = NULL; - 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/nx-X11/lib/Xp/XpDoc.c b/nx-X11/lib/Xp/XpDoc.c deleted file mode 100644 index 3fb4ad5d5..000000000 --- a/nx-X11/lib/Xp/XpDoc.c +++ /dev/null @@ -1,159 +0,0 @@ -/* $Xorg: XpDoc.c,v 1.3 2000/08/17 19:46:06 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (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/XpDoc.c,v 1.3 2001/01/17 19:43:01 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.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/nx-X11/lib/Xp/XpExtUtil.c b/nx-X11/lib/Xp/XpExtUtil.c deleted file mode 100644 index dac80286f..000000000 --- a/nx-X11/lib/Xp/XpExtUtil.c +++ /dev/null @@ -1,355 +0,0 @@ -/* $Xorg: XpExtUtil.c,v 1.3 2000/08/17 19:46:06 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (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/XpExtUtil.c,v 1.7 2002/10/16 00:37:31 dawes Exp $ */ - -#define NEED_EVENTS -#define NEED_REPLIES -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include "XpExtUtil.h" -#include - -#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 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 { - int present; - short major_version; - short minor_version; -} XPrintLocalExtensionVersion; - -typedef struct _xpPrintData { - XEvent data; - XPrintLocalExtensionVersion *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 XPrintLocalExtensionVersion 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 XpCheckExtInitUnlocked(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); - } - } - - if (info->data == NULL) { - /* - * Hang a Xp private data struct. Use it for version - * information. - */ - info->data = (XPointer) Xmalloc (sizeof (xpPrintData)); - if (!info->data) { - return (-1); - } - - ((xpPrintData *) info->data)->vers = - (XPrintLocalExtensionVersion *) Xmalloc(sizeof(XPrintLocalExtensionVersion)); - if (!(((xpPrintData *) info->data)->vers)) { - 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))) { - return (-1); - } - } - - return (0); -} - -int XpCheckExtInit(dpy, version_index) - register Display *dpy; - register int version_index; -{ - int retval; - - _XLockMutex(_Xglobal_lock); - - retval = XpCheckExtInitUnlocked(dpy, version_index); - - _XUnlockMutex(_Xglobal_lock); - - return retval; -} - -/*********************************************************************** - * - * 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); - - 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; - int i; - - *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/nx-X11/lib/Xp/XpExtUtil.h b/nx-X11/lib/Xp/XpExtUtil.h deleted file mode 100644 index 81b5ce3c4..000000000 --- a/nx-X11/lib/Xp/XpExtUtil.h +++ /dev/null @@ -1,41 +0,0 @@ -/* $XFree86: xc/lib/Xp/XpExtUtil.h,v 1.3 2002/10/16 00:37:31 dawes 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 -#include - -extern XEXT_FIND_DISPLAY_PROTO(xp_find_display); - -extern int XpCheckExtInit( - Display * /* dpy */, - int /* version_index */ -); - -#endif /* _XPEXTUTIL_H */ diff --git a/nx-X11/lib/Xp/XpExtVer.c b/nx-X11/lib/Xp/XpExtVer.c deleted file mode 100644 index 32227e89f..000000000 --- a/nx-X11/lib/Xp/XpExtVer.c +++ /dev/null @@ -1,125 +0,0 @@ -/* $Xorg: XpExtVer.c,v 1.4 2000/08/17 19:46:07 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (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/XpExtVer.c,v 1.5 2002/10/16 00:37:31 dawes Exp $ */ - -#define NEED_REPLIES - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.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; - } -} - -/* Prototype for |XpCheckExtInitUnlocked()| - * See XpExtUtil.c - same as |XpCheckExtInit()| but does not obtain the Xlib global lock */ -extern int XpCheckExtInitUnlocked( - register Display *dpy, - register int version_index -); - -Status -XpQueryVersion ( - Display *dpy, - short *major_version, - short *minor_version -) -{ - xPrintQueryVersionReq *req; - xPrintQueryVersionReply rep; - 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 (XpCheckExtInitUnlocked(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/nx-X11/lib/Xp/XpGetData.c b/nx-X11/lib/Xp/XpGetData.c deleted file mode 100644 index b49502155..000000000 --- a/nx-X11/lib/Xp/XpGetData.c +++ /dev/null @@ -1,215 +0,0 @@ -/* $Xorg: XpGetData.c,v 1.4 2000/08/17 19:46:07 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (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/XpGetData.c,v 1.4 2001/01/17 19:43:02 dawes Exp $ */ - -#define NEED_REPLIES - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.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; - 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/nx-X11/lib/Xp/XpImageRes.c b/nx-X11/lib/Xp/XpImageRes.c deleted file mode 100644 index 5b7a5c476..000000000 --- a/nx-X11/lib/Xp/XpImageRes.c +++ /dev/null @@ -1,118 +0,0 @@ -/* $Xorg: XpImageRes.c,v 1.4 2000/08/17 19:46:07 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (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/XpImageRes.c,v 1.4 2001/01/17 19:43:02 dawes Exp $ */ - - -#define NEED_REPLIES - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.h" - - -Bool -XpSetImageResolution ( - Display *dpy, - XPContext print_context, - int image_res, - int *prev_res -) -{ - xPrintSetImageResolutionReq *req; - xPrintSetImageResolutionReply rep; - 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; - 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/nx-X11/lib/Xp/XpInput.c b/nx-X11/lib/Xp/XpInput.c deleted file mode 100644 index 099189517..000000000 --- a/nx-X11/lib/Xp/XpInput.c +++ /dev/null @@ -1,107 +0,0 @@ -/* $Xorg: XpInput.c,v 1.4 2000/08/17 19:46:07 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (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/XpInput.c,v 1.4 2001/01/17 19:43:02 dawes Exp $ */ - -#define NEED_REPLIES - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.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; - 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/nx-X11/lib/Xp/XpJob.c b/nx-X11/lib/Xp/XpJob.c deleted file mode 100644 index 1ad7e306a..000000000 --- a/nx-X11/lib/Xp/XpJob.c +++ /dev/null @@ -1,206 +0,0 @@ -/* $Xorg: XpJob.c,v 1.4 2000/08/17 19:46:07 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (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.5 2002/04/10 16:20:07 tsi Exp $ */ - -#if defined(sun) && defined(i386) && defined(SVR4) && !defined(__EXTENSIONS__) -#define __EXTENSIONS__ -#endif - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include "XpExtUtil.h" -#include -#ifndef WIN32 -#define X_INCLUDE_PWD_H -#define XOS_USE_XLIB_LOCKING -#include -#endif -#include - - -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 -#ifdef X_NEEDS_PWPARAMS - _Xgetpwparams pwparams; -#endif - 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/nx-X11/lib/Xp/XpLocale.c b/nx-X11/lib/Xp/XpLocale.c deleted file mode 100644 index ef7c5fb01..000000000 --- a/nx-X11/lib/Xp/XpLocale.c +++ /dev/null @@ -1,269 +0,0 @@ -/* $Xorg: XpLocale.c,v 1.3 2000/08/17 19:46:07 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (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/XpLocale.c,v 1.4 2001/01/17 19:43:02 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.h" - -#include - - -/* - * 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/nx-X11/lib/Xp/XpNotifyPdm.c b/nx-X11/lib/Xp/XpNotifyPdm.c deleted file mode 100644 index feb62f0eb..000000000 --- a/nx-X11/lib/Xp/XpNotifyPdm.c +++ /dev/null @@ -1,900 +0,0 @@ -/* $Xorg: XpNotifyPdm.c,v 1.4 2000/08/17 19:46:07 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** 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. - ** - ****************************************************************************** - *****************************************************************************/ -/* $XFree86: xc/lib/Xp/XpNotifyPdm.c,v 1.7tsi Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include - -/* - * 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. - * Use strrchr to find : separating host from display - * to allow IPv6 numeric addresses with embedded colons. - */ - if (( tstrptr = strrchr( tstr1, ':' ) )) - if (( tstrptr = strchr( tstrptr, '.' ) )) - *tstrptr = '\0'; - - if (( tstrptr = strrchr( tstr2, ':' ) )) - if (( tstrptr = strchr( tstrptr, '.' ) )) - *tstrptr = '\0'; - - if (( tstrptr = strrchr( 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 */ -) -{ - 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%lx", (long)video_window ); - list[1] = str1; - - list[2] = XDisplayString( print_display ); - sprintf( str2, "0x%lx", (long)print_window ); - list[3] = str2; - - sprintf( str3, "0x%lx", (long)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)0; - } - - /* - * Create property and transfer data to. - */ - *sel_target_atom = XInternAtom( *sel_display, "PDM_MBOX", False ); - return (Status)1; -} - - -/****************************************************************************** - ****************************************************************************** - ** - ** 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 ); -} - -#ifdef UNUSED -/* - * 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 ); -} -#endif - - -/****************************************************************************** - * - * 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/nx-X11/lib/Xp/XpPage.c b/nx-X11/lib/Xp/XpPage.c deleted file mode 100644 index 886bc578a..000000000 --- a/nx-X11/lib/Xp/XpPage.c +++ /dev/null @@ -1,160 +0,0 @@ -/* $Xorg: XpPage.c,v 1.4 2001/03/06 13:59:02 pookie Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (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/XpPage.c,v 1.4 2001/12/19 21:28:44 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.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); - - XMapWindow(dpy, window); - 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/nx-X11/lib/Xp/XpPageDim.c b/nx-X11/lib/Xp/XpPageDim.c deleted file mode 100644 index 61ef28a41..000000000 --- a/nx-X11/lib/Xp/XpPageDim.c +++ /dev/null @@ -1,89 +0,0 @@ -/* $Xorg: XpPageDim.c,v 1.4 2000/08/17 19:46:07 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (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/XpPageDim.c,v 1.4 2001/01/17 19:43:02 dawes Exp $ */ - -#define NEED_REPLIES - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.h" - - -Status -XpGetPageDimensions ( - Display *dpy, - XPContext print_context, - unsigned short *width, - unsigned short *height, - XRectangle *reproducible_area -) -{ - xPrintGetPageDimensionsReq *req; - xPrintGetPageDimensionsReply rep; - 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/nx-X11/lib/Xp/XpPrinter.c b/nx-X11/lib/Xp/XpPrinter.c deleted file mode 100644 index 7ed33b706..000000000 --- a/nx-X11/lib/Xp/XpPrinter.c +++ /dev/null @@ -1,248 +0,0 @@ -/* $Xorg: XpPrinter.c,v 1.4 2000/08/17 19:46:07 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (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.8 2001/04/01 14:00:02 tsi Exp $ */ - -#define NEED_REPLIES - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.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 */ - long dataLenVR; - CARD8 *dataVR; /* aka STRING8 */ - - XPPrinterList ptr_list; - - XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy); - - /* For converting root winID to corresponding ScreenPtr */ - int i; - - - 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, &dataLenVR, (long) sizeof(CARD32) ); - - 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, &dataLenVR, (long) sizeof(CARD32) ); - - 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/nx-X11/lib/Xp/XpPutData.c b/nx-X11/lib/Xp/XpPutData.c deleted file mode 100644 index 76ff635d3..000000000 --- a/nx-X11/lib/Xp/XpPutData.c +++ /dev/null @@ -1,100 +0,0 @@ -/* $Xorg: XpPutData.c,v 1.3 2000/08/17 19:46:07 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (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/XpPutData.c,v 1.3 2001/01/17 19:43:02 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.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/nx-X11/lib/Xp/XpScreens.c b/nx-X11/lib/Xp/XpScreens.c deleted file mode 100644 index dd30ed329..000000000 --- a/nx-X11/lib/Xp/XpScreens.c +++ /dev/null @@ -1,128 +0,0 @@ -/* $Xorg: XpScreens.c,v 1.5 2000/08/17 19:46:08 cpqbld Exp $ */ -/****************************************************************************** - ****************************************************************************** - ** - ** (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/XpScreens.c,v 1.5 2001/04/01 14:00:02 tsi Exp $ */ - -#define NEED_REPLIES - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "XpExtUtil.h" - - -Screen ** -XpQueryScreens ( - Display *dpy, - int *list_count /* return value */ -) -{ - xPrintQueryScreensReq *req; - xPrintQueryScreensReply rep; - - /* For decoding the variable portion of Reply */ - long rootWindow; - - /* For converting root winID to corresponding ScreenPtr */ - Screen **scr_list; - Screen *checkScr; - int i,j; - - 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 */ - } - i = 0; - while(i < *list_count){ - /* - * Pull printer length and then name. - */ - _XRead32 (dpy, &rootWindow, (long) sizeof(CARD32) ); - scr_list[i] = NULL; - for ( j = 0; j < XScreenCount(dpy); j++ ) { - checkScr = XScreenOfDisplay(dpy, j); - if ( XRootWindowOfScreen(checkScr) == (Window) rootWindow ) { - scr_list[i] = checkScr; - break; - } - } - if(scr_list[i] == NULL) - (*list_count)--; - else - i++; - } - if(!(*list_count)) { - Xfree(scr_list); - scr_list = (Screen **) NULL; - } - } - else { - scr_list = (Screen **) NULL; - } - - UnlockDisplay(dpy); - SyncHandle(); - - return ( scr_list ); -} - diff --git a/nx-X11/lib/XprintAppUtil/Imakefile b/nx-X11/lib/XprintAppUtil/Imakefile deleted file mode 100644 index 4826ce8d7..000000000 --- a/nx-X11/lib/XprintAppUtil/Imakefile +++ /dev/null @@ -1,21 +0,0 @@ -#define DoNormalLib YES -# XprintAppUtil is not a stable interface yet, therefore avoid shipping it -# as shared lib for now -#define DoSharedLib NO -#define DoDebugLib NO -#define DoProfileLib NO -#define HasSharedData NO -#define LibName XprintAppUtil -#define SoRev SOZLIBREV -#define IncSubdir X11 -#define IncSubSubdir XprintAppUtil - - -HEADERS = xpapputil.h - -SRCS = xpapputil.c -OBJS = xpapputil.o - -#include - -DependTarget() diff --git a/nx-X11/lib/XprintAppUtil/xpapputil.c b/nx-X11/lib/XprintAppUtil/xpapputil.c deleted file mode 100644 index aaf918c4e..000000000 --- a/nx-X11/lib/XprintAppUtil/xpapputil.c +++ /dev/null @@ -1,550 +0,0 @@ - -/* - * $Xorg:xpapputil.c,v 1.1 2002/06/10 02:54:18 gisburn Exp $ - * - * xpapputil - Application level utility library for Xprint - * - * -Copyright 2002-2004 Roland Mainz - -All Rights Reserved. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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: Roland Mainz - */ - -#include -#include - -#include - -XpauContext *XpauGetContext( const char *printername ) -{ - Display *pdpy; - XPContext pcontext; - XpauContext *context; - - if( XpuGetPrinter(printername, &pdpy, &pcontext) != 1 ) - return NULL; - - if( (context = (XpauContext *)malloc(sizeof(XpauContext))) ) - { - memset(context, 0, sizeof(XpauContext)); - - context->pdpy = pdpy; - context->pcontext = pcontext; - - if( XpQueryExtension(pdpy, &context->xp_event_base, &context->xp_error_base) == False ) - { - fprintf(stderr, "XpauGetContext: XpQueryExtension() failed.\n"); - XpauReleaseContext(context); - return NULL; - } - - /* It may be better to fetch all this info on demand... */ - context->medium_list = XpuGetMediumSourceSizeList(pdpy, pcontext, &context->medium_num_list_entries); - context->resolution_list = XpuGetResolutionList(pdpy, pcontext, &context->resolution_num_list_entries); - context->orientation_list = XpuGetOrientationList(pdpy, pcontext, &context->orientation_num_list_entries); - context->plex_list = XpuGetPlexList(pdpy, pcontext, &context->plex_num_list_entries); - context->supported_job_attributes = XpuGetSupportedJobAttributes(pdpy, pcontext); - context->supported_doc_attributes = XpuGetSupportedDocAttributes(pdpy, pcontext); - context->supported_page_attributes = XpuGetSupportedPageAttributes(pdpy, pcontext); - - return context; - } - - XpuClosePrinterDisplay(pdpy, pcontext); - - return NULL; -} - -void XpauReleaseContext( XpauContext *context ) -{ - if( context ) - { - if( context->medium_list ) - XpuFreeMediumSourceSizeList(context->medium_list); - - if( context->resolution_list ) - XpuFreeResolutionList(context->resolution_list); - - if( context->orientation_list ) - XpuFreeOrientationList(context->orientation_list); - - if( context->plex_list ) - XpuFreePlexList(context->plex_list); - - XpuClosePrinterDisplay(context->pdpy, context->pcontext); - - free(context); - } -} - -static -XpAuErrorValue XpauParseArg( const char *arg_name, const char *arg_value, XpauContext *context, - XpauFlags *jobvaluemask, XpauJobValues *jobvalues, - XpauFlags *docvaluemask, XpauDocValues *docvalues, - char **jobfilename ) -{ - XPAU_DEBUG(printf("XpauParseArg: name='%s', value='%s'\n", arg_name, arg_value)); - - if( !strcasecmp(arg_name, "file") || - !strcasecmp(arg_name, "tofile") ) - { - if( *jobfilename ) - free((char *)*jobfilename); - - *jobfilename = strdup(arg_value); - if( !*jobfilename ) - return XpAuError_error_no_memory; - - return XpAuError_success; - } - else if( !strcasecmp(arg_name, "medium") || - !strcasecmp(arg_name, "papersize")) - { - if( !(context->medium_list && (context->supported_doc_attributes & XPUATTRIBUTESUPPORTED_DEFAULT_MEDIUM)) ) - return XpAuError_unsupported_medium; - - /* XXX: What about the tray name ? */ - docvalues->medium = XpuFindMediumSourceSizeByName(context->medium_list, - context->medium_num_list_entries, - NULL, arg_value); - - if( !docvalues->medium ) - return XpAuError_unsupported_medium; - - *docvaluemask |= XpauVMedium; - return XpAuError_success; - } - else if( !strcasecmp(arg_name, "resolution") ) - { - if( !(context->resolution_list && (context->supported_doc_attributes & XPUATTRIBUTESUPPORTED_DEFAULT_PRINTER_RESOLUTION)) ) - return XpAuError_unsupported_resolution; - - docvalues->resolution = XpuFindResolutionByName(context->resolution_list, - context->resolution_num_list_entries, - arg_value); - - if( !docvalues->resolution ) - return XpAuError_unsupported_resolution; - - *docvaluemask |= XpauVResolution; - return XpAuError_success; - } - else if( !strcasecmp(arg_name, "orientation") ) - { - if( !(context->orientation_list && (context->supported_doc_attributes & XPUATTRIBUTESUPPORTED_CONTENT_ORIENTATION)) ) - return XpAuError_unsupported_orientation; - - docvalues->orientation = XpuFindOrientationByName(context->orientation_list, - context->orientation_num_list_entries, - arg_value); - - if( !docvalues->orientation ) - return XpAuError_unsupported_orientation; - - *docvaluemask |= XpauVOrientation; - return XpAuError_success; - } - else if( !strcasecmp(arg_name, "plex") ) - { - if( !(context->plex_list && (context->supported_doc_attributes & XPUATTRIBUTESUPPORTED_PLEX)) ) - return XpAuError_unsupported_plex; - - docvalues->plex = XpuFindPlexByName(context->plex_list, - context->plex_num_list_entries, - arg_value); - - if( !docvalues->plex ) - return XpAuError_unsupported_plex; - - *docvaluemask |= XpauVPlex; - return XpAuError_success; - } - else if( !strcasecmp(arg_name, "copies") ) - { - if( !(context->supported_job_attributes & XPUATTRIBUTESUPPORTED_COPY_COUNT) ) - return XpAuError_unsupported_copy_count; - - jobvalues->copies = atoi(arg_value); - if( jobvalues->copies <= 1 ) - return XpAuError_unsupported_copy_count; - - *jobvaluemask |= XpauVCopies; - return XpAuError_success; - } - else if( !strcasecmp(arg_name, "title") ) - { - if( !(context->supported_job_attributes & XPUATTRIBUTESUPPORTED_JOB_NAME) ) - return XpAuError_unsupported_job_name; - - if( jobvalues->title ) - free((char *)jobvalues->title); - - jobvalues->title = strdup(arg_value); - if( !jobvalues->title ) - return XpAuError_error_no_memory; - - *jobvaluemask |= XpauVTitle; - return XpAuError_success; - } - - return XpAuError_unknown_argument; -} - -XpAuErrorValue XpauParseArgs( XpauContext *context, - XpauFlags *jobvaluemask, XpauJobValues *jobvalues, - XpauFlags *docvaluemask, XpauDocValues *docvalues, - char **jobfilename, - const char *argument_string ) -{ - char *args_string, - *arg_name, - *arg_value, - *start, - *s; - int result; - - if( !argument_string ) - return XpAuError_success; - - args_string = strdup(argument_string); /* Create copy of read-only string that we can write into it... */ - if( !args_string ) - return XpAuError_error_no_memory; - - s = args_string; - - while( s != NULL ) - { - /* Fetch argument name */ - start = s; - while( *s != '\0' && *s != '=' ) - s++; - if( *s == '\0' ) - { - free(args_string); - return XpAuError_unexpected_eos; - } - *s++ = '\0'; - arg_name = start; - - /* Fetch argument value */ - start = s; - while( *s != '\0' && *s != ',' ) - s++; - if( *s == '\0' ) - s = NULL; - else - *s++ = '\0'; - arg_value = start; - - result = XpauParseArg(arg_name, arg_value, context, jobvaluemask, jobvalues, docvaluemask, docvalues, jobfilename); - if( result != XpAuError_success ) - { - free(args_string); - return result; - } - } - - free(args_string); - return XpAuError_success; -} - -XpAuErrorValue -XpauSetJobValues( XpauContext *context, XpauFlags valuemask, XpauJobValues *jobvalues ) -{ - /* "Dry-run" tests */ - - /* We can't change job attributes while we are at the "job level" - * (e.g. after |XpStartJob()| and before |XpEndJob()| */ - XPAU_RETURN_IF_FAIL(context->inJob == False, XpAuError_inside_job); - - if( valuemask & XpauVTitle ) - XPAU_RETURN_IF_FAIL(jobvalues->title && (context->supported_job_attributes & XPUATTRIBUTESUPPORTED_JOB_NAME), XpAuError_unsupported_job_name); - - if( valuemask & XpauVCopies ) - XPAU_RETURN_IF_FAIL((jobvalues->copies > 0) && (context->supported_job_attributes & XPUATTRIBUTESUPPORTED_COPY_COUNT), XpAuError_unsupported_copy_count); - - /* Set values */ - - if( valuemask & XpauVTitle ) - XpuSetJobTitle(context->pdpy, context->pcontext, jobvalues->title); - -#ifdef NOTNOW - if( valuemask & XpauVResolution ) - XpuJobDocumentCopies(context->pdpy, context->pcontext, jobvalues->copies); -#endif /* NOTNOW */ - - return XpAuError_success; -} - -XpAuErrorValue -XpauSetDocValues( XpauContext *context, XpauFlags valuemask, XpauDocValues *docvalues ) -{ - /* "Dry-run" tests */ - - /* We can't change document attributes while we are at the "document level" - * (e.g. after |XpStartDoc()| and before |XpEndDoc()| */ - XPAU_RETURN_IF_FAIL(context->inDocument == False, XpAuError_inside_document); - - if( valuemask & XpauVMedium ) - XPAU_RETURN_IF_FAIL(docvalues->medium && (context->supported_doc_attributes & XPUATTRIBUTESUPPORTED_DEFAULT_MEDIUM), XpAuError_unsupported_medium); - - if( valuemask & XpauVOrientation ) - XPAU_RETURN_IF_FAIL(docvalues->orientation && (context->supported_doc_attributes & XPUATTRIBUTESUPPORTED_CONTENT_ORIENTATION), XpAuError_unsupported_orientation); - - if( valuemask & XpauVPlex ) - XPAU_RETURN_IF_FAIL(docvalues->plex && (context->supported_doc_attributes & XPUATTRIBUTESUPPORTED_PLEX), XpAuError_unsupported_plex); - - if( valuemask & XpauVResolution ) - XPAU_RETURN_IF_FAIL(docvalues->resolution && (context->supported_doc_attributes & XPUATTRIBUTESUPPORTED_DEFAULT_PRINTER_RESOLUTION), XpAuError_unsupported_resolution); - - if( valuemask & XpauVCopies ) - XPAU_RETURN_IF_FAIL((docvalues->copies > 0) && (context->supported_doc_attributes & XPUATTRIBUTESUPPORTED_COPY_COUNT), XpAuError_unsupported_copy_count); - - /* Set values */ - - if( valuemask & XpauVMedium ) - XpuSetDocMediumSourceSize(context->pdpy, context->pcontext, docvalues->medium); - - if( valuemask & XpauVOrientation ) - XpuSetDocOrientation(context->pdpy, context->pcontext, docvalues->orientation); - - if( valuemask & XpauVPlex ) - XpuSetDocPlex(context->pdpy, context->pcontext, docvalues->plex); - - if( valuemask & XpauVResolution ) - XpuSetDocResolution(context->pdpy, context->pcontext, docvalues->resolution); - - if( valuemask & XpauVCopies ) - XpuSetDocumentCopies(context->pdpy, context->pcontext, docvalues->copies); - - return XpAuError_success; -} - -XpAuErrorValue -XpauSetPageValues( XpauContext *context, XpauFlags valuemask, XpauPageValues *pagevalues ) -{ - /* "Dry-run" tests */ - - /* We can't change page attributes while we are at the "page level" - * (e.g. after |XpStartPage()| and before |XpEndPage()| */ - XPAU_RETURN_IF_FAIL(context->inPage == False, XpAuError_inside_page); - - if( valuemask & XpauVMedium ) - XPAU_RETURN_IF_FAIL(pagevalues->medium && (context->supported_page_attributes & XPUATTRIBUTESUPPORTED_DEFAULT_MEDIUM), XpAuError_unsupported_medium); - - if( valuemask & XpauVOrientation ) - XPAU_RETURN_IF_FAIL(pagevalues->orientation && (context->supported_page_attributes & XPUATTRIBUTESUPPORTED_CONTENT_ORIENTATION), XpAuError_unsupported_orientation); - - if( valuemask & XpauVPlex ) - XPAU_RETURN_IF_FAIL(pagevalues->plex && (context->supported_page_attributes & XPUATTRIBUTESUPPORTED_PLEX), XpAuError_unsupported_plex); - - if( valuemask & XpauVResolution ) - XPAU_RETURN_IF_FAIL(pagevalues->resolution && (context->supported_page_attributes & XPUATTRIBUTESUPPORTED_DEFAULT_PRINTER_RESOLUTION), XpAuError_unsupported_resolution); - - /* Set values */ - - if( valuemask & XpauVMedium ) - XpuSetPageMediumSourceSize(context->pdpy, context->pcontext, pagevalues->medium); - - if( valuemask & XpauVOrientation ) - XpuSetPageOrientation(context->pdpy, context->pcontext, pagevalues->orientation); - - if( valuemask & XpauVPlex ) - XpuSetPagePlex(context->pdpy, context->pcontext, pagevalues->plex); - - if( valuemask & XpauVResolution ) - XpuSetPageResolution(context->pdpy, context->pcontext, pagevalues->resolution); - - return XpAuError_success; -} - -XpAuErrorValue XpauStartJob( XpauContext *context, const char *printerfile ) -{ - void *handle; - XpAuErrorValue result = XpAuError_unspecified_error; - - XPAU_RETURN_IF_FAIL(context->inJob == False, XpAuError_inside_job); - - /* Set print context - * Note that this modifies the available fonts, including build-in printer prints. - * All XListFonts()/XLoadFont() stuff should be done _after_ setting the print - * context to obtain the proper fonts. - */ - XpSetContext(context->pdpy, context->pcontext); - - if( printerfile ) - { - context->print_to_filehandle = XpuStartJobToFile(context->pdpy, context->pcontext, printerfile); - if( context->print_to_filehandle ) - { - result = XpAuError_success; - } - else - { - result = XpAuError_errno; - } - } - else - { - XpuStartJobToSpooler(context->pdpy); - result = XpAuError_success; - } - - /* Get default printer resolution */ - if( XpuGetResolution(context->pdpy, context->pcontext, &context->document_dpi_x, &context->document_dpi_y) != 1 ) - { - result = XpAuError_no_dpi_set; - } - - if( result == XpAuError_success ) - { - context->inJob = True; - context->pscreen = XpGetScreenOfContext(context->pdpy, context->pcontext); - context->pscreennumber = XScreenNumberOfScreen(context->pscreen); - } - - return result; -} - -XpAuErrorValue XpauEndJob( XpauContext *context ) -{ - XPAU_RETURN_IF_FAIL(context->inJob, XpAuError_not_inside_job); - - /* End the print job - the final results are sent by the X print - * server to the spooler sub system. - */ - XpEndJob(context->pdpy); - - /* Be sure to process the X traffic (remember that we registered a - * "consumer" hook via Xlib internal magic when we print to a - * file) - * FixMe: |XpuWaitForPrintFileChild()| should call XFlush() instead! - */ - XFlush(context->pdpy); - - context->inJob = False; - context->pscreen = NULL; - context->pscreennumber = -1; - context->document_dpi_x = 0L; - context->document_dpi_y = 0L; - - if( context->print_to_filehandle ) - { - if( XpuWaitForPrintFileChild(context->print_to_filehandle) != XPGetDocFinished ) - { - return XpAuError_errno; - } - } - - return XpAuError_success; -} - -XpAuErrorValue XpauStartDocument( XpauContext *context, XPDocumentType type ) -{ - XPAU_RETURN_IF_FAIL(context->inJob == True, XpAuError_not_inside_job); - XPAU_RETURN_IF_FAIL(context->inDocument == False, XpAuError_inside_document); - XPAU_RETURN_IF_FAIL(context->inPage == False, XpAuError_inside_page); - - XpStartDoc(context->pdpy, type); - context->inDocument = True; - - return XpAuError_success; -} - -XpAuErrorValue XpauEndDocument( XpauContext *context ) -{ - XPAU_RETURN_IF_FAIL(context->inDocument, XpAuError_not_inside_document); - - XpEndDoc(context->pdpy); - context->inDocument = False; - - return XpAuError_success; -} - -XpAuErrorValue XpauStartPage( XpauContext *context, Window pwin ) -{ - XPAU_RETURN_IF_FAIL(context->inPage == False, XpAuError_inside_page); - XPAU_RETURN_IF_FAIL(context->inJob == True, XpAuError_not_inside_job); - - XpStartPage(context->pdpy, pwin); - - /* |XpStartPage()| will generate a "synthetic" |XpStartDoc()| - * if it was not called yet */ - if( context->inDocument == False ) - { - context->inDocument = True; - } - - context->inPage = True; - - return XpAuError_success; -} - -XpAuErrorValue XpauEndPage( XpauContext *context ) -{ - XPAU_RETURN_IF_FAIL(context->inPage, XpAuError_not_inside_page); - - XpEndPage(context->pdpy); - context->inPage = False; - - return XpAuError_success; -} - -void XpauWaitForPrintNotify(XpauContext *context, int type) -{ - XpuWaitForPrintNotify(context->pdpy, context->xp_event_base, type); -} - - -const char *XpAuErrorValueToString(XpAuErrorValue value) -{ - char *msg; - - switch(value) - { - case XpAuError_success: msg = "success" ; break; - case XpAuError_errno: msg = strerror(errno) ; break; - case XpAuError_error_no_memory: msg = "out of memory" ; break; - case XpAuError_unexpected_eos: msg = "unexpected end of string" ; break; - case XpAuError_unknown_argument: msg = "unknown argument" ; break; - case XpAuError_unsupported_medium: msg = "unsupported print medium" ; break; - case XpAuError_unsupported_resolution: msg = "unsupported print resolution" ; break; - case XpAuError_unsupported_orientation: msg = "unsupported orientation" ; break; - case XpAuError_unsupported_plex: msg = "unsupported plex" ; break; - case XpAuError_unsupported_copy_count: msg = "unsupported copy count" ; break; - case XpAuError_unsupported_job_name: msg = "unsupported job name" ; break; - case XpAuError_no_dpi_set: msg = "no DPI set (or no default DPI provided by server)" ; break; - case XpAuError_not_inside_job: msg = "state error: not inside job" ; break; - case XpAuError_not_inside_document: msg = "state error: not inside document" ; break; - case XpAuError_not_inside_page: msg = "stage error: not inside page" ; break; - case XpAuError_inside_job: msg = "state error: (already) inside job" ; break; - case XpAuError_inside_document: msg = "state error: (already) inside document" ; break; - case XpAuError_inside_page: msg = "stage error: (already) inside page" ; break; - case XpAuError_unspecified_error: msg = "unspecified error" ; break; - default: - msg = "unknown error" ; - break; - } - - return msg; -} - - - - diff --git a/nx-X11/lib/XprintAppUtil/xpapputil.h b/nx-X11/lib/XprintAppUtil/xpapputil.h deleted file mode 100644 index d7159bb14..000000000 --- a/nx-X11/lib/XprintAppUtil/xpapputil.h +++ /dev/null @@ -1,175 +0,0 @@ - -/* - * $Xorg:xpapputil.h,v 1.1 2002/06/10 02:54:18 gisburn Exp $ - * - * xpapputil - Application level utility library for Xprint - * - * -Copyright 2002-2004 Roland Mainz - -All Rights Reserved. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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: Roland Mainz - */ - -#ifndef XPAPPUTILS_H -#define XPAPPUTILS_H 1 - -#include -#include -#include -#include - -#ifdef DEBUG -#define XPAU_RETURN_IF_FAIL(expr, return_code) \ - if( !(expr) ) { \ - printf("XPAU_RETURN_IF_FAIL(file %s, line %d): " #expr ", returning " #return_code "\n", __FILE__, __LINE__); \ - return (return_code); \ - } - -#define XPAU_DEBUG(x) x - -#else - -#define XPAU_RETURN_IF_FAIL(expr, return_code) \ - if( !(expr) ) { \ - return (return_code); \ - } - -#define XPAU_DEBUG(x) -#endif /* DEBUG */ - -/* - * Struct for XpauGetContext(), XpauReleaseContext() - * - */ -typedef struct -{ - Display *pdpy; - XPContext pcontext; - int xp_event_base, - xp_error_base; - - Bool inJob; - Bool inDocument; - Bool inPage; - - void *print_to_filehandle; - Screen *pscreen; - int pscreennumber; - long document_dpi_x, - document_dpi_y; - - XpuSupportedFlags supported_job_attributes; - XpuSupportedFlags supported_doc_attributes; - XpuSupportedFlags supported_page_attributes; - - XpuMediumSourceSizeList medium_list; - int medium_num_list_entries; - XpuResolutionList resolution_list; - int resolution_num_list_entries; - XpuOrientationList orientation_list; - int orientation_num_list_entries; - XpuPlexList plex_list; - int plex_num_list_entries; -} XpauContext; - - -#define XpauVFilename (1L<<0) -#define XpauVMedium (1L<<1) -#define XpauVResolution (1L<<2) -#define XpauVOrientation (1L<<3) -#define XpauVPlex (1L<<4) -#define XpauVCopies (1L<<5) -#define XpauVTitle (1L<<6) -#define XpauVAll (XpauVFilename | \ - XpauVMedium | \ - XpauVResolution | \ - XpauVOrientation | \ - XpauVPlex | \ - XpauVCopies | \ - XpauVTitle) - -typedef unsigned long XpauFlags; - -typedef struct -{ - const char *title; - long copies; -} XpauJobValues; - -typedef struct -{ - XpuMediumSourceSizeRec *medium; - XpuResolutionRec *resolution; - XpuOrientationRec *orientation; - XpuPlexRec *plex; - long copies; -} XpauDocValues; - -typedef struct -{ - XpuMediumSourceSizeRec *medium; - XpuResolutionRec *resolution; - XpuOrientationRec *orientation; - XpuPlexRec *plex; -} XpauPageValues; - -typedef enum { - XpAuError_success = 0, - XpAuError_unspecified_error, - XpAuError_errno, /* check |errno| for error */ - XpAuError_error_no_memory, - XpAuError_unexpected_eos, - XpAuError_unknown_argument, - XpAuError_unsupported_medium, - XpAuError_unsupported_resolution, - XpAuError_unsupported_orientation, - XpAuError_unsupported_plex, - XpAuError_unsupported_copy_count, - XpAuError_unsupported_job_name, - XpAuError_no_dpi_set, - XpAuError_not_inside_job, - XpAuError_not_inside_document, - XpAuError_not_inside_page, - XpAuError_inside_job, - XpAuError_inside_document, - XpAuError_inside_page -} XpAuErrorValue; - -/* Prototypes */ -XpauContext * XpauGetContext( const char *printername ); -void XpauReleaseContext( XpauContext *context ); -XpAuErrorValue XpauParseArgs( XpauContext *context, - XpauFlags *jobvaluemask, XpauJobValues *jobvalues, - XpauFlags *docvaluemask, XpauDocValues *docvalues, - char **jobfilename, - const char *argument_string ); -XpAuErrorValue XpauSetJobValues( XpauContext *context, XpauFlags valuemask, XpauJobValues *Xpaujobvalues ); -XpAuErrorValue XpauSetDocValues( XpauContext *context, XpauFlags valuemask, XpauDocValues *Xpaudocvalues ); -XpAuErrorValue XpauSetPageValues( XpauContext *context, XpauFlags valuemask, XpauPageValues *Xpaupagevalues ); -XpAuErrorValue XpauStartJob( XpauContext *context, const char *printerfile ); -XpAuErrorValue XpauEndJob( XpauContext *context ); -XpAuErrorValue XpauStartDocument( XpauContext *context, XPDocumentType type ); -XpAuErrorValue XpauEndDocument( XpauContext *context ); -XpAuErrorValue XpauStartPage( XpauContext *context, Window pwin ); -XpAuErrorValue XpauEndPage( XpauContext *context ); -void XpauWaitForPrintNotify(XpauContext *context, int type); -const char *XpAuErrorValueToString(XpAuErrorValue value); -#endif /* !XPAPPUTILS_H */ - - diff --git a/nx-X11/lib/XprintUtil/Imakefile b/nx-X11/lib/XprintUtil/Imakefile deleted file mode 100644 index dfbeae63a..000000000 --- a/nx-X11/lib/XprintUtil/Imakefile +++ /dev/null @@ -1,21 +0,0 @@ -#define DoNormalLib YES -# XprintUtil is not a stable interface yet, therefore avoid shipping it -# as shared lib for now -#define DoSharedLib NO -#define DoDebugLib NO -#define DoProfileLib NO -#define HasSharedData NO -#define LibName XprintUtil -#define SoRev SOZLIBREV -#define IncSubdir X11 -#define IncSubSubdir XprintUtil - - -HEADERS = xprintutil.h - -SRCS = xprintutil.c xprintutil_printtofile.c -OBJS = xprintutil.o xprintutil_printtofile.o - -#include - -DependTarget() diff --git a/nx-X11/lib/XprintUtil/xprintutil.c b/nx-X11/lib/XprintUtil/xprintutil.c deleted file mode 100644 index 58fe1386b..000000000 --- a/nx-X11/lib/XprintUtil/xprintutil.c +++ /dev/null @@ -1,2111 +0,0 @@ -/****************************************************************************** - ****************************************************************************** - ** - ** (c) Copyright 2001-2004 Roland Mainz - ** - ** 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 "xprintutil.h" - -#include -#include -#include -#include -#include -#include -#include - -#ifdef XPU_USE_NSPR -#include "plstr.h" -#undef strtok_r -#define strtok_r(s1, s2, x) PL_strtok_r((s1), (s2), (x)) -#endif /* XPU_USE_NSPR */ - -/* List of tokens which can be used to separate entries in the - * $XPSERVERLIST env var */ -static const char XPServerListSeparators[] = " \t\v\n\r\f"; - -/* conformace only; X11 API does (currrently) not make use of |const|. - * If Xlib API gets fixed these macros can be turned into empty - * placeholders... (|#define MAKE_STRING_WRITABLE(x)|) :-) - */ -#define MAKE_STRING_WRITABLE(str) (((str)?((str) = strdup(str)):0)) -#define FREE_WRITABLE_STRING(str) free((void *)(str)) -#define STRING_AS_WRITABLE(str) ((char *)(str)) - -/* Local prototypes */ -static const char *XpuGetDefaultXpPrintername(void); -static const char *XpuGetXpServerList( void ); -static const char *XpuEnumerateXpAttributeValue( const char *value, void **vcptr ); -static const char *XpuGetCurrentAttributeGroup( void **vcptr ); -static void XpuDisposeEnumerateXpAttributeValue( void **vc ); -static Bool XpuEnumerateMediumSourceSizes( Display *pdpy, XPContext pcontext, - const char **tray_name, - const char **medium_name, int *mbool, - float *ma1, float *ma2, float *ma3, float *ma4, - void **vcptr ); -static void XpuDisposeEnumerateMediumSourceSizes( void **vc ); - -/* -** XprintUtil functions start with Xpu -** -*/ - -int XpuCheckExtension( Display *pdpy ) -{ - char *display = XDisplayString(pdpy); - short major = 0, - minor = 0; - - if( XpQueryVersion(pdpy, &major, &minor) != 0 ) - { - XPU_DEBUG_ONLY(printf("XpuCheckExtension: XpQueryVersion '%s' %d %d\n", XPU_NULLXSTR(display), (int)major, (int)minor)); - return(1); - } - else - { - XPU_DEBUG_ONLY(printf("XpuCheckExtension: XpQueryVersion '%s' returned 0(=Xprint not supported)\n", XPU_NULLXSTR(display))); - } - - return(0); -} - -/* Get the default printer name from the XPRINTER env var. - * If XPRINTER env var is not present looks for PDPRINTER, LPDEST, and - * PRINTER (in that order) - * See CDE's DtPrintSetupBox(3) manual page, too... - */ -static -const char *XpuGetDefaultXpPrintername(void) -{ - const char *s; - /* BUG/TODO: XpPrinter resource needs to be sourced, too... */ - s = getenv("XPRINTER"); - if( !s ) - { - s = getenv("PDPRINTER"); - if( !s ) - { - s = getenv("LPDEST"); - if( !s ) - { - s = getenv("PRINTER"); - } - } - } - return s; -} - -static -const char *XpuGetXpServerList( void ) -{ - const char *s; - /* BUG/TODO: XpServerList resource needs to be sourced first, then append - * contents of XPSERVERLIST, then remove duplicates... - */ - s = getenv("XPSERVERLIST"); - if( s == NULL ) - s = ""; - - return(s); -} - - -Bool XpuXprintServersAvailable( void ) -{ - const char *s; - int c = 0; - /* BUGs/ToDo: - * - XpServerList resource needs to be sourced, too... - * (see comment for |XpuGetXpServerList|, too) - * - There should be some validation whether the server entries - * are - * a) valid (easy :) - * and - * b) available (hard to implement when XOpenDisplay() should be avoided) - */ - s = getenv("XPSERVERLIST"); - /* Check if serverlist is non-empty */ - if (s) - { - while( *s++ ) - { - if( !isspace(*s) ) - c++; - } - } - /* a valid server name must at least contain the ':'-seperator - * and a number (e.g. ":1") */ - return( c >= 2 ); -} - - -static -int XpuGetPrinter2( char *printer, char *display, Display **pdpyptr, XPContext *pcontextptr ) -{ - Display *pdpy; - XPContext pcontext; - - XPU_DEBUG_ONLY(printf("XpuGetPrinter2: probing display '%s' for '%s'\n", XPU_NULLXSTR(display), XPU_NULLXSTR(printer))); - - if( (pdpy = XOpenDisplay(display)) != NULL ) - { - if( XpuCheckExtension(pdpy) ) - { - XPPrinterList list; - int list_count; - - /* get list of available printers... */ - list = XpGetPrinterList(pdpy, printer, &list_count); - if( list != NULL ) XpFreePrinterList(list); - - /* ...and check if printer exists... */ - if( (list != NULL) && (list_count > 0) ) - { - if( (pcontext = XpCreateContext(pdpy, printer)) != None ) - { - *pdpyptr = pdpy; - *pcontextptr = pcontext; - return(1); - } - - XPU_DEBUG_ONLY(printf("XpuGetPrinter2: could not create print context for '%s'\n", XPU_NULLXSTR(printer))); - } - } - else - { - XPU_DEBUG_ONLY(printf("display '%s' does not support the Xprint extension\n", XPU_NULLXSTR(display))); - } - - XCloseDisplay(pdpy); - return(0); - } - else - { - XPU_DEBUG_ONLY(printf("could not open display '%s'\n", XPU_NULLXSTR(display))); - return(0); - } -} - - -/* acceps "printer" or "printer@display" */ -int XpuGetPrinter( const char *arg_printername, Display **pdpyptr, XPContext *pcontextptr ) -{ - Display *pdpy; - XPContext pcontext; - char *printername; - char *s; - char *tok_lasts; - - *pdpyptr = NULL; - *pcontextptr = None; - - XPU_DEBUG_ONLY(printf("XpuGetPrinter: looking for '%s'\n", XPU_NULLXSTR(arg_printername))); - - /* strtok_r will modify string - duplicate it first... */ - printername = strdup(arg_printername); - if( printername == NULL ) - return(0); - - if( (s = strtok_r(printername, "@", &tok_lasts)) != NULL ) - { - char *name = s; - char *display = strtok_r(NULL, "@", &tok_lasts); - - /* if we have a display - open it and grab printer */ - if( display != NULL ) - { - if( XpuGetPrinter2(name, display, pdpyptr, pcontextptr) ) - { - free(printername); - return(1); - } - } - /* if we did not get a display, travel througth all displays */ - else - { - char *sl = strdup(XpuGetXpServerList()); - - if( sl != NULL ) - { - for( display = strtok_r(sl, XPServerListSeparators, &tok_lasts) ; - display != NULL ; - display = strtok_r(NULL, XPServerListSeparators, &tok_lasts) ) - { - if( XpuGetPrinter2(name, display, pdpyptr, pcontextptr) ) - { - free(sl); - free(printername); - return(1); - } - } - - free(sl); - } - } - } - - free(printername); - XPU_DEBUG_ONLY(printf("XpuGetPrinter: failure\n")); - - return(0); -} - - -void XpuClosePrinterDisplay(Display *pdpy, XPContext pcontext) -{ - if( pdpy ) - { - if( pcontext != None ) - XpDestroyContext(pdpy, pcontext); - - XCloseDisplay(pdpy); - } -} - -void XpuSetOneAttribute( Display *pdpy, XPContext pcontext, - XPAttributes type, const char *attribute_name, const char *value, XPAttrReplacement replacement_rule ) -{ - /* Alloc buffer for sprintf() stuff below */ - char *buffer = (char *)malloc(strlen(attribute_name)+strlen(value)+4); - - if( buffer != NULL ) - { - sprintf(buffer, "%s: %s", attribute_name, value); - XpSetAttributes(pdpy, pcontext, type, buffer, replacement_rule); - free(buffer); - } -} - -void XpuSetOneLongAttribute( Display *pdpy, XPContext pcontext, - XPAttributes type, const char *attribute_name, long value, XPAttrReplacement replacement_rule ) -{ - /* Alloc buffer for sprintf() stuff below */ - char *buffer = (char *)malloc(strlen(attribute_name)+32+4); - - if( buffer != NULL ) - { - sprintf(buffer, "%s: %ld", attribute_name, value); - XpSetAttributes(pdpy, pcontext, type, buffer, replacement_rule); - free(buffer); - } -} - -/* Check if attribute value is supported or not - * Use this function _only_ if XpuGetSupported{Job,Doc,Page}Attributes() - * does not help you... - */ -int XpuCheckSupported( Display *pdpy, XPContext pcontext, XPAttributes type, const char *attribute_name, const char *query ) -{ - char *value; - void *tok_lasts; - - MAKE_STRING_WRITABLE(attribute_name); - if( attribute_name == NULL ) - return(0); - - value = XpGetOneAttribute(pdpy, pcontext, type, STRING_AS_WRITABLE(attribute_name)); - - XPU_DEBUG_ONLY(printf("XpuCheckSupported: XpGetOneAttribute(%s) returned '%s'\n", XPU_NULLXSTR(attribute_name), XPU_NULLXSTR(value))); - - FREE_WRITABLE_STRING(attribute_name); - - if( value != NULL ) - { - const char *s; - - for( s = XpuEnumerateXpAttributeValue(value, &tok_lasts) ; s != NULL ; s = XpuEnumerateXpAttributeValue(NULL, &tok_lasts) ) - { - XPU_DEBUG_ONLY(printf("XpuCheckSupported: probing '%s'=='%s'\n", XPU_NULLXSTR(s), XPU_NULLXSTR(query))); - if( !strcmp(s, query) ) - { - XFree(value); - XpuDisposeEnumerateXpAttributeValue(&tok_lasts); - return(1); - } - } - - XpuDisposeEnumerateXpAttributeValue(&tok_lasts); - XFree(value); - } - - return(0); -} - - -int XpuSetJobTitle( Display *pdpy, XPContext pcontext, const char *title ) -{ - if( XpuGetSupportedJobAttributes(pdpy, pcontext) & XPUATTRIBUTESUPPORTED_JOB_NAME ) - { - char *encoded_title; - - encoded_title = XpuResourceEncode(title); - if (!encoded_title) - return(0); - XpuSetOneAttribute(pdpy, pcontext, XPJobAttr, "*job-name", encoded_title, XPAttrMerge); - XpuResourceFreeString(encoded_title); - return(1); - } - else - { - XPU_DEBUG_ONLY(printf("XpuSetJobTitle: XPUATTRIBUTESUPPORTED_JOB_NAME not supported ('%s')\n", XPU_NULLXSTR(title))); - return(0); - } -} - -int XpuGetOneLongAttribute( Display *pdpy, XPContext pcontext, XPAttributes type, const char *attribute_name, long *result ) -{ - char *s; - - MAKE_STRING_WRITABLE(attribute_name); - if( attribute_name == NULL ) - return(0); - s = XpGetOneAttribute(pdpy, pcontext, type, STRING_AS_WRITABLE(attribute_name)); - - if(s && *s) - { - long tmp; - - XPU_DEBUG_ONLY(printf("XpuGetOneLongAttribute: '%s' got '%s'\n", XPU_NULLXSTR(attribute_name), XPU_NULLXSTR(s))); - - tmp = strtol(s, (char **)NULL, 10); - - if( !(((tmp == 0L) || (tmp == LONG_MIN) || (tmp == LONG_MAX)) && - ((errno == ERANGE) || (errno == EINVAL))) ) - { - *result = tmp; - XFree(s); - XPU_DEBUG_ONLY(printf("XpuGetOneLongAttribute: result %ld\n", *result)); - FREE_WRITABLE_STRING(attribute_name); - return(1); - } - } - - if( s != NULL ) - XFree(s); - - FREE_WRITABLE_STRING(attribute_name); - - return(0); -} - - -#ifdef DEBUG -/* debug only */ -void dumpXpAttributes( Display *pdpy, XPContext pcontext ) -{ - char *s; - printf("------------------------------------------------\n"); - printf("--> Job\n%s\n", s=XpuGetJobAttributes(pdpy, pcontext)); XFree(s); - printf("--> Doc\n%s\n", s=XpuGetDocAttributes(pdpy, pcontext)); XFree(s); - printf("--> Page\n%s\n", s=XpuGetPageAttributes(pdpy, pcontext)); XFree(s); - printf("--> Printer\n%s\n", s=XpuGetPrinterAttributes(pdpy, pcontext)); XFree(s); - printf("--> Server\n%s\n", s=XpuGetServerAttributes(pdpy, pcontext)); XFree(s); - printf("image resolution %d\n", (int)XpGetImageResolution(pdpy, pcontext)); - printf("------------------------------------------------\n"); -} -#endif /* DEBUG */ - - -typedef struct XpuIsNotifyEventContext_ -{ - int event_base; - int detail; -} XpuIsNotifyEventContext; - -static -Bool IsXpNotifyEvent( Display *pdpy, XEvent *ev, XPointer arg ) -{ - Bool match; - XpuIsNotifyEventContext *context = (XpuIsNotifyEventContext *)arg; - XPPrintEvent *pev = (XPPrintEvent *)ev; - - match = pev->type == (context->event_base+XPPrintNotify) && - pev->detail == context->detail; - - XPU_DEBUG_ONLY(printf("XpuWaitForPrintNotify: %d=IsXpNotifyEvent(%d,%d)\n", - (int)match, - (int)pev->type, - (int)pev->detail)); - return match; -} - -void XpuWaitForPrintNotify( Display *pdpy, int xp_event_base, int detail ) -{ - XEvent dummy; - XpuIsNotifyEventContext matchcontext; - - matchcontext.event_base = xp_event_base; - matchcontext.detail = detail; - XIfEvent(pdpy, &dummy, IsXpNotifyEvent, (XPointer)&matchcontext); -} - -static -const char *skip_matching_brackets(const char *start) -{ - const char *s = start; - int level = 0; - - if( !start ) - return(NULL); - - do - { - switch(*s++) - { - case '\0': return(NULL); - case '{': level++; break; - case '}': level--; break; - } - } while(level > 0); - - return(s); -} - - -static -const char *search_next_space(const char *start) -{ - const char *s = start; - int level = 0; - - if( !start ) - return(NULL); - - for(;;) - { - if( isspace(*s) ) - return(s); - - if( *s=='\0' ) - return(NULL); - - s++; - } -} - -/* PRIVATE context data for XpuEnumerateXpAttributeValue() */ -typedef struct _XpuAttributeValueEnumeration -{ - char *value; - size_t original_value_len; /* original length of value */ - char *group; - char *start; - char *s; -} XpuAttributeValueEnumeration; - - -/* Hacked parser for Xp values and enumerations */ -static -const char *XpuEnumerateXpAttributeValue( const char *value, void **vcptr ) -{ - XpuAttributeValueEnumeration **cptr = (XpuAttributeValueEnumeration **)vcptr; - XpuAttributeValueEnumeration *context; - const char *tmp; - - if( !cptr ) - return(NULL); - - if( value ) - { - XpuAttributeValueEnumeration *e; - const char *s = value; - Bool isGroup = FALSE; - - e = (XpuAttributeValueEnumeration *)malloc(sizeof(XpuAttributeValueEnumeration)); - if( !e ) - return NULL; - - /* Skip leading '{'. */ - while(*s=='{' && isGroup==FALSE) - { - s++; - isGroup = TRUE; - } - /* Skip leading blanks. */ - while(isspace(*s)) - s++; - - e->group = NULL; - - /* Read group name. */ - if( isGroup ) - { - tmp = s; - while(!isspace(*s)) - s++; - if(strncmp(tmp, "''", s-tmp) != 0) - { - e->group = strdup(tmp); - e->group[s-tmp] = '\0'; - } - } - - e->original_value_len = strlen(s); - e->value = (char *)malloc(e->original_value_len+4); /* We may look up to three bytes beyond the string */ - strcpy(e->value, s); - memset(e->value+e->original_value_len+1, 0, 3); /* quad termination */ - e->start = e->s = e->value; - - *cptr = e; - } - - context = *cptr; - - if( !context || !context->s ) - return(NULL); - - /* Skip leading blanks, '\'' or '}' */ - while(isspace(*(context->s)) || *(context->s)=='\'' /*|| *(context->s)=='}'*/ ) - context->s++; - - if( *(context->s) == '\0' ) - return(NULL); - - context->start = context->s; - if( *(context->start) == '{' ) - context->s = (char *)skip_matching_brackets(context->start); - else - context->s = (char *)search_next_space(context->start); - - /* end of string reached ? */ - if( context->s ) - { - *(context->s) = '\0'; - context->s++; - } - - /* Check if we reached a new attribute group */ - tmp = context->start; - while(isspace(*tmp)) - tmp++; - if( *tmp=='}' ) - { - void *prev_cptr = *vcptr; - - tmp+=2; /* We have 3*'\0' at the end of the string - this is legal! */ - if( *tmp!='\0' ) - { - const char *ret; - - /* Start the parser again */ - *vcptr = NULL; - ret = XpuEnumerateXpAttributeValue(tmp, vcptr); - - /* Free old context */ - XpuDisposeEnumerateXpAttributeValue(&prev_cptr); - - return(ret); - } - else - { - return(NULL); - } - } - - return(context->start); -} - -/* Get enumeration group for last string returned by |XpuEnumerateXpAttributeValue|... */ -static -const char *XpuGetCurrentAttributeGroup( void **vcptr ) -{ - XpuAttributeValueEnumeration **cptr = (XpuAttributeValueEnumeration **)vcptr; - if( !cptr ) - return(NULL); - if( !*cptr ) - return(NULL); - - return((*cptr)->group); -} - - -static -void XpuDisposeEnumerateXpAttributeValue( void **vc ) -{ - if( vc ) - { - XpuAttributeValueEnumeration *context = *((XpuAttributeValueEnumeration **)vc); - free(context->value); - if(context->group) - free(context->group); - free(context); - } -} - -/* parse a paper size string - * (example: '{na-letter False {6.3500 209.5500 6.3500 273.0500}}') */ -static -Bool XpuParseMediumSourceSize( const char *value, - const char **medium_name, int *mbool, - float *ma1, float *ma2, float *ma3, float *ma4 ) -{ - const char *s; - char *d, - *name; - char *boolbuf; - size_t value_len; - int num_input_items; - const char *cur_locale; - - if( value && value[0]!='{' && value[0]!='\0' ) - return(False); - - value_len = strlen(value); - - /* alloc buffer for |medium_name| and |boolbuf| in one step - * (both must be large enougth to hold at least |strlen(value)+1| bytes) */ - name = (char *)malloc(value_len*2 + 4); - boolbuf = name + value_len+2; /* |boolbuf| starts directly after |name| */ - - /* remove '{' && '}' */ - s = value; - d = name; - do - { - *d = tolower(*s); - - if( *s!='{' && *s!='}' ) - d++; - - s++; - } - while(*s); - *d = '\0'; - - /* separate medium name from string */ - d = (char *)search_next_space(name); - if( !d ) - { - free(name); - return(False); - } - *d = '\0'; - *medium_name = name; - - /* ... continue to parse the remaining string... */ - d++; - - - /* Force C/POSIX radix for scanf()-parsing (see bug 131831 ("Printing - * does not work in de_AT@euro locale")), do the parsing and restore - * the original locale. - * XXX: This may affect all threads and not only the calling one... - */ - { -#define CUR_LOCALE_SIZE 256 - char cur_locale[CUR_LOCALE_SIZE+1]; - strncpy(cur_locale, setlocale(LC_NUMERIC, NULL), CUR_LOCALE_SIZE); - cur_locale[CUR_LOCALE_SIZE]='\0'; - setlocale(LC_NUMERIC, "C"); - num_input_items = sscanf(d, "%s %f %f %f %f", boolbuf, ma1, ma2, ma3, ma4); - setlocale(LC_NUMERIC, cur_locale); -#undef CUR_LOCALE_SIZE - } - - if( num_input_items != 5 ) - { - free(name); - return(False); - } - - if( !strcmp(boolbuf, "true") ) - *mbool = True; - else if( !strcmp(boolbuf, "false") ) - *mbool = False; - else - { - free(name); - return(False); - } - return(True); -} - - -/* parse a paper size string - * (example: '{na-letter False {6.3500 209.5500 6.3500 273.0500}}') */ -static -Bool XpuEnumerateMediumSourceSizes( Display *pdpy, XPContext pcontext, - const char **tray_name, - const char **medium_name, int *mbool, - float *ma1, float *ma2, float *ma3, float *ma4, - void **vcptr ) -{ - const char *medium_spec; - const char *value = NULL; - - if( pdpy && pcontext ) - { - value = XpGetOneAttribute(pdpy, pcontext, XPPrinterAttr, "medium-source-sizes-supported"); - if( !value ) - return(False); - } - - while(1) - { - medium_spec = XpuEnumerateXpAttributeValue(value, vcptr); - - if( value ) - { - XFree((void *)value); - value = NULL; - } - - /* enumeration done? */ - if( !medium_spec ) - return(False); - - if (XpuParseMediumSourceSize(medium_spec, - medium_name, mbool, - ma1, ma2, ma3, ma4)) - { - *tray_name = XpuGetCurrentAttributeGroup(vcptr); - return(True); - } - else - { - /* Should never ever happen! */ - fprintf(stderr, "XpuEnumerateMediumSourceSize: error parsing '%s'\n", medium_spec); - } - } - /* not reached */ -} - -static -void XpuDisposeEnumerateMediumSourceSizes( void **vc ) -{ - XpuDisposeEnumerateXpAttributeValue(vc); -} - - -/* future: Migrate this functionality into |XpGetPrinterList| - just do - * not pass a |Display *| to |XpGetPrinterList| - */ -XPPrinterList XpuGetPrinterList( const char *printer, int *res_list_count ) -{ - XPPrinterRec *rec = NULL; - int rec_count = 1; /* Allocate one more |XPPrinterRec| structure - * as terminator */ - char *sl; - const char *default_printer_name = XpuGetDefaultXpPrintername(); - int default_printer_rec_index = -1; - - if( !res_list_count ) - return(NULL); - - sl = strdup(XpuGetXpServerList()); - MAKE_STRING_WRITABLE(printer); - - if( sl != NULL ) - { - char *display; - char *tok_lasts; - - for( display = strtok_r(sl, XPServerListSeparators, &tok_lasts) ; - display != NULL ; - display = strtok_r(NULL, XPServerListSeparators, &tok_lasts) ) - { - Display *pdpy; - - if( (pdpy = XOpenDisplay(display)) != NULL ) - { - XPPrinterList list; - int list_count; - size_t display_len = strlen(display); - - /* get list of available printers... */ - list = XpGetPrinterList(pdpy, STRING_AS_WRITABLE(printer), &list_count); - - if( list && list_count ) - { - int i; - - for( i = 0 ; i < list_count ; i++ ) - { - char *s; - - /* Workaround for http://bugzilla.mozilla.org/show_bug.cgi?id=193499 - * ("Xprint print/print preview crashes Mozilla") where the Solaris - * Xprt may create invalid entries (e.g. |XpGetPrinterList| will - * return |list[i].name==NULL| due to empty lines in the printer list. - */ - if( !list[i].name ) - continue; - - rec_count++; - rec = (XPPrinterRec *)realloc(rec, sizeof(XPPrinterRec)*rec_count); - if( !rec ) /* failure */ - break; - - s = (char *)malloc(strlen(list[i].name)+display_len+4); - sprintf(s, "%s@%s", list[i].name, display); - rec[rec_count-2].name = s; - rec[rec_count-2].desc = (list[i].desc)?(strdup(list[i].desc)):(NULL); - - /* Test for default printer (if the user set one).*/ - if( default_printer_name ) - { - /* Default_printer_name may either contain the FQPN(=full - * qualified printer name ("foo@myhost:5") or just the name - * ("foo")) */ - if( (!strcmp(list[i].name, default_printer_name)) || - (!strcmp(s, default_printer_name)) ) - { - /* Remember index of default printer that we can swap it to - * the head of the array below... */ - default_printer_rec_index = rec_count-2; - } - } - } - - XpFreePrinterList(list); - } - - XCloseDisplay(pdpy); - } - } - - free(sl); - } - - if( rec ) - { - /* users: DO NOT COUNT ON THIS DETAIL - * (this is only to make current impl. of XpuFreePrinterList() easier) - * I may remove this implementation detail in a later revision of - * the library! - */ - rec[rec_count-1].name = NULL; - rec[rec_count-1].desc = NULL; - rec_count--; - } - else - { - rec_count = 0; - } - - /* The default printer is always the first one in the printer list... */ - if( (default_printer_rec_index != -1) && rec ) - { - XPPrinterRec tmp; - tmp = rec[0]; - rec[0] = rec[default_printer_rec_index]; - rec[default_printer_rec_index] = tmp; - } - - *res_list_count = rec_count; - FREE_WRITABLE_STRING(printer); - return(rec); -} - - -void XpuFreePrinterList( XPPrinterList list ) -{ - if( list ) - { - XPPrinterRec *curr = list; - - /* See the warning abouve about using this implementation detail for - * checking for the list's end... */ - while( curr->name != NULL ) - { - free(curr->name); - if(curr->desc) - free(curr->desc); - curr++; - } - - free(list); - } -} - -/* Set number of copies to print from this document */ -int XpuSetDocumentCopies( Display *pdpy, XPContext pcontext, long num_copies ) -{ - if( XpuGetSupportedDocAttributes(pdpy, pcontext) & XPUATTRIBUTESUPPORTED_COPY_COUNT) - { - XpuSetOneLongAttribute(pdpy, pcontext, XPDocAttr, "*copy-count", num_copies, XPAttrMerge); - return(1); - } - else - { - XPU_DEBUG_ONLY(printf("XpuSetContentOrientation: XPUATTRIBUTESUPPORTED_COPY_COUNT not supported\n")); - - /* Failure... */ - return(0); - } -} - -XpuMediumSourceSizeList XpuGetMediumSourceSizeList( Display *pdpy, XPContext pcontext, int *numEntriesPtr ) -{ - XpuMediumSourceSizeList list = NULL; - int rec_count = 1; /* allocate one more |XpuMediumSourceSizeRec| structure - * as terminator */ - Bool status; - float ma1, - ma2, - ma3, - ma4; - char *value; - void *tok_lasts; - const char *tray_name, - *medium_name; - int mbool; - const char *default_tray, - *default_medium; - int default_medium_rec_index = -1; - - default_tray = XpGetOneAttribute(pdpy, pcontext, XPDocAttr, "default-input-tray"); - if(!default_tray) - { - fprintf(stderr, "XpuGetMediumSourceSizeList: Internal error, no 'default-input-tray' found.\n"); - return(NULL); - } - default_medium = XpGetOneAttribute(pdpy, pcontext, XPDocAttr, "default-medium"); - if(!default_medium) - { - fprintf(stderr, "XpuGetMediumSourceSizeList: Internal error, no 'default-medium' found.\n"); - XFree((void *)default_tray); - return(NULL); - } - - for( status = XpuEnumerateMediumSourceSizes(pdpy, pcontext, &tray_name, &medium_name, &mbool, - &ma1, &ma2, &ma3, &ma4, &tok_lasts) ; - status != False ; - status = XpuEnumerateMediumSourceSizes(NULL, None, &tray_name, &medium_name, &mbool, - &ma1, &ma2, &ma3, &ma4, &tok_lasts) ) - { - rec_count++; - list = (XpuMediumSourceSizeRec *)realloc(list, sizeof(XpuMediumSourceSizeRec)*rec_count); - if( !list ) - return(NULL); - - list[rec_count-2].tray_name = (tray_name)?(strdup(tray_name)):(NULL); - list[rec_count-2].medium_name = strdup(medium_name); - list[rec_count-2].mbool = mbool; - list[rec_count-2].ma1 = ma1; - list[rec_count-2].ma2 = ma2; - list[rec_count-2].ma3 = ma3; - list[rec_count-2].ma4 = ma4; - - /* Default medium ? */ - if( (!strcmp(medium_name, default_medium)) && - ((tray_name && (*default_tray))?(!strcmp(tray_name, default_tray)):(True)) ) - { - default_medium_rec_index = rec_count-2; - } - } - - XpuDisposeEnumerateMediumSourceSizes(&tok_lasts); - - if( list ) - { - /* users: DO NOT COUNT ON THIS DETAIL - * (this is only to make current impl. of XpuFreeMediumSourceSizeList() easier) - * I may remove this implementation detail in a later revision of - * the library! */ - list[rec_count-1].tray_name = NULL; - list[rec_count-1].medium_name = NULL; - rec_count--; - } - else - { - rec_count = 0; - } - - /* Make the default medium always the first item in the list... */ - if( (default_medium_rec_index != -1) && list ) - { - XpuMediumSourceSizeRec tmp; - tmp = list[0]; - list[0] = list[default_medium_rec_index]; - list[default_medium_rec_index] = tmp; - } - - *numEntriesPtr = rec_count; - return(list); -} - -void XpuFreeMediumSourceSizeList( XpuMediumSourceSizeList list ) -{ - if( list ) - { - XpuMediumSourceSizeRec *curr = list; - - /* See the warning abouve about using this implementation detail for - * checking for the list's end... */ - while( curr->medium_name != NULL ) - { - if( curr->tray_name) - free((void *)curr->tray_name); - free((void *)curr->medium_name); - curr++; - } - - free(list); - } -} - -static -int XpuSetMediumSourceSize( Display *pdpy, XPContext pcontext, XPAttributes type, XpuMediumSourceSizeRec *medium_spec ) -{ - /* Set the "default-medium" and "*default-input-tray" - * (if |XpuEnumerateMediumSourceSizes| returned one) XPDocAttr's - * attribute and return */ - if (medium_spec->tray_name) - { - XpuSetOneAttribute(pdpy, pcontext, type, "*default-input-tray", medium_spec->tray_name, XPAttrMerge); - } - XpuSetOneAttribute(pdpy, pcontext, type, "*default-medium", medium_spec->medium_name, XPAttrMerge); - - return( 1 ); -} - -/* Set document medium size */ -int XpuSetDocMediumSourceSize( Display *pdpy, XPContext pcontext, XpuMediumSourceSizeRec *medium_spec ) -{ - XpuSupportedFlags doc_supported_flags; - - doc_supported_flags = XpuGetSupportedDocAttributes(pdpy, pcontext); - - if( (doc_supported_flags & XPUATTRIBUTESUPPORTED_DEFAULT_MEDIUM) == 0 ) - return( 0 ); - - if (medium_spec->tray_name) - { - if( (doc_supported_flags & XPUATTRIBUTESUPPORTED_DEFAULT_INPUT_TRAY) == 0 ) - return( 0 ); - } - - return XpuSetMediumSourceSize(pdpy, pcontext, XPDocAttr, medium_spec); -} - -/* Set page medium size */ -int XpuSetPageMediumSourceSize( Display *pdpy, XPContext pcontext, XpuMediumSourceSizeRec *medium_spec ) -{ - XpuSupportedFlags page_supported_flags; - - page_supported_flags = XpuGetSupportedPageAttributes(pdpy, pcontext); - - if( (page_supported_flags & XPUATTRIBUTESUPPORTED_DEFAULT_MEDIUM) == 0 ) - return( 0 ); - - if (medium_spec->tray_name) - { - if( (page_supported_flags & XPUATTRIBUTESUPPORTED_DEFAULT_INPUT_TRAY) == 0 ) - return( 0 ); - } - - return XpuSetMediumSourceSize(pdpy, pcontext, XPPageAttr, medium_spec); -} - -#ifndef ABS -#define ABS(x) ((x)<0?-(x):(x)) -#endif /* ABS */ -#define MORE_OR_LESS_EQUAL(a, b, tolerance) (ABS((a) - (b)) <= (tolerance)) - -XpuMediumSourceSizeRec * -XpuFindMediumSourceSizeBySize( XpuMediumSourceSizeList mlist, int mlist_count, - float page_width_mm, float page_height_mm, float tolerance ) -{ - int i; - for( i = 0 ; i < mlist_count ; i++ ) - { - XpuMediumSourceSizeRec *curr = &mlist[i]; - float total_width = curr->ma1 + curr->ma2, - total_height = curr->ma3 + curr->ma4; - - /* Match width/height*/ - if( ((page_width_mm !=-1.f)?(MORE_OR_LESS_EQUAL(total_width, page_width_mm, tolerance)):(True)) && - ((page_height_mm!=-1.f)?(MORE_OR_LESS_EQUAL(total_height, page_height_mm, tolerance)):(True)) ) - { - return(curr); - } - } - - return(NULL); -} - -XpuMediumSourceSizeRec * -XpuFindMediumSourceSizeByBounds( XpuMediumSourceSizeList mlist, int mlist_count, - float m1, float m2, float m3, float m4, float tolerance ) -{ - int i; - for( i = 0 ; i < mlist_count ; i++ ) - { - XpuMediumSourceSizeRec *curr = &mlist[i]; - - /* Match bounds */ - if( ((m1!=-1.f)?(MORE_OR_LESS_EQUAL(curr->ma1, m1, tolerance)):(True)) && - ((m2!=-1.f)?(MORE_OR_LESS_EQUAL(curr->ma2, m2, tolerance)):(True)) && - ((m3!=-1.f)?(MORE_OR_LESS_EQUAL(curr->ma3, m3, tolerance)):(True)) && - ((m4!=-1.f)?(MORE_OR_LESS_EQUAL(curr->ma4, m4, tolerance)):(True)) ) - { - return(curr); - } - } - - return(NULL); -} - -XpuMediumSourceSizeRec * -XpuFindMediumSourceSizeByName( XpuMediumSourceSizeList mlist, int mlist_count, - const char *tray_name, const char *medium_name ) -{ - int i; - for( i = 0 ; i < mlist_count ; i++ ) - { - XpuMediumSourceSizeRec *curr = &mlist[i]; - - /* Match by tray name and/or medium name */ - if( ((tray_name && curr->tray_name)?(!strcasecmp(curr->tray_name, tray_name)):(tray_name==NULL)) && - ((medium_name)?(!strcasecmp(curr->medium_name, medium_name)):(True)) ) - { - return(curr); - } - } - - return(NULL); -} - -XpuResolutionList XpuGetResolutionList( Display *pdpy, XPContext pcontext, int *numEntriesPtr ) -{ - XpuResolutionList list = NULL; - int rec_count = 1; /* Allocate one more |XpuResolutionRec| structure - * as terminator */ - char *value; - char *tok_lasts; - const char *s; - long default_resolution = -1; - int default_resolution_rec_index = -1; - char namebuf[64]; - - /* Get default document resolution */ - if( XpuGetOneLongAttribute(pdpy, pcontext, XPDocAttr, "default-printer-resolution", &default_resolution) != 1 ) - { - default_resolution = -1; - } - - value = XpGetOneAttribute(pdpy, pcontext, XPPrinterAttr, "printer-resolutions-supported"); - if (!value) - { - fprintf(stderr, "XpuGetResolutionList: Internal error, no 'printer-resolutions-supported' XPPrinterAttr found.\n"); - return(NULL); - } - - for( s = strtok_r(value, " ", &tok_lasts) ; - s != NULL ; - s = strtok_r(NULL, " ", &tok_lasts) ) - { - long tmp; - - tmp = strtol(s, (char **)NULL, 10); - - if( ((tmp == 0L) || (tmp == LONG_MIN) || (tmp == LONG_MAX)) && - ((errno == ERANGE) || (errno == EINVAL)) ) - { - fprintf(stderr, "XpuGetResolutionList: Internal parser errror for '%s'.\n", s); - continue; - } - - rec_count++; - list = (XpuResolutionRec *)realloc(list, sizeof(XpuResolutionRec)*rec_count); - if( !list ) - return(NULL); - - sprintf(namebuf, "%lddpi", tmp); - list[rec_count-2].name = strdup(namebuf); - list[rec_count-2].x_dpi = tmp; - list[rec_count-2].y_dpi = tmp; - - if( default_resolution != -1 ) - { - /* Is this the default resolution ? */ - if( (list[rec_count-2].x_dpi == default_resolution) && - (list[rec_count-2].y_dpi == default_resolution) ) - { - default_resolution_rec_index = rec_count-2; - } - } - } - - XFree(value); - - if( list ) - { - /* users: DO NOT COUNT ON THIS DETAIL - * (this is only to make current impl. of XpuGetResolutionList() easier) - * We may remove this implementation detail in a later revision of - * the library! */ - list[rec_count-1].name = NULL; - list[rec_count-1].x_dpi = -1; - list[rec_count-1].y_dpi = -1; - rec_count--; - } - else - { - rec_count = 0; - } - - /* Make the default resolution always the first item in the list... */ - if( (default_resolution_rec_index != -1) && list ) - { - XpuResolutionRec tmp; - tmp = list[0]; - list[0] = list[default_resolution_rec_index]; - list[default_resolution_rec_index] = tmp; - } - - *numEntriesPtr = rec_count; - return(list); -} - -void XpuFreeResolutionList( XpuResolutionList list ) -{ - if( list ) - { - XpuResolutionRec *curr = list; - - /* See the warning abouve about using this implementation detail for - * checking for the list's end... */ - while( curr->name != NULL ) - { - free((void *)curr->name); - curr++; - } - - free(list); - } -} - -/* Find resolution in resolution list. - */ -XpuResolutionRec *XpuFindResolutionByName( XpuResolutionList list, int list_count, const char *name) -{ - int i; - - for( i = 0 ; i < list_count ; i++ ) - { - XpuResolutionRec *curr = &list[i]; - if (!strcasecmp(curr->name, name)) - return curr; - - /* Search by plain DPI value (no "dpi" suffix )*/ - if (curr->x_dpi == curr->x_dpi) - { - char buf[32]; - sprintf(buf, "%ld", curr->x_dpi); - if (!strcasecmp(buf, name)) - return curr; - } - } - - return NULL; -} - -/* Get default page (if defined) or document resolution - * this function may fail in the following conditions: - * - No default resolution set yet - * - X DPI != Y DPI (not yet implemented in Xprt) - */ -Bool XpuGetResolution( Display *pdpy, XPContext pcontext, long *x_dpi_ptr, long *y_dpi_ptr ) -{ - long dpi; - - /* Try to get the current page's resolution (pages may differ in resolution if the DDX supports this) */ - if( XpuGetOneLongAttribute(pdpy, pcontext, XPPageAttr, "default-printer-resolution", &dpi) == 1 ) - { - *x_dpi_ptr = dpi; - *y_dpi_ptr = dpi; - return True; - } - - /* Get document resolution */ - if( XpuGetOneLongAttribute(pdpy, pcontext, XPDocAttr, "default-printer-resolution", &dpi) == 1 ) - { - *x_dpi_ptr = dpi; - *y_dpi_ptr = dpi; - return True; - } - - return False; -} - -static -int XpuSetResolution( Display *pdpy, XPContext pcontext, XPAttributes type, XpuResolutionRec *rec ) -{ - if( rec->x_dpi != rec->y_dpi ) - { - fprintf(stderr, "XpuSetResolution: internal error: x_dpi != y_dpi not supported yet.\n"); - return 0; - } - - XpuSetOneLongAttribute(pdpy, pcontext, type, "*default-printer-resolution", rec->x_dpi, XPAttrMerge); - return( 1 ); -} - -/* Set document resolution - * Retun error if printer does not support setting a resolution - */ -int XpuSetDocResolution( Display *pdpy, XPContext pcontext, XpuResolutionRec *rec ) -{ - if( (XpuGetSupportedDocAttributes(pdpy, pcontext) & XPUATTRIBUTESUPPORTED_DEFAULT_PRINTER_RESOLUTION) == 0 ) - return( 0 ); - - return XpuSetResolution(pdpy, pcontext, XPDocAttr, rec); -} - -/* Set page medium size - * Retun error if printer does not support setting a resolution or if per-page - * resolution changes are not allowed. - */ -int XpuSetPageResolution( Display *pdpy, XPContext pcontext, XpuResolutionRec *rec ) -{ - if( (XpuGetSupportedPageAttributes(pdpy, pcontext) & XPUATTRIBUTESUPPORTED_DEFAULT_PRINTER_RESOLUTION) == 0 ) - return( 0 ); - - return XpuSetResolution(pdpy, pcontext, XPPageAttr, rec); -} - -XpuOrientationList XpuGetOrientationList( Display *pdpy, XPContext pcontext, int *numEntriesPtr ) -{ - XpuOrientationList list = NULL; - int rec_count = 1; /* Allocate one more |XpuOrientationRec| - * structure as terminator */ - char *value; - char *tok_lasts; - const char *s; - const char *default_orientation = NULL; - int default_orientation_rec_index = -1; - - /* Get default document orientation */ - default_orientation = XpGetOneAttribute(pdpy, pcontext, XPDocAttr, "content-orientation"); - if( !default_orientation ) - { - fprintf(stderr, "XpuGetOrientationList: Internal error, no 'content-orientation' XPDocAttr found.\n"); - return(NULL); - } - - value = XpGetOneAttribute(pdpy, pcontext, XPPrinterAttr, "content-orientations-supported"); - if (!value) - { - fprintf(stderr, "XpuGetOrientationList: Internal error, no 'content-orientations-supported' XPPrinterAttr found.\n"); - return(NULL); - } - - for( s = strtok_r(value, " ", &tok_lasts) ; - s != NULL ; - s = strtok_r(NULL, " ", &tok_lasts) ) - { - rec_count++; - list = (XpuOrientationRec *)realloc(list, sizeof(XpuOrientationRec)*rec_count); - if( !list ) - return(NULL); - - list[rec_count-2].orientation = strdup(s); - - /* Default resolution ? */ - if( !strcmp(list[rec_count-2].orientation, default_orientation) ) - { - default_orientation_rec_index = rec_count-2; - } - } - - XFree(value); - XFree((void *)default_orientation); - - if( list ) - { - /* users: DO NOT COUNT ON THIS DETAIL - * (this is only to make current impl. of XpuFreeOrientationList() easier) - * I may remove this implementation detail in a later revision of - * the library! */ - list[rec_count-1].orientation = NULL; - rec_count--; - } - else - { - rec_count = 0; - } - - /* Make the default orientation always the first item in the list... */ - if( (default_orientation_rec_index != -1) && list ) - { - XpuOrientationRec tmp; - tmp = list[0]; - list[0] = list[default_orientation_rec_index]; - list[default_orientation_rec_index] = tmp; - } - - *numEntriesPtr = rec_count; - return(list); -} - -void XpuFreeOrientationList( XpuOrientationList list ) -{ - if( list ) - { - XpuOrientationRec *curr = list; - - /* See the warning abouve about using this implementation detail for - * checking for the list's end... */ - while( curr->orientation != NULL ) - { - free((void *)curr->orientation); - curr++; - } - free(list); - } -} - -XpuOrientationRec * -XpuFindOrientationByName( XpuOrientationList list, int list_count, const char *orientation ) -{ - int i; - - for( i = 0 ; i < list_count ; i++ ) - { - XpuOrientationRec *curr = &list[i]; - if (!strcasecmp(curr->orientation, orientation)) - return curr; - } - - return(NULL); -} - -static -int XpuSetOrientation( Display *pdpy, XPContext pcontext, XPAttributes type, XpuOrientationRec *rec ) -{ - XpuSetOneAttribute(pdpy, pcontext, type, "*content-orientation", rec->orientation, XPAttrMerge); - return(1); -} - -/* Set document orientation - * Retun error if printer does not support setting an orientation - */ -int XpuSetDocOrientation( Display *pdpy, XPContext pcontext, XpuOrientationRec *rec ) -{ - if( (XpuGetSupportedDocAttributes(pdpy, pcontext) & XPUATTRIBUTESUPPORTED_CONTENT_ORIENTATION) == 0 ) - return( 0 ); - - return XpuSetOrientation(pdpy, pcontext, XPDocAttr, rec); -} - -/* Set page orientation - * Retun error if printer does not support setting an orientation or if - * per-page orientations changes are not allowed - */ -int XpuSetPageOrientation( Display *pdpy, XPContext pcontext, XpuOrientationRec *rec ) -{ - if( (XpuGetSupportedPageAttributes(pdpy, pcontext) & XPUATTRIBUTESUPPORTED_CONTENT_ORIENTATION) == 0 ) - return( 0 ); - - return XpuSetOrientation(pdpy, pcontext, XPPageAttr, rec); -} - -XpuPlexList XpuGetPlexList( Display *pdpy, XPContext pcontext, int *numEntriesPtr ) -{ - XpuPlexList list = NULL; - int rec_count = 1; /* Allocate one more |XpuPlexList| structure - * as terminator */ - char *value; - char *tok_lasts; - const char *s; - const char *default_plex = NULL; - int default_plex_rec_index = -1; - - /* Get default document plex */ - default_plex = XpGetOneAttribute(pdpy, pcontext, XPDocAttr, "plex"); - if( !default_plex ) - { - fprintf(stderr, "XpuGetPlexList: Internal error, no 'plex' XPDocAttr found.\n"); - return(NULL); - } - - value = XpGetOneAttribute(pdpy, pcontext, XPPrinterAttr, "plexes-supported"); - if (!value) - { - fprintf(stderr, "XpuGetPlexList: Internal error, no 'plexes-supported' XPPrinterAttr found.\n"); - return(NULL); - } - - for( s = strtok_r(value, " ", &tok_lasts) ; - s != NULL ; - s = strtok_r(NULL, " ", &tok_lasts) ) - { - rec_count++; - list = (XpuPlexRec *)realloc(list, sizeof(XpuPlexRec)*rec_count); - if( !list ) - return(NULL); - - list[rec_count-2].plex = strdup(s); - - /* Default plex ? */ - if( !strcmp(list[rec_count-2].plex, default_plex) ) - { - default_plex_rec_index = rec_count-2; - } - } - - XFree(value); - XFree((void *)default_plex); - - if( list ) - { - /* users: DO NOT COUNT ON THIS DETAIL - * (this is only to make current impl. of XpuFreePlexList() easier) - * I may remove this implementation detail in a later revision of - * the library! */ - list[rec_count-1].plex = NULL; - rec_count--; - } - else - { - rec_count = 0; - } - - /* Make the default plex always the first item in the list... */ - if( (default_plex_rec_index != -1) && list ) - { - XpuPlexRec tmp; - tmp = list[0]; - list[0] = list[default_plex_rec_index]; - list[default_plex_rec_index] = tmp; - } - - *numEntriesPtr = rec_count; - return(list); -} - -void XpuFreePlexList( XpuPlexList list ) -{ - if( list ) - { - XpuPlexRec *curr = list; - - /* See the warning abouve about using this implementation detail for - * checking for the list's end... */ - while( curr->plex != NULL ) - { - free((void *)curr->plex); - curr++; - } - free(list); - } -} - -XpuPlexRec * -XpuFindPlexByName( XpuPlexList list, int list_count, const char *plex ) -{ - int i; - - for( i = 0 ; i < list_count ; i++ ) - { - XpuPlexRec *curr = &list[i]; - if (!strcasecmp(curr->plex, plex)) - return curr; - } - - return(NULL); -} - -static -int XpuSetContentPlex( Display *pdpy, XPContext pcontext, XPAttributes type, XpuPlexRec *rec ) -{ - XpuSetOneAttribute(pdpy, pcontext, type, "*plex", rec->plex, XPAttrMerge); - return(1); -} - -/* Set document plex - * Retun error if printer does not support setting an plex - */ -int XpuSetDocPlex( Display *pdpy, XPContext pcontext, XpuPlexRec *rec ) -{ - if( (XpuGetSupportedDocAttributes(pdpy, pcontext) & XPUATTRIBUTESUPPORTED_PLEX) == 0 ) - return( 0 ); - - return XpuSetContentPlex(pdpy, pcontext, XPDocAttr, rec); -} - -/* Set page plex - * Retun error if printer does not support setting an plex or if - * per-page plex changes are not allowed - */ -int XpuSetPagePlex( Display *pdpy, XPContext pcontext, XpuPlexRec *rec ) -{ - if( (XpuGetSupportedPageAttributes(pdpy, pcontext) & XPUATTRIBUTESUPPORTED_PLEX) == 0 ) - return( 0 ); - - return XpuSetContentPlex(pdpy, pcontext, XPPageAttr, rec); -} - - -XpuColorspaceList XpuGetColorspaceList( Display *pdpy, XPContext pcontext, int *numEntriesPtr ) -{ - XpuColorspaceList list = NULL; - int rec_count = 1; /* Allocate one more |XpuColorspaceRec| structure - * as terminator */ - char namebuf[256]; /* Temporary name buffer for colorspace names */ - int i; /* Loop counter */ - int nvi; /* Number of visuals */ - Screen *pscreen; /* Print screen */ - XVisualInfo viproto; /* fill in for getting info */ - XVisualInfo *vip; /* retured info */ - - pscreen = XpGetScreenOfContext(pdpy, pcontext); - - nvi = 0; - viproto.screen = XScreenNumberOfScreen(pscreen); - vip = XGetVisualInfo(pdpy, VisualScreenMask, &viproto, &nvi); - if (!vip) - { - fprintf(stderr, "XpuGetColorspaceList: Internal error: vip == NULL\n"); - return NULL; - } - - for( i = 0 ; i < nvi ; i++ ) - { - XVisualInfo *vcurr = vip+i; - char cbuff[64]; - const char *class = NULL; - -#ifdef USE_MOZILLA_TYPES - /* Workaround for the current limitation of the gfx/src/xlibrgb code - * which cannot handle depths > 24bit yet */ - if( vcurr->depth > 24 ) - continue; -#endif /* USE_MOZILLA_TYPES */ - - rec_count++; - list = (XpuColorspaceRec *)realloc(list, sizeof(XpuColorspaceRec)*rec_count); - if( !list ) - return NULL; - - /* ToDO: This needs to be updated for the COLORSPACE X11 extension - * once it is ready and approved by the XOrg arch board. */ - switch (vcurr->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; - default: /* Needed for forward compatibility to the COLORSPACE extension */ - sprintf (cbuff, "unknown_class_%x", vcurr->class); - class = cbuff; - break; - } - - if (vcurr->bits_per_rgb == 8) - { - sprintf(namebuf, "%s/%dbit", class, vcurr->depth); - } - else - { - sprintf(namebuf, "%s/%dbit/%dbpg", class, vcurr->depth, vcurr->bits_per_rgb); - } - list[rec_count-2].name = strdup(namebuf); - list[rec_count-2].visualinfo = *vcurr; - } - - XFree((char *)vip); - - if( list ) - { - /* users: DO NOT COUNT ON THIS DETAIL - * (this is only to make current impl. of XpuGetResolutionList() easier) - * We may remove this implementation detail in a later revision of - * the library! */ - list[rec_count-1].name = NULL; - rec_count--; - } - else - { - rec_count = 0; - } - - *numEntriesPtr = rec_count; - return(list); -} - -void XpuFreeColorspaceList( XpuColorspaceList list ) -{ - if( list ) - { - XpuColorspaceRec *curr = list; - - /* See the warning abouve about using this implementation detail for - * checking for the list's end... */ - while( curr->name != NULL ) - { - free((void *)curr->name); - curr++; - } - - free(list); - } -} - -XpuColorspaceRec * -XpuFindColorspaceByName( XpuColorspaceList list, int list_count, const char *name ) -{ - int i; - - for( i = 0 ; i < list_count ; i++ ) - { - XpuColorspaceRec *curr = &list[i]; - if (!strcmp(curr->name, name)) - return curr; - } - - return(NULL); -} - -Bool XpuGetEnableFontDownload( Display *pdpy, XPContext pcontext ) -{ - Bool enableFontDownload; - char *value; - - value = XpGetOneAttribute(pdpy, pcontext, XPPrinterAttr, "xp-listfonts-modes-supported"); - if( !value ) - { - fprintf(stderr, "XpuGetEnableFontDownload: xp-listfonts-modes-supported printer attribute not found.\n"); - return False; - } - - enableFontDownload = (strstr(value, "xp-list-glyph-fonts") != NULL); - XFree(value); - return enableFontDownload; -} - -int XpuSetEnableFontDownload( Display *pdpy, XPContext pcontext, Bool enableFontDownload ) -{ - char *value, - *newvalue; - - value = XpGetOneAttribute(pdpy, pcontext, XPPrinterAttr, "xp-listfonts-modes-supported"); - if( !value ) - { - fprintf(stderr, "XpuSetEnableFontDownload: xp-listfonts-modes-supported printer attribute not found.\n"); - return 0; /* failure */ - } - - /* Set "xp-list-glyph-fonts" */ - if( enableFontDownload ) - { - /* Return success if "xp-list-glyph-fonts" is already set */ - if( strstr(value, "xp-list-glyph-fonts") != NULL ) - { - XFree(value); - return 1; /* success */ - } - - newvalue = malloc(strlen(value) + 33); - if( !newvalue ) - { - XFree(value); - return 0; /* failure */ - } - - sprintf(newvalue, "%s xp-list-glyph-fonts", value); - XpuSetOneAttribute(pdpy, pcontext, XPDocAttr, "*xp-listfonts-modes", newvalue, XPAttrMerge); - - free(newvalue); - XFree(value); - return 1; /* success */ - } - else - { - char *s, /* copy string "source" */ - *d; /* copy string "destination" */ - - /* Return success if "xp-list-glyph-fonts" not set */ - d = strstr(value, "xp-list-glyph-fonts"); - if( d == NULL ) - { - XFree(value); - return 1; /* success */ - } - - /* strip "xp-list-glyph-fonts" from |value| */ - s = d+19/*strlen("xp-list-glyph-fonts")*/; - while( (*d++ = *s++) != '\0' ) - ; - - XpuSetOneAttribute(pdpy, pcontext, XPDocAttr, "*xp-listfonts-modes", value, XPAttrMerge); - - XFree(value); - return 1; /* success */ - } -} - -/* Return flags to indicate which attributes are supported and which not... */ -static -XpuSupportedFlags XpuGetSupportedAttributes( Display *pdpy, XPContext pcontext, XPAttributes type, const char *attribute_name ) -{ - char *value; - void *tok_lasts; - XpuSupportedFlags flags = 0; - - MAKE_STRING_WRITABLE(attribute_name); - if( attribute_name == NULL ) - return(0); - - value = XpGetOneAttribute(pdpy, pcontext, type, STRING_AS_WRITABLE(attribute_name)); - - FREE_WRITABLE_STRING(attribute_name); - - if( value != NULL ) - { - const char *s; - - for( s = XpuEnumerateXpAttributeValue(value, &tok_lasts) ; s != NULL ; s = XpuEnumerateXpAttributeValue(NULL, &tok_lasts) ) - { - if( !strcmp(s, "job-name") ) flags |= XPUATTRIBUTESUPPORTED_JOB_NAME; - else if( !strcmp(s, "job-owner") ) flags |= XPUATTRIBUTESUPPORTED_JOB_OWNER; - else if( !strcmp(s, "notification-profile") ) flags |= XPUATTRIBUTESUPPORTED_NOTIFICATION_PROFILE; - else if( !strcmp(s, "copy-count") ) flags |= XPUATTRIBUTESUPPORTED_COPY_COUNT; - else if( !strcmp(s, "document-format") ) flags |= XPUATTRIBUTESUPPORTED_DOCUMENT_FORMAT; - else if( !strcmp(s, "content-orientation") ) flags |= XPUATTRIBUTESUPPORTED_CONTENT_ORIENTATION; - else if( !strcmp(s, "default-printer-resolution") ) flags |= XPUATTRIBUTESUPPORTED_DEFAULT_PRINTER_RESOLUTION; - else if( !strcmp(s, "default-input-tray") ) flags |= XPUATTRIBUTESUPPORTED_DEFAULT_INPUT_TRAY; - else if( !strcmp(s, "default-medium") ) flags |= XPUATTRIBUTESUPPORTED_DEFAULT_MEDIUM; - else if( !strcmp(s, "plex") ) flags |= XPUATTRIBUTESUPPORTED_PLEX; - else if( !strcmp(s, "xp-listfonts-modes") ) flags |= XPUATTRIBUTESUPPORTED_LISTFONTS_MODES; - } - - XpuDisposeEnumerateXpAttributeValue(&tok_lasts); - XFree(value); - } - - return(flags); -} - -XpuSupportedFlags XpuGetSupportedJobAttributes(Display *pdpy, XPContext pcontext) -{ - return XpuGetSupportedAttributes(pdpy, pcontext, XPPrinterAttr, "job-attributes-supported"); -} - -XpuSupportedFlags XpuGetSupportedDocAttributes(Display *pdpy, XPContext pcontext) -{ - return XpuGetSupportedAttributes(pdpy, pcontext, XPPrinterAttr, "document-attributes-supported"); -} - -XpuSupportedFlags XpuGetSupportedPageAttributes(Display *pdpy, XPContext pcontext) -{ - return XpuGetSupportedAttributes(pdpy, pcontext, XPPrinterAttr, "xp-page-attributes-supported"); -} - -/* Encode string for usage in a Xrm resource database as - * defined in X(7): [...] To allow a Value to begin - * with whitespace, the two-character sequence ``\space'' - * (backslash followed by space) is recognized and replaced by - * a space character, and the two-character sequence ``\tab'' - * (backslash followed by horizontal tab) is recognized and - * replaced by a horizontal tab character. To allow a Value to - * contain embedded newline characters, the two-character - * sequence ``\n'' is recognized and replaced by a newline - * character. To allow a Value to be broken across multiple - * lines in a text file, the two-character sequence ``\new- - * line'' (backslash followed by newline) is recognized and - * removed from the value. To allow a Value to contain arbi- - * trary character codes, the four-character sequence ``\nnn'', - * where each n is a digit character in the range of - * ``0''-``7'', is recognized and replaced with a single byte - * that contains the octal value specified by the sequence. - * Finally, the two-character sequence ``\\'' is recognized and - * replaced with a single backslash. - */ -char *XpuResourceEncode( const char *s ) -{ - size_t slen; - char *res; - char *d; - int i, - c; - - slen = strlen(s); - res = malloc(slen*4+1); - if (!res) - return NULL; - - d = res; - i = slen; - while (i--) { - c = *s++; - if (c == '\n') { - if (i) { - *d++ = '\\'; - *d++ = 'n'; - *d++ = '\\'; - *d++ = '\n'; - } - else { - *d++ = '\\'; - *d++ = 'n'; - } - } else if (c == '\\') { - *d++ = '\\'; - *d++ = '\\'; - } - else if ((c < ' ' && c != '\t') || - ((unsigned char)c >= 0x7F && (unsigned char)c < 0xA0)) { - sprintf(d, "\\%03o", (unsigned char)c); - d += 4; - } - else { - *d++ = c; - } - } - - *d = '\0'; - - return res; -} - -#ifdef XXXJULIEN_NOTNOW -char *XpuResourceDecode( const char *str ) -{ -} -#endif /* XXXJULIEN_NOTNOW */ - -void XpuResourceFreeString( char *s ) -{ - free(s); -} - -const char *XpuXmbToCompoundText(Display *dpy, const char *xmbtext) -{ - XTextProperty xtp; - int xcr; - char *xtl[2]; - char *ct; - - if (strlen(xmbtext) == 0) - return strdup(xmbtext); - - memset(&xtp, 0, sizeof(xtp)); - xtl[0] = (char *)xmbtext; - xtl[1] = NULL; - - xcr = XmbTextListToTextProperty(dpy, xtl, 1, XCompoundTextStyle, &xtp); - - if (xcr == XNoMemory || xcr == XLocaleNotSupported) - { - fprintf(stderr, "XpuXmbToCompoundText: XmbTextListToTextProperty failure.\n"); - return strdup(xmbtext); - } - - /* Did conversion succeed (some unconvertible characters - * are not a problem) ? */ - if ( !((xcr == Success) || (xcr > 0)) || - (xtp.value == NULL)) - { - fprintf(stderr, "XpuXmbToCompoundText: XmbTextListToTextProperty failure 2.\n"); - return strdup(xmbtext); - } - - ct = malloc(xtp.nitems+1); - if (!ct) - { - XFree(xtp.value); - return NULL; - } - memcpy(ct, xtp.value, xtp.nitems); - ct[xtp.nitems] = '\0'; - - XFree(xtp.value); - - return ct; -} - -void XpuFreeCompundTextString( const char *s ) -{ - free((void *)s); -} - -const char *XpuCompoundTextToXmb(Display *dpy, const char *ct) -{ - XTextProperty xtp; - int xcr; - char **xtl = NULL; - int xtl_count = 0; - char *xmb; - int xmb_len = 0; - int i; - - if (strlen(ct) == 0) - return strdup(ct); - - xtp.value = (unsigned char *)ct; - xtp.nitems = strlen(ct); - xtp.encoding = XInternAtom(dpy, "COMPOUND_TEXT", False); - xtp.format = 8; - - xcr = XmbTextPropertyToTextList(dpy, &xtp, &xtl, &xtl_count); - - if (xcr == XNoMemory || xcr == XLocaleNotSupported) - { - fprintf(stderr, "XpuCompoundTextToXmb: XmbTextPropertyToTextList failure 1.\n"); - return strdup(ct); - } - - /* Did conversion succeed (some unconvertible characters - * are not a problem) ? */ - if ( !((xcr == Success) || (xcr > 0)) || - (xtl == NULL)) - { - fprintf(stderr, "XpuCompoundTextToXmb: XmbTextPropertyToTextList failure 2.\n"); - return strdup(ct); - } - - for (i = 0; i < xtl_count; i++) - { - xmb_len += strlen(xtl[i]); - } - xmb = malloc (xmb_len + 1); - if (!xmb) - { - XFreeStringList(xtl); - return NULL; - } - xmb[0] = '\0'; /* Catch zero-length case */ - for (i = 0; i < xtl_count; i++) - { - strcat(xmb, xtl[i]); - } - - XFreeStringList(xtl); - - return xmb; -} - -void XpuFreeXmbString( const char *s ) -{ - free((void *)s); -} - -/* EOF. */ diff --git a/nx-X11/lib/XprintUtil/xprintutil.h b/nx-X11/lib/XprintUtil/xprintutil.h deleted file mode 100644 index e4cc7c640..000000000 --- a/nx-X11/lib/XprintUtil/xprintutil.h +++ /dev/null @@ -1,250 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -#ifndef XPRINTUTIL_H -#define XPRINTUTIL_H 1 -/****************************************************************************** - ****************************************************************************** - ** - ** (c) Copyright 2001-2004 Roland Mainz - ** - ** 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. - ** - ****************************************************************************** - *****************************************************************************/ - -/* Force ANSI C prototypes from X11 headers */ -#ifndef FUNCPROTO -#define FUNCPROTO 15 -#endif /* !FUNCPROTO */ - -#include -#include -#include - -/* I don't know how to make this "better" yet... ;-( */ -#ifdef USE_MOZILLA_TYPES -#include -#include -#include -#define XPU_USE_NSPR 1 -/* - * Disabled for now - Threaded codepath does not work properly always. - * See bug 134570 ("Print-to-file not working with threaded XprintUtil") - * #define XPU_USE_THREADS 1 - */ -#endif /* USE_MOZILLA_TYPES */ - -#ifdef DEBUG -/* trace function calls */ -#define XPU_TRACE(EX) (puts(#EX),EX) -/* trace function calls in child */ -#define XPU_TRACE_CHILD(EX) (puts("child: " #EX),EX) -/* execute function EX only in debug mode */ -#define XPU_DEBUG_ONLY(EX) (EX) -#else -#define XPU_TRACE(EX) (EX) -#define XPU_TRACE_CHILD(EX) (EX) -#define XPU_DEBUG_ONLY(EX) -#endif /* DEBUG */ - -/* debug/logging: replace NULLptrs with "" string */ -#define XPU_NULLXSTR(s) (((s)!=NULL)?(s):("")) - -/* - * Struct for XpuGetMediumSourceSizeList(), XpuFreeMediumSourceSizeList(), - * XpuSetDocMediumSourceSize(), XpuSetPageMediumSourceSize(), - * XpuFindMediumSourceSizeBy*() - */ -typedef struct { - const char *tray_name; - const char *medium_name; - int mbool; - float ma1; - float ma2; - float ma3; - float ma4; -} XpuMediumSourceSizeRec, *XpuMediumSourceSizeList; - -/* - * Struct for XpuGetResolutionList(), XpuFreeResolutionList(), - * XpuGetResolution(), XpuSetPageResolution(), XpuSetDocResolution(), - * XpuFindResolutionByName() - */ -typedef struct { - const char *name; - long x_dpi; - long y_dpi; -} XpuResolutionRec, *XpuResolutionList; - -/* - * Struct for XpuGetOrientationList(), XpuFreeOrientationList(), - * XpuFindOrientationBy*(), XpuSetPageResolution(), - * XpuSetDocOrientation() - */ -typedef struct { - const char *orientation; -} XpuOrientationRec, *XpuOrientationList; - -/* - * Struct for XpuGetPlexList(), XpuFreePlexList(), XpuFindPlexBy*(), - * XpuSetDocPlex(), XpuSetPagePlex() - */ -typedef struct { - const char *plex; -} XpuPlexRec, *XpuPlexList; - -/* - * Struct for XpuGetColorspaceList(), XpuFreeColorspaceList() - */ -typedef struct -{ - const char *name; - XVisualInfo visualinfo; -} XpuColorspaceRec, *XpuColorspaceList; - -/* XPUATTRIBUTESUPPORTED_*: - * Flags which indicate whether it is allowed to set/change a specific attribute - */ -typedef long XpuSupportedFlags; -/* Job attributes */ -#define XPUATTRIBUTESUPPORTED_JOB_NAME (1L<<0) -#define XPUATTRIBUTESUPPORTED_JOB_OWNER (1L<<1) -#define XPUATTRIBUTESUPPORTED_NOTIFICATION_PROFILE (1L<<2) -/* Document/Page attributes */ -#define XPUATTRIBUTESUPPORTED_COPY_COUNT (1L<<3) -#define XPUATTRIBUTESUPPORTED_DOCUMENT_FORMAT (1L<<4) -#define XPUATTRIBUTESUPPORTED_CONTENT_ORIENTATION (1L<<5) -#define XPUATTRIBUTESUPPORTED_DEFAULT_PRINTER_RESOLUTION (1L<<6) -#define XPUATTRIBUTESUPPORTED_DEFAULT_INPUT_TRAY (1L<<7) -#define XPUATTRIBUTESUPPORTED_DEFAULT_MEDIUM (1L<<8) -#define XPUATTRIBUTESUPPORTED_PLEX (1L<<9) -#define XPUATTRIBUTESUPPORTED_LISTFONTS_MODES (1L<<10) - -/* prototypes */ -_XFUNCPROTOBEGIN - -int XpuCheckExtension( Display *pdpy ); - -/* Create/destroy connection to printer */ -Bool XpuXprintServersAvailable( void ); -int XpuGetPrinter( const char *printername, Display **pdpyptr, XPContext *pcontextptr ); -void XpuClosePrinterDisplay(Display *pdpy, XPContext pcontext); - -/* Misc. functions */ -void XpuSetOneAttribute( Display *pdpy, XPContext pcontext, - XPAttributes type, const char *attribute_name, const char *value, XPAttrReplacement replacement_rule ); -void XpuSetOneLongAttribute( Display *pdpy, XPContext pcontext, - XPAttributes type, const char *attribute_name, long value, XPAttrReplacement replacement_rule ); -int XpuCheckSupported( Display *pdpy, XPContext pcontext, XPAttributes type, const char *attribute_name, const char *query ); -int XpuSetJobTitle( Display *pdpy, XPContext pcontext, const char *title ); -int XpuGetOneLongAttribute( Display *pdpy, XPContext pcontext, XPAttributes type, const char *attribute_name, long *result ); -#ifdef DEBUG -void dumpXpAttributes( Display *pdpy, XPContext pcontext ); -#endif /* DEBUG */ -void XpuWaitForPrintNotify( Display *pdpy, int xp_event_base, int detail ); - -/* Get list of printers */ -XPPrinterList XpuGetPrinterList( const char *printer, int *res_list_count ); -void XpuFreePrinterList( XPPrinterList list ); - -/* Set number of document copies */ -int XpuSetDocumentCopies( Display *pdpy, XPContext pcontext, long num_copies ); - -/* Get/Set/Query supported mediums (paper sizes) */ -XpuMediumSourceSizeList XpuGetMediumSourceSizeList( Display *pdpy, XPContext pcontext, int *numEntriesPtr ); -void XpuFreeMediumSourceSizeList( XpuMediumSourceSizeList list ); -int XpuSetDocMediumSourceSize( Display *pdpy, XPContext pcontext, XpuMediumSourceSizeRec *medium_spec ); -int XpuSetPageMediumSourceSize( Display *pdpy, XPContext pcontext, XpuMediumSourceSizeRec *medium_spec ); -XpuMediumSourceSizeRec * -XpuFindMediumSourceSizeBySize( XpuMediumSourceSizeList mlist, int mlist_count, - float page_width_mm, float page_height_mm, float tolerance ); -XpuMediumSourceSizeRec * -XpuFindMediumSourceSizeByBounds( XpuMediumSourceSizeList mlist, int mlist_count, - float m1, float m2, float m3, float m4, float tolerance ); -XpuMediumSourceSizeRec * -XpuFindMediumSourceSizeByName( XpuMediumSourceSizeList mlist, int mlist_count, - const char *tray_name, const char *medium_name ); - -/* Get/Set resolution */ -XpuResolutionList XpuGetResolutionList( Display *pdpy, XPContext pcontext, int *numEntriesPtr ); -void XpuFreeResolutionList( XpuResolutionList list ); -Bool XpuGetResolution( Display *pdpy, XPContext pcontext, long *x_dpi, long *y_dpi ); -Bool XpuSetPageResolution( Display *pdpy, XPContext pcontext, XpuResolutionRec * ); -Bool XpuSetDocResolution( Display *pdpy, XPContext pcontext, XpuResolutionRec * ); -XpuResolutionRec *XpuFindResolutionByName( XpuResolutionList list, int list_count, const char *resolution_name); - -/* Get/Set orientation */ -XpuOrientationList XpuGetOrientationList( Display *pdpy, XPContext pcontext, int *numEntriesPtr ); -void XpuFreeOrientationList( XpuOrientationList list ); -XpuOrientationRec * -XpuFindOrientationByName( XpuOrientationList list, int list_count, const char *orientation ); -int XpuSetDocOrientation( Display *pdpy, XPContext pcontext, XpuOrientationRec *rec ); -int XpuSetPageOrientation( Display *pdpy, XPContext pcontext, XpuOrientationRec *rec ); - -/* Get/set plex modes */ -XpuPlexList XpuGetPlexList( Display *pdpy, XPContext pcontext, int *numEntriesPtr ); -void XpuFreePlexList( XpuPlexList list ); -XpuPlexRec *XpuFindPlexByName( XpuPlexList list, int list_count, const char *plex ); -int XpuSetDocPlex( Display *pdpy, XPContext pcontext, XpuPlexRec *rec ); -int XpuSetPagePlex( Display *pdpy, XPContext pcontext, XpuPlexRec *rec ); - -/* Set/get usage of fonts */ -Bool XpuGetEnableFontDownload( Display *pdpy, XPContext pcontext ); -int XpuSetEnableFontDownload( Display *pdpy, XPContext pcontext, Bool enableFontDownload ); - -/* Get per-printer colorspace information */ -XpuColorspaceList XpuGetColorspaceList( Display *pdpy, XPContext pcontext, int *numEntriesPtr ); -void XpuFreeColorspaceList( XpuColorspaceList list ); -XpuColorspaceRec *XpuFindColorspaceByName( XpuColorspaceList list, int list_count, const char *colorspace ); - -/* Start job to printer (spooler) or file */ -void XpuStartJobToSpooler(Display *pdpy); -void *XpuStartJobToFile( Display *pdpy, XPContext pcontext, const char *filename ); -XPGetDocStatus XpuWaitForPrintFileChild( void *handle ); - -/* Get flags which indicate whether it is allowed to set/change a specific attribute */ -XpuSupportedFlags XpuGetSupportedJobAttributes(Display *pdpy, XPContext pcontext); -XpuSupportedFlags XpuGetSupportedDocAttributes(Display *pdpy, XPContext pcontext); -XpuSupportedFlags XpuGetSupportedPageAttributes(Display *pdpy, XPContext pcontext); - -/* Encode/decode resource strings */ -char *XpuResourceEncode( const char *str ); -char *XpuResourceDecode( const char *str ); -void XpuResourceFreeString( char *s ); - -/* COMPOUND_TEXT <----> local encoding string converters */ -const char *XpuXmbToCompoundText(Display *dpy, const char *xmbtext); -void XpuFreeCompundTextString( const char *s ); -const char *XpuCompoundTextToXmb(Display *dpy, const char *ct); -void XpuFreeXmbString( const char *s ); - - -_XFUNCPROTOEND - -#define XpuGetJobAttributes( pdpy, pcontext ) XpGetAttributes( (pdpy), (pcontext), XPJobAttr ) -#define XpuGetDocAttributes( pdpy, pcontext ) XpGetAttributes( (pdpy), (pcontext), XPDocAttr ) -#define XpuGetPageAttributes( pdpy, pcontext ) XpGetAttributes( (pdpy), (pcontext), XPPageAttr ) -#define XpuGetPrinterAttributes( pdpy, pcontext ) XpGetAttributes( (pdpy), (pcontext), XPPrinterAttr ) -#define XpuGetServerAttributes( pdpy, pcontext ) XpGetAttributes( (pdpy), (pcontext), XPServerAttr ) - -#endif /* !XPRINTUTIL_H */ -/* EOF. */ diff --git a/nx-X11/lib/XprintUtil/xprintutil_printtofile.c b/nx-X11/lib/XprintUtil/xprintutil_printtofile.c deleted file mode 100644 index 331e7ad5b..000000000 --- a/nx-X11/lib/XprintUtil/xprintutil_printtofile.c +++ /dev/null @@ -1,498 +0,0 @@ -/****************************************************************************** - ****************************************************************************** - ** - ** (c) Copyright 2001-2004 Roland Mainz - ** - ** 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 "xprintutil.h" - -#include -#include -#include -#include -#include -#ifdef XPU_USE_THREADS -#include -#ifdef XPU_USE_NSPR -#include -#else -#include -#endif /* XPU_USE_NSPR */ -#endif /* XPU_USE_THREADS */ -#include -#include -#include -#include - -/* local prototypes */ -#ifdef DEBUG -static void PrintXPGetDocStatus( XPGetDocStatus status ); -#endif -static Bool XNextEventTimeout( Display *display, XEvent *event_return, struct timeval *timeout ); -static void *XpuPrintToFile( Display *pdpy, XPContext pcontext, const char *filename ); -static void MyPrintToFileProc( Display *pdpy, XPContext pcontext, unsigned char *data, unsigned int data_len, XPointer client_data ); -static void MyFinishProc( Display *pdpy, XPContext pcontext, XPGetDocStatus status, XPointer client_data ); -#ifdef XPU_USE_NSPR -static void PrintToFile_Consumer( void *handle ); -#else -static void *PrintToFile_Consumer( void *handle ); -#endif - -void XpuStartJobToSpooler(Display *pdpy) -{ - XpStartJob(pdpy, XPSpool); -} - -void *XpuStartJobToFile( Display *pdpy, XPContext pcontext, const char *filename ) -{ - void *handle; - - XpStartJob(pdpy, XPGetData); - handle = XpuPrintToFile(pdpy, pcontext, filename); - - if (!handle) - { - /* Cancel the print job and discard all events... */ - XpCancelJob(pdpy, True); - } - - return(handle); -} - -#ifdef DEBUG -/* DEBUG: Print XPGetDocStatus */ -static -void PrintXPGetDocStatus( XPGetDocStatus status ) -{ - switch(status) - { - case XPGetDocFinished: puts("PrintXPGetDocStatus: XPGetDocFinished"); break; - case XPGetDocSecondConsumer: puts("PrintXPGetDocStatus: XPGetDocSecondConsumer"); break; - case XPGetDocError: puts("PrintXPGetDocStatus: XPGetDocError"); break; - default: puts("PrintXPGetDocStatus: parent_pdpy = pdpy; - mpfd->displayname = XDisplayString(pdpy); - mpfd->pdpy = NULL; - mpfd->pcontext = pcontext; - mpfd->file_name = filename; - mpfd->file = NULL; - mpfd->status = XPGetDocError; - - /* make sure we can open the file for writing */ - if( (mpfd->file = fopen(mpfd->file_name, "w")) == NULL ) - { - /* fopen() error */ - free(mpfd); - return(NULL); - } - - /* its important to flush before we start the consumer thread, - * to make sure that the XpStartJob gets through first in the parent - */ - XFlush(pdpy); -#ifdef XPU_USE_NSPR - if( (mpfd->prthread = PR_CreateThread(PR_SYSTEM_THREAD, PrintToFile_Consumer, mpfd, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0)) == NULL ) -#else - if( pthread_create(&(mpfd->tid), NULL, PrintToFile_Consumer, mpfd) != 0 ) -#endif - { - /* pthread_create() error */ - fclose(mpfd->file); - free(mpfd); - return(NULL); - } - - /* we're still in the parent */ - XPU_DEBUG_ONLY(printf("### parent started consumer thread.\n" )); - return(mpfd); -} - - -XPGetDocStatus XpuWaitForPrintFileChild( void *handle ) -{ - MyPrintFileData *mpfd = (MyPrintFileData *)handle; - void *res; - XPGetDocStatus status; - - /* Flush data a last time to make sure we send all data to Xprt and that - * the Xlib internal hooks have called a last time */ - XFlush(mpfd->parent_pdpy); - -#ifdef XPU_USE_NSPR - if( PR_JoinThread(mpfd->prthread) != PR_SUCCESS ) - perror("XpuWaitForPrintFileChild: PR_JoinThread() failure"); /* fixme(later): use NSPR error handling calls... */ -#else - if( XPU_TRACE(pthread_join(mpfd->tid, &res)) != 0 ) - perror("XpuWaitForPrintFileChild: pthread_join() failure"); -#endif - - status = mpfd->status; - free(handle); - - XPU_DEBUG_ONLY(PrintXPGetDocStatus(status)); - return(status); -} - -#else /* XPU_USE_THREADS */ -/** - ** XpuPrintToFile() - fork() version - ** Create consumer thread which creates it's own display connection to print server - ** (a 2nd display connection/process is required to avoid deadlocks within Xlib), - ** registers (Xlib-internal) consumer callback (via XpGetDocumentData(3Xp)) and - ** processes/eats all incoming events via MyPrintToFileProc(). A final call to - ** MyPrintToFileProc() cleans-up all stuff and sets the "done" flag. - ** Note that these callbacks are called directly by Xlib while waiting for events in - ** XNextEvent() because XpGetDocumentData() registeres them as "internal" callbacks, - ** e.g. XNextEvent() does _not_ return before/after processing these events !! - ** - ** Usage: - ** XpStartJob(pdpy, XPGetData); - ** handle = XpuPrintToFile(pdpy, pcontext, "myfile"); - ** // render something - ** XpEndJob(); // or XpCancelJob() - ** status = XpuWaitForPrintFileChild(handle); - ** - */ -typedef struct -{ - pid_t pid; - int pipe[2]; /* child-->parent communication pipe */ - const char *displayname; - Display *pdpy; - Display *parent_pdpy; - XPContext pcontext; - const char *file_name; - FILE *file; - XPGetDocStatus status; - Bool done; -} MyPrintFileData; - - -static -void *XpuPrintToFile( Display *pdpy, XPContext pcontext, const char *filename ) -{ - MyPrintFileData *mpfd; - - if( (mpfd = (MyPrintFileData *)malloc(sizeof(MyPrintFileData))) == NULL ) - return(NULL); - - /* create pipe */ - if( pipe(mpfd->pipe) == -1 ) - { - /* this should never happen, but... */ - perror("XpuPrintToFile: cannot create pipe"); - free(mpfd); - return(NULL); - } - - mpfd->parent_pdpy = pdpy; - mpfd->displayname = XDisplayString(pdpy); - mpfd->pcontext = pcontext; - mpfd->file_name = filename; - mpfd->file = NULL; - mpfd->status = XPGetDocError; - - /* make sure we can open the file for writing */ - if( (mpfd->file = fopen(mpfd->file_name, "w")) == NULL ) - { - /* fopen() error */ - close(mpfd->pipe[1]); - close(mpfd->pipe[0]); - free(mpfd); - return(NULL); - } - - /* its important to flush before we fork, to make sure that the - * XpStartJob gets through first in the parent - */ - XFlush(pdpy); - - mpfd->pid = fork(); - - if( mpfd->pid == 0 ) - { - /* we're now in the fork()'ed child */ - PrintToFile_Consumer(mpfd); - } - else if( mpfd->pid < 0 ) - { - /* fork() error */ - close(mpfd->pipe[1]); - close(mpfd->pipe[0]); - fclose(mpfd->file); - free(mpfd); - return(NULL); - } - - /* we're still in the parent */ - XPU_DEBUG_ONLY(printf("### parent fork()'ed consumer child.\n")); - - /* child will write into file - we don't need it anymore here... :-) */ - fclose(mpfd->file); - close(mpfd->pipe[1]); - return(mpfd); -} - - -XPGetDocStatus XpuWaitForPrintFileChild( void *handle ) -{ - MyPrintFileData *mpfd = (MyPrintFileData *)handle; - int res; - XPGetDocStatus status = XPGetDocError; /* used when read() from pipe fails */ - - /* Flush data a last time to make sure we send all data to Xprt and that - * the Xlib internal hooks have called a last time */ - XFlush(mpfd->parent_pdpy); - - if( XPU_TRACE(waitpid(mpfd->pid, &res, 0)) == -1 ) - perror("XpuWaitForPrintFileChild: waitpid failure"); - - /* read the status from the child */ - if( read(mpfd->pipe[0], &status, sizeof(XPGetDocStatus)) != sizeof(XPGetDocStatus) ) - { - perror("XpuWaitForPrintFileChild: can't read XPGetDocStatus"); - } - close(mpfd->pipe[0]); - - free(handle); - - XPU_DEBUG_ONLY(PrintXPGetDocStatus(status)); - return(status); -} -#endif /* XPU_USE_THREADS */ - - -static -void MyPrintToFileProc( Display *pdpy, - XPContext pcontext, - unsigned char *data, - unsigned int data_len, - XPointer client_data ) -{ - MyPrintFileData *mpfd = (MyPrintFileData *)client_data; - - /* write to the file */ - XPU_TRACE_CHILD((void)fwrite(data, data_len, 1, mpfd->file)); /* what about error handling ? */ -} - - -static -void MyFinishProc( Display *pdpy, - XPContext pcontext, - XPGetDocStatus status, - XPointer client_data ) -{ - MyPrintFileData *mpfd = (MyPrintFileData *)client_data; - - /* remove the file if unsuccessful */ - if( status != XPGetDocFinished ) - { - XPU_DEBUG_ONLY(printf("MyFinishProc: error %d\n", (int)status)); - XPU_TRACE_CHILD(remove(mpfd->file_name)); - } - - XPU_TRACE_CHILD((void)fclose(mpfd->file)); /* what about error handling ? */ - - mpfd->status = status; - mpfd->done = True; -} - - -static -#ifdef XPU_USE_NSPR -void PrintToFile_Consumer( void *handle ) -#else -void *PrintToFile_Consumer( void *handle ) -#endif -{ - MyPrintFileData *mpfd = (MyPrintFileData *)handle; - XEvent dummy; - struct timeval timeout; - - timeout.tv_sec = 0; - timeout.tv_usec = 100000; /* 1/10 s */ - - XPU_DEBUG_ONLY(printf("### child running, getting data from '%s'.\n", mpfd->displayname)); - - /* we cannot reuse fork()'ed display handles - our child needs his own one */ - if( (mpfd->pdpy = XPU_TRACE_CHILD(XOpenDisplay(mpfd->displayname))) == NULL ) - { - perror("child cannot open display"); -#ifdef XPU_USE_NSPR - return; -#else - return(NULL); -#endif - } - - mpfd->done = False; - - /* register "consumer" callbacks */ - if( XPU_TRACE_CHILD(XpGetDocumentData(mpfd->pdpy, mpfd->pcontext, - MyPrintToFileProc, MyFinishProc, - (XPointer)mpfd)) == 0 ) - { - XPU_DEBUG_ONLY(printf("XpGetDocumentData cannot register callbacks\n")); -#ifdef XPU_USE_NSPR - return; -#else - return(NULL); -#endif - } - - /* loop forever - libXp has registered hidden event callbacks for the consumer - * callbacks - the finishCB will call set the "done" boolean after all... - */ - while( mpfd->done != True ) - { - XNextEventTimeout(mpfd->pdpy, &dummy, &timeout); - } - - XCloseDisplay(mpfd->pdpy); - -#ifdef XPU_USE_THREADS -#ifdef XPU_USE_NSPR - return; -#else - return(NULL); -#endif -#else - /* write the status to the parent */ - if( XPU_TRACE_CHILD(write(mpfd->pipe[1], &mpfd->status, sizeof(XPGetDocStatus))) != sizeof(XPGetDocStatus) ) - { - perror("PrintToFile_Consumer: can't write XPGetDocStatus"); - } - - /* we don't do any free's or close's, as we are just - * going to exit, in fact, get out without calling any C++ - * destructors, etc., as we don't want anything funny to happen - * to the parent - */ - XPU_TRACE_CHILD(_exit(EXIT_SUCCESS)); -#endif /* XPU_USE_THREADS */ -} - -/* EOF. */ diff --git a/nx-X11/lib/Xss/Imakefile b/nx-X11/lib/Xss/Imakefile deleted file mode 100644 index bd7f7a8fc..000000000 --- a/nx-X11/lib/Xss/Imakefile +++ /dev/null @@ -1,47 +0,0 @@ -XCOMM $XFree86: xc/lib/Xss/Imakefile,v 3.5 2003/10/26 18:59:49 herrb Exp $ -#define DoNormalLib NormalLibXss -#define DoSharedLib SharedLibXss -#define DoExtraLib SharedLibXss -#define DoDebugLib DebugLibXss -#define DoProfileLib ProfileLibXss -#define LibName Xss -#define SoRev SOXSSREV -#define LibHeaders NO - -#include - -#ifdef SharedXssReqs -REQUIREDLIBS = SharedXssReqs -#endif - -SCRNSAVSRC = XScrnSaver.c -SCRNSAVOBJ = XScrnSaver.o - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - - DEFINES = $(ALLOC_DEFINES) - SRCS = $(SCRNSAVSRC) - OBJS = $(SCRNSAVOBJ) - LINTLIBS = $(LINTXLIB) - -#define IncludeSharedObjectInNormalLib - -MANSUFFIX=$(LIBMANSUFFIX) -InstallManPage(LibName,$(LIBMANDIR)) -#if ExpandManNames -InstallManPageAliases(LibName,$(LIBMANDIR), XScreenSaverQueryExtension \ @@\ - XScreenSaverQueryVersion \ @@\ - XScreenSaverAllocInfo \ @@\ - XScreenSaverQueryInfo \ @@\ - XScreenSaverSelectInput \ @@\ - XScreenSaverSetAttributes \ @@\ - XScreenSaverUnsetAttributes \ @@\ - XScreenSaverRegister \ @@\ - XScreenSaverUnregister \ @@\ - XScreenSaverGetRegistered) -#endif -#include - -DependTarget() diff --git a/nx-X11/lib/Xss/XScrnSaver.c b/nx-X11/lib/Xss/XScrnSaver.c deleted file mode 100644 index 3727ae4f6..000000000 --- a/nx-X11/lib/Xss/XScrnSaver.c +++ /dev/null @@ -1,442 +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 - */ -/* $XFree86: xc/lib/Xss/XScrnSaver.c,v 3.1 2001/10/28 03:32:40 tsi Exp $ */ - -#define NEED_EVENTS -#define NEED_REPLIES -#include -#include -#include -#include -#include -#include - - -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/nx-X11/lib/Xss/Xss-def.cpp b/nx-X11/lib/Xss/Xss-def.cpp deleted file mode 100644 index 60d529cf1..000000000 --- a/nx-X11/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/nx-X11/lib/Xss/Xss.man b/nx-X11/lib/Xss/Xss.man deleted file mode 100644 index fa1545241..000000000 --- a/nx-X11/lib/Xss/Xss.man +++ /dev/null @@ -1,328 +0,0 @@ -.\" -.\" $XFree86: xc/lib/Xss/Xss.man,v 1.1 2003/10/26 19:00:24 herrb Exp $ -.\" $XdotOrg: xc/lib/Xss/Xss.man,v 1.2 2004/04/23 18:43:51 eich Exp $ -.\" -.\" Copyright (C) 2003 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 NON-INFRINGEMENT. -.\" 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. -.\" -.TH XScreenSaver __libmansuffix__ __vendorversion__ -.SH NAME -XScreenSaver \- X11 Screen Saver extension client library -.SH SYNOPSIS -.B #include -.PP -.nf -.ta .5i 2i -typedef struct { - Window window; /\(** screen saver window */ - int state; /\(** ScreenSaver{Off,On,Disabled} */ - int kind; /\(** ScreenSaver{Blanked,Internal,External} */ - unsigned long til_or_since; /\(** milliseconds */ - unsigned long idle; /\(** milliseconds */ - unsigned long event_mask; /\(** events */ -.br -} XScreenSaverInfo; - -typedef struct { - int type; /\(** of event */ - unsigned long serial; /\(** # of last request processed by server */ - Bool send_event; /\(** true if this came frome a SendEvent request */ - Display *display; /\(** Display the event was read from */ - Window window; /\(** screen saver window */ - Window root; /\(** root window of event screen */ - int state; /\(** ScreenSaver{Off,On,Cycle} */ - int kind; /\(** ScreenSaver{Blanked,Internal,External} */ - Bool forced; /\(** extents of new region */ - Time time; /\(** event timestamp */ -.br -} XScreenSaverNotifyEvent; -.fi -.HP -Bool XScreenSaverQueryExtension(Display *\fIdpy\fP, -int *\fIevent_basep\fP, int *\fIerror_basep\fP\^); -.HP -Status XScreenSaverQueryVersion(Display *\fIdpy\fP, int *\fImajor_versionp\fP, -int *\fIminor_versionp\fP\^); -.HP -XScreenSaverInfo *XScreenSaverAllocInfo(\^void\^); -.HP -Status XScreenSaverQueryInfo(\^Display *\fIdpy\fP, Drawable \fIdrawable\fP, -XScreenSaverInfo *\fIsaver_info\fP\^); -.HP -void XScreenSaverSelectInput(Display *\fIdpy\fP, Drawable \fIdrawable\fP, -unsigned long \fImask\fp\^); -.HP -void XScreenSaverSetAttributes(Display *\fIdpy\fP, Drawable \fIdrawable\fP, -int \fIx\fP, -int \fIy\fP, -unsigned int \fIwidth\fP, -unsigned int \fIheight\fP, -unsigned int \fIborder_width\fP, -int \fIdepth\fP, -unsigned int \fIclass\fP, -Visual *\fIvisual\fP, -unsigned long \fIvaluemask\fP, -XSetWindowAttributes *\fIattributes\fP\^); -.HP -void XScreenSaverUnsetAttributes(Display *\fIdpy\fP, -Drawable \fIdrawable\fP\^); -.HP -void XScreenSaverSaverRegister(Display *\fIdpy\fP, int \fIscreen\fP, -XID \fIxid\fP, Atom \fItype\fP\^); -.HP -Status XScreenSaverUnregister(Display *\fIdpy\fP, int \fIscreen\fP\^); -.HP -Status XScreenSaverGetRegistered(Display *\fIdpy\fP, int \fIscreen\fP, -XID *\fIxid\fP, Atom *\fItype\fP\^); -.PP -.SH DESCRIPTION -The X Window System provides support for changing the image on a -display screen after a user-settable period of inactivity to avoid -burning the cathode ray tube phosphors. -However, no interfaces are provided for the user to control the image -that is drawn. -This extension allows an external ``screen saver'' client to detect -when the alternate image is to be displayed and to provide the -graphics. -.PP -Current X server implementations typically provide at least one form of -``screen saver'' image. -Historically, this has been a copy of the X logo drawn against the -root background pattern. -However, many users have asked for the mechanism to allow them to -write screen saver programs that provide capabilities similar to those -provided by other window systems. -In particular, such users often wish to be able to display corporate -logos, instructions on how to reactivate the screen, and automatic -screen-locking utilities. -This extension provides a means for writing such clients. -.SS Assumptions -This extension exports the notion of a special screen saver window that is -mapped above all other windows on a display. -This window has the \fIoverride-redirect\fP attribute set so that it -is not subject to manipulation by the window manager. -Furthermore, the X identifier for the window is never returned by -\fBQueryTree\fP requests on the root window, so it is typically not -visible to other clients. -.PP -.B XScreenSaverQueryExtension -returns -.B True -if the -.I XScreenSaver -extension is available on the given display. -A client must call -.B XScreenSaverQueryExtension -before calling any other XScreenSaver function in order -to negotiate a compatible protocol version; otherwise the client will -get undefined behavior (XScreenSaver may or may not work). -.PP -If the extension is supported, the event number for -.I ScreenSaverNotify -events is returned in the value pointed to by \fIevent_base\fP. -Since no additional errors are defined by this extension, the results -of \fIerror_base\fP are not defined. -.PP -.B XScreenSaverQueryVersion -returns -.B True -if the request succeeded; the values of the major and minor protocol -versions supported by the server are returned in -.I major_versionp -and -.I minor_versionp . -.PP -.B XScreenSaverAllocInfo -allocates and returns an \fBXScreenSaverInfo\fP structure -for use in calls to \fBXScreenSaverQueryInfo\fP. -All fields in the structure are initialized to zero. -If insufficient memory is available, NULL is returned. -The results of this routine can be released using \fIXFree\fP. -.PP -.B XScreenSaverQueryInfo -returns information about the current state of the -screen server in \fIsaver_info\fP and a non-zero value is -returned. -If the extension is not supported, \fIsaver_info\fP is not changed and 0 -is returned. -.br -The \fIstate\fP field specifies whether or not the screen saver is currently -active and how the \fItil-or-since\fP value should be interpreted: -.TP 4 -.I Off -The screen is not currently being saved; \fItil-or-since\fP -specifies the number of milliseconds until the screen saver is expected to -activate. -.TP 4 -.I On -The screen is currently being saved; \fItil-or-since\fP specifies -the number of milliseconds since the screen saver activated. -.TP 4 -.I Disabled -The screen saver is currently disabled; \fItil-or-since\fP is zero. -.br -The \fIkind\fP field specifies the mechanism that either is currently being -used or would have been were the screen being saved: -.TP 4 -.I Blanked -The video signal to the display monitor was disabled. -.TP 4 -.I Internal -A server-dependent, built-in screen saver image was displayed; either no -client had set the screen saver window attributes or a different client -had the server grabbed when the screen saver activated. -.TP 4 -.I External -The screen saver window was mapped with attributes set by a -client using the \fBScreenSaverSetAttributes\fP request. -.PP -The \fIidle\fP field specifies the number of milliseconds since the last -input was received from the user on any of the input devices. -.br -The \fIevent-mask\fP field specifies which, if any, screen saver -events this client has requested using \fBScreenSaverSelectInput\fP. -.PP -.B XScreenSaverSelectInput -asks that events related to -the screen saver be generated for this client. -If -no bits are set in \fIevent-mask\fP, then no events will be generated. -Otherwise, any combination of the following bits may be set: -.TP 8 -.B ScreenSaverNotify -If this bit is set, \fBScreenSaverNotify\fP events are generated whenever -the screen saver is activated or deactivated. -.TP 8 -.B ScreenSaverCycle -If this bit is set, \fBScreenSaverNotify\fP events are generated whenever -the screen saver cycle interval passes. -.PP -.B XScreenSaverSetAttributes -sets the attributes to be used -the next time the external screen saver is activated. -If another client currently has the attributes set, -a BadAccess error is generated and the request is ignored. -.br -Otherwise, the specified window attributes are checked as if -they were used in a core \fBCreateWindow\fP request whose -parent is the root. -The \fIoverride-redirect\fP field is ignored as it is implicitly set -to True. -If the window attributes result in an error according to the rules for -\fBCreateWindow\fP, the request is ignored. -.br -Otherwise, the attributes are stored and will take effect on the next -activation that occurs when the server is not grabbed by another client. -Any resources specified for the -\fIbackground-pixmap\fP or \fIcursor\fP attributes may be -freed immediately. -The server is free to copy the \fIbackground-pixmap\fP or \fIcursor\fP -resources or to use them in place; therefore, the effect of changing -the contents of those resources is undefined. -If the specified \fIcolormap\fP no longer exists when the screen saver -activates, the parent's colormap is used instead. -If no errors are generated by this request, any previous screen saver -window attributes set by this client are released. -.br -When the screen saver next activates and the server is not grabbed by -another client, the screen saver window is -created, if necessary, and set to the specified attributes and events -are generated as usual. -The colormap associated with the screen saver window is installed. -Finally, the screen saver window is mapped. -.br -The window remains mapped and at the top of the stacking order -until the screen saver is deactivated in response to activity on -any of the user input devices, a \fBForceScreenSaver\fP request with -a value of Reset, or any request that would cause the window to be -unmapped. -.br -If the screen saver activates while the server is grabbed by another -client, the internal saver mechanism is used. -The \fBForceScreenSaver\fP request may be used with a value of Active -to deactivate the internal saver and activate the external saver. -.br -If the screen saver client's connection to the server is broken -while the screen saver is activated and the client's close down mode has not -been RetainPermanent or RetainTemporary, the current screen saver -is deactivated and the internal screen saver is immediately activated. -.br -When the screen saver deactivates, the screen saver window's colormap -is uninstalled and the window is unmapped (except as described below). -The screen saver XID is disassociated -with the window and the server may, but is not required to, -destroy the window along with any children. -.br -When the screen saver is being deactivated and then immediately -reactivated (such as when switching screen savers), the server -may leave the screen saver window mapped (typically to avoid -generating exposures). -.PP -.B XScreenSaverUnsetAttributes -instructs the server to discard -any previous screen saver window attributes set by this client. -.PP -.B XScreenSaverRegister -stores the given \fIXID\fP in the \fB_SCREEN_SAVER_ID\fP -property (of the given \fItype\fP) on the -root window of the specified \fIscreen\fP. -It returns zero if an error is encountered and the property is not -changed, otherwise it returns non-zero. -.PP -.B XScreenSaverUnregister -removes any \fB_SCREEN_SAVER_ID\fP from the -root window of the specified \fIscreen\fP. -It returns zero if an error is encountered and the property is -changed, otherwise it returns non-zero. -.PP -.B XScreenSaverGetRegistered -returns the \fIXID\fP and \fItype\fP stored in -the \fB_SCREEN_SAVER_ID\fP property on the -root window of the specified \fIscreen\fP. -It returns zero if an error is encountered or if the property does not -exist or is not of the correct format; otherwise it returns non-zero. -.SH "ERRORS" -.B XScreenSaverSelectInput, -.B XScreenSaverQueryInfo, -.B XScreenSaverSetAttributes -and -.B XScreenSaverUnsetAttributes -will generate a -.I BadDrawable -error if \fIdrawable\fP is not a valid drawable identifier. -If any undefined bits are set in \fIevent-mask\fP, -a BadValue error is generated by -.B XScreenSaverSelectInput . -.PP -.SH "SEE ALSO" -X(__miscmansuffix__) -.SH AUTHORS -Jim Fulton and Keith Packard. -.SH STABILITY -This API is considered as experimental. -The Xss library major revision may be incremented whenever -incompatible changes are done to the API without notice. -Use with care. diff --git a/nx-X11/lib/Xt/ActionHook.c b/nx-X11/lib/Xt/ActionHook.c deleted file mode 100644 index 6c2fe2bd0..000000000 --- a/nx-X11/lib/Xt/ActionHook.c +++ /dev/null @@ -1,135 +0,0 @@ -/* $Xorg: ActionHook.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/*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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/ActionHook.c,v 1.2 2001/08/22 22:52:17 dawes Exp $ */ - -/* - * Contains XtAppAddActionHook, XtRemoveActionHook - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" - - -/*ARGSUSED*/ -static void FreeActionHookList( - 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( - 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( - 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/nx-X11/lib/Xt/Alloc.c b/nx-X11/lib/Xt/Alloc.c deleted file mode 100644 index 1312db2ac..000000000 --- a/nx-X11/lib/Xt/Alloc.c +++ /dev/null @@ -1,494 +0,0 @@ -/* $Xorg: Alloc.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/*********************************************************** -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/Alloc.c,v 1.9 2001/12/14 19:56:07 dawes Exp $ */ - -/* - * X Toolkit Memory Allocation Routines - * - * Uses Xlib memory management, which is spec'd to be re-entrant. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include "InitialI.h" -#undef _XBCOPYFUNC - -#include - -#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( - char *src, char *dst, - int length) -{ - if (src < dst) { - dst += length; - src += length; - while (length--) - *--dst = *--src; - } else { - while (length--) - *dst++ = *src++; - } -} -#endif - -void _XtAllocError( - 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->start = NULL; - heap->bytes_remaining = 0; -} - -#ifndef XTTRACEMEMORY - -char *XtMalloc( - 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( - char *ptr, - unsigned size) -{ - if (ptr == NULL) { -#ifdef MALLOC_0_RETURNS_NULL - if (!size) size = 1; -#endif - return(XtMalloc(size)); - } else if ((ptr = Xrealloc(ptr, size)) == NULL -#ifdef MALLOC_0_RETURNS_NULL - && size -#endif - ) - _XtAllocError("realloc"); - - return(ptr); -} - -char *XtCalloc( - unsigned num, unsigned 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( - char *ptr) -{ - if (ptr != NULL) Xfree(ptr); -} - -char* __XtMalloc( - unsigned size) -{ -#ifdef MALLOC_0_RETURNS_NULL - if (!size) size = 1; -#endif - return XtMalloc (size); -} - -char* __XtCalloc( - unsigned num, unsigned 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* 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) -{ - 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( - StatsPtr mem) -{ - mem->seq = XtSeqId; /* avoid being optimized out of existence */ -} - -char *_XtMalloc( - 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( - unsigned size) -{ - return _XtMalloc(size, (char *)NULL, 0); -} - -char *_XtRealloc( - 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( - char *ptr, - unsigned size) -{ - return _XtRealloc(ptr, size, (char *)NULL, 0); -} - -char *_XtCalloc( - unsigned num, unsigned 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( - unsigned num, unsigned size) -{ - return _XtCalloc(num, size, (char *)NULL, 0); -} - -Boolean _XtIsValidPointer( - 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( - 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(char *ptr) -{ - _XtFree(ptr); -} - -char *_XtHeapMalloc( - 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(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 - -void _XtPrintMemory(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/nx-X11/lib/Xt/ArgList.c b/nx-X11/lib/Xt/ArgList.c deleted file mode 100644 index 622f31351..000000000 --- a/nx-X11/lib/Xt/ArgList.c +++ /dev/null @@ -1,77 +0,0 @@ -/* $Xorg: ArgList.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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 HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include - -/* - * This routine merges two arglists. It does NOT check for duplicate entries. - */ - -ArgList XtMergeArgLists( - 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/nx-X11/lib/Xt/Callback.c b/nx-X11/lib/Xt/Callback.c deleted file mode 100644 index 03aae5274..000000000 --- a/nx-X11/lib/Xt/Callback.c +++ /dev/null @@ -1,692 +0,0 @@ -/* $Xorg: Callback.c,v 1.4 2001/02/09 02:03:54 xorgcvs Exp $ */ - -/*********************************************************** -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.8 2001/12/14 19:56:08 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#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 widget, - _Xconst char *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( - 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( - 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 */ - -void XtAddCallback( - Widget widget, - _Xconst char* name, - XtCallbackProc callback, - XtPointer closure - ) -{ - 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 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 */ - -void XtAddCallbacks( - Widget widget, - _Xconst char* name, - XtCallbackList xtcallbacks - ) -{ - 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 ( - 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 */ - -void XtRemoveCallback ( - Widget widget, - _Xconst char* name, - XtCallbackProc callback, - XtPointer closure - ) -{ - 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 */ - - -void XtRemoveCallbacks ( - Widget widget, - _Xconst char* name, - XtCallbackList xtcallbacks) -{ - 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 ( - InternalCallbackList *callbacks) -{ - register InternalCallbackList icl = *callbacks; - - if (icl) { - if (icl->call_state) - icl->call_state |= _XtCBFreeAfterCalling; - else - XtFree((char *) icl); - *callbacks = NULL; - } -} /* _XtRemoveAllCallbacks */ - -void XtRemoveAllCallbacks( - Widget widget, - _Xconst char* name) -{ - 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( - 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( - 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); -} - -void XtCallCallbacks( - Widget widget, - _Xconst char* name, - XtPointer call_data - ) -{ - 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 */ - - -XtCallbackStatus XtHasCallbacks( - Widget widget, - _Xconst char* callback_name - ) -{ - 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 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 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 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/nx-X11/lib/Xt/CallbackI.h b/nx-X11/lib/Xt/CallbackI.h deleted file mode 100644 index 4ae08ab01..000000000 --- a/nx-X11/lib/Xt/CallbackI.h +++ /dev/null @@ -1,117 +0,0 @@ -/* $Xorg: CallbackI.h,v 1.4 2001/02/09 02:03:54 xorgcvs Exp $ */ -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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$ */ - -/**************************************************************** - * - * 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)( - XtPointer /* data */ -); - -extern void _XtAddCallback( - InternalCallbackList* /* callbacks */, - XtCallbackProc /* callback */, - XtPointer /* closure */ -); - -extern void _XtAddCallbackOnce( - InternalCallbackList* /* callbacks */, - XtCallbackProc /* callback */, - XtPointer /* closure */ -); - -extern InternalCallbackList _XtCompileCallbackList( - XtCallbackList /* xtcallbacks */ -); - -extern XtCallbackList _XtGetCallbackList( - InternalCallbackList* /* callbacks */ -); - -extern void _XtRemoveAllCallbacks( - InternalCallbackList* /* callbacks */ -); - -extern void _XtRemoveCallback( - InternalCallbackList* /* callbacks */, - XtCallbackProc /* callback */, - XtPointer /* closure */ -); - -extern void _XtPeekCallback( - Widget /* widget */, - XtCallbackList /* callbacks */, - XtCallbackProc * /* callback */, - XtPointer * /* closure */ -); - -extern void _XtCallConditionalCallbackList( - Widget /* widget */, - XtCallbackList /* callbacks */, - XtPointer /* call_data */, - _XtConditionProc /* cond_proc */ -); diff --git a/nx-X11/lib/Xt/ClickTime.c b/nx-X11/lib/Xt/ClickTime.c deleted file mode 100644 index bfebd421f..000000000 --- a/nx-X11/lib/Xt/ClickTime.c +++ /dev/null @@ -1,93 +0,0 @@ -/* $Xorg: ClickTime.c,v 1.4 2001/02/09 02:03:54 xorgcvs Exp $ */ - -/*********************************************************** -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" - -void XtSetMultiClickTime( - Display *dpy, - int time) -{ - DPY_TO_APPCON(dpy); - - LOCK_APP(app); - _XtGetPerDisplay(dpy)->multi_click_time = time; - UNLOCK_APP(app); -} - - -int XtGetMultiClickTime( - 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/nx-X11/lib/Xt/Composite.c b/nx-X11/lib/Xt/Composite.c deleted file mode 100644 index 7a90975a3..000000000 --- a/nx-X11/lib/Xt/Composite.c +++ /dev/null @@ -1,284 +0,0 @@ -/* $Xorg: Composite.c,v 1.4 2001/02/09 02:03:54 xorgcvs Exp $ */ - -/*********************************************************** -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/Composite.c,v 1.5 2001/08/22 22:52:17 dawes Exp $ */ - -#define XT_COMPOSITE -#ifdef HAVE_CONFIG_H -#include -#endif -#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(WidgetClass); -static void CompositeInitialize(Widget, Widget, ArgList, Cardinal *); -static void CompositeInsertChild(Widget); -static void CompositeDeleteChild(Widget); -static void CompositeDestroy(Widget); - -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( - 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) -{ - register CompositePartPtr wcPtr; - register CompositePartPtr superPtr = NULL; - - wcPtr = (CompositePartPtr) - &(((CompositeWidgetClass)widgetClass)->composite_class); - - if (widgetClass != compositeWidgetClass) - /* don't compute possible bogus pointer */ - superPtr = (CompositePartPtr)&(((CompositeWidgetClass)widgetClass - ->core_class.superclass)->composite_class); - - /* 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( - Widget w) -{ - register CompositeWidget cw = (CompositeWidget) w; - - XtFree((char *) cw->composite.children); -} - -static void CompositeInsertChild( - 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( - 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( - Widget requested_widget, - Widget new_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/nx-X11/lib/Xt/Composite.h b/nx-X11/lib/Xt/Composite.h deleted file mode 100644 index 0a58332be..000000000 --- a/nx-X11/lib/Xt/Composite.h +++ /dev/null @@ -1,105 +0,0 @@ -/* $Xorg: Composite.h,v 1.4 2001/02/09 02:03:54 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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$ */ - -#ifndef _XtComposite_h -#define _XtComposite_h - -typedef struct _CompositeClassRec *CompositeWidgetClass; - -typedef Cardinal (*XtOrderProc)( - Widget /* child */ -); - -_XFUNCPROTOBEGIN - -extern void XtManageChildren( - WidgetList /* children */, - Cardinal /* num_children */ -); - -extern void XtManageChild( - Widget /* child */ -); - -extern void XtUnmanageChildren( - WidgetList /* children */, - Cardinal /* num_children */ -); - -extern void XtUnmanageChild( - Widget /* child */ -); - -typedef void (*XtDoChangeProc)( - Widget /* composite_parent */, - WidgetList /* unmanage_children */, - Cardinal * /* num_unmanage_children */, - WidgetList /* manage_children */, - Cardinal * /* num_manage_children */, - XtPointer /* client_data */ -); - -extern void XtChangeManagedSet( - WidgetList /* unmanage_children */, - Cardinal /* num_unmanage_children */, - XtDoChangeProc /* do_change_proc */, - XtPointer /* client_data */, - WidgetList /* manage_children */, - Cardinal /* num_manage_children */ -); - -_XFUNCPROTOEND - -#ifndef XT_COMPOSITE -externalref WidgetClass compositeWidgetClass; -#endif - -#endif /* _XtComposite_h */ -/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/nx-X11/lib/Xt/CompositeP.h b/nx-X11/lib/Xt/CompositeP.h deleted file mode 100644 index ed055b21f..000000000 --- a/nx-X11/lib/Xt/CompositeP.h +++ /dev/null @@ -1,111 +0,0 @@ -/* $Xorg: CompositeP.h,v 1.4 2001/02/09 02:03:54 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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 - -/************************************************************************ - * - * 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/nx-X11/lib/Xt/ConstrainP.h b/nx-X11/lib/Xt/ConstrainP.h deleted file mode 100644 index a90d19ac6..000000000 --- a/nx-X11/lib/Xt/ConstrainP.h +++ /dev/null @@ -1,94 +0,0 @@ -/* $Xorg: ConstrainP.h,v 1.4 2001/02/09 02:03:54 xorgcvs Exp $ */ -/* $oHeader: ConstrainP.h,v 1.2 88/08/18 15:54:15 asente Exp $ */ -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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 - -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/nx-X11/lib/Xt/Constraint.c b/nx-X11/lib/Xt/Constraint.c deleted file mode 100644 index dd9b52310..000000000 --- a/nx-X11/lib/Xt/Constraint.c +++ /dev/null @@ -1,134 +0,0 @@ -/* $Xorg: Constraint.c,v 1.4 2001/02/09 02:03:54 xorgcvs Exp $ */ - -/*********************************************************** -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/Constraint.c,v 1.2 2001/08/22 22:52:17 dawes Exp $ */ - -#define CONSTRAINT -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include "StringDefs.h" - -static void ConstraintPartInitialize(WidgetClass wc); -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(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/nx-X11/lib/Xt/Constraint.h b/nx-X11/lib/Xt/Constraint.h deleted file mode 100644 index 9bb962e0d..000000000 --- a/nx-X11/lib/Xt/Constraint.h +++ /dev/null @@ -1,60 +0,0 @@ -/* $Xorg: Constraint.h,v 1.4 2001/02/09 02:03:54 xorgcvs Exp $ */ -/* $oHeader: Constraint.h,v 1.2 88/08/18 15:54:18 asente Exp $ */ -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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/nx-X11/lib/Xt/Convert.c b/nx-X11/lib/Xt/Convert.c deleted file mode 100644 index c3bb3c63a..000000000 --- a/nx-X11/lib/Xt/Convert.c +++ /dev/null @@ -1,1087 +0,0 @@ -/* $Xorg: Convert.c,v 1.5 2001/02/09 02:03:54 xorgcvs Exp $ */ - -/*********************************************************** -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.7 2001/12/14 19:56:09 dawes Exp $ */ - -/* - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#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( - 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( - ConverterTable table) -{ - register Cardinal 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; - -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) -{ - 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; - } -} - -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 - ) -{ - 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; -} - -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 - ) -{ - 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 */ -void XtAddConverter( - register _Xconst char* from_type, - register _Xconst char* to_type, - XtConverter converter, - XtConvertArgList convert_args, - Cardinal num_args - ) -{ - 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 */ -void XtAppAddConverter( - XtAppContext app, - register _Xconst char* from_type, - register _Xconst char* to_type, - XtConverter converter, - XtConvertArgList convert_args, - Cardinal num_args - ) -{ - 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* 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( - 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( - 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 - -void _XtConverterCacheStats(void) -{ - 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( - 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 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: - args[i].addr = - (XPointer)((char *)widget + (long)convert_args[i].address_id); - break; - - case XtWidgetBaseOffset: - if (!ancestor) { - if (XtIsWidget(widget)) - ancestor = widget; - else - ancestor = _XtWindowedAncestor(widget); - } - - args[i].addr = - (XPointer)((char *)ancestor + (long)convert_args[i].address_id); - 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; - } - args[i].addr = (XPointer)((char *)widget + offset); - 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( - 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( - XtAppContext app, - XtTypeConverter converter) -{ - Cardinal 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( - 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( - 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 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; -} - -void XtConvert( - Widget widget, - _Xconst char* from_type_str, - XrmValuePtr from, - _Xconst char* to_type_str, - XrmValuePtr to) -{ - 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); -} - -Boolean XtConvertAndStore( - Widget object, - _Xconst char* from_type_str, - XrmValuePtr from, - _Xconst char* to_type_str, - XrmValuePtr to) -{ - 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( - 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 widget, /* unused */ - XtPointer closure, - XtPointer call_data) /* unused */ -{ - XtAppReleaseCacheRefs( XtWidgetToApplicationContext(widget), - (XtCacheRef*)closure ); - XtFree(closure); -} - - -/* ARGSUSED */ -void XtCallbackReleaseCacheRef( - 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/nx-X11/lib/Xt/ConvertI.h b/nx-X11/lib/Xt/ConvertI.h deleted file mode 100644 index 02c0e5ca0..000000000 --- a/nx-X11/lib/Xt/ConvertI.h +++ /dev/null @@ -1,96 +0,0 @@ -/* $Xorg: ConvertI.h,v 1.4 2001/02/09 02:03:54 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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/ConvertI.h,v 1.3 2001/12/14 19:56:09 dawes Exp $ */ - -/* Representation types */ - -extern XrmQuark _XtQString; - -/* - * Resource conversions - */ - -typedef struct _ConverterRec **ConverterTable; - -extern void _XtAddDefaultConverters( - ConverterTable /* table */ -); - -extern void _XtSetDefaultConverterTable( - ConverterTable* /* table */ -); - -extern void _XtFreeConverterTable( - ConverterTable /* table */ -); - -extern 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 */ -); - -extern Boolean _XtConvert( - Widget /* widget */, - XrmRepresentation /* from_type */, - XrmValuePtr /* from */, - XrmRepresentation /* to_type */, - XrmValuePtr /* to */, - XtCacheRef* /* cache_ref_return */ -); - -void _XtConvertInitialize(void); - diff --git a/nx-X11/lib/Xt/Converters.c b/nx-X11/lib/Xt/Converters.c deleted file mode 100644 index acb572e69..000000000 --- a/nx-X11/lib/Xt/Converters.c +++ /dev/null @@ -1,1864 +0,0 @@ -/* $Xorg: Converters.c,v 1.5 2001/02/09 02:03:54 xorgcvs Exp $ */ - -/*********************************************************** -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.14tsi Exp $ */ - -/* - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include "StringDefs.h" -#include "Shell.h" -#include -#include -#include -#include -#include /* for StringToDirectoryString */ - -#ifdef __UNIXOS2__ -#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 __UNIXOS2__ -XrmQuark _XtQString = 0; -#else -XrmQuark _XtQString; -#endif - -void _XtConvertInitialize(void) -{ - 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; \ - } - -void XtDisplayStringConversionWarning( - Display* dpy, - _Xconst char* from, - _Xconst char* toType - ) -{ -#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); -} - -void XtStringConversionWarning( - _Xconst char* from, - _Xconst char* toType - ) -{ - 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(char *, char *); - - -static Boolean IsInteger( - String string, - int *value) -{ - Boolean foundDigit = False; - Boolean isNegative = False; - Boolean isPositive = False; - int val = 0; - char ch; - /* skip leading whitespace */ -#ifndef __UNIXOS2__ - 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( - 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( - 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( - 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( - 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( - 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( - 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( - 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( - 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 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( - 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 Cardinal 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( - 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( - 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( - 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( - 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( - 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( - 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( - 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-*"); - if (f != 0) - goto Done; - - XtAppWarningMsg(XtDisplayToApplicationContext(dpy), - "noFont","cvtStringToFont",XtCXtToolkitError, - "Unable to load any usable ISO8859 font", - (String *) NULL, (Cardinal *)NULL); - - return False; -} - -/* ARGSUSED */ -static void FreeFont( - 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( - 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( - 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( - 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 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( - 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-*"); - if (f != NULL) - goto Done; - - XtAppWarningMsg(XtDisplayToApplicationContext(dpy), - "noFont","cvtStringToFontStruct",XtCXtToolkitError, - "Unable to load any usable ISO8859 font", - (String *) NULL, (Cardinal *)NULL); - - return False; -} - -/* ARGSUSED */ -static void FreeFontStruct( - 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( - 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( - 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( - 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( - 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( - 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( - 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( - 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( - 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(register char *source, register *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 (char *first, char *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(char *dst, char *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( - 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( - 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( - 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( - 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( - 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( - 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( - Display *dpy, - XrmValuePtr args, - Cardinal *num_args, - XrmValuePtr fromVal, - XrmValuePtr toVal, - XtPointer *closure_ret) -{ - String *strarray, *ptr; - char *src; - 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 = 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( - 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 ( - 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( - 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/nx-X11/lib/Xt/Core.c b/nx-X11/lib/Xt/Core.c deleted file mode 100644 index d30b4937c..000000000 --- a/nx-X11/lib/Xt/Core.c +++ /dev/null @@ -1,400 +0,0 @@ -/* $Xorg: Core.c,v 1.4 2001/02/09 02:03:54 xorgcvs Exp $ */ - -/*********************************************************** -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 - -#ifdef HAVE_CONFIG_H -#include -#endif -#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(Widget, int, XrmValue *); - -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(Widget, Widget, ArgList, Cardinal *); -static void CoreClassPartInitialize(WidgetClass); -static void CoreDestroy(Widget); -static void CoreRealize(Widget, XtValueMask *, XSetWindowAttributes *); -static Boolean CoreSetValues(Widget, Widget, Widget, ArgList, Cardinal *); -static void CoreSetValuesAlmost(Widget, Widget, XtWidgetGeometry *, XtWidgetGeometry *); - -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 widget, - int offset, - XrmValue *value) -{ - value->addr = (XPointer)(&widget->core.screen); -} - -/* - * Start of Core methods - */ - -static void CoreClassPartInitialize( - 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( - 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 widget, - XtValueMask *value_mask, - XSetWindowAttributes *attributes) -{ - XtCreateWindow(widget, (unsigned int) InputOutput, - (Visual *) CopyFromParent, *value_mask, attributes); -} /* CoreRealize */ - -static void CoreDestroy ( - 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( - Widget old, Widget reference, Widget 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( - Widget old, - Widget new, - XtWidgetGeometry *request, - XtWidgetGeometry *reply) -{ - *request = *reply; -} diff --git a/nx-X11/lib/Xt/Core.h b/nx-X11/lib/Xt/Core.h deleted file mode 100644 index ff6cb7535..000000000 --- a/nx-X11/lib/Xt/Core.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -* $Xorg: Core.h,v 1.4 2001/02/09 02:03:54 xorgcvs Exp $ -* $oHeader: Core.h,v 1.2 88/08/18 15:54:32 asente Exp $ -*/ - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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/nx-X11/lib/Xt/CoreP.h b/nx-X11/lib/Xt/CoreP.h deleted file mode 100644 index e07f085e6..000000000 --- a/nx-X11/lib/Xt/CoreP.h +++ /dev/null @@ -1,171 +0,0 @@ -/* -* $Xorg: CoreP.h,v 1.4 2001/02/09 02:03:54 xorgcvs Exp $ -* $oHeader: CoreP.h,v 1.2 88/08/18 15:54:37 asente Exp $ -*/ - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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 - -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/nx-X11/lib/Xt/Create.c b/nx-X11/lib/Xt/Create.c deleted file mode 100644 index d3417a115..000000000 --- a/nx-X11/lib/Xt/Create.c +++ /dev/null @@ -1,779 +0,0 @@ -/* $Xorg: Create.c,v 1.4 2001/02/09 02:03:54 xorgcvs Exp $ */ - -/*********************************************************** -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.10 2002/12/17 04:50:58 dawes Exp $ */ - -/* - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include "VarargsI.h" -#include "ShellP.h" -#include "CreateI.h" -#ifndef X_NO_RESOURCE_CONFIGURATION_MANAGEMENT -#include "ResConfigP.h" -#endif -#include - -static String XtNxtCreateWidget = "xtCreateWidget"; -static String XtNxtCreatePopupShell = "xtCreatePopupShell"; - -static void -CallClassPartInit(WidgetClass ancestor, WidgetClass 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 ( - 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 ( - ConstraintWidgetClass class, - Widget req_widget, - 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( - 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)); - bzero(widget, 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) -{ - 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( - char *name, - char *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 = NULL; - Cardinal wsize, csize; - Widget widget; - XtCacheRef *cache_refs; - Cardinal 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(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", - ¶m, &num_params); - } else { - (*insert_child) (w); - } -} - -Widget -_XtCreateWidget( - 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); -} - -Widget -XtCreateWidget( - _Xconst char* name, - WidgetClass widget_class, - Widget parent, - ArgList args, - Cardinal num_args - ) -{ - Widget retval; - WIDGET_TO_APPCON(parent); - - LOCK_APP(app); - retval = _XtCreateWidget((String)name, widget_class, parent, args, num_args, - (XtTypedArgList)NULL, (Cardinal)0); - UNLOCK_APP(app); - return retval; -} - - -Widget -XtCreateManagedWidget( - _Xconst char* name, - WidgetClass widget_class, - Widget parent, - ArgList args, - Cardinal num_args - ) -{ - register Widget widget; - WIDGET_TO_APPCON(parent); - - LOCK_APP(app); - XtCheckSubclass(parent, compositeWidgetClass, "in XtCreateManagedWidget"); - widget = _XtCreateWidget((String)name, widget_class, parent, args, - num_args, (XtTypedArgList)NULL, (Cardinal) 0); - XtManageChild(widget); - UNLOCK_APP(app); - return widget; -} - -static void -popupPostProc(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( - 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); -} - -Widget -XtCreatePopupShell( - _Xconst char* name, - WidgetClass widget_class, - Widget parent, - ArgList args, - Cardinal num_args - ) -{ - Widget retval; - WIDGET_TO_APPCON(parent); - - LOCK_APP(app); - retval = _XtCreatePopupShell((String)name, widget_class, parent, args, - num_args, (XtTypedArgList)NULL, (Cardinal)0); - UNLOCK_APP(app); - return retval; -} - -Widget -_XtAppCreateShell( - String name, - String 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; -} - -Widget -XtAppCreateShell( - _Xconst char* name, - _Xconst char* class, - WidgetClass widget_class, - Display *display, - ArgList args, - Cardinal num_args - ) -{ - Widget retval; - DPY_TO_APPCON(display); - - LOCK_APP(app); - retval = _XtAppCreateShell((String)name, (String)class, widget_class, - display, args, num_args, (XtTypedArgList)NULL, (Cardinal)0); - UNLOCK_APP(app); - return retval; -} - -/* ARGSUSED */ -Widget -XtCreateApplicationShell( - _Xconst char* name, /* unused in R3 and later */ - WidgetClass widget_class, - ArgList args, - Cardinal num_args - ) -{ - 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) -{ - 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/nx-X11/lib/Xt/CreateI.h b/nx-X11/lib/Xt/CreateI.h deleted file mode 100644 index 87abb1d2d..000000000 --- a/nx-X11/lib/Xt/CreateI.h +++ /dev/null @@ -1,37 +0,0 @@ -/* $XFree86$ */ - -#ifndef _XtcreateI_h -#define _XtcreateI_h - -extern Widget _XtCreateWidget(String name, WidgetClass widget_class, - Widget parent, ArgList args, Cardinal num_args, - XtTypedArgList typed_args, - Cardinal num_typed_args); -extern Widget _XtCreatePopupShell(String name, WidgetClass widget_class, - Widget parent, ArgList args, - Cardinal num_args, XtTypedArgList typed_args, - Cardinal num_typed_args); -extern Widget _XtAppCreateShell(String name, String class, - WidgetClass widget_class, Display *display, - ArgList args, Cardinal num_args, - XtTypedArgList typed_args, - Cardinal num_typed_args); -extern Widget _XtCreateHookObj(Screen *screen); - - -#include - -/* VarCreate.c */ -extern 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); -extern 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); - -#endif /* _XtcreateI_h */ diff --git a/nx-X11/lib/Xt/Destroy.c b/nx-X11/lib/Xt/Destroy.c deleted file mode 100644 index 60f1b277f..000000000 --- a/nx-X11/lib/Xt/Destroy.c +++ /dev/null @@ -1,374 +0,0 @@ -/* $Xorg: Destroy.c,v 1.4 2001/02/09 02:03:54 xorgcvs Exp $ */ - -/*********************************************************** -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/Destroy.c,v 1.2 2001/08/22 22:52:18 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" - -struct _DestroyRec { - int dispatch_level; - Widget widget; -}; - -static void Recursive(Widget widget, XtWidgetProc proc) -{ - register Cardinal 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 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) -{ - if (widget->core.destroy_callbacks != NULL) { - XtCallCallbackList(widget, - widget->core.destroy_callbacks, (XtPointer) NULL); - } -} /* Phase2Callbacks */ - -static void Phase2Destroy(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 widget, Widget root) -{ - while ((widget = XtParent(widget)) != root) { - if (widget == NULL) return False; - } - return True; -} - -static void XtPhase2Destroy (Widget widget) -{ - Display *display = NULL; - 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) { - Cardinal 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", - ¶m, &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; - } - 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) { - Cardinal 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(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) -{ - 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/nx-X11/lib/Xt/Display.c b/nx-X11/lib/Xt/Display.c deleted file mode 100644 index 2812aa81e..000000000 --- a/nx-X11/lib/Xt/Display.c +++ /dev/null @@ -1,763 +0,0 @@ -/* $Xorg: Display.c,v 1.6 2001/02/09 02:03:54 xorgcvs Exp $ */ - -/*********************************************************** -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.15 2002/09/18 01:25:01 dawes Exp $ */ - -/* - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#ifndef X_NO_RESOURCE_CONFIGURATION_MANAGEMENT -#include "ResConfigP.h" -#endif - -#include - -#ifdef XTHREADS -void (*_XtProcessLock)(void) = NULL; -void (*_XtProcessUnlock)(void) = NULL; -void (*_XtInitAppLock)(XtAppContext) = NULL; -#endif - -static String XtNnoPerDisplay = "noPerDisplay"; - -ProcessContext _XtGetProcessContext(void) -{ - static ProcessContextRec processContextRec = { - (XtAppContext)NULL, - (XtAppContext)NULL, - (ConverterTable)NULL, - {(XtLanguageProc)NULL, (XtPointer)NULL} - }; - - return &processContextRec; -} - - -XtAppContext _XtDefaultAppContext(void) -{ - ProcessContext process = _XtGetProcessContext(); - XtAppContext app; - - LOCK_PROCESS; - if (process->defaultAppContext == NULL) { - process->defaultAppContext = XtCreateApplicationContext(); - } - app = process->defaultAppContext; - UNLOCK_PROCESS; - return app; -} - -static void AddToAppContext( - 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( - 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; -#ifndef USE_POLL - if ((ConnectionNumber(d) + 1) == app->fds.nfds) - app->fds.nfds--; - else /* Unnecessary, just to be fool-proof */ - FD_CLR(ConnectionNumber(d), &app->fds.rmask); -#else - app->fds.nfds--; -#endif -} - -static XtPerDisplay NewPerDisplay( - 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( - Display *dpy, - XtAppContext app, - _Xconst char * name, - _Xconst char * classname) -{ - 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; -} - -Display *XtOpenDisplay( - XtAppContext app, - _Xconst char* displayName, - _Xconst char* applName, - _Xconst char* className, - XrmOptionDescRec *urlist, - Cardinal num_urs, - int *argc, - String *argv) -{ - 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, - (String *)&applName, - (String *)(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 __UNIXOS2__ - 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( - XtAppContext * app_context_return, - String application_class, - XrmOptionDescRec *options, - Cardinal num_options, - int *argc_in_out, - String **argv_in_out, - String * 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", ¶m, ¶m_count); - XtFree((char *) (*app_context_return)->display_name_tried); - } - *argv_in_out = saved_argv; - UNLOCK_APP((*app_context_return)); - return dpy; -} - -void -XtDisplayInitialize( - XtAppContext app, - Display *dpy, - _Xconst char* name, - _Xconst char* classname, - XrmOptionDescRec *urlist, - Cardinal num_urs, - int *argc, - String *argv - ) -{ - 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(void) -{ - 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; -} - -void XtAppSetExitFlag ( - XtAppContext app) -{ - LOCK_APP(app); - app->exit_flag = TRUE; - UNLOCK_APP(app); -} - -Boolean XtAppGetExitFlag ( - XtAppContext app) -{ - Boolean retval; - LOCK_APP(app); - retval = app->exit_flag; - UNLOCK_APP(app); - return retval; -} - -static void DestroyAppContext(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(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(void) -{ - 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(Display *dpy) -{ - XrmDatabase retval; - DPY_TO_APPCON(dpy); - - LOCK_APP(app); - retval = XrmGetDatabase(dpy); - UNLOCK_APP(app); - return retval; -} - -PerDisplayTablePtr _XtperDisplayList = NULL; - -XtPerDisplay _XtSortPerDisplayList(Display *dpy) -{ - register PerDisplayTablePtr pd, opd = NULL; - - 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(Display *dpy) -{ - XtAppContext retval; - - retval = _XtGetPerDisplay(dpy)->appContext; - return retval; -} - -static void CloseDisplay(Display *dpy) -{ - register XtPerDisplay xtpd; - register PerDisplayTablePtr pd, opd = NULL; - XrmDatabase db; - int i; - - 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) { - 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(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); -} - -void _XtCloseDisplays(XtAppContext app) -{ - 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(Widget w) -{ - XtAppContext retval; - - retval = _XtGetPerDisplay(XtDisplayOfObject(w))->appContext; - return retval; -} - - -void XtGetApplicationNameAndClass( - Display *dpy, - String *name_return, - String *class_return) -{ - XtPerDisplay pd; - - pd = _XtGetPerDisplay(dpy); - *name_return = XrmQuarkToString(pd->name); - *class_return = XrmQuarkToString(pd->class); -} - -XtPerDisplay _XtGetPerDisplay (Display* display) -{ - XtPerDisplay retval; - - LOCK_PROCESS; - retval = ((_XtperDisplayList != NULL && - _XtperDisplayList->dpy == display) - ? &_XtperDisplayList->perDpy - : _XtSortPerDisplayList(display)); - UNLOCK_PROCESS; - return retval; -} - -XtPerDisplayInputRec* _XtGetPerDisplayInput(Display* display) -{ - XtPerDisplayInputRec* retval; - LOCK_PROCESS; - retval = ((_XtperDisplayList != NULL && - _XtperDisplayList->dpy == display) - ? &_XtperDisplayList->perDpy.pdi - : &_XtSortPerDisplayList(display)->pdi); - UNLOCK_PROCESS; - return retval; -} - -void XtGetDisplays( - XtAppContext app_context, - Display*** dpy_return, - Cardinal* num_dpy_return) -{ - 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/nx-X11/lib/Xt/Error.c b/nx-X11/lib/Xt/Error.c deleted file mode 100644 index b1badc970..000000000 --- a/nx-X11/lib/Xt/Error.c +++ /dev/null @@ -1,636 +0,0 @@ -/* $Xorg: Error.c,v 1.5 2001/02/09 02:03:54 xorgcvs Exp $ */ - -/*********************************************************** -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.13tsi Exp $ */ - -/* - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include -#include - -/* 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(XrmDatabase *); -#if GLOBALERRORS -static XrmDatabase errorDB = NULL; -static Boolean error_inited = FALSE; -void _XtDefaultErrorMsg(String, String, String, String, String*, Cardinal*); -void _XtDefaultWarningMsg(String, String, String, String, String*, Cardinal*); -void _XtDefaultError(String); -void _XtDefaultWarning(String); -static XtErrorMsgHandler errorMsgHandler = _XtDefaultErrorMsg; -static XtErrorMsgHandler warningMsgHandler = _XtDefaultWarningMsg; -static XtErrorHandler errorHandler = _XtDefaultError; -static XtErrorHandler warningHandler = _XtDefaultWarning; -#endif /* GLOBALERRORS */ - -XrmDatabase *XtGetErrorDatabase(void) -{ - XrmDatabase* retval; -#if GLOBALERRORS - LOCK_PROCESS; - retval = &errorDB; - UNLOCK_PROCESS; -#else - retval = XtAppGetErrorDatabase(_XtDefaultAppContext()); -#endif /* GLOBALERRORS */ - return retval; -} - -XrmDatabase *XtAppGetErrorDatabase( - 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; -} - -void XtGetErrorDatabaseText( - register _Xconst char* name, - register _Xconst char* type, - register _Xconst char* class, - _Xconst char* defaultp, - String buffer, - int nbytes) -{ -#if GLOBALERRORS - XtAppGetErrorDatabaseText(NULL, - name,type,class,defaultp, buffer, nbytes, NULL); -#else - XtAppGetErrorDatabaseText(_XtDefaultAppContext(), - name,type,class,defaultp, buffer, nbytes, NULL); -#endif /* GLOBALERRORS */ -} - -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) -{ - 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 > (unsigned) 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 ( - XrmDatabase *db) -{ - XrmDatabase errordb; - - errordb = XrmGetFileDatabase(ERRORDB); - XrmMergeDatabases(errordb, db); -} - -static void DefaultMsg ( - String name, - String type, - String class, - String defaultp, - String* params, - Cardinal* num_params, - Bool error, - void (*fn)(_Xconst _XtString)) -{ -#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. - */ - Cardinal 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! :-) - */ - Cardinal 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 ( - String name, - String type, - String class, - String defaultp, - String* params, - Cardinal* num_params) -{ - DefaultMsg (name,type,class,defaultp,params,num_params,True,XtError); -} - -void _XtDefaultWarningMsg ( - String name, - String type, - String class, - String defaultp, - String* params, - Cardinal* num_params) -{ - DefaultMsg (name,type,class,defaultp,params,num_params,False,XtWarning); -} - -void XtErrorMsg( - _Xconst char* name, - _Xconst char* type, - _Xconst char* class, - _Xconst char* defaultp, - String* params, - Cardinal* num_params) -{ -#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 */ -} - -void XtAppErrorMsg( - XtAppContext app, - _Xconst char* name, - _Xconst char* type, - _Xconst char* class, - _Xconst char* defaultp, - String* params, - Cardinal* num_params) -{ -#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 */ -} - -void XtWarningMsg( - _Xconst char* name, - _Xconst char* type, - _Xconst char* class, - _Xconst char* defaultp, - String* params, - Cardinal* num_params) -{ -#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 */ -} - -void XtAppWarningMsg( - XtAppContext app, - _Xconst char* name, - _Xconst char* type, - _Xconst char* class, - _Xconst char* defaultp, - String* params, - Cardinal* num_params) -{ -#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( - XtErrorMsgHandler handler) -{ -#if GLOBALERRORS - LOCK_PROCESS; - if (handler != NULL) errorMsgHandler = handler; - else errorMsgHandler = _XtDefaultErrorMsg; - UNLOCK_PROCESS; -#else - XtAppSetErrorMsgHandler(_XtDefaultAppContext(), handler); -#endif /* GLOBALERRORS */ -} - -XtErrorMsgHandler XtAppSetErrorMsgHandler( - XtAppContext app, - XtErrorMsgHandler handler) -{ - 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( - XtErrorMsgHandler handler) -{ -#if GLOBALERRORS - LOCK_PROCESS; - if (handler != NULL) warningMsgHandler = handler; - else warningMsgHandler = _XtDefaultWarningMsg; - UNLOCK_PROCESS; -#else - XtAppSetWarningMsgHandler(_XtDefaultAppContext(),handler); -#endif /* GLOBALERRORS */ -} - -XtErrorMsgHandler XtAppSetWarningMsgHandler( - XtAppContext app, - XtErrorMsgHandler handler) -{ - 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(String message) -{ - if (message && *message) - (void)fprintf(stderr, "%sError: %s\n", XTERROR_PREFIX, message); - exit(1); -} - -void _XtDefaultWarning(String message) -{ - if (message && *message) - (void)fprintf(stderr, "%sWarning: %s\n", XTWARNING_PREFIX, message); - return; -} - -void XtError( - _Xconst char* message) -{ -#if GLOBALERRORS - LOCK_PROCESS; - (*errorHandler)((String)message); - UNLOCK_PROCESS; -#else - XtAppError(_XtDefaultAppContext(),message); -#endif /* GLOBALERRORS */ -} - -void XtAppError( - XtAppContext app, - _Xconst char* message) -{ -#if GLOBALERRORS - LOCK_PROCESS; - (*errorHandler)((String)message); - UNLOCK_PROCESS; -#else - LOCK_APP(app); - (*app->errorHandler)(message); - UNLOCK_APP(app); -#endif /* GLOBALERRORS */ -} - -void XtWarning( - _Xconst char* message) -{ -#if GLOBALERRORS - LOCK_PROCESS; - (*warningHandler)((String)message); - UNLOCK_PROCESS; -#else - XtAppWarning(_XtDefaultAppContext(),message); -#endif /* GLOBALERRORS */ -} - -void XtAppWarning( - XtAppContext app, - _Xconst char* message) -{ -#if GLOBALERRORS - LOCK_PROCESS; - (*warningHandler)((String)message); - UNLOCK_PROCESS; -#else - LOCK_APP(app); - (*app->warningHandler)(message); - UNLOCK_APP(app); -#endif /* GLOBALERRORS */ -} - -void XtSetErrorHandler(XtErrorHandler handler) -{ -#if GLOBALERRORS - LOCK_PROCESS; - if (handler != NULL) errorHandler = handler; - else errorHandler = _XtDefaultError; - UNLOCK_PROCESS; -#else - XtAppSetErrorHandler(_XtDefaultAppContext(),handler); -#endif /* GLOBALERRORS */ -} - -XtErrorHandler XtAppSetErrorHandler( - XtAppContext app, - XtErrorHandler handler) -{ - 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; -} - -void XtSetWarningHandler(XtErrorHandler handler) -{ -#if GLOBALERRORS - LOCK_PROCESS; - if (handler != NULL) warningHandler = handler; - else warningHandler = _XtDefaultWarning; - UNLOCK_PROCESS; -#else - XtAppSetWarningHandler(_XtDefaultAppContext(),handler); -#endif /* GLOBALERRORS */ -} - -XtErrorHandler XtAppSetWarningHandler( - XtAppContext app, - XtErrorHandler handler) -{ - 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( - XtErrorMsgHandler *errMsg, - XtErrorMsgHandler *warnMsg, - XtErrorHandler *err, - XtErrorHandler *warn) -{ -#ifndef GLOBALERRORS - LOCK_PROCESS; - *errMsg = _XtDefaultErrorMsg; - *warnMsg = _XtDefaultWarningMsg; - *err = _XtDefaultError; - *warn = _XtDefaultWarning; - UNLOCK_PROCESS; -#endif /* GLOBALERRORS */ -} diff --git a/nx-X11/lib/Xt/Event.c b/nx-X11/lib/Xt/Event.c deleted file mode 100644 index 1d564f970..000000000 --- a/nx-X11/lib/Xt/Event.c +++ /dev/null @@ -1,1731 +0,0 @@ -/* $Xorg: Event.c,v 1.5 2001/02/09 02:03:54 xorgcvs Exp $ */ - -/*********************************************************** -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/Event.c,v 3.10 2001/12/14 19:56:11 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include "Shell.h" -#include "StringDefs.h" - -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) -{ - 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) { - Cardinal 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 widget, - ExtSelectRec* rec, - Boolean forceCall) -{ - XtEventRec* p; - XtPointer* data; - int* types; - Cardinal 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 widget, - XtPointer select_data, - int type, - Boolean has_type_specifier, - Boolean 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 { - Cardinal 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 widget, - XtPointer select_data, - int type, - Boolean has_type_specifier, - Boolean other, - XtEventHandler proc, - XtPointer closure, - XtListPosition position, - Boolean force_new_position, - Boolean raw) -{ - register XtEventRec *p, **pp; - EventMask oldMask = 0, eventMask = 0; - - 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 { - Cardinal 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; - } - } - } -} - -void XtRemoveEventHandler( - Widget widget, - EventMask eventMask, - _XtBoolean other, - XtEventHandler proc, - XtPointer closure) -{ - WIDGET_TO_APPCON(widget); - LOCK_APP(app); - RemoveEventHandler(widget, (XtPointer) &eventMask, 0, FALSE, - other, proc, closure, FALSE); - UNLOCK_APP(app); -} - -void XtAddEventHandler( - Widget widget, - EventMask eventMask, - _XtBoolean other, - XtEventHandler proc, - XtPointer closure) -{ - WIDGET_TO_APPCON(widget); - LOCK_APP(app); - AddEventHandler(widget, (XtPointer) &eventMask, 0, FALSE, other, - proc, closure, XtListTail, FALSE, FALSE); - UNLOCK_APP(app); -} - -void XtInsertEventHandler( - Widget widget, - EventMask eventMask, - _XtBoolean other, - XtEventHandler proc, - XtPointer closure, - XtListPosition position) -{ - WIDGET_TO_APPCON(widget); - LOCK_APP(app); - AddEventHandler(widget, (XtPointer) &eventMask, 0, FALSE, other, - proc, closure, position, TRUE, FALSE); - UNLOCK_APP(app); -} - -void XtRemoveRawEventHandler( - Widget widget, - EventMask eventMask, - _XtBoolean other, - XtEventHandler proc, - XtPointer closure) -{ - WIDGET_TO_APPCON(widget); - LOCK_APP(app); - RemoveEventHandler(widget, (XtPointer) &eventMask, 0, FALSE, - other, proc, closure, TRUE); - UNLOCK_APP(app); -} - -void XtInsertRawEventHandler( - Widget widget, - EventMask eventMask, - _XtBoolean other, - XtEventHandler proc, - XtPointer closure, - XtListPosition position) -{ - WIDGET_TO_APPCON(widget); - LOCK_APP(app); - AddEventHandler(widget, (XtPointer) &eventMask, 0, FALSE, other, - proc, closure, position, TRUE, TRUE); - UNLOCK_APP(app); -} - -void XtAddRawEventHandler( - Widget widget, - EventMask eventMask, - _XtBoolean other, - XtEventHandler proc, - XtPointer closure) -{ - WIDGET_TO_APPCON(widget); - LOCK_APP(app); - AddEventHandler(widget, (XtPointer) &eventMask, 0, FALSE, other, - proc, closure, XtListTail, FALSE, TRUE); - UNLOCK_APP(app); -} - -void XtRemoveEventTypeHandler( - Widget widget, - int type, - XtPointer select_data, - XtEventHandler proc, - XtPointer closure) -{ - WIDGET_TO_APPCON(widget); - LOCK_APP(app); - RemoveEventHandler(widget, select_data, type, TRUE, - FALSE, proc, closure, FALSE); - UNLOCK_APP(app); -} - -void XtInsertEventTypeHandler( - Widget widget, - int type, - XtPointer select_data, - XtEventHandler proc, - XtPointer closure, - XtListPosition position) -{ - 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(WWTable); - -void XtRegisterDrawable( - 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* 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( - register WWTable tab) -{ - unsigned int oldmask; - register Widget *oldentries, *entries; - register Cardinal 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( - 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( - 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( - 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 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(XEvent *, Widget); - -#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 - -Boolean XtDispatchEventToWidget( - Widget widget, - XEvent* event) -{ - 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(XEvent *, Widget, XtPerDisplay); -static Bool CheckExposureEvent(Display *, XEvent *, char *); -static void AddExposureToRectangularRegion(XEvent *, Region); - -/* 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( -XEvent * event, -Widget widget) -{ - 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( - 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( - 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(void) -{ -#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( -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( -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 ( - int eventType) -{ - if ((Cardinal) eventType < XtNumber(masks)) - return masks[eventType]; - else - return NoEventMask; -} - -Boolean _XtOnGrabList( - 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( - 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( - 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( - 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; - - 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 ( - 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 widget, - XtPointer closure, - XtPointer call_data) -{ - /* Remove widget from grab list if it destroyed */ - XtRemoveGrab(widget); -} - -static XtGrabRec *NewGrabRec( - 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; -} - -void XtAddGrab( - Widget widget, - _XtBoolean exclusive, - _XtBoolean spring_loaded) -{ - 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) -{ - 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(void) -{ - XtAppMainLoop(_XtDefaultAppContext()); -} - -void XtAppMainLoop( - 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( - XtEventTable *event_table) -{ - register XtEventTable event; - - event = *event_table; - while (event != NULL) { - register XtEventTable next = event->next; - XtFree((char *) event); - event = next; - } -} - -Time XtLastTimestampProcessed( - 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( - 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( - 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(void) -{ - XtEventDispatchProc* l = - (XtEventDispatchProc*) __XtCalloc((Cardinal) 128, - (Cardinal)sizeof(XtEventDispatchProc)); - return l; -} - -XtEventDispatchProc XtSetEventDispatcher( - Display *dpy, - int event_type, - XtEventDispatchProc proc) -{ - 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; -} - -void XtRegisterExtensionSelector( - Display *dpy, - int min_event_type, - int max_event_type, - XtExtensionSelectProc proc, - XtPointer client_data) -{ - 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) -{ - 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/nx-X11/lib/Xt/EventI.h b/nx-X11/lib/Xt/EventI.h deleted file mode 100644 index 00858e71e..000000000 --- a/nx-X11/lib/Xt/EventI.h +++ /dev/null @@ -1,134 +0,0 @@ -/* $Xorg: EventI.h,v 1.4 2001/02/09 02:03:54 xorgcvs Exp $ */ -/* $oHeader: EventI.h,v 1.3 88/08/24 09:21:11 asente Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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/EventI.h,v 1.3 2001/12/14 19:56:12 dawes Exp $ */ - -/* - * 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; - -#include "PassivGraI.h" - -extern void _XtEventInitialize( - void -); - -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( - XtEventTable* /* event_table */ -); - -extern Boolean _XtOnGrabList( - Widget /* widget */, - XtGrabRec* /* grabList */ -); - -extern void _XtRemoveAllInputs( - XtAppContext /* app */ -); - -extern void _XtRefreshMapping( - XEvent* /* event */, - _XtBoolean /* dispatch */ -); - -extern void _XtSendFocusEvent( - Widget /* child */, - int /* type */); - -extern EventMask _XtConvertTypeToMask( - int /* eventType */ -); - -/* EventUtil.c */ -extern Widget _XtFindRemapWidget(XEvent *event, Widget widget, - EventMask mask, XtPerDisplayInput pdi); -extern void _XtUngrabBadGrabs(XEvent *event, Widget widget, - EventMask mask, XtPerDisplayInput pdi); -extern void _XtFillAncestorList(Widget **listPtr, int *maxElemsPtr, - int *numElemsPtr, Widget start, - Widget breakWidget); - -/* NextEvent.c */ -extern Boolean XtAppPeekEvent_SkipTimer; - -#endif /* _Event_h_ */ diff --git a/nx-X11/lib/Xt/EventUtil.c b/nx-X11/lib/Xt/EventUtil.c deleted file mode 100644 index 929d83dc1..000000000 --- a/nx-X11/lib/Xt/EventUtil.c +++ /dev/null @@ -1,221 +0,0 @@ -/* $Xorg: EventUtil.c,v 1.4 2001/02/09 02:03:54 xorgcvs Exp $ */ - -/******************************************************** - -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/EventUtil.c,v 1.6 2001/12/14 19:56:13 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include "PassivGraI.h" -#include "StringDefs.h" -#include "EventI.h" - -static XContext perWidgetInputContext = 0; - -void _XtFreePerWidgetInput( - 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. - */ -XtPerWidgetInput _XtGetPerWidgetInput( - Widget widget, - _XtBoolean create) -{ - 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( - Widget **listPtr, - int *maxElemsPtr, - int *numElemsPtr, - Widget start, - Widget 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 == (Cardinal) *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( - 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( - 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/nx-X11/lib/Xt/Functions.c b/nx-X11/lib/Xt/Functions.c deleted file mode 100644 index 074a60f4c..000000000 --- a/nx-X11/lib/Xt/Functions.c +++ /dev/null @@ -1,216 +0,0 @@ -/* $Xorg: Functions.c,v 1.4 2001/02/09 02:03:54 xorgcvs Exp $ */ - -/* - -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include -#include - -/* - * This file defines functional equivalents to all macros defined - * in Intrinsic.h - * - */ - -#undef XtIsRectObj -Boolean XtIsRectObj(Widget object) -{ - return _XtCheckSubclassFlag(object, 0x02); -} - - -#undef XtIsWidget -Boolean XtIsWidget(Widget object) -{ - return _XtCheckSubclassFlag(object, 0x04); -} - - -#undef XtIsComposite -Boolean XtIsComposite(Widget object) -{ - return _XtCheckSubclassFlag(object, 0x08); -} - - -#undef XtIsConstraint -Boolean XtIsConstraint(Widget object) -{ - return _XtCheckSubclassFlag(object, 0x10); -} - - -#undef XtIsShell -Boolean XtIsShell(Widget object) -{ - return _XtCheckSubclassFlag(object, 0x20); -} - - -#undef XtIsOverrideShell -Boolean XtIsOverrideShell(Widget object) -{ - return _XtIsSubclassOf(object, (WidgetClass)overrideShellWidgetClass, - (WidgetClass)shellWidgetClass, 0x20); -} - - -#undef XtIsWMShell -Boolean XtIsWMShell(Widget object) -{ - return _XtCheckSubclassFlag(object, 0x40); -} - - -#undef XtIsVendorShell -Boolean XtIsVendorShell(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(Widget object) -{ - return _XtIsSubclassOf(object, (WidgetClass)transientShellWidgetClass, - (WidgetClass)wmShellWidgetClass, 0x40); -} - - -#undef XtIsTopLevelShell -Boolean XtIsTopLevelShell(Widget object) -{ - return _XtCheckSubclassFlag(object, 0x80); -} - - -#undef XtIsApplicationShell -Boolean XtIsApplicationShell(Widget object) -{ - return _XtIsSubclassOf(object, (WidgetClass)applicationShellWidgetClass, - (WidgetClass)topLevelShellWidgetClass, 0x80); -} - -#undef XtIsSessionShell -Boolean XtIsSessionShell(Widget object) -{ - return _XtIsSubclassOf(object, (WidgetClass)sessionShellWidgetClass, - (WidgetClass)topLevelShellWidgetClass, 0x80); -} - -#undef XtMapWidget -void XtMapWidget(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(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(String str) -{ - if (str == NULL) - return NULL; - else - return strcpy(__XtMalloc((unsigned)strlen(str) + 1), str); -} diff --git a/nx-X11/lib/Xt/GCManager.c b/nx-X11/lib/Xt/GCManager.c deleted file mode 100644 index c09cb229b..000000000 --- a/nx-X11/lib/Xt/GCManager.c +++ /dev/null @@ -1,353 +0,0 @@ -/* $Xorg: GCManager.c,v 1.5 2001/02/09 02:03:54 xorgcvs Exp $ */ - -/*********************************************************** -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/GCManager.c,v 1.5 2001/08/22 22:52:18 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#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( - 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, ~0UL); - CHECK(GCFillStyle, fill_style, FillSolid); - CHECK(GCLineWidth, line_width, 0); - CHECK(GCFunction, function, GXcopy); - CHECK(GCGraphicsExposures, graphics_exposures, True); - CHECK(GCTile, tile, ~0UL); - 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, ~0UL); - 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( - 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( - 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 == (Cardinal) 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( - register Widget widget, - XtGCMask valueMask, - XGCValues *values) -{ - return XtAllocateGC(widget, 0, valueMask, values, 0, 0); -} /* XtGetGC */ - -void XtReleaseGC( - 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(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/nx-X11/lib/Xt/Geometry.c b/nx-X11/lib/Xt/Geometry.c deleted file mode 100644 index b183bfd76..000000000 --- a/nx-X11/lib/Xt/Geometry.c +++ /dev/null @@ -1,817 +0,0 @@ -/* $Xorg: Geometry.c,v 1.5 2001/02/09 02:03:54 xorgcvs Exp $ */ - -/*********************************************************** -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/Geometry.c,v 1.12 2001/12/14 19:56:15 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include "ShellP.h" -#include "ShellI.h" - -static void ClearRectObjAreas( - 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 widget, - XtWidgetGeometry *request, - XtWidgetGeometry *reply, - Boolean * clear_rect_obj) -{ - XtWidgetGeometry junk; - XtGeometryHandler manager = (XtGeometryHandler) NULL; - 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); - - managed = XtIsManaged(widget); - parentRealized = XtIsRealized(parent); - if (XtIsComposite(parent)) - { - LOCK_PROCESS; - manager = ((CompositeWidgetClass) (parent->core.widget_class)) - ->composite_class.geometry_manager; - UNLOCK_PROCESS; - } - } - -#if 0 - /* - * The Xt spec says that these conditions must generate - * error messages (not warnings), but many Xt applications - * and toolkits (including parts of Xaw, Motif and Netscape) - * depend on the previous Xt behaviour. Thus, these tests - * should probably remain disabled. - */ - if (parentRealized && managed) { - if (parent && !XtIsComposite(parent)) - { - /* - * 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. - */ - XtAppErrorMsg(XtWidgetToApplicationContext(widget), - "invalidParent", "xtMakeGeometryRequest", - XtCXtToolkitError, - "XtMakeGeometryRequest - parent not composite", - (String *)NULL, (Cardinal *)NULL); - } - else if (manager == (XtGeometryHandler) NULL) - { - XtAppErrorMsg(XtWidgetToApplicationContext(widget), - "invalidGeometryManager","xtMakeGeometryRequest", - XtCXtToolkitError, - "XtMakeGeometryRequest - parent has no geometry manager", - (String *)NULL, (Cardinal *)NULL); - } - } -#else - if (!manager) - managed = False; -#endif - - 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 widget, - XtWidgetGeometry *request, - XtWidgetGeometry *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); -} - -XtGeometryResult -XtMakeResizeRequest( - Widget widget, - _XtDimension width, - _XtDimension height, - Dimension *replyWidth, - Dimension *replyHeight) -{ - 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( - Widget w) -{ - XtConfigureHookDataRec req; - Widget hookobj; - WIDGET_TO_APPCON(w); - - LOCK_APP(app); - if (XtIsRealized(w)) { - 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 */ - -void XtResizeWidget( - Widget w, - _XtDimension width, - _XtDimension height, - _XtDimension borderWidth) -{ - XtConfigureWidget(w, w->core.x, w->core.y, width, height, borderWidth); -} /* XtResizeWidget */ - -void XtConfigureWidget( - Widget w, - _XtPosition x, - _XtPosition y, - _XtDimension width, - _XtDimension height, - _XtDimension borderWidth) -{ - 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 */ - -void XtMoveWidget( - Widget w, - _XtPosition x, - _XtPosition y) -{ - XtConfigureWidget(w, x, y, w->core.width, w->core.height, - w->core.border_width); -} /* XtMoveWidget */ - -void XtTranslateCoords( - register Widget w, - _XtPosition x, - _XtPosition y, - register Position *rootx, /* return */ - register Position *rooty) /* return */ -{ - 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; - _XtShellGetCoordinates( w, &x, &y ); - *rootx += x + w->core.border_width; - *rooty += y + w->core.border_width; - } - UNLOCK_APP(app); -} - -XtGeometryResult XtQueryGeometry( - 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/nx-X11/lib/Xt/GetActKey.c b/nx-X11/lib/Xt/GetActKey.c deleted file mode 100644 index 20cae5efe..000000000 --- a/nx-X11/lib/Xt/GetActKey.c +++ /dev/null @@ -1,102 +0,0 @@ -/* $Xorg: GetActKey.c,v 1.4 2001/02/09 02:03:55 xorgcvs Exp $ */ - -/*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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" - -KeySym XtGetActionKeysym( - 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/nx-X11/lib/Xt/GetResList.c b/nx-X11/lib/Xt/GetResList.c deleted file mode 100644 index 8f99398d7..000000000 --- a/nx-X11/lib/Xt/GetResList.c +++ /dev/null @@ -1,193 +0,0 @@ -/* $Xorg: GetResList.c,v 1.4 2001/02/09 02:03:55 xorgcvs Exp $ */ - -/*********************************************************** -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.5 2001/08/22 22:52:18 dawes Exp $ */ - -/* - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include "Intrinsic.h" - -/* - * XtGetResourceList(), XtGetConstraintResourceList() - */ - -#define TOXRMQUARK(p) ((XrmQuark)(long)(p)) /* avoid LP64 warnings */ - -void XtGetResourceList( - WidgetClass widget_class, - XtResourceList *resources, - Cardinal *num_resources) -{ - int size; - register Cardinal 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(WidgetClass class, WidgetClass superclass) -{ - for (; class != NULL; class = class->core_class.superclass) { - if (class == superclass) return True; - } - return False; -} - -void XtGetConstraintResourceList( - WidgetClass widget_class, - XtResourceList *resources, - Cardinal *num_resources) -{ - int size; - register Cardinal 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/nx-X11/lib/Xt/GetValues.c b/nx-X11/lib/Xt/GetValues.c deleted file mode 100644 index f6b8e1f3b..000000000 --- a/nx-X11/lib/Xt/GetValues.c +++ /dev/null @@ -1,251 +0,0 @@ -/* $Xorg: GetValues.c,v 1.4 2001/02/09 02:03:55 xorgcvs Exp $ */ -/*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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/GetValues.c,v 1.2 2001/08/22 22:52:18 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include "StringDefs.h" - -static int GetValues( - 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 Cardinal 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( - 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( - 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( - 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( - 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/nx-X11/lib/Xt/HookObj.c b/nx-X11/lib/Xt/HookObj.c deleted file mode 100644 index f4ac749b2..000000000 --- a/nx-X11/lib/Xt/HookObj.c +++ /dev/null @@ -1,137 +0,0 @@ -/* $Xorg: HookObj.c,v 1.4 2001/02/09 02:03:55 xorgcvs Exp $ */ - -/* - -Copyright 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/HookObj.c,v 1.2 2001/08/22 22:52:18 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#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(Widget widget, ArgList args, Cardinal *num_args); -static void Initialize(Widget req, Widget new, ArgList args, - Cardinal *num_args); - -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( - Widget w, - XtPointer closure, - XtPointer call_data) -{ - HookObject h = (HookObject)w; - if (h->hooks.shells != NULL) - XtFree((char*)h->hooks.shells); -} - -static void Initialize( - Widget req, - Widget 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 widget, - ArgList args, - Cardinal* num_args) -{ - /* get the XtNshells and XtNnumShells pseudo-resources */ -} diff --git a/nx-X11/lib/Xt/HookObjI.h b/nx-X11/lib/Xt/HookObjI.h deleted file mode 100644 index c9a22a256..000000000 --- a/nx-X11/lib/Xt/HookObjI.h +++ /dev/null @@ -1,71 +0,0 @@ -/* $Xorg: HookObjI.h,v 1.4 2001/02/09 02:03:55 xorgcvs Exp $ */ - -/* - -Copyright 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/nx-X11/lib/Xt/Hooks.c b/nx-X11/lib/Xt/Hooks.c deleted file mode 100644 index 05b67ce05..000000000 --- a/nx-X11/lib/Xt/Hooks.c +++ /dev/null @@ -1,158 +0,0 @@ -/* $Xorg: Hooks.c,v 1.4 2001/02/09 02:03:55 xorgcvs Exp $ */ - -/* - -Copyright 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/Hooks.c,v 1.3 2001/12/14 19:56:18 dawes Exp $ */ - -/*LINTLIBRARY*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include "CreateI.h" - -static void FreeBlockHookList( - 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( - 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( - 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( - Widget shell, - XtPointer closure, - XtPointer call_data) -{ - /* app_con is locked when this function is called */ - Cardinal 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 - -void _XtAddShellToHookObj( - Widget shell) -{ - /* 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); -} - -Boolean _XtIsHookObject( - Widget widget) -{ - return (widget->core.widget_class == hookObjectClass); -} - -Widget XtHooksOfDisplay( - Display* dpy) -{ - 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/nx-X11/lib/Xt/Imakefile b/nx-X11/lib/Xt/Imakefile deleted file mode 100644 index 6399e4618..000000000 --- a/nx-X11/lib/Xt/Imakefile +++ /dev/null @@ -1,307 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */ -/* */ -/* NX-X11, NX protocol compression and NX extensions to this software */ -/* are copyright of NoMachine. Redistribution and use of the present */ -/* software is allowed according to terms specified in the file LICENSE */ -/* which comes in the source distribution. */ -/* */ -/* Check http://www.nomachine.com/licensing.html for applicability. */ -/* */ -/* NX and NoMachine are trademarks of Medialogic S.p.A. */ -/* */ -/* All rights reserved. */ -/* */ -/**************************************************************************/ - -XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:46:12 cpqbld Exp $ - - - - -XCOMM $XFree86: xc/lib/Xt/Imakefile,v 3.18tsi Exp $ - -#if NXLibraries - -/* - * This will make applications that use the Xt - * toolkit deal with the NX modified select(). - */ - -NX_DEFINES = -DNX_TRANS_SOCKET - -# -DNX_TRANS_TEST \ -# -DNX_TRANS_DEBUG - -#endif - -#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 - -#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 - -#if NXLibraries - DEFINES = AllocateLocalDefines $(ALIGN_DEFINES) $(POLL_DEFINES) $(MISC_DEFINES) XtExtraDefines $(RCM_DEFINES) $(POPDOWN_DEFINES) $(NX_DEFINES) -#else - DEFINES = AllocateLocalDefines $(ALIGN_DEFINES) $(POLL_DEFINES) $(MISC_DEFINES) XtExtraDefines $(RCM_DEFINES) $(POPDOWN_DEFINES) -#endif - - 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 \ - \ - CallbackI.h \ - ConvertI.h \ - CreateI.h \ - EventI.h \ - HookObjI.h \ - InitialI.h \ - IntrinsicI.h \ - PassivGraI.h \ - ResourceI.h \ - SelectionI.h \ - ShellI.h \ - ThreadsI.h \ - TranslateI.h \ - VarargsI.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 - -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 -#if defined(ItsyCompilerBug) -SpecialCLibObjectRule(PassivGrab,$(_NOOP_),-O0) -#endif - -STRINGS_FILES = StringDefs.c StringDefs.h Shell.h -STRINGS_TMPLS = util/StrDefs.ct util/StrDefs.ht util/Shell.ht -STRING_LIST = util/string.list - -ToolkitMakeStrings($(STRINGS_FILES),$(STRING_LIST),$(STRINGSABIOPTIONS),$(STRINGS_TMPLS),StringDefs.c) - -DependTarget() diff --git a/nx-X11/lib/Xt/Imakefile.NX.original b/nx-X11/lib/Xt/Imakefile.NX.original deleted file mode 100644 index 6399e4618..000000000 --- a/nx-X11/lib/Xt/Imakefile.NX.original +++ /dev/null @@ -1,307 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */ -/* */ -/* NX-X11, NX protocol compression and NX extensions to this software */ -/* are copyright of NoMachine. Redistribution and use of the present */ -/* software is allowed according to terms specified in the file LICENSE */ -/* which comes in the source distribution. */ -/* */ -/* Check http://www.nomachine.com/licensing.html for applicability. */ -/* */ -/* NX and NoMachine are trademarks of Medialogic S.p.A. */ -/* */ -/* All rights reserved. */ -/* */ -/**************************************************************************/ - -XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:46:12 cpqbld Exp $ - - - - -XCOMM $XFree86: xc/lib/Xt/Imakefile,v 3.18tsi Exp $ - -#if NXLibraries - -/* - * This will make applications that use the Xt - * toolkit deal with the NX modified select(). - */ - -NX_DEFINES = -DNX_TRANS_SOCKET - -# -DNX_TRANS_TEST \ -# -DNX_TRANS_DEBUG - -#endif - -#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 - -#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 - -#if NXLibraries - DEFINES = AllocateLocalDefines $(ALIGN_DEFINES) $(POLL_DEFINES) $(MISC_DEFINES) XtExtraDefines $(RCM_DEFINES) $(POPDOWN_DEFINES) $(NX_DEFINES) -#else - DEFINES = AllocateLocalDefines $(ALIGN_DEFINES) $(POLL_DEFINES) $(MISC_DEFINES) XtExtraDefines $(RCM_DEFINES) $(POPDOWN_DEFINES) -#endif - - 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 \ - \ - CallbackI.h \ - ConvertI.h \ - CreateI.h \ - EventI.h \ - HookObjI.h \ - InitialI.h \ - IntrinsicI.h \ - PassivGraI.h \ - ResourceI.h \ - SelectionI.h \ - ShellI.h \ - ThreadsI.h \ - TranslateI.h \ - VarargsI.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 - -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 -#if defined(ItsyCompilerBug) -SpecialCLibObjectRule(PassivGrab,$(_NOOP_),-O0) -#endif - -STRINGS_FILES = StringDefs.c StringDefs.h Shell.h -STRINGS_TMPLS = util/StrDefs.ct util/StrDefs.ht util/Shell.ht -STRING_LIST = util/string.list - -ToolkitMakeStrings($(STRINGS_FILES),$(STRING_LIST),$(STRINGSABIOPTIONS),$(STRINGS_TMPLS),StringDefs.c) - -DependTarget() diff --git a/nx-X11/lib/Xt/Imakefile.X.original b/nx-X11/lib/Xt/Imakefile.X.original deleted file mode 100644 index af6da4dbe..000000000 --- a/nx-X11/lib/Xt/Imakefile.X.original +++ /dev/null @@ -1,271 +0,0 @@ -XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:46:12 cpqbld Exp $ - - - - -XCOMM $XFree86: xc/lib/Xt/Imakefile,v 3.18tsi 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 - -#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 \ - \ - CallbackI.h \ - ConvertI.h \ - CreateI.h \ - EventI.h \ - HookObjI.h \ - InitialI.h \ - IntrinsicI.h \ - PassivGraI.h \ - ResourceI.h \ - SelectionI.h \ - ShellI.h \ - ThreadsI.h \ - TranslateI.h \ - VarargsI.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 - -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 -#if defined(ItsyCompilerBug) -SpecialCLibObjectRule(PassivGrab,$(_NOOP_),-O0) -#endif - -STRINGS_FILES = StringDefs.c StringDefs.h Shell.h -STRINGS_TMPLS = util/StrDefs.ct util/StrDefs.ht util/Shell.ht -STRING_LIST = util/string.list - -ToolkitMakeStrings($(STRINGS_FILES),$(STRING_LIST),$(STRINGSABIOPTIONS),$(STRINGS_TMPLS),StringDefs.c) - -DependTarget() diff --git a/nx-X11/lib/Xt/InitialI.h b/nx-X11/lib/Xt/InitialI.h deleted file mode 100644 index c2fe47c1b..000000000 --- a/nx-X11/lib/Xt/InitialI.h +++ /dev/null @@ -1,429 +0,0 @@ -/* $Xorg: InitialI.h,v 1.4 2001/02/09 02:03:55 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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/InitialI.h,v 3.10 2001/12/14 19:56:18 dawes Exp $ */ - -#ifndef _XtinitialI_h -#define _XtinitialI_h - -/**************************************************************** - * - * Displays - * - ****************************************************************/ - -#ifndef X_NOT_POSIX -#ifdef _POSIX_SOURCE -#include -#else -#define _POSIX_SOURCE -#include -#undef _POSIX_SOURCE -#endif -#endif -#ifndef PATH_MAX -#ifdef WIN32 -#define PATH_MAX 512 -#else -#include -#endif -#ifndef PATH_MAX -#ifdef MAXPATHLEN -#define PATH_MAX MAXPATHLEN -#else -#define PATH_MAX 1024 -#endif -#endif -#endif - -#include -#include - -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; - -extern void _XtHeapInit(Heap* heap); -extern void _XtHeapFree(Heap* heap); - -#ifdef XTTRACEMEMORY - - -extern char *_XtHeapMalloc( - Heap* /* heap */, - Cardinal /* size */, - char * /* file */, - int /* line */ -); - -#define _XtHeapAlloc(heap,bytes) _XtHeapMalloc(heap, bytes, __FILE__, __LINE__) - -#else /* XTTRACEMEMORY */ - -extern char* _XtHeapAlloc( - Heap* /* heap */, - Cardinal /* size */ -); - -#endif /* XTTRACEMEMORY */ - -extern void _XtSetDefaultErrorHandlers( - XtErrorMsgHandler* /* errMsg */, - XtErrorMsgHandler* /* warnMsg */, - XtErrorHandler* /* err */, - XtErrorHandler* /* warn */ -); - -extern void _XtSetDefaultSelectionTimeout( - unsigned long* /* timeout */ -); - -extern XtAppContext _XtDefaultAppContext( - void -); - -extern ProcessContext _XtGetProcessContext( - void -); - -Display * -_XtAppInit( - XtAppContext* /* app_context_return */, - String /* application_class */, - XrmOptionDescRec* /* options */, - Cardinal /* num_options */, - int* /* argc_in_out */, - String** /* argv_in_out */, - String* /* fallback_resources */ -); - -extern void _XtDestroyAppContexts( - void -); - -extern void _XtCloseDisplays( - XtAppContext /* app */ -); - -extern int _XtAppDestroyCount; - -extern int _XtWaitForSomething( - XtAppContext /* app */, - _XtBoolean /* ignoreEvents */, - _XtBoolean /* ignoreTimers */, - _XtBoolean /* ignoreInputs */, - _XtBoolean /* ignoreSignals */, - _XtBoolean /* block */, -#ifdef XTHREADS - _XtBoolean /* drop_lock */, -#endif - unsigned long* /* howlong */ -); - -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( - Display* /* dpy */ -); - -extern XtPerDisplay _XtGetPerDisplay( - Display* /* dpy */ -); - -extern XtPerDisplayInputRec* _XtGetPerDisplayInput( - Display* /* dpy */ -); - -#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( - Display* /* dpy */, - XtPerDisplay /* pd */, - _Xconst char* /* name */, - XrmOptionDescRec* /* urlist */, - Cardinal /* num_urs */, - int* /* argc */, - char** /* argv */ -); - -extern void _XtCacheFlushTag( - XtAppContext /* app */, - XtPointer /* tag */ -); - -extern void _XtFreeActions( - struct _ActionListRec* /* action_table */ -); - -extern void _XtDoPhase2Destroy( - XtAppContext /* app */, - int /* dispatch_level */ -); - -extern void _XtDoFreeBindings( - XtAppContext /* app */ -); - -extern void _XtExtensionSelect( - Widget /* widget */ -); - -#define _XtSafeToDestroy(app) ((app)->dispatch_level == 0) - -extern void _XtAllocWWTable( - XtPerDisplay pd -); - -extern void _XtFreeWWTable( - XtPerDisplay pd -); - -extern String _XtGetUserName(String dest, int len); -extern XrmDatabase _XtPreparseCommandLine(XrmOptionDescRec *urlist, - Cardinal num_urs, int argc, String *argv, - String *applName, String *displayName, - String *language); - -#endif /* _XtinitialI_h */ diff --git a/nx-X11/lib/Xt/Initialize.c b/nx-X11/lib/Xt/Initialize.c deleted file mode 100644 index bbc84b954..000000000 --- a/nx-X11/lib/Xt/Initialize.c +++ /dev/null @@ -1,1044 +0,0 @@ -/* $Xorg: Initialize.c,v 1.8 2001/02/09 02:03:55 xorgcvs Exp $ */ - -/*********************************************************** -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.21 2003/04/21 16:34:27 herrb Exp $ */ - -/* - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include "StringDefs.h" -#include "CoreP.h" -#include "ShellP.h" -#include -#include -#ifdef XTHREADS -#include -#endif -#ifndef WIN32 -#define X_INCLUDE_PWD_H -#define XOS_USE_XT_LOCKING -#include -#endif - -#include - -#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 -#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 ( - char *buf, - int maxlen) -{ -#ifdef USE_UNAME - int len; - 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(void) -{ - extern void __XtInherit(); - __XtInherit(); -} -#define _XtInherit __XtInherit -#endif - - -#if defined(__CYGWIN__) -/* - * The Symbol _XtInherit is used in two different manners. - * First it could be used as a generic function and second - * as an absolute address reference, which will be used to - * check the initialisation process of several other libraries. - * Because of this the symbol must be accessable by all - * client dll's and applications. In unix environments - * this is no problem, because the used shared libraries - * format (elf) supports this immediatly. Under Windows - * this isn't true, because a functions address in a dll - * is different from the same function in another dll or - * applications, because the used Portable Executable - * File adds a code stub to each client to provide the - * exported symbol name. This stub uses an indirect - * pointer to get the original symbol address, which is - * then jumped to, like in this example: - * - * --- client --- --- dll ---- - * ... - * call foo - * - * foo: jmp (*_imp_foo) ----> foo: .... - * nop - * nop - * - * _imp_foo: .long - * - * Now it is clear why the clients symbol foo isn't the same - * as in the dll and we can think about how to deal which - * this two above mentioned requirements, to export this - * symbol to all clients and to allow calling this symbol - * as a function. The solution I've used exports the - * symbol _XtInherit as data symbol, because global data - * symbols are exported to all clients. But how to deal - * with the second requirement, that this symbol should - * be used as function. The Trick is to build a little - * code stub in the data section in the exact manner as - * above explained. This is done with the assembler code - * below. - * - * Ralf Habacker - * - * References: - * msdn http://msdn.microsoft.com/msdnmag/issues/02/02/PE/PE.asp - * cygwin-xfree: http://www.cygwin.com/ml/cygwin-xfree/2003-10/msg00000.html - */ - -asm (".data\n\ - .globl __XtInherit \n\ - __XtInherit: jmp *_y \n\ - _y: .long ___XtInherit \n\ - .text \n"); - -#define _XtInherit __XtInherit -#endif - - -void _XtInherit(void) -{ - XtErrorMsg("invalidProcedure","inheritanceProc",XtCXtToolkitError, - "Unresolved inheritance operation", - (String *)NULL, (Cardinal *)NULL); -} - - -void XtToolkitInitialize(void) -{ - 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(); - - /* Some apps rely on old (broken) XtAppPeekEvent behavior */ - if(getenv("XTAPPPEEKEVENT_SKIPTIMER")) - XtAppPeekEvent_SkipTimer = True; - else - XtAppPeekEvent_SkipTimer = False; -} - - -String _XtGetUserName( - 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 -#ifdef X_NEEDS_PWPARAMS - _Xgetpwparams pwparams; -#endif - 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( - String dest, - int len) -{ -#ifdef WIN32 - register char *ptr1; - register char *ptr2 = NULL; - 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 -#ifdef X_NEEDS_PWPARAMS - _Xgetpwparams pwparams; -#endif - 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( - 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( - 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( - XrmDatabase *db, - XrmBindingList bindings, - XrmQuarkList quarks, - XrmRepresentation *type, - XrmValuePtr value, - XPointer data) -{ - XrmQPutResource((XrmDatabase *)data, bindings, quarks, *type, value); - return False; -} - -static XrmDatabase CopyDB(XrmDatabase db) -{ - XrmDatabase copy = NULL; - XrmQuark empty = NULLQUARK; - - XrmEnumerateDatabase(db, &empty, &empty, XrmEnumAllLevels, - StoreDBEntry, (XPointer)©); - return copy; -} - -/*ARGSUSED*/ -static String _XtDefaultLanguageProc( - 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 */ -} - -XtLanguageProc XtSetLanguageProc( - XtAppContext app, - XtLanguageProc proc, - XtPointer closure) -{ - 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) -{ - 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( - const XrmOptionDescRec *src1, - Cardinal num_src1, - const XrmOptionDescRec *src2, - Cardinal num_src2, - XrmOptionDescRec **dst, - Cardinal *num_dst) -{ - XrmOptionDescRec *table, *endP; - register XrmOptionDescRec *opt1, *whereP, *dstP; - register const XrmOptionDescRec *opt2; - int i1; - Cardinal i2; - int 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( - Display *dpy, - XrmSearchList list, - String name, - String class, - String 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( - XrmOptionDescRec *urlist, - Cardinal num_urs, - int argc, - String *argv, - /* return */ - String *applName, - String *displayName, - String *language) -{ - 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( - 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 ( - XtPointer client_data, - int* fd, - XtInputId* id) -{ - XProcessInternalConnection ((Display *) client_data, *fd); -} - -static void ConnectionWatch ( - 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); - } -} - -void _XtDisplayInitialize( - Display *dpy, - XtPerDisplay pd, - _Xconst char* name, - XrmOptionDescRec *urlist, - Cardinal num_urs, - int *argc, - char **argv) -{ - 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. - */ - -void -XtAppSetFallbackResources( - XtAppContext app_context, - String *specification_list) -{ - LOCK_APP(app_context); - app_context->fallback_resources = specification_list; - UNLOCK_APP(app_context); -} - - -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) -{ - 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; -} - - -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) -{ - 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*/ -Widget -XtInitialize( - _Xconst char* name, - _Xconst char* classname, - XrmOptionDescRec *options, - Cardinal num_options, - int *argc, - String *argv) -{ - 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/nx-X11/lib/Xt/Intrinsic.c b/nx-X11/lib/Xt/Intrinsic.c deleted file mode 100644 index 482df0ab3..000000000 --- a/nx-X11/lib/Xt/Intrinsic.c +++ /dev/null @@ -1,1593 +0,0 @@ -/* $Xorg: Intrinsic.c,v 1.4 2001/02/09 02:03:55 xorgcvs Exp $ */ - -/*********************************************************** -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.22 2003/01/12 03:55:46 tsi Exp $ */ - -/* - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include "VarargsI.h" /* for geoTattler */ -#ifndef NO_IDENTIFY_WINDOWS -#include -#endif -#ifndef VMS -#include -#endif /* VMS */ - -#include - -String XtCXtToolkitError = "XtToolkitError"; - -Boolean XtIsSubclass( - 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 */ - - -Boolean _XtCheckSubclassFlag( - Widget object, - _XtXtEnum flag) -{ - Boolean retval; - - LOCK_PROCESS; - if (object->core.widget_class->core_class.class_inited & flag) - retval = TRUE; - else - retval = FALSE; - UNLOCK_PROCESS; - return retval; -} /*_XtVerifySubclass */ - - -Boolean _XtIsSubclassOf( - Widget object, - WidgetClass widgetClass, - WidgetClass superClass, - _XtXtEnum flag) -{ - 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 */ - - -XtPointer XtGetClassExtension( - WidgetClass object_class, - Cardinal byte_offset, - XrmQuark type, - long version, - Cardinal record_size) -{ - 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 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( - 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( - 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( - 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) -{ - 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_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) -{ - 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) -{ - 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 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( - Widget root, - XrmNameList names, - XrmBindingList bindings, - int in_depth, int *out_depth, int *found_depth); - -typedef Widget (*NameMatchProc)(XrmNameList, - XrmBindingList, - WidgetList, Cardinal, int, int *, int *); - -static Widget MatchExactChildren( - XrmNameList names, - XrmBindingList bindings, - register WidgetList children, - register Cardinal num, - int in_depth, int *out_depth, int *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( - XrmNameList names, - XrmBindingList bindings, - register WidgetList children, - register Cardinal num, - int in_depth, int *out_depth, int *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( - Widget root, - XrmNameList names, - XrmBindingList bindings, - NameMatchProc matchproc, - int in_depth, int *out_depth, int *found_depth) -{ - Widget w1 = 0, 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( - register Widget root, - XrmNameList names, - XrmBindingList bindings, - int in_depth, int *out_depth, int *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 */ - -Widget XtNameToWidget( - Widget root, - _Xconst char* name) -{ - 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( - 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) -{ - /* Attempts to LockApp() here will generate endless recursive loops */ - return DisplayOfScreen(widget->core.screen); -} - -#undef XtScreenOfObject -Screen *XtScreenOfObject( - 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) -{ - /* Attempts to LockApp() here will generate endless recursive loops */ - return widget->core.screen; -} - -#undef XtWindowOfObject -Window XtWindowOfObject( - Widget object) -{ - return XtWindow(XtIsWidget(object) ? object : _XtWindowedAncestor(object)); -} - - -#undef XtWindow -Window XtWindow( - Widget widget) -{ - return widget->core.window; -} - -#undef XtSuperclass -WidgetClass XtSuperclass( - Widget widget) -{ - WidgetClass retval; - - LOCK_PROCESS; - retval = XtClass(widget)->core_class.superclass; - UNLOCK_PROCESS; - return retval; -} - -#undef XtClass -WidgetClass XtClass( - Widget widget) -{ - WidgetClass retval; - - LOCK_PROCESS; - retval = widget->core.widget_class; - UNLOCK_PROCESS; - return retval; -} - -#undef XtIsManaged -Boolean XtIsManaged( - 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 ( - 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( - 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( - 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", - ¶ms, &num_params); - } - - return object; -} - -#undef XtParent -Widget XtParent( - Widget widget) -{ - /* Attempts to LockApp() here will generate endless recursive loops */ - return widget->core.parent; -} - -#undef XtName -String XtName( - Widget object) -{ - /* Attempts to LockApp() here will generate endless recursive loops */ - return XrmQuarkToString(object->core.xrm_name); -} - - -Boolean XtIsObject( - 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 ( - 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 ( - 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 __UNIXOS2__ - 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 __UNIXOS2__ - /* 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( - 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_IFMT) != S_IFDIR); /* 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( - register _Xconst 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 Cardinal 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 -} - - -String XtFindFile( - _Xconst char* path, - Substitution substitutions, - Cardinal num_substitutions, - XtFilePredicate predicate) -{ - 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 __UNIXOS2__ - if (colon > (path+1)) -#endif - break; - } - len = colon - path; - if (Resolve(path, len, substitutions, num_substitutions, - buf, '/')) { - if (firstTime || strcmp(buf1,buf2) != 0) { -#ifdef __UNIXOS2__ - { - 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( - String lang) -{ - -#if defined(hpux) || defined(CSRG_BASED) || defined(sun) || defined(SVR4) || defined(sgi) || defined(__osf__) || defined(AIXV3) || defined(ultrix) || defined(WIN32) || defined(__UNIXOS2__) || defined (linux) -# 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 -# 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(__UNIXOS2__) -# define SKIPCOUNT 1 -# define STARTCHAR '=' -# define ENDCHAR ';' -# define WHITEFILL -# else -# if defined(__osf__) || (defined(AIXV3) && !defined(AIXV4)) -# define STARTCHAR ' ' -# define ENDCHAR ' ' -# else -# if defined(linux) -# define STARTSTR "LC_CTYPE=" -# define ENDCHAR ';' -# else -# if !defined(sun) || defined(SVR4) -# define STARTCHAR '/' -# define ENDCHAR '/' -# endif -# endif -# 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))) -# elif defined (STARTSTR) - if (start && (start = strstr (start,STARTSTR))) -# endif - { -# ifdef STARTCHAR - start++; -# elif defined (STARTSTR) - start += strlen(STARTSTR); -# 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; - } else /* if no ENDCHAR is found we are at the end of the line */ - return start; - } -# 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( - 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. - */ -static char *implementation_default_path(void) -{ -#if defined(WIN32) || defined(__UNIXOS2__) - /* 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} -}; - - -String XtResolvePathname( - Display *dpy, - _Xconst char* type, - _Xconst char* filename, - _Xconst char* suffix, - _Xconst char* path, - Substitution substitutions, - Cardinal num_substitutions, - XtFilePredicate predicate) -{ - 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 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. */ -static Boolean IsTattled (Widget widget) -{ - 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 -_XtGeoTab (int direction) /* +1 or -1 */ -{ - n_tab += direction ; -} - - -void -_XtGeoTrace (Widget widget, ...) -{ - va_list args; - char *fmt; - int i ; - if (IsTattled(widget)) { - va_start(args, widget); - fmt = va_arg(args, char *); - for (i=0; i -#include -#include -#include -#ifdef XT_BC -#include /* for R4 compatibility */ -#else -#include -#include /* for XtNewString */ -#endif /* XT_BC else */ - -#define XtSpecificationRelease 6 - -typedef char *String; - -/* 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 */ - -#include - -#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 */ - -typedef void* XtPointer; - -/* 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 -#include -#include -#include -#include - -typedef struct _TranslationData *XtTranslations; -typedef struct _TranslationData *XtAccelerators; -typedef unsigned int Modifiers; - -typedef void (*XtActionProc)( - Widget /* widget */, - XEvent* /* event */, - String* /* params */, - Cardinal* /* num_params */ -); - -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)( - Widget /* widget */, - Cardinal* /* size */, - XrmValue* /* value */ -); - -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 */ - XrmValue* /* args */, - Cardinal* /* num_args */, - XrmValue* /* from */, - XrmValue* /* to */ -); - -typedef Boolean (*XtTypeConverter)( - Display* /* dpy */, - XrmValue* /* args */, - Cardinal* /* num_args */, - XrmValue* /* from */, - XrmValue* /* to */, - XtPointer* /* converter_data */ -); - -typedef void (*XtDestructor)( - XtAppContext /* app */, - XrmValue* /* to */, - XtPointer /* converter_data */, - XrmValue* /* args */, - Cardinal* /* num_args */ -); - -typedef Opaque XtCacheRef; - -typedef Opaque XtActionHookId; - -typedef void (*XtActionHookProc)( - Widget /* w */, - XtPointer /* client_data */, - String /* action_name */, - XEvent* /* event */, - String* /* params */, - Cardinal* /* num_params */ -); - -typedef unsigned long XtBlockHookId; - -typedef void (*XtBlockHookProc)( - XtPointer /* client_data */ -); - -typedef void (*XtKeyProc)( - Display* /* dpy */, - _XtKeyCode /* keycode */, - Modifiers /* modifiers */, - Modifiers* /* modifiers_return */, - KeySym* /* keysym_return */ -); - -typedef void (*XtCaseProc)( - Display* /* display */, - KeySym /* keysym */, - KeySym* /* lower_return */, - KeySym* /* upper_return */ -); - -typedef void (*XtEventHandler)( - Widget /* widget */, - XtPointer /* closure */, - XEvent* /* event */, - Boolean* /* continue_to_dispatch */ -); -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)( - XtPointer /* closure */, - XtIntervalId* /* id */ -); - -typedef void (*XtInputCallbackProc)( - XtPointer /* closure */, - int* /* source */, - XtInputId* /* id */ -); - -typedef void (*XtSignalCallbackProc)( - XtPointer /* closure */, - XtSignalId* /* id */ -); - -typedef struct { - String name; - XtArgVal value; -} Arg, *ArgList; - -typedef XtPointer XtVarArgsList; - -typedef void (*XtCallbackProc)( - Widget /* widget */, - XtPointer /* closure */, /* data the application registered */ - XtPointer /* call_data */ /* callback specific data */ -); - -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)( - Widget /* widget */, - int /* offset */, - XrmValue* /* value */ -); - -typedef String (*XtLanguageProc)( - Display* /* dpy */, - String /* xnl */, - XtPointer /* client_data */ -); - -typedef void (*XtErrorMsgHandler)( - String /* name */, - String /* type */, - String /* class */, - String /* default */, - String* /* params */, - Cardinal* /* num_params */ -); - -typedef void (*XtErrorHandler)( - String /* msg */ -); - -typedef void (*XtCreatePopupChildProc)( - Widget /* shell */ -); - -typedef Boolean (*XtWorkProc)( - XtPointer /* closure */ /* data the application registered */ -); - -typedef struct { - char match; - String substitution; -} SubstitutionRec, *Substitution; - -typedef Boolean (*XtFilePredicate)( - String /* filename */ -); - -typedef XtPointer XtRequestId; - -typedef Boolean (*XtConvertSelectionProc)( - Widget /* widget */, - Atom* /* selection */, - Atom* /* target */, - Atom* /* type_return */, - XtPointer* /* value_return */, - unsigned long* /* length_return */, - int* /* format_return */ -); - -typedef void (*XtLoseSelectionProc)( - Widget /* widget */, - Atom* /* selection */ -); - -typedef void (*XtSelectionDoneProc)( - Widget /* widget */, - Atom* /* selection */, - Atom* /* target */ -); - -typedef void (*XtSelectionCallbackProc)( - Widget /* widget */, - XtPointer /* closure */, - Atom* /* selection */, - Atom* /* type */, - XtPointer /* value */, - unsigned long* /* length */, - int* /* format */ -); - -typedef void (*XtLoseSelectionIncrProc)( - Widget /* widget */, - Atom* /* selection */, - XtPointer /* client_data */ -); - -typedef void (*XtSelectionDoneIncrProc)( - Widget /* widget */, - Atom* /* selection */, - Atom* /* target */, - XtRequestId* /* receiver_id */, - XtPointer /* client_data */ -); - -typedef Boolean (*XtConvertSelectionIncrProc)( - 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 */ -); - -typedef void (*XtCancelConvertSelectionProc)( - Widget /* widget */, - Atom* /* selection */, - Atom* /* target */, - XtRequestId* /* receiver_id */, - XtPointer /* client_data */ -); - -typedef Boolean (*XtEventDispatchProc)( - XEvent* /* event */ -); - -typedef void (*XtExtensionSelectProc)( - Widget /* widget */, - int* /* event_types */, - XtPointer* /* select_data */, - int /* count */, - XtPointer /* client_data */ -); - -/*************************************************************** - * - * Exported Interfaces - * - ****************************************************************/ - -_XFUNCPROTOBEGIN - -extern Boolean XtConvertAndStore( - Widget /* widget */, - _Xconst _XtString /* from_type */, - XrmValue* /* from */, - _Xconst _XtString /* to_type */, - XrmValue* /* to_in_out */ -); - -extern Boolean XtCallConverter( - Display* /* dpy */, - XtTypeConverter /* converter */, - XrmValuePtr /* args */, - Cardinal /* num_args */, - XrmValuePtr /* from */, - XrmValue* /* to_in_out */, - XtCacheRef* /* cache_ref_return */ -); - -extern Boolean XtDispatchEvent( - XEvent* /* event */ -); - -extern Boolean XtCallAcceptFocus( - Widget /* widget */, - Time* /* time */ -); - -extern Boolean XtPeekEvent( /* obsolete */ - XEvent* /* event_return */ -); - -extern Boolean XtAppPeekEvent( - XtAppContext /* app_context */, - XEvent* /* event_return */ -); - -extern Boolean XtIsSubclass( - Widget /* widget */, - WidgetClass /* widgetClass */ -); - -extern Boolean XtIsObject( - Widget /* object */ -); - -extern Boolean _XtCheckSubclassFlag( /* implementation-private */ - Widget /* object */, - _XtXtEnum /* type_flag */ -); - -extern Boolean _XtIsSubclassOf( /* implementation-private */ - Widget /* object */, - WidgetClass /* widget_class */, - WidgetClass /* flag_class */, - _XtXtEnum /* type_flag */ -); - -extern Boolean XtIsManaged( - Widget /* rectobj */ -); - -extern Boolean XtIsRealized( - Widget /* widget */ -); - -extern Boolean XtIsSensitive( - Widget /* widget */ -); - -extern Boolean XtOwnSelection( - Widget /* widget */, - Atom /* selection */, - Time /* time */, - XtConvertSelectionProc /* convert */, - XtLoseSelectionProc /* lose */, - XtSelectionDoneProc /* done */ -); - -extern Boolean XtOwnSelectionIncremental( - Widget /* widget */, - Atom /* selection */, - Time /* time */, - XtConvertSelectionIncrProc /* convert_callback */, - XtLoseSelectionIncrProc /* lose_callback */, - XtSelectionDoneIncrProc /* done_callback */, - XtCancelConvertSelectionProc /* cancel_callback */, - XtPointer /* client_data */ -); - -extern XtGeometryResult XtMakeResizeRequest( - Widget /* widget */, - _XtDimension /* width */, - _XtDimension /* height */, - Dimension* /* width_return */, - Dimension* /* height_return */ -); - -extern void XtTranslateCoords( - Widget /* widget */, - _XtPosition /* x */, - _XtPosition /* y */, - Position* /* rootx_return */, - Position* /* rooty_return */ -); - -extern KeySym* XtGetKeysymTable( - Display* /* dpy */, - KeyCode* /* min_keycode_return */, - int* /* keysyms_per_keycode_return */ -); - -extern void XtKeysymToKeycodeList( - Display* /* dpy */, - KeySym /* keysym */, - KeyCode** /* keycodes_return */, - Cardinal* /* keycount_return */ -); - -extern void XtStringConversionWarning( /* obsolete */ - _Xconst _XtString /* from_value */, - _Xconst _XtString /* to_type */ -); - -extern void XtDisplayStringConversionWarning( - Display* /* dpy */, - _Xconst _XtString /* from_value */, - _Xconst _XtString /* to_type */ -); - -externalref XtConvertArgRec const colorConvertArgs[]; -externalref XtConvertArgRec const screenConvertArg[]; - -extern void XtAppAddConverter( /* obsolete */ - XtAppContext /* app_context */, - _Xconst _XtString /* from_type */, - _Xconst _XtString /* to_type */, - XtConverter /* converter */, - XtConvertArgList /* convert_args */, - Cardinal /* num_args */ -); - -extern void XtAddConverter( /* obsolete */ - _Xconst _XtString /* from_type */, - _Xconst _XtString /* to_type */, - XtConverter /* converter */, - XtConvertArgList /* convert_args */, - Cardinal /* num_args */ -); - -extern void XtSetTypeConverter( - _Xconst _XtString /* from_type */, - _Xconst _XtString /* to_type */, - XtTypeConverter /* converter */, - XtConvertArgList /* convert_args */, - Cardinal /* num_args */, - XtCacheType /* cache_type */, - XtDestructor /* destructor */ -); - -extern void XtAppSetTypeConverter( - XtAppContext /* app_context */, - _Xconst _XtString /* from_type */, - _Xconst _XtString /* to_type */, - XtTypeConverter /* converter */, - XtConvertArgList /* convert_args */, - Cardinal /* num_args */, - XtCacheType /* cache_type */, - XtDestructor /* destructor */ -); - -extern void XtConvert( /* obsolete */ - Widget /* widget */, - _Xconst _XtString /* from_type */, - XrmValue* /* from */, - _Xconst _XtString /* to_type */, - XrmValue* /* to_return */ -); - -extern void XtDirectConvert( /* obsolete */ - XtConverter /* converter */, - XrmValuePtr /* args */, - Cardinal /* num_args */, - XrmValuePtr /* from */, - XrmValue* /* to_return */ -); - -/**************************************************************** - * - * Translation Management - * - ****************************************************************/ - -extern XtTranslations XtParseTranslationTable( - _Xconst _XtString /* table */ -); - -extern XtAccelerators XtParseAcceleratorTable( - _Xconst _XtString /* source */ -); - -extern void XtOverrideTranslations( - Widget /* widget */, - XtTranslations /* translations */ -); - -extern void XtAugmentTranslations( - Widget /* widget */, - XtTranslations /* translations */ -); - -extern void XtInstallAccelerators( - Widget /* destination */, - Widget /* source */ -); - -extern void XtInstallAllAccelerators( - Widget /* destination */, - Widget /* source */ -); - -extern void XtUninstallTranslations( - Widget /* widget */ -); - -extern void XtAppAddActions( - XtAppContext /* app_context */, - XtActionList /* actions */, - Cardinal /* num_actions */ -); - -extern void XtAddActions( /* obsolete */ - XtActionList /* actions */, - Cardinal /* num_actions */ -); - -extern XtActionHookId XtAppAddActionHook( - XtAppContext /* app_context */, - XtActionHookProc /* proc */, - XtPointer /* client_data */ -); - -extern void XtRemoveActionHook( - XtActionHookId /* id */ -); - -extern void XtGetActionList( - WidgetClass /* widget_class */, - XtActionList* /* actions_return */, - Cardinal* /* num_actions_return */ -); - -extern void XtCallActionProc( - Widget /* widget */, - _Xconst _XtString /* action */, - XEvent* /* event */, - String* /* params */, - Cardinal /* num_params */ -); - -extern void XtRegisterGrabAction( - XtActionProc /* action_proc */, - _XtBoolean /* owner_events */, - unsigned int /* event_mask */, - int /* pointer_mode */, - int /* keyboard_mode */ -); - -extern void XtSetMultiClickTime( - Display* /* dpy */, - int /* milliseconds */ -); - -extern int XtGetMultiClickTime( - Display* /* dpy */ -); - -extern KeySym XtGetActionKeysym( - XEvent* /* event */, - Modifiers* /* modifiers_return */ -); - -/*************************************************************** - * - * Keycode and Keysym procedures for translation management - * - ****************************************************************/ - -extern void XtTranslateKeycode( - Display* /* dpy */, - _XtKeyCode /* keycode */, - Modifiers /* modifiers */, - Modifiers* /* modifiers_return */, - KeySym* /* keysym_return */ -); - -extern void XtTranslateKey( - Display* /* dpy */, - _XtKeyCode /* keycode */, - Modifiers /* modifiers */, - Modifiers* /* modifiers_return */, - KeySym* /* keysym_return */ -); - -extern void XtSetKeyTranslator( - Display* /* dpy */, - XtKeyProc /* proc */ -); - -extern void XtRegisterCaseConverter( - Display* /* dpy */, - XtCaseProc /* proc */, - KeySym /* start */, - KeySym /* stop */ -); - -extern void XtConvertCase( - Display* /* dpy */, - KeySym /* keysym */, - KeySym* /* lower_return */, - KeySym* /* upper_return */ -); - -/**************************************************************** - * - * Event Management - * - ****************************************************************/ - -/* XtAllEvents is valid only for XtRemoveEventHandler and - * XtRemoveRawEventHandler; don't use it to select events! - */ -#define XtAllEvents ((EventMask) -1L) - -extern void XtAddEventHandler( - Widget /* widget */, - EventMask /* event_mask */, - _XtBoolean /* nonmaskable */, - XtEventHandler /* proc */, - XtPointer /* closure */ -); - -extern void XtRemoveEventHandler( - Widget /* widget */, - EventMask /* event_mask */, - _XtBoolean /* nonmaskable */, - XtEventHandler /* proc */, - XtPointer /* closure */ -); - -extern void XtAddRawEventHandler( - Widget /* widget */, - EventMask /* event_mask */, - _XtBoolean /* nonmaskable */, - XtEventHandler /* proc */, - XtPointer /* closure */ -); - -extern void XtRemoveRawEventHandler( - Widget /* widget */, - EventMask /* event_mask */, - _XtBoolean /* nonmaskable */, - XtEventHandler /* proc */, - XtPointer /* closure */ -); - -extern void XtInsertEventHandler( - Widget /* widget */, - EventMask /* event_mask */, - _XtBoolean /* nonmaskable */, - XtEventHandler /* proc */, - XtPointer /* closure */, - XtListPosition /* position */ -); - -extern void XtInsertRawEventHandler( - Widget /* widget */, - EventMask /* event_mask */, - _XtBoolean /* nonmaskable */, - XtEventHandler /* proc */, - XtPointer /* closure */, - XtListPosition /* position */ -); - -extern XtEventDispatchProc XtSetEventDispatcher( - Display* /* dpy */, - int /* event_type */, - XtEventDispatchProc /* proc */ -); - -extern Boolean XtDispatchEventToWidget( - Widget /* widget */, - XEvent* /* event */ -); - -extern void XtInsertEventTypeHandler( - Widget /* widget */, - int /* type */, - XtPointer /* select_data */, - XtEventHandler /* proc */, - XtPointer /* closure */, - XtListPosition /* position */ -); - -extern void XtRemoveEventTypeHandler( - Widget /* widget */, - int /* type */, - XtPointer /* select_data */, - XtEventHandler /* proc */, - XtPointer /* closure */ -); - -extern EventMask XtBuildEventMask( - Widget /* widget */ -); - -extern void XtRegisterExtensionSelector( - Display* /* dpy */, - int /* min_event_type */, - int /* max_event_type */, - XtExtensionSelectProc /* proc */, - XtPointer /* client_data */ -); - -extern void XtAddGrab( - Widget /* widget */, - _XtBoolean /* exclusive */, - _XtBoolean /* spring_loaded */ -); - -extern void XtRemoveGrab( - Widget /* widget */ -); - -extern void XtProcessEvent( /* obsolete */ - XtInputMask /* mask */ -); - -extern void XtAppProcessEvent( - XtAppContext /* app_context */, - XtInputMask /* mask */ -); - -extern void XtMainLoop( /* obsolete */ - void -); - -extern void XtAppMainLoop( - XtAppContext /* app_context */ -); - -extern void XtAddExposureToRegion( - XEvent* /* event */, - Region /* region */ -); - -extern void XtSetKeyboardFocus( - Widget /* subtree */, - Widget /* descendent */ -); - -extern Widget XtGetKeyboardFocusWidget( - Widget /* widget */ -); - -extern XEvent* XtLastEventProcessed( - Display* /* dpy */ -); - -extern Time XtLastTimestampProcessed( - Display* /* dpy */ -); - -/**************************************************************** - * - * Event Gathering Routines - * - ****************************************************************/ - -extern XtIntervalId XtAddTimeOut( /* obsolete */ - unsigned long /* interval */, - XtTimerCallbackProc /* proc */, - XtPointer /* closure */ -); - -extern XtIntervalId XtAppAddTimeOut( - XtAppContext /* app_context */, - unsigned long /* interval */, - XtTimerCallbackProc /* proc */, - XtPointer /* closure */ -); - -extern void XtRemoveTimeOut( - XtIntervalId /* timer */ -); - -extern XtInputId XtAddInput( /* obsolete */ - int /* source */, - XtPointer /* condition */, - XtInputCallbackProc /* proc */, - XtPointer /* closure */ -); - -extern XtInputId XtAppAddInput( - XtAppContext /* app_context */, - int /* source */, - XtPointer /* condition */, - XtInputCallbackProc /* proc */, - XtPointer /* closure */ -); - -extern void XtRemoveInput( - XtInputId /* id */ -); - -extern XtSignalId XtAddSignal( - XtSignalCallbackProc /* proc */, - XtPointer /* closure */); - -extern XtSignalId XtAppAddSignal( - XtAppContext /* app_context */, - XtSignalCallbackProc /* proc */, - XtPointer /* closure */ -); - -extern void XtRemoveSignal( - XtSignalId /* id */ -); - -extern void XtNoticeSignal( - XtSignalId /* id */ -); - -extern void XtNextEvent( /* obsolete */ - XEvent* /* event */ -); - -extern void XtAppNextEvent( - XtAppContext /* app_context */, - XEvent* /* event_return */ -); - -#define XtIMXEvent 1 -#define XtIMTimer 2 -#define XtIMAlternateInput 4 -#define XtIMSignal 8 -#define XtIMAll (XtIMXEvent | XtIMTimer | XtIMAlternateInput | XtIMSignal) - -extern Boolean XtPending( /* obsolete */ - void -); - -extern XtInputMask XtAppPending( - XtAppContext /* app_context */ -); - -extern XtBlockHookId XtAppAddBlockHook( - XtAppContext /* app_context */, - XtBlockHookProc /* proc */, - XtPointer /* client_data */ -); - -extern void XtRemoveBlockHook( - XtBlockHookId /* id */ -); - -/**************************************************************** - * - * 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)) - -#undef XtIsOverrideShell -extern Boolean XtIsOverrideShell(Widget /* object */); -#define XtIsOverrideShell(widget) \ - (_XtIsSubclassOf(widget, (WidgetClass)overrideShellWidgetClass, \ - (WidgetClass)shellWidgetClass, (XtEnum)0x20)) - -#define XtIsWMShell(widget) (_XtCheckSubclassFlag(widget, (XtEnum)0x40)) - -#undef XtIsVendorShell -extern Boolean XtIsVendorShell(Widget /* object */); -#define XtIsVendorShell(widget) \ - (_XtIsSubclassOf(widget, (WidgetClass)vendorShellWidgetClass, \ - (WidgetClass)wmShellWidgetClass, (XtEnum)0x40)) - -#undef XtIsTransientShell -extern Boolean XtIsTransientShell(Widget /* object */); -#define XtIsTransientShell(widget) \ - (_XtIsSubclassOf(widget, (WidgetClass)transientShellWidgetClass, \ - (WidgetClass)wmShellWidgetClass, (XtEnum)0x40)) -#define XtIsTopLevelShell(widget) (_XtCheckSubclassFlag(widget, (XtEnum)0x80)) - -#undef XtIsApplicationShell -extern Boolean XtIsApplicationShell(Widget /* object */); -#define XtIsApplicationShell(widget) \ - (_XtIsSubclassOf(widget, (WidgetClass)applicationShellWidgetClass, \ - (WidgetClass)topLevelShellWidgetClass, (XtEnum)0x80)) - -#undef XtIsSessionShell -extern Boolean XtIsSessionShell(Widget /* object */); -#define XtIsSessionShell(widget) \ - (_XtIsSubclassOf(widget, (WidgetClass)sessionShellWidgetClass, \ - (WidgetClass)topLevelShellWidgetClass, (XtEnum)0x80)) - -extern void XtRealizeWidget( - Widget /* widget */ -); - -void XtUnrealizeWidget( - Widget /* widget */ -); - -extern void XtDestroyWidget( - Widget /* widget */ -); - -extern void XtSetSensitive( - Widget /* widget */, - _XtBoolean /* sensitive */ -); - -extern void XtSetMappedWhenManaged( - Widget /* widget */, - _XtBoolean /* mapped_when_managed */ -); - -extern Widget XtNameToWidget( - Widget /* reference */, - _Xconst _XtString /* names */ -); - -extern Widget XtWindowToWidget( - Display* /* display */, - Window /* window */ -); - -extern XtPointer XtGetClassExtension( - WidgetClass /* object_class */, - Cardinal /* byte_offset */, - XrmQuark /* type */, - long /* version */, - Cardinal /* record_size */ -); - -/*************************************************************** - * - * Arg lists - * - ****************************************************************/ - - -#define XtSetArg(arg, n, d) \ - ((void)( (arg).name = (n), (arg).value = (XtArgVal)(d) )) - -extern ArgList XtMergeArgLists( - ArgList /* args1 */, - Cardinal /* num_args1 */, - ArgList /* args2 */, - Cardinal /* num_args2 */ -); - -/*************************************************************** - * - * Vararg lists - * - ****************************************************************/ - -#define XtVaNestedList "XtVaNestedList" -#define XtVaTypedArg "XtVaTypedArg" - -extern XtVarArgsList XtVaCreateArgsList( - XtPointer /*unused*/, ... -) _X_SENTINEL(0); - -/************************************************************* - * - * Information routines - * - ************************************************************/ - -#ifndef _XtIntrinsicP_h - -/* We're not included from the private file, so define these */ - -extern Display *XtDisplay( - Widget /* widget */ -); - -extern Display *XtDisplayOfObject( - Widget /* object */ -); - -extern Screen *XtScreen( - Widget /* widget */ -); - -extern Screen *XtScreenOfObject( - Widget /* object */ -); - -extern Window XtWindow( - Widget /* widget */ -); - -extern Window XtWindowOfObject( - Widget /* object */ -); - -extern String XtName( - Widget /* object */ -); - -extern WidgetClass XtSuperclass( - Widget /* object */ -); - -extern WidgetClass XtClass( - Widget /* object */ -); - -extern Widget XtParent( - Widget /* widget */ -); - -#endif /*_XtIntrinsicP_h*/ - -#undef XtMapWidget -extern void XtMapWidget(Widget /* w */); -#define XtMapWidget(widget) XMapWindow(XtDisplay(widget), XtWindow(widget)) - -#undef XtUnmapWidget -extern void XtUnmapWidget(Widget /* w */); -#define XtUnmapWidget(widget) \ - XUnmapWindow(XtDisplay(widget), XtWindow(widget)) - -extern void XtAddCallback( - Widget /* widget */, - _Xconst _XtString /* callback_name */, - XtCallbackProc /* callback */, - XtPointer /* closure */ -); - -extern void XtRemoveCallback( - Widget /* widget */, - _Xconst _XtString /* callback_name */, - XtCallbackProc /* callback */, - XtPointer /* closure */ -); - -extern void XtAddCallbacks( - Widget /* widget */, - _Xconst _XtString /* callback_name */, - XtCallbackList /* callbacks */ -); - -extern void XtRemoveCallbacks( - Widget /* widget */, - _Xconst _XtString /* callback_name */, - XtCallbackList /* callbacks */ -); - -extern void XtRemoveAllCallbacks( - Widget /* widget */, - _Xconst _XtString /* callback_name */ -); - - -extern void XtCallCallbacks( - Widget /* widget */, - _Xconst _XtString /* callback_name */, - XtPointer /* call_data */ -); - -extern void XtCallCallbackList( - Widget /* widget */, - XtCallbackList /* callbacks */, - XtPointer /* call_data */ -); - -extern XtCallbackStatus XtHasCallbacks( - Widget /* widget */, - _Xconst _XtString /* callback_name */ -); - -/**************************************************************** - * - * Geometry Management - * - ****************************************************************/ - - -extern XtGeometryResult XtMakeGeometryRequest( - Widget /* widget */, - XtWidgetGeometry* /* request */, - XtWidgetGeometry* /* reply_return */ -); - -extern XtGeometryResult XtQueryGeometry( - Widget /* widget */, - XtWidgetGeometry* /* intended */, - XtWidgetGeometry* /* preferred_return */ -); - -extern Widget XtCreatePopupShell( - _Xconst _XtString /* name */, - WidgetClass /* widgetClass */, - Widget /* parent */, - ArgList /* args */, - Cardinal /* num_args */ -); - -extern Widget XtVaCreatePopupShell( - _Xconst _XtString /* name */, - WidgetClass /* widgetClass */, - Widget /* parent */, - ... -) _X_SENTINEL(0); - -extern void XtPopup( - Widget /* popup_shell */, - XtGrabKind /* grab_kind */ -); - -extern void XtPopupSpringLoaded( - Widget /* popup_shell */ -); - -extern void XtCallbackNone( - Widget /* widget */, - XtPointer /* closure */, - XtPointer /* call_data */ -); - -extern void XtCallbackNonexclusive( - Widget /* widget */, - XtPointer /* closure */, - XtPointer /* call_data */ -); - -extern void XtCallbackExclusive( - Widget /* widget */, - XtPointer /* closure */, - XtPointer /* call_data */ -); - -extern void XtPopdown( - Widget /* popup_shell */ -); - -extern void XtCallbackPopdown( - Widget /* widget */, - XtPointer /* closure */, - XtPointer /* call_data */ -); - -extern void XtMenuPopupAction( - Widget /* widget */, - XEvent* /* event */, - String* /* params */, - Cardinal* /* num_params */ -); - -extern Widget XtCreateWidget( - _Xconst _XtString /* name */, - WidgetClass /* widget_class */, - Widget /* parent */, - ArgList /* args */, - Cardinal /* num_args */ -); - -extern Widget XtCreateManagedWidget( - _Xconst _XtString /* name */, - WidgetClass /* widget_class */, - Widget /* parent */, - ArgList /* args */, - Cardinal /* num_args */ -); - -extern Widget XtVaCreateWidget( - _Xconst _XtString /* name */, - WidgetClass /* widget */, - Widget /* parent */, - ... -) _X_SENTINEL(0); - -extern Widget XtVaCreateManagedWidget( - _Xconst _XtString /* name */, - WidgetClass /* widget_class */, - Widget /* parent */, - ... -) _X_SENTINEL(0); - -extern Widget XtCreateApplicationShell( /* obsolete */ - _Xconst _XtString /* name */, - WidgetClass /* widget_class */, - ArgList /* args */, - Cardinal /* num_args */ -); - -extern Widget XtAppCreateShell( - _Xconst _XtString /* application_name */, - _Xconst _XtString /* application_class */, - WidgetClass /* widget_class */, - Display* /* display */, - ArgList /* args */, - Cardinal /* num_args */ -); - -extern Widget XtVaAppCreateShell( - _Xconst _XtString /* application_name */, - _Xconst _XtString /* application_class */, - WidgetClass /* widget_class */, - Display* /* display */, - ... -) _X_SENTINEL(0); - -/**************************************************************** - * - * Toolkit initialization - * - ****************************************************************/ - -extern void XtToolkitInitialize( - void -); - -extern XtLanguageProc XtSetLanguageProc( - XtAppContext /* app_context */, - XtLanguageProc /* proc */, - XtPointer /* client_data */ -); - -extern void XtDisplayInitialize( - XtAppContext /* app_context */, - Display* /* dpy */, - _Xconst _XtString /* application_name */, - _Xconst _XtString /* application_class */, - XrmOptionDescRec* /* options */, - Cardinal /* num_options */, - int* /* argc */, - char** /* argv */ -); - -extern Widget XtOpenApplication( - 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 */ -); - -extern Widget XtVaOpenApplication( - 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 */, - ... -) _X_SENTINEL(0); - -extern Widget XtAppInitialize( /* obsolete */ - 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 */ -); - -extern Widget XtVaAppInitialize( /* obsolete */ - XtAppContext* /* app_context_return */, - _Xconst _XtString /* application_class */, - XrmOptionDescList /* options */, - Cardinal /* num_options */, - int* /* argc_in_out */, - String* /* argv_in_out */, - String* /* fallback_resources */, - ... -) _X_SENTINEL(0); - -extern Widget XtInitialize( /* obsolete */ - _Xconst _XtString /* shell_name */, - _Xconst _XtString /* application_class */, - XrmOptionDescRec* /* options */, - Cardinal /* num_options */, - int* /* argc */, - char** /* argv */ -); - -extern Display *XtOpenDisplay( - XtAppContext /* app_context */, - _Xconst _XtString /* display_string */, - _Xconst _XtString /* application_name */, - _Xconst _XtString /* application_class */, - XrmOptionDescRec* /* options */, - Cardinal /* num_options */, - int* /* argc */, - char** /* argv */ -); - -extern XtAppContext XtCreateApplicationContext( - void -); - -extern void XtAppSetFallbackResources( - XtAppContext /* app_context */, - String* /* specification_list */ -); - -extern void XtDestroyApplicationContext( - XtAppContext /* app_context */ -); - -extern void XtInitializeWidgetClass( - WidgetClass /* widget_class */ -); - -extern XtAppContext XtWidgetToApplicationContext( - Widget /* widget */ -); - -extern XtAppContext XtDisplayToApplicationContext( - Display* /* dpy */ -); - -extern XrmDatabase XtDatabase( - Display* /* dpy */ -); - -extern XrmDatabase XtScreenDatabase( - Screen* /* screen */ -); - -extern void XtCloseDisplay( - Display* /* dpy */ -); - -extern void XtGetApplicationResources( - Widget /* widget */, - XtPointer /* base */, - XtResourceList /* resources */, - Cardinal /* num_resources */, - ArgList /* args */, - Cardinal /* num_args */ -); - -extern void XtVaGetApplicationResources( - Widget /* widget */, - XtPointer /* base */, - XtResourceList /* resources */, - Cardinal /* num_resources */, - ... -) _X_SENTINEL(0); - -extern void XtGetSubresources( - Widget /* widget */, - XtPointer /* base */, - _Xconst _XtString /* name */, - _Xconst _XtString /* class */, - XtResourceList /* resources */, - Cardinal /* num_resources */, - ArgList /* args */, - Cardinal /* num_args */ -); - -extern void XtVaGetSubresources( - Widget /* widget */, - XtPointer /* base */, - _Xconst _XtString /* name */, - _Xconst _XtString /* class */, - XtResourceList /* resources */, - Cardinal /* num_resources */, - ... -) _X_SENTINEL(0); - -extern void XtSetValues( - Widget /* widget */, - ArgList /* args */, - Cardinal /* num_args */ -); - -extern void XtVaSetValues( - Widget /* widget */, - ... -) _X_SENTINEL(0); - -extern void XtGetValues( - Widget /* widget */, - ArgList /* args */, - Cardinal /* num_args */ -); - -extern void XtVaGetValues( - Widget /* widget */, - ... -) _X_SENTINEL(0); - -extern void XtSetSubvalues( - XtPointer /* base */, - XtResourceList /* resources */, - Cardinal /* num_resources */, - ArgList /* args */, - Cardinal /* num_args */ -); - -extern void XtVaSetSubvalues( - XtPointer /* base */, - XtResourceList /* resources */, - Cardinal /* num_resources */, - ... -) _X_SENTINEL(0); - -extern void XtGetSubvalues( - XtPointer /* base */, - XtResourceList /* resources */, - Cardinal /* num_resources */, - ArgList /* args */, - Cardinal /* num_args */ -); - -extern void XtVaGetSubvalues( - XtPointer /* base */, - XtResourceList /* resources */, - Cardinal /* num_resources */, - ... -) _X_SENTINEL(0); - -extern void XtGetResourceList( - WidgetClass /* widget_class */, - XtResourceList* /* resources_return */, - Cardinal* /* num_resources_return */ -); - -extern void XtGetConstraintResourceList( - WidgetClass /* widget_class */, - XtResourceList* /* resources_return */, - Cardinal* /* num_resources_return */ -); - -#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) -#define XtOffset(p_type,field) _Offsetof(p_type,field) -#else /* ! CRAY */ -#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( - Widget /* widget */ -); - -void XtSessionReturnToken( - XtCheckpointToken /* token */ -); - -/************************************************************* - * - * Error Handling - * - ************************************************************/ - -extern XtErrorMsgHandler XtAppSetErrorMsgHandler( - XtAppContext /* app_context */, - XtErrorMsgHandler /* handler */ -); - -extern void XtSetErrorMsgHandler( /* obsolete */ - XtErrorMsgHandler /* handler */ -); - -extern XtErrorMsgHandler XtAppSetWarningMsgHandler( - XtAppContext /* app_context */, - XtErrorMsgHandler /* handler */ -); - -extern void XtSetWarningMsgHandler( /* obsolete */ - XtErrorMsgHandler /* handler */ -); - -extern void XtAppErrorMsg( - XtAppContext /* app_context */, - _Xconst _XtString /* name */, - _Xconst _XtString /* type */, - _Xconst _XtString /* class */, - _Xconst _XtString /* default */, - String* /* params */, - Cardinal* /* num_params */ -); - -extern void XtErrorMsg( /* obsolete */ - _Xconst _XtString /* name */, - _Xconst _XtString /* type */, - _Xconst _XtString /* class */, - _Xconst _XtString /* default */, - String* /* params */, - Cardinal* /* num_params */ -); - -extern void XtAppWarningMsg( - XtAppContext /* app_context */, - _Xconst _XtString /* name */, - _Xconst _XtString /* type */, - _Xconst _XtString /* class */, - _Xconst _XtString /* default */, - String* /* params */, - Cardinal* /* num_params */ -); - -extern void XtWarningMsg( /* obsolete */ - _Xconst _XtString /* name */, - _Xconst _XtString /* type */, - _Xconst _XtString /* class */, - _Xconst _XtString /* default */, - String* /* params */, - Cardinal* /* num_params */ -); - -extern XtErrorHandler XtAppSetErrorHandler( - XtAppContext /* app_context */, - XtErrorHandler /* handler */ -); - -extern void XtSetErrorHandler( /* obsolete */ - XtErrorHandler /* handler */ -); - -extern XtErrorHandler XtAppSetWarningHandler( - XtAppContext /* app_context */, - XtErrorHandler /* handler */ -); - -extern void XtSetWarningHandler( /* obsolete */ - XtErrorHandler /* handler */ -); - -extern void XtAppError( - XtAppContext /* app_context */, - _Xconst _XtString /* message */ -); - -extern void XtError( /* obsolete */ - _Xconst _XtString /* message */ -); - -extern void XtAppWarning( - XtAppContext /* app_context */, - _Xconst _XtString /* message */ -); - -extern void XtWarning( /* obsolete */ - _Xconst _XtString /* message */ -); - -extern XrmDatabase *XtAppGetErrorDatabase( - XtAppContext /* app_context */ -); - -extern XrmDatabase *XtGetErrorDatabase( /* obsolete */ - void -); - -extern void XtAppGetErrorDatabaseText( - XtAppContext /* app_context */, - _Xconst _XtString /* name */, - _Xconst _XtString /* type */, - _Xconst _XtString /* class */, - _Xconst _XtString /* default */, - String /* buffer_return */, - int /* nbytes */, - XrmDatabase /* database */ -); - -extern void XtGetErrorDatabaseText( /* obsolete */ - _Xconst _XtString /* name */, - _Xconst _XtString /* type */, - _Xconst _XtString /* class */, - _Xconst _XtString /* default */, - String /* buffer_return */, - int /* nbytes */ -); - -/**************************************************************** - * - * Memory Management - * - ****************************************************************/ - -extern char *XtMalloc( - Cardinal /* size */ -); - -extern char *XtCalloc( - Cardinal /* num */, - Cardinal /* size */ -); - -extern char *XtRealloc( - char* /* ptr */, - Cardinal /* num */ -); - -extern void XtFree( - char* /* ptr */ -); - -#ifdef XTTRACEMEMORY - -extern char *_XtMalloc( /* implementation-private */ - Cardinal /* size */, - char * /* file */, - int /* line */ -); - -extern char *_XtRealloc( /* implementation-private */ - char * /* ptr */, - Cardinal /* size */, - char * /* file */, - int /* line */ -); - -extern char *_XtCalloc( /* implementation-private */ - Cardinal /* num */, - Cardinal /* size */, - char * /* file */, - int /* line */ -); - -extern void _XtFree( /* implementation-private */ - char * /* ptr */ -); - -#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))) - -#undef XtNewString -extern String XtNewString(String /* str */); -#define XtNewString(str) \ - ((str) != NULL ? (strcpy(XtMalloc((unsigned)strlen(str) + 1), str)) : NULL) - -/************************************************************* - * - * Work procs - * - **************************************************************/ - -extern XtWorkProcId XtAddWorkProc( /* obsolete */ - XtWorkProc /* proc */, - XtPointer /* closure */ -); - -extern XtWorkProcId XtAppAddWorkProc( - XtAppContext /* app_context */, - XtWorkProc /* proc */, - XtPointer /* closure */ -); - -extern void XtRemoveWorkProc( - XtWorkProcId /* id */ -); - - -/**************************************************************** - * - * Graphic Context Management - *****************************************************************/ - -extern GC XtGetGC( - Widget /* widget */, - XtGCMask /* valueMask */, - XGCValues* /* values */ -); - -extern GC XtAllocateGC( - Widget /* widget */, - Cardinal /* depth */, - XtGCMask /* valueMask */, - XGCValues* /* values */, - XtGCMask /* dynamicMask */, - XtGCMask /* unusedMask */ -); - -/* 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 */ - GC /* gc */ -); - -extern void XtReleaseGC( - Widget /* object */, - GC /* gc */ -); - - - -extern void XtAppReleaseCacheRefs( - XtAppContext /* app_context */, - XtCacheRef* /* cache_ref */ -); - -extern void XtCallbackReleaseCacheRef( - Widget /* widget */, - XtPointer /* closure */, /* XtCacheRef */ - XtPointer /* call_data */ -); - -extern void XtCallbackReleaseCacheRefList( - Widget /* widget */, - XtPointer /* closure */, /* XtCacheRef* */ - XtPointer /* call_data */ -); - -extern void XtSetWMColormapWindows( - Widget /* widget */, - Widget* /* list */, - Cardinal /* count */ -); - -extern String XtFindFile( - _Xconst _XtString /* path */, - Substitution /* substitutions */, - Cardinal /* num_substitutions */, - XtFilePredicate /* predicate */ -); - -extern String XtResolvePathname( - Display* /* dpy */, - _Xconst _XtString /* type */, - _Xconst _XtString /* filename */, - _Xconst _XtString /* suffix */, - _Xconst _XtString /* path */, - Substitution /* substitutions */, - Cardinal /* num_substitutions */, - XtFilePredicate /* predicate */ -); - -/**************************************************************** - * - * Selections - * - *****************************************************************/ - -#define XT_CONVERT_FAIL (Atom)0x80000001 - -extern void XtDisownSelection( - Widget /* widget */, - Atom /* selection */, - Time /* time */ -); - -extern void XtGetSelectionValue( - Widget /* widget */, - Atom /* selection */, - Atom /* target */, - XtSelectionCallbackProc /* callback */, - XtPointer /* closure */, - Time /* time */ -); - -extern void XtGetSelectionValues( - Widget /* widget */, - Atom /* selection */, - Atom* /* targets */, - int /* count */, - XtSelectionCallbackProc /* callback */, - XtPointer* /* closures */, - Time /* time */ -); - -extern void XtAppSetSelectionTimeout( - XtAppContext /* app_context */, - unsigned long /* timeout */ -); - -extern void XtSetSelectionTimeout( /* obsolete */ - unsigned long /* timeout */ -); - -extern unsigned long XtAppGetSelectionTimeout( - XtAppContext /* app_context */ -); - -extern unsigned long XtGetSelectionTimeout( /* obsolete */ - void -); - -extern XSelectionRequestEvent *XtGetSelectionRequest( - Widget /* widget */, - Atom /* selection */, - XtRequestId /* request_id */ -); - -extern void XtGetSelectionValueIncremental( - Widget /* widget */, - Atom /* selection */, - Atom /* target */, - XtSelectionCallbackProc /* selection_callback */, - XtPointer /* client_data */, - Time /* time */ -); - -extern void XtGetSelectionValuesIncremental( - Widget /* widget */, - Atom /* selection */, - Atom* /* targets */, - int /* count */, - XtSelectionCallbackProc /* callback */, - XtPointer* /* client_data */, - Time /* time */ -); - -extern void XtSetSelectionParameters( - Widget /* requestor */, - Atom /* selection */, - Atom /* type */, - XtPointer /* value */, - unsigned long /* length */, - int /* format */ -); - -extern void XtGetSelectionParameters( - Widget /* owner */, - Atom /* selection */, - XtRequestId /* request_id */, - Atom* /* type_return */, - XtPointer* /* value_return */, - unsigned long* /* length_return */, - int* /* format_return */ -); - -extern void XtCreateSelectionRequest( - Widget /* requestor */, - Atom /* selection */ -); - -extern void XtSendSelectionRequest( - Widget /* requestor */, - Atom /* selection */, - Time /* time */ -); - -extern void XtCancelSelectionRequest( - Widget /* requestor */, - Atom /* selection */ -); - -extern Atom XtReservePropertyAtom( - Widget /* widget */ -); - -extern void XtReleasePropertyAtom( - Widget /* widget */, - Atom /* selection */ -); - -extern void XtGrabKey( - Widget /* widget */, - _XtKeyCode /* keycode */, - Modifiers /* modifiers */, - _XtBoolean /* owner_events */, - int /* pointer_mode */, - int /* keyboard_mode */ -); - -extern void XtUngrabKey( - Widget /* widget */, - _XtKeyCode /* keycode */, - Modifiers /* modifiers */ -); - -extern int XtGrabKeyboard( - Widget /* widget */, - _XtBoolean /* owner_events */, - int /* pointer_mode */, - int /* keyboard_mode */, - Time /* time */ -); - -extern void XtUngrabKeyboard( - Widget /* widget */, - Time /* time */ -); - -extern 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 */ -); - -extern void XtUngrabButton( - Widget /* widget */, - unsigned int /* button */, - Modifiers /* modifiers */ -); - -extern int XtGrabPointer( - Widget /* widget */, - _XtBoolean /* owner_events */, - unsigned int /* event_mask */, - int /* pointer_mode */, - int /* keyboard_mode */, - Window /* confine_to */, - Cursor /* cursor */, - Time /* time */ -); - -extern void XtUngrabPointer( - Widget /* widget */, - Time /* time */ -); - -extern void XtGetApplicationNameAndClass( - Display* /* dpy */, - String* /* name_return */, - String* /* class_return */ -); - -extern void XtRegisterDrawable( - Display* /* dpy */, - Drawable /* drawable */, - Widget /* widget */ -); - -extern void XtUnregisterDrawable( - Display* /* dpy */, - Drawable /* drawable */ -); - -extern Widget XtHooksOfDisplay( - Display* /* dpy */ -); - -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( - XtAppContext /* app_context */, - Display*** /* dpy_return */, - Cardinal* /* num_dpy_return */ -); - -extern Boolean XtToolkitThreadInitialize( - void -); - -extern void XtAppSetExitFlag( - XtAppContext /* app_context */ -); - -extern Boolean XtAppGetExitFlag( - XtAppContext /* app_context */ -); - -extern void XtAppLock( - XtAppContext /* app_context */ -); - -extern void XtAppUnlock( - XtAppContext /* app_context */ -); - -/* - * Predefined Resource Converters - */ - - -/* String converters */ - -extern Boolean XtCvtStringToAcceleratorTable( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToAtom( - Display* /* dpy */, - XrmValuePtr /* args */, /* Display */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToBool( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToBoolean( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToCommandArgArray( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToCursor( - Display* /* dpy */, - XrmValuePtr /* args */, /* Display */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToDimension( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToDirectoryString( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToDisplay( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToFile( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToFloat( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToFont( - Display* /* dpy */, - XrmValuePtr /* args */, /* Display */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToFontSet( - Display* /* dpy */, - XrmValuePtr /* args */, /* Display, locale */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToFontStruct( - Display* /* dpy */, - XrmValuePtr /* args */, /* Display */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToGravity( - Display* /* dpy */, - XrmValuePtr /* args */, - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToInitialState( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToInt( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToPixel( - Display* /* dpy */, - XrmValuePtr /* args */, /* Screen, Colormap */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -#define XtCvtStringToPosition XtCvtStringToShort - -extern Boolean XtCvtStringToRestartStyle( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToShort( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToTranslationTable( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToUnsignedChar( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtStringToVisual( - Display* /* dpy */, - XrmValuePtr /* args */, /* Screen, depth */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -/* int converters */ - -extern Boolean XtCvtIntToBool( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtIntToBoolean( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtIntToColor( - Display* /* dpy */, - XrmValuePtr /* args */, /* Screen, Colormap */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -#define XtCvtIntToDimension XtCvtIntToShort - -extern Boolean XtCvtIntToFloat( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtIntToFont( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtIntToPixel( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtIntToPixmap( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -#define XtCvtIntToPosition XtCvtIntToShort - -extern Boolean XtCvtIntToShort( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -extern Boolean XtCvtIntToUnsignedChar( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -/* Color converter */ - -extern Boolean XtCvtColorToPixel( - Display* /* dpy */, - XrmValuePtr /* args */, /* none */ - Cardinal* /* num_args */, - XrmValuePtr /* fromVal */, - XrmValuePtr /* toVal */, - XtPointer* /* closure_ret */ -); - -/* Pixel converter */ - -#define XtCvtPixelToColor XtCvtIntToColor - - -_XFUNCPROTOEND - -#endif /*_XtIntrinsic_h*/ -/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/nx-X11/lib/Xt/IntrinsicI.h b/nx-X11/lib/Xt/IntrinsicI.h deleted file mode 100644 index d749867b8..000000000 --- a/nx-X11/lib/Xt/IntrinsicI.h +++ /dev/null @@ -1,261 +0,0 @@ -/* $Xorg: IntrinsicI.h,v 1.4 2001/02/09 02:03:55 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.8 2001/12/14 19:56:25 dawes Exp $ */ - -#ifndef _XtintrinsicI_h -#define _XtintrinsicI_h - -#include "Xtos.h" -#include "IntrinsicP.h" -#ifdef WIN32 -#define _WILLWINSOCK_ -#endif -#include - -#include "Object.h" -#include "RectObj.h" -#include "ObjectP.h" -#include "RectObjP.h" - -#include "ConvertI.h" -#include "TranslateI.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 - -/* If the alignment characteristics of your machine are right, these may be - faster */ - -#ifdef UNALIGNED - -#define XtMemmove(dst, src, size) \ - if ((char *)(dst) != (char *)(src)) { \ - 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) \ - if ((char *)(dst) != (char *)(src)) { \ - (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); } - -/*************************************************************** - * - * 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( - String /* alloc_type */ -); - -extern void _XtCompileResourceList( - XtResourceList /* resources */, - Cardinal /* num_resources */ -); - -extern XtGeometryResult _XtMakeGeometryRequest( - Widget /* widget */, - XtWidgetGeometry* /* request */, - XtWidgetGeometry* /* reply_return */, - Boolean* /* clear_rect_obj */ -); - -extern Boolean _XtIsHookObject( - Widget /* widget */ -); - -extern void _XtAddShellToHookObj( - Widget /* widget */ -); - -/* GCManager.c */ -extern void _XtGClistFree(Display *dpy, XtPerDisplay pd); - -/** GeoTattler stuff */ - -#ifdef XT_GEO_TATTLER - -extern void _XtGeoTab (int); -extern void _XtGeoTrace ( - Widget widget, - ... -) _X_ATTRIBUTE_PRINTF(2,3); - -#define CALLGEOTAT(f) f - -#else /* XT_GEO_TATTLER */ - -#define CALLGEOTAT(f) - -#endif /* XT_GEO_TATTLER */ - -#ifndef XTTRACEMEMORY - -extern char* __XtMalloc ( - unsigned /* size */ -); -extern char* __XtCalloc ( - unsigned /* num */, - unsigned /* size */ -); - -#else - -#define __XtMalloc XtMalloc -#define __XtCalloc XtCalloc -#endif - -#endif /* _XtintrinsicI_h */ -/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/nx-X11/lib/Xt/IntrinsicP.h b/nx-X11/lib/Xt/IntrinsicP.h deleted file mode 100644 index 517c55d2b..000000000 --- a/nx-X11/lib/Xt/IntrinsicP.h +++ /dev/null @@ -1,327 +0,0 @@ -/* $Xorg: IntrinsicP.h,v 1.4 2001/02/09 02:03:55 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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$ */ - -#ifndef _XtintrinsicP_h -#define _XtintrinsicP_h - -#include - -/* - * 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)( - void -); - -typedef void (*XtWidgetClassProc)( - WidgetClass /* class */ -); - -typedef void (*XtWidgetProc)( - Widget /* widget */ -); - -typedef Boolean (*XtAcceptFocusProc)( - Widget /* widget */, - Time* /* time */ -); - -typedef void (*XtArgsProc)( - Widget /* widget */, - ArgList /* args */, - Cardinal* /* num_args */ -); - -typedef void (*XtInitProc)( - Widget /* request */, - Widget /* new */, - ArgList /* args */, - Cardinal* /* num_args */ -); - -typedef Boolean (*XtSetValuesFunc)( - Widget /* old */, - Widget /* request */, - Widget /* new */, - ArgList /* args */, - Cardinal* /* num_args */ -); - -typedef Boolean (*XtArgsFunc)( - Widget /* widget */, - ArgList /* args */, - Cardinal* /* num_args */ -); - -typedef void (*XtAlmostProc)( - Widget /* old */, - Widget /* new */, - XtWidgetGeometry* /* request */, - XtWidgetGeometry* /* reply */ -); - -typedef void (*XtExposeProc)( - Widget /* widget */, - XEvent* /* event */, - Region /* region */ -); - -/* 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)( - Widget /* widget */, - XtValueMask* /* mask */, - XSetWindowAttributes* /* attributes */ -); - -typedef XtGeometryResult (*XtGeometryHandler)( - Widget /* widget */, - XtWidgetGeometry* /* request */, - XtWidgetGeometry* /* reply */ -); - -typedef void (*XtStringProc)( - Widget /* widget */, - String /* str */ -); - -typedef struct { - String name; /* resource name */ - String type; /* representation type name */ - XtArgVal value; /* representation */ - int size; /* size of representation */ -} XtTypedArg, *XtTypedArgList; - -typedef void (*XtAllocateProc)( - 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 */ -); - -typedef void (*XtDeallocateProc)( - Widget /* widget */, - XtPointer /* more_bytes */ -); - -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 -#include -#include -#include -#include - -#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 -extern Boolean XtIsRectObj(Widget); -#define XtIsRectObj(obj) \ - (((Object)(obj))->object.widget_class->core_class.class_inited & 0x02) - -#undef XtIsWidget -extern Boolean XtIsWidget(Widget); -#define XtIsWidget(obj) \ - (((Object)(obj))->object.widget_class->core_class.class_inited & 0x04) - -#undef XtIsComposite -extern Boolean XtIsComposite(Widget); -#define XtIsComposite(obj) \ - (((Object)(obj))->object.widget_class->core_class.class_inited & 0x08) - -#undef XtIsConstraint -extern Boolean XtIsConstraint(Widget); -#define XtIsConstraint(obj) \ - (((Object)(obj))->object.widget_class->core_class.class_inited & 0x10) - -#undef XtIsShell -extern Boolean XtIsShell(Widget); -#define XtIsShell(obj) \ - (((Object)(obj))->object.widget_class->core_class.class_inited & 0x20) - -#undef XtIsWMShell -extern Boolean XtIsWMShell(Widget); -#define XtIsWMShell(obj) \ - (((Object)(obj))->object.widget_class->core_class.class_inited & 0x40) - -#undef XtIsTopLevelShell -extern Boolean XtIsTopLevelShell(Widget); -#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 */ - Widget /* object */ -); - -extern void _XtInherit( - void -); - -extern void _XtHandleFocus( - Widget /* widget */, - XtPointer /* client_data */, - XEvent * /* event */, - Boolean * /* cont */); - -extern void XtCreateWindow( - Widget /* widget */, - unsigned int /* window_class */, - Visual* /* visual */, - XtValueMask /* value_mask */, - XSetWindowAttributes* /* attributes */ -); - -extern void XtResizeWidget( - Widget /* widget */, - _XtDimension /* width */, - _XtDimension /* height */, - _XtDimension /* border_width */ -); - -extern void XtMoveWidget( - Widget /* widget */, - _XtPosition /* x */, - _XtPosition /* y */ -); - -extern void XtConfigureWidget( - Widget /* widget */, - _XtPosition /* x */, - _XtPosition /* y */, - _XtDimension /* width */, - _XtDimension /* height */, - _XtDimension /* border_width */ -); - -extern void XtResizeWindow( - Widget /* widget */ -); - -extern void XtProcessLock( - void -); - -extern void XtProcessUnlock( - void -); - -_XFUNCPROTOEND - -#endif /* _XtIntrinsicP_h */ -/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/nx-X11/lib/Xt/Keyboard.c b/nx-X11/lib/Xt/Keyboard.c deleted file mode 100644 index 82bcc2478..000000000 --- a/nx-X11/lib/Xt/Keyboard.c +++ /dev/null @@ -1,851 +0,0 @@ -/* $Xorg: Keyboard.c,v 1.5 2001/02/09 02:03:55 xorgcvs Exp $ */ - -/******************************************************** - -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/Keyboard.c,v 3.3 2001/08/22 22:52:19 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" - -#include "PassivGraI.h" -#include "EventI.h" - -#define _GetWindowedAncestor(w) (XtIsWidget(w) ? w : _XtWindowedAncestor(w)) - -/* 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) -{ - /* the caller must lock the process lock */ - if (pathTraceDepth && pathTrace[0] == widget) - pathTraceDepth = 0; -} - -static XtServerGrabPtr CheckServerGrabs( - 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(Widget a, Widget 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( - register Widget a, - register Widget 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 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 widget, - XtPerDisplayInput pdi) -{ - if (pdi->focusWidget) - return pdi->focusWidget; - else - return _FindFocusWidget(widget, pdi->trace, pdi->traceDepth, FALSE, NULL); -} - -Widget XtGetKeyboardFocusWidget(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( - 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 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( - 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 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) -{ - 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 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 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 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 widget, - XtPointer closure, /* Widget */ - XtPointer call_data) -{ - XtSetKeyboardFocus((Widget)closure, None); -} - -void XtSetKeyboardFocus( - 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/nx-X11/lib/Xt/Manage.c b/nx-X11/lib/Xt/Manage.c deleted file mode 100644 index 05957a2fa..000000000 --- a/nx-X11/lib/Xt/Manage.c +++ /dev/null @@ -1,491 +0,0 @@ -/* $Xorg: Manage.c,v 1.4 2001/02/09 02:03:55 xorgcvs Exp $ */ - -/*********************************************************** -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.10tsi Exp $ */ - -/* - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" - -static String XtNinvalidChild = "invalidChild"; -static String XtNxtUnmanageChildren = "xtUnmanageChildren"; -static String XtNxtManageChildren = "xtManageChildren"; -static String XtNxtChangeManagedSet = "xtChangeManagedSet"; - -static void UnmanageChildren( - 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 = NULL; - Bool parent_realized = False; - - *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 ( - WidgetList children, - Cardinal num_children) -{ - Widget parent, hookobj; - Cardinal ii; -#ifdef XTHREADS - XtAppContext app; -#endif - - 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; - } -#ifdef XTHREADS - app = XtWidgetToApplicationContext(children[0]); -#endif - 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( - Widget child) -{ - XtUnmanageChildren(&child, (Cardinal)1); -} /* XtUnmanageChild */ - - -static void ManageChildren( - 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 = NULL; - WidgetList unique_children; - Widget cache[MAXCHILDREN]; - Bool parent_realized = False; - - 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( - WidgetList children, - Cardinal num_children) -{ - Widget parent, hookobj; -#ifdef XTHREADS - XtAppContext app; -#endif - - if (num_children == 0) return; - if (children[0] == NULL) { - XtWarningMsg(XtNinvalidChild, XtNxtManageChildren, XtCXtToolkitError, - "null child passed to XtManageChildren", - (String*)NULL, (Cardinal*)NULL); - return; - } -#ifdef XTHREADS - app = XtWidgetToApplicationContext(children[0]); -#endif - 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( - Widget child) -{ - XtManageChildren(&child, (Cardinal) 1); -} /* XtManageChild */ - - -void XtSetMappedWhenManaged( - Widget widget, - _XtBoolean mapped_when_managed) -{ - 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 */ - - -void XtChangeManagedSet( - WidgetList unmanage_children, - Cardinal num_unmanage, - XtDoChangeProc do_change_proc, - XtPointer client_data, - WidgetList manage_children, - Cardinal num_manage) -{ - 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/nx-X11/lib/Xt/NextEvent.c b/nx-X11/lib/Xt/NextEvent.c deleted file mode 100644 index e6cd9cb06..000000000 --- a/nx-X11/lib/Xt/NextEvent.c +++ /dev/null @@ -1,1642 +0,0 @@ -/* $Xorg: NextEvent.c,v 1.8 2001/02/09 02:03:55 xorgcvs Exp $ */ - -/*********************************************************** -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, 2001 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */ -/* */ -/* NX-X11, NX protocol compression and NX extensions to this software */ -/* are copyright of NoMachine. Redistribution and use of the present */ -/* software is allowed according to terms specified in the file LICENSE */ -/* which comes in the source distribution. */ -/* */ -/* Check http://www.nomachine.com/licensing.html for applicability. */ -/* */ -/* NX and NoMachine are trademarks of Medialogic S.p.A. */ -/* */ -/* All rights reserved. */ -/* */ -/**************************************************************************/ - -/* $XFree86: xc/lib/Xt/NextEvent.c,v 3.26 2002/06/04 21:55:42 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include -#include - -#ifdef __UNIXOS2__ -#include -#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(__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 ( - 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 <= (unsigned long)(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); -} - -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; -#else -#define X_BLOCK -1 -#define X_DONT_BLOCK 0 -#endif - -static void InitTimes ( - 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 ( - XtAppContext app, - Boolean ignoreEvents, - Boolean ignoreInputs, - wait_fds_ptr_t wf) -{ - int ii; - app->rebuild_fdlist = FALSE; -#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 -#ifndef POLLRDNORM -#define POLLRDNORM 0 -#endif - -#ifndef POLLRDBAND -#define POLLRDBAND 0 -#endif - -#ifndef POLLWRNORM -#define POLLWRNORM 0 -#endif - -#ifndef POLLWRBAND -#define POLLWRBAND 0 -#endif - -#define XPOLL_READ (POLLIN|POLLRDNORM|POLLPRI|POLLRDBAND) -#define XPOLL_WRITE (POLLOUT|POLLWRNORM|POLLWRBAND) -#define XPOLL_EXCEPT 0 - - 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 -} - -static void AdjustTimes ( - 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 -} - - -static int IoWait ( - wait_times_ptr_t wt, - wait_fds_ptr_t wf) -{ -#ifndef USE_POLL - -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) - - fprintf(stderr, "Xt::IoWait: Select called with [%d][%p][%p][%p][%p].\n", - wf->nfds, (void *) &wf->rmask, (void *) &wf->wmask, (void *) &wf->emask, - (void *) wt->wait_time_ptr); -#endif - - 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 -} - - -static void FindInputs ( - 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 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) { - /* make sure this input isn't already marked outstanding */ - InputEvent *oq; - for (oq = app->outstandingQueue; oq; oq = oq->ie_oq) - if (oq == ep) - break; - if (!oq) - { - 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) { - InputEvent *oq; - /* make sure this input isn't already marked outstanding */ - for (oq = app->outstandingQueue; oq; oq = oq->ie_oq) - if (oq == ep) - break; - if (!oq) - { - ep->ie_oq = app->outstandingQueue; - app->outstandingQueue = ep; - } - } - } - } - } -#endif /* } */ -} - -/* - * 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. - */ -int _XtWaitForSomething( - XtAppContext app, - _XtBoolean ignoreEvents, - _XtBoolean ignoreTimers, - _XtBoolean ignoreInputs, - _XtBoolean ignoreSignals, - _XtBoolean block, -#ifdef XTHREADS - _XtBoolean drop_lock, -#endif - unsigned long *howlong) -{ - 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 /* } */ - nfds = IoWait (&wt, &wf); - 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", - ¶m, ¶m_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( - unsigned long interval, - XtTimerCallbackProc proc, - XtPointer closure) -{ - return XtAppAddTimeOut(_XtDefaultAppContext(), - interval, proc, closure); -} - -static void QueueTimerEvent( - 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( - 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 (¤t_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( - 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( - XtWorkProc proc, - XtPointer closure) -{ - return XtAppAddWorkProc(_XtDefaultAppContext(), proc, closure); -} - -XtWorkProcId XtAppAddWorkProc( - 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( - 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( - XtSignalCallbackProc proc, - XtPointer closure) -{ - return XtAppAddSignal(_XtDefaultAppContext(), proc, closure); -} - -XtSignalId XtAppAddSignal( - 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( - 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( - 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( - int source, - XtPointer Condition, - XtInputCallbackProc proc, - XtPointer closure) -{ - return XtAppAddInput(_XtDefaultAppContext(), - source, Condition, proc, closure); -} - -XtInputId XtAppAddInput( - XtAppContext app, - int source, - XtPointer Condition, - XtInputCallbackProc proc, - XtPointer closure) -{ - 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); -} - -void XtRemoveInput( - 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( - 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( - 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( - 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( - XEvent *event) -{ - XtAppNextEvent(_XtDefaultAppContext(), event); -} - -void _XtRefreshMapping( - XEvent* event, - _XtBoolean dispatch) -{ - 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( - 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( - XtInputMask mask) -{ - XtAppProcessEvent(_XtDefaultAppContext(), mask); -} - -void XtAppProcessEvent( - 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(void) -{ - return (XtAppPending(_XtDefaultAppContext()) != 0); -} - -XtInputMask XtAppPending( - 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( - 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( - XEvent *event) -{ - return XtAppPeekEvent(_XtDefaultAppContext(), event); -} - -Boolean XtAppPeekEvent_SkipTimer; - -Boolean XtAppPeekEvent( - 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; - } - - while (1) { - d = _XtWaitForSomething (app, - FALSE, FALSE, FALSE, FALSE, - TRUE, -#ifdef XTHREADS - TRUE, -#endif - (unsigned long *) NULL); - - if (d != -1) { /* event */ - GotEvent: - XPeekEvent(app->list[d], event); - app->last = (d == 0 ? app->count : d) - 1; - UNLOCK_APP(app); - return TRUE; - } - else { /* input or timer or signal */ - /* - * Check to see why a -1 was returned, if a timer expired, - * call it and block some more - */ - if ((app->timerQueue != NULL) && ! XtAppPeekEvent_SkipTimer) { /* timer */ - struct timeval cur_time; - Bool did_timer = False; - - X_GETTIMEOFDAY (&cur_time); - FIXUP_TIMEVAL(cur_time); - while (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); - did_timer = True; - } - LOCK_PROCESS; - te_ptr->te_next = freeTimerRecs; - freeTimerRecs = te_ptr; - UNLOCK_PROCESS; - if (app->timerQueue == NULL) break; - } - if (did_timer) - { - for (d = 0; d < app->count; d++) - /* the timer's procedure may have caused an event */ - if (XEventsQueued(app->list[d], QueuedAfterFlush)) { - goto GotEvent; - } - continue; /* keep blocking */ - } - } - /* - * spec is vague here; we'll assume signals also return FALSE, - * of course to determine whether a signal is pending requires - * walking the signalQueue looking for se_notice flags which - * this code doesn't do. - */ -#if 0 - if (app->signalQueue != NULL) { /* signal */ - event->xany.type = 0; - event->xany.display = NULL; - event->xany.window = 0; - UNLOCK_APP(app); - return FALSE; - } - else -#endif - { /* input */ - event->xany.type = 0; - event->xany.display = NULL; - event->xany.window = 0; - UNLOCK_APP(app); - return FALSE; - } - } - } /* end while */ -} diff --git a/nx-X11/lib/Xt/NextEvent.c.NX.original b/nx-X11/lib/Xt/NextEvent.c.NX.original deleted file mode 100644 index e6cd9cb06..000000000 --- a/nx-X11/lib/Xt/NextEvent.c.NX.original +++ /dev/null @@ -1,1642 +0,0 @@ -/* $Xorg: NextEvent.c,v 1.8 2001/02/09 02:03:55 xorgcvs Exp $ */ - -/*********************************************************** -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, 2001 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */ -/* */ -/* NX-X11, NX protocol compression and NX extensions to this software */ -/* are copyright of NoMachine. Redistribution and use of the present */ -/* software is allowed according to terms specified in the file LICENSE */ -/* which comes in the source distribution. */ -/* */ -/* Check http://www.nomachine.com/licensing.html for applicability. */ -/* */ -/* NX and NoMachine are trademarks of Medialogic S.p.A. */ -/* */ -/* All rights reserved. */ -/* */ -/**************************************************************************/ - -/* $XFree86: xc/lib/Xt/NextEvent.c,v 3.26 2002/06/04 21:55:42 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include -#include - -#ifdef __UNIXOS2__ -#include -#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(__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 ( - 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 <= (unsigned long)(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); -} - -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; -#else -#define X_BLOCK -1 -#define X_DONT_BLOCK 0 -#endif - -static void InitTimes ( - 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 ( - XtAppContext app, - Boolean ignoreEvents, - Boolean ignoreInputs, - wait_fds_ptr_t wf) -{ - int ii; - app->rebuild_fdlist = FALSE; -#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 -#ifndef POLLRDNORM -#define POLLRDNORM 0 -#endif - -#ifndef POLLRDBAND -#define POLLRDBAND 0 -#endif - -#ifndef POLLWRNORM -#define POLLWRNORM 0 -#endif - -#ifndef POLLWRBAND -#define POLLWRBAND 0 -#endif - -#define XPOLL_READ (POLLIN|POLLRDNORM|POLLPRI|POLLRDBAND) -#define XPOLL_WRITE (POLLOUT|POLLWRNORM|POLLWRBAND) -#define XPOLL_EXCEPT 0 - - 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 -} - -static void AdjustTimes ( - 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 -} - - -static int IoWait ( - wait_times_ptr_t wt, - wait_fds_ptr_t wf) -{ -#ifndef USE_POLL - -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) - - fprintf(stderr, "Xt::IoWait: Select called with [%d][%p][%p][%p][%p].\n", - wf->nfds, (void *) &wf->rmask, (void *) &wf->wmask, (void *) &wf->emask, - (void *) wt->wait_time_ptr); -#endif - - 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 -} - - -static void FindInputs ( - 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 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) { - /* make sure this input isn't already marked outstanding */ - InputEvent *oq; - for (oq = app->outstandingQueue; oq; oq = oq->ie_oq) - if (oq == ep) - break; - if (!oq) - { - 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) { - InputEvent *oq; - /* make sure this input isn't already marked outstanding */ - for (oq = app->outstandingQueue; oq; oq = oq->ie_oq) - if (oq == ep) - break; - if (!oq) - { - ep->ie_oq = app->outstandingQueue; - app->outstandingQueue = ep; - } - } - } - } - } -#endif /* } */ -} - -/* - * 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. - */ -int _XtWaitForSomething( - XtAppContext app, - _XtBoolean ignoreEvents, - _XtBoolean ignoreTimers, - _XtBoolean ignoreInputs, - _XtBoolean ignoreSignals, - _XtBoolean block, -#ifdef XTHREADS - _XtBoolean drop_lock, -#endif - unsigned long *howlong) -{ - 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 /* } */ - nfds = IoWait (&wt, &wf); - 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", - ¶m, ¶m_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( - unsigned long interval, - XtTimerCallbackProc proc, - XtPointer closure) -{ - return XtAppAddTimeOut(_XtDefaultAppContext(), - interval, proc, closure); -} - -static void QueueTimerEvent( - 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( - 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 (¤t_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( - 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( - XtWorkProc proc, - XtPointer closure) -{ - return XtAppAddWorkProc(_XtDefaultAppContext(), proc, closure); -} - -XtWorkProcId XtAppAddWorkProc( - 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( - 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( - XtSignalCallbackProc proc, - XtPointer closure) -{ - return XtAppAddSignal(_XtDefaultAppContext(), proc, closure); -} - -XtSignalId XtAppAddSignal( - 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( - 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( - 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( - int source, - XtPointer Condition, - XtInputCallbackProc proc, - XtPointer closure) -{ - return XtAppAddInput(_XtDefaultAppContext(), - source, Condition, proc, closure); -} - -XtInputId XtAppAddInput( - XtAppContext app, - int source, - XtPointer Condition, - XtInputCallbackProc proc, - XtPointer closure) -{ - 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); -} - -void XtRemoveInput( - 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( - 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( - 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( - 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( - XEvent *event) -{ - XtAppNextEvent(_XtDefaultAppContext(), event); -} - -void _XtRefreshMapping( - XEvent* event, - _XtBoolean dispatch) -{ - 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( - 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( - XtInputMask mask) -{ - XtAppProcessEvent(_XtDefaultAppContext(), mask); -} - -void XtAppProcessEvent( - 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(void) -{ - return (XtAppPending(_XtDefaultAppContext()) != 0); -} - -XtInputMask XtAppPending( - 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( - 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( - XEvent *event) -{ - return XtAppPeekEvent(_XtDefaultAppContext(), event); -} - -Boolean XtAppPeekEvent_SkipTimer; - -Boolean XtAppPeekEvent( - 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; - } - - while (1) { - d = _XtWaitForSomething (app, - FALSE, FALSE, FALSE, FALSE, - TRUE, -#ifdef XTHREADS - TRUE, -#endif - (unsigned long *) NULL); - - if (d != -1) { /* event */ - GotEvent: - XPeekEvent(app->list[d], event); - app->last = (d == 0 ? app->count : d) - 1; - UNLOCK_APP(app); - return TRUE; - } - else { /* input or timer or signal */ - /* - * Check to see why a -1 was returned, if a timer expired, - * call it and block some more - */ - if ((app->timerQueue != NULL) && ! XtAppPeekEvent_SkipTimer) { /* timer */ - struct timeval cur_time; - Bool did_timer = False; - - X_GETTIMEOFDAY (&cur_time); - FIXUP_TIMEVAL(cur_time); - while (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); - did_timer = True; - } - LOCK_PROCESS; - te_ptr->te_next = freeTimerRecs; - freeTimerRecs = te_ptr; - UNLOCK_PROCESS; - if (app->timerQueue == NULL) break; - } - if (did_timer) - { - for (d = 0; d < app->count; d++) - /* the timer's procedure may have caused an event */ - if (XEventsQueued(app->list[d], QueuedAfterFlush)) { - goto GotEvent; - } - continue; /* keep blocking */ - } - } - /* - * spec is vague here; we'll assume signals also return FALSE, - * of course to determine whether a signal is pending requires - * walking the signalQueue looking for se_notice flags which - * this code doesn't do. - */ -#if 0 - if (app->signalQueue != NULL) { /* signal */ - event->xany.type = 0; - event->xany.display = NULL; - event->xany.window = 0; - UNLOCK_APP(app); - return FALSE; - } - else -#endif - { /* input */ - event->xany.type = 0; - event->xany.display = NULL; - event->xany.window = 0; - UNLOCK_APP(app); - return FALSE; - } - } - } /* end while */ -} diff --git a/nx-X11/lib/Xt/NextEvent.c.X.original b/nx-X11/lib/Xt/NextEvent.c.X.original deleted file mode 100644 index 64be87814..000000000 --- a/nx-X11/lib/Xt/NextEvent.c.X.original +++ /dev/null @@ -1,1616 +0,0 @@ -/* $Xorg: NextEvent.c,v 1.8 2001/02/09 02:03:55 xorgcvs Exp $ */ - -/*********************************************************** -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, 2001 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.26 2002/06/04 21:55:42 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include -#include - -#ifdef __UNIXOS2__ -#include -#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(__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 ( - 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 <= (unsigned long)(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); -} - -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; -#else -#define X_BLOCK -1 -#define X_DONT_BLOCK 0 -#endif - -static void InitTimes ( - 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 ( - XtAppContext app, - Boolean ignoreEvents, - Boolean ignoreInputs, - wait_fds_ptr_t wf) -{ - int ii; - app->rebuild_fdlist = FALSE; -#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 -#ifndef POLLRDNORM -#define POLLRDNORM 0 -#endif - -#ifndef POLLRDBAND -#define POLLRDBAND 0 -#endif - -#ifndef POLLWRNORM -#define POLLWRNORM 0 -#endif - -#ifndef POLLWRBAND -#define POLLWRBAND 0 -#endif - -#define XPOLL_READ (POLLIN|POLLRDNORM|POLLPRI|POLLRDBAND) -#define XPOLL_WRITE (POLLOUT|POLLWRNORM|POLLWRBAND) -#define XPOLL_EXCEPT 0 - - 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 -} - -static void AdjustTimes ( - 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 -} - - -static int IoWait ( - 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 -} - - -static void FindInputs ( - 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 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) { - /* make sure this input isn't already marked outstanding */ - InputEvent *oq; - for (oq = app->outstandingQueue; oq; oq = oq->ie_oq) - if (oq == ep) - break; - if (!oq) - { - 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) { - InputEvent *oq; - /* make sure this input isn't already marked outstanding */ - for (oq = app->outstandingQueue; oq; oq = oq->ie_oq) - if (oq == ep) - break; - if (!oq) - { - ep->ie_oq = app->outstandingQueue; - app->outstandingQueue = ep; - } - } - } - } - } -#endif /* } */ -} - -/* - * 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. - */ -int _XtWaitForSomething( - XtAppContext app, - _XtBoolean ignoreEvents, - _XtBoolean ignoreTimers, - _XtBoolean ignoreInputs, - _XtBoolean ignoreSignals, - _XtBoolean block, -#ifdef XTHREADS - _XtBoolean drop_lock, -#endif - unsigned long *howlong) -{ - 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 /* } */ - nfds = IoWait (&wt, &wf); - 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", - ¶m, ¶m_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( - unsigned long interval, - XtTimerCallbackProc proc, - XtPointer closure) -{ - return XtAppAddTimeOut(_XtDefaultAppContext(), - interval, proc, closure); -} - -static void QueueTimerEvent( - 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( - 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 (¤t_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( - 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( - XtWorkProc proc, - XtPointer closure) -{ - return XtAppAddWorkProc(_XtDefaultAppContext(), proc, closure); -} - -XtWorkProcId XtAppAddWorkProc( - 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( - 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( - XtSignalCallbackProc proc, - XtPointer closure) -{ - return XtAppAddSignal(_XtDefaultAppContext(), proc, closure); -} - -XtSignalId XtAppAddSignal( - 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( - 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( - 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( - int source, - XtPointer Condition, - XtInputCallbackProc proc, - XtPointer closure) -{ - return XtAppAddInput(_XtDefaultAppContext(), - source, Condition, proc, closure); -} - -XtInputId XtAppAddInput( - XtAppContext app, - int source, - XtPointer Condition, - XtInputCallbackProc proc, - XtPointer closure) -{ - 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); -} - -void XtRemoveInput( - 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( - 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( - 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( - 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( - XEvent *event) -{ - XtAppNextEvent(_XtDefaultAppContext(), event); -} - -void _XtRefreshMapping( - XEvent* event, - _XtBoolean dispatch) -{ - 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( - 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( - XtInputMask mask) -{ - XtAppProcessEvent(_XtDefaultAppContext(), mask); -} - -void XtAppProcessEvent( - 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(void) -{ - return (XtAppPending(_XtDefaultAppContext()) != 0); -} - -XtInputMask XtAppPending( - 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( - 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( - XEvent *event) -{ - return XtAppPeekEvent(_XtDefaultAppContext(), event); -} - -Boolean XtAppPeekEvent_SkipTimer; - -Boolean XtAppPeekEvent( - 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; - } - - while (1) { - d = _XtWaitForSomething (app, - FALSE, FALSE, FALSE, FALSE, - TRUE, -#ifdef XTHREADS - TRUE, -#endif - (unsigned long *) NULL); - - if (d != -1) { /* event */ - GotEvent: - XPeekEvent(app->list[d], event); - app->last = (d == 0 ? app->count : d) - 1; - UNLOCK_APP(app); - return TRUE; - } - else { /* input or timer or signal */ - /* - * Check to see why a -1 was returned, if a timer expired, - * call it and block some more - */ - if ((app->timerQueue != NULL) && ! XtAppPeekEvent_SkipTimer) { /* timer */ - struct timeval cur_time; - Bool did_timer = False; - - X_GETTIMEOFDAY (&cur_time); - FIXUP_TIMEVAL(cur_time); - while (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); - did_timer = True; - } - LOCK_PROCESS; - te_ptr->te_next = freeTimerRecs; - freeTimerRecs = te_ptr; - UNLOCK_PROCESS; - if (app->timerQueue == NULL) break; - } - if (did_timer) - { - for (d = 0; d < app->count; d++) - /* the timer's procedure may have caused an event */ - if (XEventsQueued(app->list[d], QueuedAfterFlush)) { - goto GotEvent; - } - continue; /* keep blocking */ - } - } - /* - * spec is vague here; we'll assume signals also return FALSE, - * of course to determine whether a signal is pending requires - * walking the signalQueue looking for se_notice flags which - * this code doesn't do. - */ -#if 0 - if (app->signalQueue != NULL) { /* signal */ - event->xany.type = 0; - event->xany.display = NULL; - event->xany.window = 0; - UNLOCK_APP(app); - return FALSE; - } - else -#endif - { /* input */ - event->xany.type = 0; - event->xany.display = NULL; - event->xany.window = 0; - UNLOCK_APP(app); - return FALSE; - } - } - } /* end while */ -} diff --git a/nx-X11/lib/Xt/Object.c b/nx-X11/lib/Xt/Object.c deleted file mode 100644 index f762a2545..000000000 --- a/nx-X11/lib/Xt/Object.c +++ /dev/null @@ -1,297 +0,0 @@ -/* $Xorg: Object.c,v 1.4 2001/02/09 02:03:56 xorgcvs Exp $ */ - -/*********************************************************** -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.5 2001/01/17 19:43:06 dawes Exp $ */ - -#define OBJECT -#ifdef HAVE_CONFIG_H -#include -#endif -#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(WidgetClass); -static Boolean ObjectSetValues(Widget, Widget, Widget, ArgList, Cardinal *); -static void ObjectDestroy(Widget); - -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) -{ - 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( - 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( - 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( - Widget old, - Widget request, - Widget 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 ( - 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/nx-X11/lib/Xt/Object.h b/nx-X11/lib/Xt/Object.h deleted file mode 100644 index 96723b16e..000000000 --- a/nx-X11/lib/Xt/Object.h +++ /dev/null @@ -1,60 +0,0 @@ -/* $Xorg: Object.h,v 1.4 2001/02/09 02:03:56 xorgcvs Exp $ */ -/* $oHeader: Object.h,v 1.2 88/08/18 15:55:32 asente Exp $ */ -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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/nx-X11/lib/Xt/ObjectP.h b/nx-X11/lib/Xt/ObjectP.h deleted file mode 100644 index a24564ef2..000000000 --- a/nx-X11/lib/Xt/ObjectP.h +++ /dev/null @@ -1,139 +0,0 @@ -/* $Xorg: ObjectP.h,v 1.4 2001/02/09 02:03:56 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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 - -/********************************************************** - * 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/nx-X11/lib/Xt/PassivGraI.h b/nx-X11/lib/Xt/PassivGraI.h deleted file mode 100644 index 02e296484..000000000 --- a/nx-X11/lib/Xt/PassivGraI.h +++ /dev/null @@ -1,186 +0,0 @@ -/* -* $Xorg: PassivGraI.h,v 1.4 2001/02/09 02:03:56 xorgcvs Exp $ -*/ - -/******************************************************** - -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/PassivGraI.h,v 1.3 2001/12/14 19:56:27 dawes Exp $ */ - -#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( - Widget /* w */, - XtPointer /* pwi */, /*XtPerWidgetInput*/ - XtPointer /* call_data */ -); - -extern XtPerWidgetInput _XtGetPerWidgetInput( - Widget /* widget */, - _XtBoolean /* create */ -); - -extern XtServerGrabPtr _XtCheckServerGrabsOnWidget( - XEvent* /* event */, - Widget /* widget */, - _XtBoolean /* isKeyboard */ -); - -/* -extern XtGrabList* _XtGetGrabList( XtPerDisplayInput ); -*/ - -#define _XtGetGrabList(pdi) (&(pdi)->grabList) - -extern void _XtFreePerWidgetInput( - Widget /* w */, - XtPerWidgetInput /* pwi */ -); - -extern Widget _XtProcessKeyboardEvent( - XKeyEvent* /* event */, - Widget /* widget */, - XtPerDisplayInput /* pdi */ -); - -extern Widget _XtProcessPointerEvent( - XButtonEvent* /* event */, - Widget /* widget */, - XtPerDisplayInput /* pdi */ -); - -extern void _XtRegisterPassiveGrabs( - Widget /* widget */ -); - -extern void _XtClearAncestorCache( - Widget /* widget */ -); - -#endif /* _PDI_h_ */ diff --git a/nx-X11/lib/Xt/PassivGrab.c b/nx-X11/lib/Xt/PassivGrab.c deleted file mode 100644 index 377efdcd5..000000000 --- a/nx-X11/lib/Xt/PassivGrab.c +++ /dev/null @@ -1,1053 +0,0 @@ -/* $Xorg: PassivGrab.c,v 1.5 2001/02/09 02:03:56 xorgcvs Exp $ */ - -/******************************************************** - -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. - -********************************************************/ -/* $XFree86$ */ - -/* - -Copyright 1987, 1988, 1989, 1990, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#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( - 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( - 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 widget, - Boolean ownerEvents, - Modifiers modifiers, - KeyCode keybut, - int pointer_mode, - int 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( - 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( - register DetailPtr firstDetail, - register DetailPtr 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( - unsigned short firstExact, - unsigned short secondExact, - unsigned short 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( - register DetailPtr firstDetail, - register DetailPtr 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( - register XtServerGrabPtr pFirstGrab, - register XtServerGrabPtr 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( - register XtServerGrabPtr pFirstGrab, - register XtServerGrabPtr 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( - 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( - 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( - 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. - */ - -XtServerGrabPtr _XtCheckServerGrabsOnWidget ( - XEvent *event, - Widget widget, - _XtBoolean isKeyboard) -{ - 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 widget, - XtPointer pdi, - XEvent *event, - Boolean *cont) -{ - /* nothing */ -} - - -/* - * MakeGrab - */ -static void MakeGrab( - 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( - 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 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 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 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); -} - -void XtGrabKey ( - Widget widget, - _XtKeyCode keycode, - Modifiers modifiers, - _XtBoolean owner_events, - int pointer_mode, - int keyboard_mode) -{ - 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); -} - -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) -{ - 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. - */ - -void XtUngrabKey ( - Widget widget, - _XtKeyCode keycode, - Modifiers modifiers) -{ - WIDGET_TO_APPCON(widget); - - LOCK_APP(app); - UngrabKeyOrButton(widget, (int)keycode, modifiers, KEYBOARD); - UNLOCK_APP(app); -} - -void XtUngrabButton ( - 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 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 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 - */ -int XtGrabKeyboard ( - Widget widget, - _XtBoolean owner_events, - int pointer_mode, - int keyboard_mode, - Time time) -{ - 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 widget, - Time time) -{ - WIDGET_TO_APPCON(widget); - - LOCK_APP(app); - UngrabDevice(widget, time, KEYBOARD); - UNLOCK_APP(app); -} - - - - -/* - * grab the pointer - */ -int XtGrabPointer ( - Widget widget, - _XtBoolean owner_events, - unsigned int event_mask, - int pointer_mode, - int keyboard_mode, - Window confine_to, - Cursor cursor, - Time time) -{ - 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 widget, - Time time) -{ - WIDGET_TO_APPCON(widget); - - LOCK_APP(app); - UngrabDevice(widget, time, POINTER); - UNLOCK_APP(app); -} - - -void _XtRegisterPassiveGrabs ( - 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/nx-X11/lib/Xt/Pointer.c b/nx-X11/lib/Xt/Pointer.c deleted file mode 100644 index bbcb13371..000000000 --- a/nx-X11/lib/Xt/Pointer.c +++ /dev/null @@ -1,115 +0,0 @@ -/* $Xorg: Pointer.c,v 1.4 2001/02/09 02:03:56 xorgcvs Exp $ */ - -/******************************************************** - -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include "PassivGraI.h" - - -#define AllButtonsMask (Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask) - -Widget _XtProcessPointerEvent( - 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/nx-X11/lib/Xt/Popup.c b/nx-X11/lib/Xt/Popup.c deleted file mode 100644 index aac712da1..000000000 --- a/nx-X11/lib/Xt/Popup.c +++ /dev/null @@ -1,198 +0,0 @@ -/* $Xorg: Popup.c,v 1.4 2001/02/09 02:03:56 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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$ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include "ShellP.h" - -void _XtPopup( - Widget widget, - XtGrabKind grab_kind, - _XtBoolean spring_loaded) -{ - 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 */ - -void XtPopup (Widget widget, XtGrabKind grab_kind) -{ - 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 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) -{ - /* 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 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/nx-X11/lib/Xt/PopupCB.c b/nx-X11/lib/Xt/PopupCB.c deleted file mode 100644 index be5fd8502..000000000 --- a/nx-X11/lib/Xt/PopupCB.c +++ /dev/null @@ -1,84 +0,0 @@ -/* $Xorg: PopupCB.c,v 1.4 2001/02/09 02:03:56 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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 HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" - -/* ARGSUSED */ -void XtCallbackNone( - Widget widget, - XtPointer closure, - XtPointer call_data) -{ - XtSetSensitive(widget, FALSE); - _XtPopup((Widget) closure, XtGrabNone, FALSE); -} /* XtCallbackNone */ - -/* ARGSUSED */ -void XtCallbackNonexclusive( - Widget widget, - XtPointer closure, - XtPointer call_data) -{ - - XtSetSensitive(widget, FALSE); - _XtPopup((Widget) closure, XtGrabNonexclusive, FALSE); -} /* XtCallbackNonexclusive */ - -/* ARGSUSED */ -void XtCallbackExclusive( - Widget widget, - XtPointer closure, - XtPointer call_data) -{ - XtSetSensitive(widget, FALSE); - _XtPopup((Widget) closure, XtGrabExclusive, FALSE); -} /* XtCallbackExclusive */ diff --git a/nx-X11/lib/Xt/RectObj.c b/nx-X11/lib/Xt/RectObj.c deleted file mode 100644 index 07bbd1ff3..000000000 --- a/nx-X11/lib/Xt/RectObj.c +++ /dev/null @@ -1,194 +0,0 @@ -/* $Xorg: RectObj.c,v 1.4 2001/02/09 02:03:56 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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/RectObj.c,v 1.2 2001/08/22 22:52:19 dawes Exp $ */ - -#define RECTOBJ -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include "StringDefs.h" -#include "CreateI.h" - -/****************************************************************** - * - * Rectangle Object Resources - * - ******************************************************************/ - -static void XtCopyAncestorSensitive(Widget, int, XrmValue *); - -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(WidgetClass); -static void RectSetValuesAlmost(Widget, Widget, XtWidgetGeometry *, XtWidgetGeometry *); - -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 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( - 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( - Widget old, - Widget new, - XtWidgetGeometry *request, - XtWidgetGeometry *reply) -{ - *request = *reply; -} diff --git a/nx-X11/lib/Xt/RectObj.h b/nx-X11/lib/Xt/RectObj.h deleted file mode 100644 index 07615fab7..000000000 --- a/nx-X11/lib/Xt/RectObj.h +++ /dev/null @@ -1,60 +0,0 @@ -/* $Xorg: RectObj.h,v 1.4 2001/02/09 02:03:56 xorgcvs Exp $ */ -/* $oHeader: RectObj.h,v 1.2 88/08/18 17:39:17 asente Exp $ */ -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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/nx-X11/lib/Xt/RectObjP.h b/nx-X11/lib/Xt/RectObjP.h deleted file mode 100644 index ca3b8ade7..000000000 --- a/nx-X11/lib/Xt/RectObjP.h +++ /dev/null @@ -1,129 +0,0 @@ -/* $Xorg: RectObjP.h,v 1.4 2001/02/09 02:03:56 xorgcvs Exp $ */ -/* $oHeader: RectObjP.h,v 1.2 88/08/18 15:55:52 asente Exp $ */ -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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 -#include - -/********************************************************** - * 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/nx-X11/lib/Xt/ResConfig.c b/nx-X11/lib/Xt/ResConfig.c deleted file mode 100644 index 4c2e73602..000000000 --- a/nx-X11/lib/Xt/ResConfig.c +++ /dev/null @@ -1,1022 +0,0 @@ -/* $Xorg: ResConfig.c,v 1.5 2001/02/09 02:03:56 xorgcvs Exp $ */ -/* - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ -/***************************************************************** - -(C) COPYRIGHT International Business Machines Corp. 1992,1997 - 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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE IBM CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, -BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the IBM Corporation shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from the IBM -Corporation. - -******************************************************************/ -/* $XFree86: xc/lib/Xt/ResConfig.c,v 3.7 2001/08/22 22:52:19 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Intrinsic.h" -#include "IntrinsicI.h" -#include "Core.h" -#include "CoreP.h" -#include "ShellP.h" -#include "StringDefs.h" -#include "ResConfigP.h" -#include -#include -#include - -#define MAX_BUFFER 512 - -static void _search_child(Widget, char *, char *, char *, char *, char, char *); -static void _set_and_search(Widget, char *, char *, char *, char *, char , char *); -static int _locate_children(Widget, Widget **); - -#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 ( - 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; - Cardinal 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_indexcore.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 ( - 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; icore.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 ( - 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= 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 ( - 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 ( - 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 ( - 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 ( - Widget w, - char *resource, - char *value) -{ - Widget parent = w; - char *last_part; - char *remainder = NULL; - 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 ( - Widget parent, - Widget **children) -{ - CompositeWidget comp = (CompositeWidget) parent; - Cardinal 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; icomposite.num_children; i++) { - (*children)[current] = comp->composite.children[i]; - current++; - } - } - - if (XtIsWidget (parent)) { - for (i=0; icore.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 ( - 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; icore.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 ( - 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 ((void *)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/nx-X11/lib/Xt/ResConfigP.h b/nx-X11/lib/Xt/ResConfigP.h deleted file mode 100644 index a06cda715..000000000 --- a/nx-X11/lib/Xt/ResConfigP.h +++ /dev/null @@ -1,78 +0,0 @@ -/* $Xorg: ResConfigP.h,v 1.5 2001/02/09 02:03:56 xorgcvs Exp $ */ -/* - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ -/***************************************************************** - -(C) COPYRIGHT International Business Machines Corp. 1992,1997 - 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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE IBM CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, -BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the IBM Corporation shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from the IBM -Corporation. - -******************************************************************/ -/* $XFree86: xc/lib/Xt/ResConfigP.h,v 3.7 2001/12/20 19:40:59 tsi Exp $ */ - -#ifndef _RESCONFIGP_H -#define _RESCONFIGP_H - -#include - -_XFUNCPROTOBEGIN - -/* - * Atom names for resource configuration management customization tool. - */ -#define RCM_DATA "Custom Data" -#define RCM_INIT "Custom Init" - -extern void _XtResourceConfigurationEH( - Widget /* w */, - XtPointer /* client_data */, - XEvent * /* event */ -); - -_XFUNCPROTOEND - -#endif diff --git a/nx-X11/lib/Xt/ResourceI.h b/nx-X11/lib/Xt/ResourceI.h deleted file mode 100644 index d6ed1df23..000000000 --- a/nx-X11/lib/Xt/ResourceI.h +++ /dev/null @@ -1,100 +0,0 @@ -/* $Xorg: ResourceI.h,v 1.4 2001/02/09 02:03:56 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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/ResourceI.h,v 1.5 2001/12/14 19:56:28 dawes Exp $ */ - -/**************************************************************** - * - * Resources - * - ****************************************************************/ - -#ifndef _XtresourceI_h -#define _XtresourceI_h - -#define StringToQuark(string) XrmStringToQuark(string) -#define StringToName(string) XrmStringToName(string) -#define StringToClass(string) XrmStringToClass(string) - -extern void _XtDependencies( - XtResourceList * /* class_resp */, - Cardinal * /* class_num_resp */, - XrmResourceList * /* super_res */, - Cardinal /* super_num_res */, - Cardinal /* super_widget_size */); - -extern void _XtResourceDependencies( - WidgetClass /* wc */ -); - -extern void _XtConstraintResDependencies( - ConstraintWidgetClass /* wc */ -); - -extern XtCacheRef* _XtGetResources( - Widget /* w */, - ArgList /* args */, - Cardinal /* num_args */, - XtTypedArgList /* typed_args */, - Cardinal* /* num_typed_args */ -); - -extern void _XtCopyFromParent( - Widget /* widget */, - int /* offset */, - XrmValue* /* value */ -); - -extern void _XtCopyToArg(char *src, XtArgVal *dst, unsigned int size); -extern void _XtCopyFromArg(XtArgVal src, char *dst, unsigned int size); -extern XrmResourceList* _XtCreateIndirectionTable(XtResourceList resources, - Cardinal num_resources); -extern void _XtResourceListInitialize(void); - - -#endif /* _XtresourceI_h */ diff --git a/nx-X11/lib/Xt/Resources.c b/nx-X11/lib/Xt/Resources.c deleted file mode 100644 index 7da7d90a2..000000000 --- a/nx-X11/lib/Xt/Resources.c +++ /dev/null @@ -1,1259 +0,0 @@ -/* $Xorg: Resources.c,v 1.4 2001/02/09 02:03:56 xorgcvs Exp $ */ - -/*********************************************************** -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.11tsi Exp $ */ - -/*LINTLIBRARY*/ -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include "VarargsI.h" -#include "Shell.h" -#include "ShellP.h" -#include "StringDefs.h" -#include - -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 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( - 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( - 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( - 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( - 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( - 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( - 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( - Widget w) -{ - Cardinal count; - - for (count = 1; w != NULL; w = (Widget) w->core.parent) - count++; - - return count; -} - -static void GetNamesAndClasses( - 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( - 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); - xrmres->xrm_offset = (Cardinal) - (-(int)resources->resource_offset - 1); - xrmres->xrm_default_type = PSToQ(resources->default_type); - } -#undef PSToQ -#undef xrmres -} /* _XtCompileResourceList */ - -/* Like _XtCompileResourceList, but strings are not permanent */ -static void XrmCompileResourceListEphem( - 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); - xrmres->xrm_offset = (Cardinal) - (-(int)resources->resource_offset - 1); - xrmres->xrm_default_type = StringToQuark(resources->default_type); - } -#undef xrmres -} /* XrmCompileResourceListEphem */ - -static void BadSize( - 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( - 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 ((Cardinal)(-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( - 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( - 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 ( - XtResourceList resources, - Cardinal num_resources) -{ - register Cardinal 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 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. */ - unsigned num_resources, /* number of items in resource list */ - XrmQuarkList quark_args, /* Arg names quarkified */ - ArgList args, /* ArgList to override resources */ - unsigned 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 Cardinal j; - register int i; - register XrmResourceList rx; - register XrmResourceList *res; - for (arg = args, i = 0; (Cardinal)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 Cardinal 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) || ((unsigned) 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 Cardinal 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) || ((unsigned) 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 ((Cardinal)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( - 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( - 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 */ - - -void _XtGetSubresources ( - Widget w, /* Widget "parent" of subobject */ - XtPointer base, /* Base address to write to */ - const char* name, /* name of subobject */ - const char* class, /* class of subobject */ - 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; - 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); -} - -void XtGetSubresources ( - Widget w, /* Widget "parent" of subobject */ - XtPointer base, /* Base address to write to */ - _Xconst char* name, /* name of subobject */ - _Xconst char* class, /* class of subobject */ - XtResourceList resources, /* resource list for subobject */ - Cardinal num_resources, - ArgList args, /* arg list to override resources */ - Cardinal num_args) -{ - _XtGetSubresources (w, base, name, class, resources, num_resources, args, num_args, NULL, 0); -} - - -void _XtGetApplicationResources ( - 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; -#ifdef XTHREADS - XtAppContext app; -#endif - - if (num_resources == 0) return; - -#ifdef XTHREADS - if (w == NULL) app = _XtDefaultAppContext(); - else app = XtWidgetToApplicationContext(w); -#endif - - 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 ( - 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(void) -{ - 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/nx-X11/lib/Xt/Selection.c b/nx-X11/lib/Xt/Selection.c deleted file mode 100644 index 46c75f882..000000000 --- a/nx-X11/lib/Xt/Selection.c +++ /dev/null @@ -1,2295 +0,0 @@ -/* $Xorg: Selection.c,v 1.4 2001/02/09 02:03:56 xorgcvs Exp $ */ - -/*********************************************************** -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/Selection.c,v 3.9 2001/12/14 19:56:29 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include "StringDefs.h" -#include "SelectionI.h" -#include -#include - -void _XtSetDefaultSelectionTimeout( - unsigned long *timeout) -{ - *timeout = 5000; /* default to 5 seconds */ -} - -void XtSetSelectionTimeout( - unsigned long timeout) -{ - XtAppSetSelectionTimeout(_XtDefaultAppContext(), timeout); -} - -void XtAppSetSelectionTimeout( - XtAppContext app, - unsigned long timeout) -{ - LOCK_APP(app); - app->selectionTimeout = timeout; - UNLOCK_APP(app); -} - -unsigned long XtGetSelectionTimeout(void) -{ - return XtAppGetSelectionTimeout(_XtDefaultAppContext()); -} - -unsigned long XtAppGetSelectionTimeout( - XtAppContext app) -{ - unsigned long retval; - - LOCK_APP(app); - retval = app->selectionTimeout; - UNLOCK_APP(app); - return retval; -} - - -/* General utilities */ - -static void HandleSelectionReplies(Widget, XtPointer, XEvent *, Boolean *); -static void ReqTimedOut(XtPointer, XtIntervalId *); -static void HandlePropertyGone(Widget, XtPointer, XEvent *, Boolean *); -static void HandleGetIncrement(Widget, XtPointer, XEvent *, Boolean *); -static void HandleIncremental(Display *, Widget, Atom, CallBackInfo, unsigned long); - -static XContext selectPropertyContext = 0; -static XContext paramPropertyContext = 0; -static XContext multipleContext = 0; - -/* Multiple utilities */ -static void AddSelectionRequests(Widget, Atom, int, Atom *, XtSelectionCallbackProc *, int, XtPointer *, Boolean *, Atom *); -static Boolean IsGatheringRequest(Widget, Atom); - -#define PREALLOCED 32 - -/* Parameter utilities */ -static void AddParamInfo(Widget, Atom, Atom); -static void RemoveParamInfo(Widget, Atom); -static Atom GetParamInfo(Widget, Atom); - -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( - 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( - 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( - 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( - 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( - 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( - 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( - 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( - 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( - 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 widget, - XtPointer closure, XtPointer 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(Widget, XtPointer, XEvent *, Boolean *); - -static Boolean LoseSelection( - 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)(Display*, XErrorEvent*); - -static xErrorHandler oldErrorHandler = NULL; -static unsigned long firstProtectRequest; -static Window errorWindow; - -static int LocalErrorHandler ( - 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( - 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( - 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( - 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( - 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( - 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( - Request incr) -{ - Display *dpy = incr->ctx->dpy; - - unsigned long 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((int)incrSize, incr->format)); - EndProtectedSection(dpy); - incr->offset += incrSize; -} - -static void AllSent( - 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 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( - Request req, - Widget widget, - Window window, - Atom property, - Atom target, - 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( - 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) <= (unsigned long) 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 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 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 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 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( - 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 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( - 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 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 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 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( - 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( - 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 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( - 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 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 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 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 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 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 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 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", - ¶ms, &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 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( - Widget w) -{ - return(GetSelectionProperty(XtDisplay(w))); -} - -void XtReleasePropertyAtom( - 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( - 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( - 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( - 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 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 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 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( - 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( - 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( - 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( - 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( - 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/nx-X11/lib/Xt/SelectionI.h b/nx-X11/lib/Xt/SelectionI.h deleted file mode 100644 index e589aece5..000000000 --- a/nx-X11/lib/Xt/SelectionI.h +++ /dev/null @@ -1,170 +0,0 @@ -/* $Xorg: SelectionI.h,v 1.4 2001/02/09 02:03:58 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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; - unsigned long 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/nx-X11/lib/Xt/SetSens.c b/nx-X11/lib/Xt/SetSens.c deleted file mode 100644 index ad2b6f489..000000000 --- a/nx-X11/lib/Xt/SetSens.c +++ /dev/null @@ -1,128 +0,0 @@ -/* $Xorg: SetSens.c,v 1.4 2001/02/09 02:03:58 xorgcvs Exp $ */ - -/*********************************************************** -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/SetSens.c,v 1.3 2001/12/14 19:56:29 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include "StringDefs.h" - -/* - * XtSetSensitive() - */ - -static void SetAncestorSensitive( - 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 */ - - -void XtSetSensitive( - register Widget widget, - _XtBoolean sensitive) -{ - 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/nx-X11/lib/Xt/SetValues.c b/nx-X11/lib/Xt/SetValues.c deleted file mode 100644 index d9e8a4695..000000000 --- a/nx-X11/lib/Xt/SetValues.c +++ /dev/null @@ -1,443 +0,0 @@ -/* $Xorg: SetValues.c,v 1.4 2001/02/09 02:03:58 xorgcvs Exp $ */ - -/*********************************************************** -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/SetValues.c,v 1.2 2001/08/22 22:52:19 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" - -/* - * XtSetValues(), XtSetSubvalues() - */ - - -static void SetValues( - 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 Cardinal 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 ( - WidgetClass class, - Widget current, - Widget request, - Widget 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 ( - ConstraintWidgetClass class, - Widget current, - Widget request, - Widget 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( - 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( - 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 = 0; - 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/nx-X11/lib/Xt/SetWMCW.c b/nx-X11/lib/Xt/SetWMCW.c deleted file mode 100644 index d714fa665..000000000 --- a/nx-X11/lib/Xt/SetWMCW.c +++ /dev/null @@ -1,173 +0,0 @@ -/* $Xorg: SetWMCW.c,v 1.4 2001/02/09 02:03:58 xorgcvs Exp $ */ -/* $XdotOrg: xc/lib/Xt/SetWMCW.c,v 1.4 2005/07/22 20:30:10 alanc Exp $ - * - * Author: Chris D. Peterson, MIT X Consortium - */ - -/* Copyright 1993 Sun Microsystems, 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, and/or sell copies of the Software, and to permit persons - * to whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT - * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL - * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Except as contained in this notice, the name of a copyright holder - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * of the copyright holder. - */ - -/* - -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include - -/* 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 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/nx-X11/lib/Xt/Shell.c b/nx-X11/lib/Xt/Shell.c deleted file mode 100644 index b3e57b8e5..000000000 --- a/nx-X11/lib/Xt/Shell.c +++ /dev/null @@ -1,3414 +0,0 @@ -/* $Xorg: Shell.c,v 1.4 2001/02/09 02:03:58 xorgcvs Exp $ */ - -/*********************************************************** -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.16tsi Exp $ */ - -/* - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include "StringDefs.h" -#include "Shell.h" -#include "ShellP.h" -#include "ShellI.h" -#include "Vendor.h" -#include "VendorP.h" -#include -#include -#include -#include -#include - -#ifdef EDITRES -#include -#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(Widget, int, XrmValue *); -void _XtShellColormap(Widget, int, XrmValue *); -void _XtShellAncestorSensitive(Widget, int, XrmValue *); -void _XtTitleEncoding(Widget, int, XrmValue *); -#else -static void _XtShellDepth(Widget, int, XrmValue *); -static void _XtShellColormap(Widget, int, XrmValue *); -static void _XtShellAncestorSensitive(Widget, int, XrmValue *); -static void _XtTitleEncoding(Widget, int, XrmValue *); -#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(WidgetClass); -static void Initialize(Widget, Widget, ArgList, Cardinal *); -static void Realize(Widget, Mask *, XSetWindowAttributes *); -static void Resize(Widget); -static Boolean SetValues(Widget, Widget, Widget, ArgList , Cardinal *); -static void GetValuesHook(Widget, ArgList, Cardinal*); -static void ChangeManaged(Widget); -static XtGeometryResult GeometryManager(Widget, XtWidgetGeometry *, XtWidgetGeometry *); -static XtGeometryResult RootGeometryManager(Widget gw, XtWidgetGeometry *request, XtWidgetGeometry *reply); -static void Destroy(Widget); - -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(Widget, Widget, ArgList, Cardinal *); -static Boolean WMSetValues(Widget, Widget, Widget, ArgList, Cardinal *); -static void WMDestroy(Widget); - -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(Widget, Mask *, XSetWindowAttributes *); -static Boolean TransientSetValues(Widget, Widget, Widget, ArgList, Cardinal *); - -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(Widget, Widget, ArgList, Cardinal *); -static Boolean TopLevelSetValues(Widget, Widget, Widget, ArgList, Cardinal *); -static void TopLevelDestroy(Widget); - -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(Widget, Widget, ArgList, Cardinal *); -static void ApplicationDestroy(Widget); -static Boolean ApplicationSetValues(Widget, Widget, Widget, ArgList, Cardinal *); -static void ApplicationShellInsertChild(Widget); - -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(Widget, Widget, ArgList, Cardinal *); -static void SessionDestroy(Widget); -static Boolean SessionSetValues(Widget, Widget, Widget, ArgList, Cardinal *); - -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( - 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( - 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( - 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(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(Widget wid, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch); -static void _popup_set_prop(ShellWidget); - - -/*ARGSUSED*/ -static void XtCopyDefaultDepth( - Widget widget, - int offset, - XrmValue *value) -{ - value->addr = (XPointer)(&DefaultDepthOfScreen(XtScreenOfObject(widget))); -} - -#ifndef CRAY -static -#endif -void _XtShellDepth( - 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 widget, - int offset, - XrmValue *value) -{ - value->addr = (XPointer)(&DefaultColormapOfScreen(XtScreenOfObject(widget))); -} - -#ifndef CRAY -static -#endif -void _XtShellColormap( - 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 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 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( - Widget req, - Widget 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( - Widget req, Widget 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( - Widget req, Widget 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(int, String *); -static String *NewStringArray(String *); -static void FreeStringArray(String *); - -/* ARGSUSED */ -static void ApplicationInitialize( - Widget req, Widget 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) - -static void JoinSession(SessionShellWidget); -static void SetSessionProperties(SessionShellWidget, Boolean, unsigned long, unsigned long); -static void StopManagingSession(SessionShellWidget, SmcConn); - -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( - Widget req, Widget 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( - Widget w) -{ - register ShellWidget sw = (ShellWidget)w; - Widget childwid; - Cardinal 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(Widget, Widget); - -static void Realize( - 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( - 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( - 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( - 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( - 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( - 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( - 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( - 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( - Widget wid) -{ - if (XtIsRealized(wid)) - XDestroyWindow( XtDisplay(wid), XtWindow(wid) ); -} - -static void WMDestroy( - Widget wid) -{ - WMShellWidget w = (WMShellWidget) wid; - - XtFree((char *) w->wm.title); - XtFree((char *) w->wm.window_role); -} - -static void TopLevelDestroy( - Widget wid) -{ - TopLevelShellWidget w = (TopLevelShellWidget) wid; - - XtFree((char *) w->topLevel.icon_name); -} - -static void ApplicationDestroy( - Widget wid) -{ - ApplicationShellWidget w = (ApplicationShellWidget) wid; - if (w->application.argc > 0) - FreeStringArray(w->application.argv); -} - -static void SessionDestroy( - 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( - Widget W, Widget 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(Widget wid) -{ - ShellWidget w = (ShellWidget) wid; - Widget child = NULL; - Cardinal 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( - 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( - 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 Boolean _wait_for_response( - 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( - Widget gw, - XtWidgetGeometry *request, XtWidgetGeometry *reply) -{ - register ShellWidget w = (ShellWidget)gw; - XWindowChanges values; - unsigned int mask = request->request_mode; - XEvent event; - Boolean wm; - register struct _OldXSizeHints *hintp = NULL; - 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( - Widget old, Widget ref, Widget 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; - - for (n = *num_args; n; n--, args++) { - if (strcmp(XtNx, args->name) == 0) { - _XtShellGetCoordinates((Widget)ow, &ow->core.x, - &ow->core.y); - } else if (strcmp(XtNy, args->name) == 0) { - _XtShellGetCoordinates((Widget)ow, &ow->core.x, - &ow->core.y); - } - } - } - return FALSE; -} - -/* ARGSUSED */ -static Boolean WMSetValues( - Widget old, Widget ref, Widget 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( - Widget oldW, Widget refW, Widget 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( - Widget oldW, Widget refW, Widget 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( - 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( - Widget current, Widget request, Widget 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( - Widget current, Widget request, Widget new, - ArgList args, - Cardinal *num_args) -{ -#ifndef XT_NO_SM - SessionShellWidget nw = (SessionShellWidget) new; - SessionShellWidget cw = (SessionShellWidget) current; - unsigned long set_mask = 0UL; - unsigned long unset_mask = 0UL; - 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((SessionShellWidget) 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 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 widget, - ArgList args, - Cardinal* num_args) -{ - ShellWidget w = (ShellWidget) widget; - - /* 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) -{ - 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 - -static void CallSaveCallbacks(SessionShellWidget ); -static String *EditCommand(String, String *, String *); -static Boolean ExamineToken(XtPointer); -static void GetIceEvent(XtPointer, int *, XtInputId *); -static XtCheckpointToken GetToken(Widget, int); -static void XtCallCancelCallbacks(SmcConn, SmPointer); -static void XtCallDieCallbacks(SmcConn, SmPointer); -static void XtCallSaveCallbacks(SmcConn, SmPointer, int, Bool, int, Bool); -static void XtCallSaveCompleteCallbacks(SmcConn, SmPointer); - -#ifndef XT_NO_SM -static void StopManagingSession( - 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( - 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(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(String *str) -{ - if (str) - XtFree((char *) str); -} - - -#ifndef XT_NO_SM -static SmProp * CardPack( - 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(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( - 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( - SmProp **props, - int num_props) -{ - while (--num_props >= 0) - XtFree((char *) props[num_props]); -} - -typedef SmProp* (*PackProc)(char *, XtPointer); - -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( - 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, "%ld", (long)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( - XtPointer client_data, - int * source, - XtInputId * id) -{ - SessionShellWidget w = (SessionShellWidget) client_data; - IceProcessMessagesStatus status; - - 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( - 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( - 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( - 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( - 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( - SmcConn connection, - SmPointer client_data) -{ - SessionShellWidget w = (SessionShellWidget) client_data; - - XtCallCallbackList((Widget)w, w->session.save_complete_callbacks, - (XtPointer) NULL); -} - -/*ARGSUSED*/ -static void XtCallNextPhaseCallbacks( - SmcConn connection, /* unused */ - SmPointer client_data) -{ - SessionShellWidget w = (SessionShellWidget) client_data; - w->session.save->phase = 2; - CallSaveCallbacks(w); -} - -/*ARGSUSED*/ -static void XtCallDieCallbacks( - 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( - 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 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; -} - -XtCheckpointToken XtSessionGetToken(Widget widget) -{ - 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( - 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; -} - -void XtSessionReturnToken(XtCheckpointToken token) -{ - 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( - 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( - 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/nx-X11/lib/Xt/ShellI.h b/nx-X11/lib/Xt/ShellI.h deleted file mode 100644 index 6a093d791..000000000 --- a/nx-X11/lib/Xt/ShellI.h +++ /dev/null @@ -1,12 +0,0 @@ -/* $XFree86$ */ - -#ifndef _XtShellInternal_h -#define _XtShellInternal_h - -#include - -_XFUNCPROTOBEGIN - -extern void _XtShellGetCoordinates(Widget widget, Position *x, Position *y); - -#endif /* _XtShellInternal_h */ diff --git a/nx-X11/lib/Xt/ShellP.h b/nx-X11/lib/Xt/ShellP.h deleted file mode 100644 index 2b08c3f5c..000000000 --- a/nx-X11/lib/Xt/ShellP.h +++ /dev/null @@ -1,428 +0,0 @@ -/* $Xorg: ShellP.h,v 1.4 2001/02/09 02:03:58 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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 - -/* ***** - * ***** 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 - -/*********************************************************************** - * - * 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/nx-X11/lib/Xt/TMaction.c b/nx-X11/lib/Xt/TMaction.c deleted file mode 100644 index 54a8402ec..000000000 --- a/nx-X11/lib/Xt/TMaction.c +++ /dev/null @@ -1,1056 +0,0 @@ -/* $Xorg: TMaction.c,v 1.5 2001/02/09 02:03:58 xorgcvs Exp $ */ -/*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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/TMaction.c,v 3.7 2001/12/14 19:56:30 dawes Exp $ */ - -/* TMaction.c -- maintains the state table of actions for the translation - * manager. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#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( - register RConst 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)(_Xconst char*); - - 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; (Cardinal) i <= count - 1; i++) { - register Cardinal 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( - 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; - - 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( - 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( - 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 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; - - } else { - bindStatus->boundInContext = False; - } - UNLOCK_PROCESS; - return unbound; -} - -static XtActionProc *TryBindCache( - 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. - */ -XtPointer _XtInitializeActionData( - register struct _XtActionsRec *actions, - register Cardinal count, - _XtBoolean inPlace) -{ - 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( - 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( - 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 widget, - XtPointer closure, XtPointer 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 widget, - XtTM tm) -{ - XtTranslations xlations = tm->translations; - TMSimpleStateTree stateTree; - int globalUnbound = 0; - Cardinal i; - TMBindData bindData = (TMBindData)tm->proc_table; - TMSimpleBindProcs simpleBindProcs = NULL; - TMComplexBindProcs complexBindProcs = NULL; - 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 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( - 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( - ActionList actions) -{ - ActionList curr, next; - - for (curr = actions; curr;) { - next = curr->next; - XtFree((char *)curr->table); - XtFree((char *)curr); - curr = next; - } -} - -void XtAddActions( - XtActionList actions, - Cardinal num_actions) -{ - XtAppAddActions(_XtDefaultAppContext(), actions, num_actions); -} - -void XtAppAddActions( - 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( - 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 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; icore.num_popups; i++) - if (w->core.popup_list[i]->core.xrm_name == q) - return w->core.popup_list[i]; - - return NULL; -} - -void XtMenuPopupAction( - 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 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( - 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); -} - - -void XtCallActionProc( - Widget widget, - _Xconst char* action, - XEvent *event, - String *params, - Cardinal num_params) -{ - 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( - 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/nx-X11/lib/Xt/TMgrab.c b/nx-X11/lib/Xt/TMgrab.c deleted file mode 100644 index 9fc4df982..000000000 --- a/nx-X11/lib/Xt/TMgrab.c +++ /dev/null @@ -1,336 +0,0 @@ -/* $Xorg: TMgrab.c,v 1.4 2001/02/09 02:03:58 xorgcvs Exp $ */ - -/*********************************************************** -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/TMgrab.c,v 1.3 2001/12/14 19:56:30 dawes Exp $ */ - -/*LINTLIBRARY*/ -#ifdef HAVE_CONFIG_H -#include -#endif -#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 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( - 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) -{ - 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; - } - } -} - -void XtRegisterGrabAction( - XtActionProc action_proc, - _XtBoolean owner_events, - unsigned int event_mask, - int pointer_mode, - int keyboard_mode) -{ - 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( - XtAppContext app) -{ - LOCK_PROCESS; - if (grabActionList == NULL) - XtRegisterGrabAction( XtMenuPopupAction, True, - (unsigned)(ButtonPressMask | ButtonReleaseMask), - GrabModeAsync, - GrabModeAsync - ); - UNLOCK_PROCESS; - -} diff --git a/nx-X11/lib/Xt/TMkey.c b/nx-X11/lib/Xt/TMkey.c deleted file mode 100644 index 41944452a..000000000 --- a/nx-X11/lib/Xt/TMkey.c +++ /dev/null @@ -1,715 +0,0 @@ -/* $Xorg: TMkey.c,v 1.4 2001/02/09 02:03:58 xorgcvs Exp $ */ -/*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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/TMkey.c,v 3.10 2001/12/14 19:56:30 dawes Exp $ */ - -#define XK_MISCELLANY -#define XK_LATIN1 -#define XK_LATIN2 -#define XK_LATIN3 -#define XK_LATIN4 - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include -#ifdef XKB -#include -#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( - Display *dpy, - LateBindingsPtr lateModifiers, - Modifiers *computed, - Modifiers *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;jcount;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( - 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(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( - 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<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( - Display *dpy, - KeySym keysym, - KeySym *lower_return, - KeySym *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 ( - 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( - 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;jmax_keypermod;j++) { - keycode = modKeymap->modifiermap[i*modKeymap->max_keypermod+j]; - if (keycode != 0) { - pd->isModifier[keycode>>3] |= 1 << (keycode & 7); - for (k=0; kkeysyms_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); -} - -void XtTranslateKeycode ( - Display *dpy, - _XtKeyCode keycode, - Modifiers modifiers, - Modifiers *modifiers_return, - KeySym *keysym_return) -{ - 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 */ -void XtTranslateKey( - register Display *dpy, - _XtKeyCode keycode, - Modifiers modifiers, - Modifiers *modifiers_return, - KeySym *keysym_return) -{ -#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); -#endif -} - -void XtSetKeyTranslator( - 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( - 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( - 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( - 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 = NULL; - 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/nx-X11/lib/Xt/TMparse.c b/nx-X11/lib/Xt/TMparse.c deleted file mode 100644 index 25522fb59..000000000 --- a/nx-X11/lib/Xt/TMparse.c +++ /dev/null @@ -1,2135 +0,0 @@ -/* $Xorg: TMparse.c,v 1.6 2001/02/09 02:03:58 xorgcvs Exp $ */ - -/*********************************************************** -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.10tsi Exp $ */ - -/* - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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 HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include "StringDefs.h" -#include -#include -#ifndef NOTASCII -#define XK_LATIN1 -#endif -#define XK_MISCELLANY -#include - -#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)( - String /* str; */, - Opaque /* closure; */, - EventPtr /* event; */, - Boolean* /* error */); - -typedef TMShortCard Value; -typedef void (*ModifierProc)(Value, LateBindingsPtr*, Boolean, 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(Value, LateBindingsPtr*, Boolean, Value*); -static void ParseModSym(Value, LateBindingsPtr*, Boolean, Value*); -static String PanicModeRecovery(String); -static String CheckForPoundSign(String, _XtTranslateOp, _XtTranslateOp *); -static KeySym StringToKeySym(String, Boolean *); -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(String, Opaque, EventPtr, Boolean*); -static String ParseKeyAndModifiers(String, Opaque, EventPtr, Boolean*); -static String ParseTable(String, Opaque, EventPtr, Boolean*); -static String ParseImmed(String, Opaque, EventPtr, Boolean*); -static String ParseAddModifier(String, Opaque, EventPtr, Boolean*); -static String ParseNone(String, Opaque, EventPtr, Boolean*); -static String ParseAtom(String, Opaque, EventPtr, Boolean*); - -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 __UNIXOS2__ -#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 __UNIXOS2__ -#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( - 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( - NameValueTable table) -{ - register int i; - - for (i=0; table[i].name; i++) - table[i].signature = XrmPermStringToQuark(table[i].name); -} - -static int OrderEvents(_Xconst void *a, _Xconst void *b) -{ - return ((((_Xconst EventKey *)a)->signature < - ((_Xconst EventKey *)b)->signature) ? -1 : 1); -} - -static void Compile_XtEventTable( - 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(_Xconst void *a, _Xconst void *b) -{ - return ((((_Xconst ModifierRec *)a)->signature < - ((_Xconst ModifierRec *)b)->signature) ? -1 : 1); -} - -static void Compile_XtModifierTable( - 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( - String str) -{ - ScanFor(str,'\n'); - if (*str == '\n') str++; - return str; - -} - - -static void Syntax( - String str0,String str1) -{ - 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( - String eventStr, - Boolean *error) -{ - register int i = 0, 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( - 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( - 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( - 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( - 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( - 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 ((size_t)(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( - 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( - register String str, - EventPtr event, - Cardinal *tmEventP, - Boolean* error) -{ - String start = str; - char eventTypeStrbuf[100]; - char* eventTypeStr; - - ScanAlphanumeric(str); - eventTypeStr = XtStackAlloc ((size_t)(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( - 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( - 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( - 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( - 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 value, - LateBindingsPtr* lateBindings, - Boolean notFlag, - Value* valueP) -{ - *valueP = value; -} - - /* 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) - */ -static void ParseModSym( - 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( - register String str, - register Opaque closure, - register EventPtr event, - Boolean* error) -{ - event->event.eventCode = (unsigned long)closure; - event->event.eventCodeMask = ~0UL; - - return BROKEN_OPTIMIZER_HACK(str); -} - -/* ARGSUSED */ -static String ParseAddModifier( - 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( - 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( - 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 ((size_t)(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( - 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( - 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( - 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(String, int *, Boolean *, Boolean *); - -static String ParseEvent( - 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( - 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, False}, - /* (StatePtr) -1 */ NULL, - NULL, - NULL -}; - -static void RepeatDown( - 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; inext = 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( - EventPtr *eventP, - int reps, - ActionPtr **actionsP) -{ - EventRec upEventRec; - register EventPtr event, downEvent, lastDownEvent = NULL; - 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 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( - 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; inext = 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( - EventPtr *eventP, - int reps, - ActionPtr **actionsP) -{ - EventRec upEventRec; - register EventPtr event, downEvent, lastUpEvent = NULL; - 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; inext = 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( - 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; inext = XtNew(EventSeqRec); - event = event->next; - *event = *tempEvent; - } - - *eventP = event; - *actionsP = &event->actions; -} - -static void RepeatOtherPlus( - 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; inext = XtNew(EventSeqRec); - event = event->next; - *event = *tempEvent; - } - - event->next = event; - *eventP = event; - *actionsP = &event->actions; -} - -static void RepeatEvent( - 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( - register String str, - int *reps, - Boolean *plus, Boolean *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]; - size_t 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( - 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( - 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( - 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( - 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( - 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( - 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( - String currentProduction) -{ - Cardinal num_params = 1; - String params[1]; - size_t len; - char *eol, *production, productionbuf[500]; - -#ifdef __UNIXOS2__ - 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( - 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( - 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( - 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( - Display* dpy, - XrmValuePtr args, - Cardinal *num_args, - XrmValuePtr from, - XrmValuePtr 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( - Display *dpy, - XrmValuePtr args, - Cardinal *num_args, - XrmValuePtr from, - XrmValuePtr 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 - */ -XtAccelerators XtParseAcceleratorTable( - _Xconst char* source) -{ - Boolean error = FALSE; - XtAccelerators ret = - (XtAccelerators) ParseTranslationTable ((char *)source, TRUE, XtTableAugment, &error); - if (error == TRUE) - XtWarningMsg ("parseError", "cvtStringToAcceleratorTable", - XtCXtToolkitError, - "String to AcceleratorTable conversion encountered errors", - (String *)NULL, (Cardinal *)NULL); - return ret; -} - -XtTranslations XtParseTranslationTable( - _Xconst char* source) -{ - Boolean error = FALSE; - XtTranslations ret = ParseTranslationTable((char *)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(void) -{ - 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( - 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/nx-X11/lib/Xt/TMprint.c b/nx-X11/lib/Xt/TMprint.c deleted file mode 100644 index 7b7bde22b..000000000 --- a/nx-X11/lib/Xt/TMprint.c +++ /dev/null @@ -1,881 +0,0 @@ -/* $Xorg: TMprint.c,v 1.4 2001/02/09 02:03:58 xorgcvs Exp $ */ - -/*********************************************************** -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/TMprint.c,v 1.6 2001/12/14 19:56:31 dawes Exp $ */ - -/*LINTLIBRARY*/ -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include - -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 ((unsigned)(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) \ -{ \ - size_t l = strlen(more); \ - ExpandForChars(sb, l); \ - } - -static void PrintModifiers( - TMStringBuf sb, - unsigned long mask, unsigned long mod) -{ - Boolean notfirst = False; - CHECK_STR_OVERFLOW(sb); - - if (mask == ~0UL && 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( - 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, "") - PRINTEVENT(KeyRelease, "") - PRINTEVENT(ButtonPress, "") - PRINTEVENT(ButtonRelease, "") - PRINTEVENT(MotionNotify, "") - PRINTEVENT(EnterNotify, "") - PRINTEVENT(LeaveNotify, "") - PRINTEVENT(FocusIn, "") - PRINTEVENT(FocusOut, "") - PRINTEVENT(KeymapNotify, "") - PRINTEVENT(Expose, "") - PRINTEVENT(GraphicsExpose, "") - PRINTEVENT(NoExpose, "") - PRINTEVENT(VisibilityNotify, "") - PRINTEVENT(CreateNotify, "") - PRINTEVENT(DestroyNotify, "") - PRINTEVENT(UnmapNotify, "") - PRINTEVENT(MapNotify, "") - PRINTEVENT(MapRequest, "") - PRINTEVENT(ReparentNotify, "") - PRINTEVENT(ConfigureNotify, "") - PRINTEVENT(ConfigureRequest, "") - PRINTEVENT(GravityNotify, "") - PRINTEVENT(ResizeRequest, "") - PRINTEVENT(CirculateNotify, "") - PRINTEVENT(CirculateRequest, "") - PRINTEVENT(PropertyNotify, "") - PRINTEVENT(SelectionClear, "") - PRINTEVENT(SelectionRequest, "") - PRINTEVENT(SelectionNotify, "") - PRINTEVENT(ColormapNotify, "") - PRINTEVENT(ClientMessage, "") - case _XtEventTimerEventType: - (void) strcpy(sb->current,""); - break; - default: - (void) sprintf(sb->current, "<0x%x>", (int) event); -#undef PRINTEVENT - } - sb->current += strlen(sb->current); -} - -static void PrintCode( - TMStringBuf sb, - unsigned long mask, unsigned long code) -{ - CHECK_STR_OVERFLOW(sb); - if (mask != 0) { - if (mask != ~0UL) - (void) sprintf(sb->current, "0x%lx:0x%lx", mask, code); - else (void) sprintf(sb->current, /*"0x%lx"*/ "%d", (unsigned)code); - sb->current += strlen(sb->current); - } -} - -static void PrintKeysym( - TMStringBuf sb, - KeySym keysym) -{ - String keysymName; - - if (keysym == 0) return; - - CHECK_STR_OVERFLOW(sb); - keysymName = XKeysymToString(keysym); - if (keysymName == NULL) - PrintCode(sb,~0UL,(unsigned long)keysym); - else { - ExpandToFit(sb, keysymName); - strcpy(sb->current, keysymName); - sb->current += strlen(sb->current); - } -} - -static void PrintAtom( - TMStringBuf sb, - Display *dpy, - Atom atom) -{ - String atomName; - - if (atom == 0) return; - - atomName = (dpy ? XGetAtomName(dpy, atom) : NULL); - - if (! atomName) - PrintCode(sb,~0UL,(unsigned long)atom); - else { - ExpandToFit( sb, atomName ); - strcpy(sb->current, atomName); - sb->current += strlen(sb->current); - XFree(atomName); - } -} - -static void PrintLateModifiers( - 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( - 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( - TMStringBuf sb, - String *params, - Cardinal num_params) -{ - register Cardinal i; - for (i = 0; icurrent++ = ','; - *sb->current++ = ' '; - } - *sb->current++ = '"'; - strcpy(sb->current, params[i]); - sb->current += strlen(sb->current); - *sb->current++ = '"'; - } - *sb->current = '\0'; -} - -static void PrintActions( - 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( - 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 (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( - 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( - 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( - 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( - 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( - 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; -} - -String _XtPrintXlations( - Widget w, - XtTranslations xlations, - Widget accelWidget, - _XtBoolean includeRHS) -{ - 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 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 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 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( - 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( - 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( - 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/nx-X11/lib/Xt/TMstate.c b/nx-X11/lib/Xt/TMstate.c deleted file mode 100644 index 604947496..000000000 --- a/nx-X11/lib/Xt/TMstate.c +++ /dev/null @@ -1,2349 +0,0 @@ -/* $Xorg: TMstate.c,v 1.6 2001/02/09 02:03:58 xorgcvs Exp $ */ - -/*********************************************************** -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.8 2001/12/14 19:56:31 dawes Exp $ */ - -/* - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" - -#ifndef TM_NO_MATCH -#define TM_NO_MATCH (-2) -#endif /* TM_NO_MATCH */ - -/* forward definitions */ -static StatePtr NewState(TMParseStateTree, TMShortCard, TMShortCard); - - -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( - 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( - 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( - 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) -{ - TMShortCard i, j = TM_TYPE_SEGMENT_SIZE; - TMShortCard typeIndex = 0; - TMTypeMatch typeMatch; - TMTypeMatch segment = NULL; - - 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( - LateBindingsPtr lateBind1P, - LateBindingsPtr 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) -{ - TMShortCard i, j = TM_MOD_SEGMENT_SIZE; - TMShortCard modIndex = 0; - TMModifierMatch modMatch; - TMModifierMatch segment = NULL; - - 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( - 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( - 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( - 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( - 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( - 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( - 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( - 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( - 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( - 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( - TMSimpleStateTree stateTree, - int startIndex, - TMShortCard typeIndex, - TMShortCard 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( - Widget w, - XtTM tmRecPtr, - TMEventRec *curEventPtr) -{ - XtTranslations xlations = tmRecPtr->translations; - TMSimpleStateTree stateTree; - TMContext *contextPtr = GetContextPtr(tmRecPtr); - TMShortCard i; - ActionRec *actions = NULL; - Boolean matchExact = False; - Boolean match = False; - StatePtr complexMatchState = NULL; - int currIndex; - TMShortCard typeIndex = 0, modIndex = 0; - 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( - 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( - 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( - Widget w, - XtTM tmRecPtr, - TMEventRec *curEventPtr) -{ - XtTranslations xlations = tmRecPtr->translations; - TMContext *contextPtr = GetContextPtr(tmRecPtr); - TMShortCard i, matchTreeIndex = 0; - 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 ( - 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( - TMParseStateTree stateTree, - TMShortCard typeIndex, - TMShortCard 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( - 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( - 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 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 widget, - XtPointer closure, /* target widget */ - XtPointer call_data) -{ - _XtRemoveCallback( &_XtGetPerDisplay(XtDisplay(widget))->mapping_callbacks, - DispatchMappingNotify, - closure - ); -} - -static Boolean AggregateEventMask( - StatePtr state, - XtPointer data) -{ - LOCK_PROCESS; - *((EventMask *)data) |= EventToMask(TMGetTypeMatch(state->typeIndex), - TMGetModifierMatch(state->modIndex)); - UNLOCK_PROCESS; - return False; -} - -void _XtInstallTranslations( - 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) -{ - 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) -{ - 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) -{ - 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) -{ - 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); -} - -XtTranslations _XtCreateXlations( - TMStateTree *stateTrees, - TMShortCard numStateTrees, - XtTranslations first, - XtTranslations second) -{ - 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( - 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( - 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( - 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( - 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( - Display *dpy, - XrmValuePtr args, - Cardinal *num_args, - XrmValuePtr from, - XrmValuePtr 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( - Widget dest, - XtTranslations first, - XtTranslations 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; - -#ifndef REFCNT_TRANSLATIONS - - if (cache_ref) - XtAddCallback(dest, XtNdestroyCallback, - XtCallbackReleaseCacheRef, (XtPointer)cache_ref); - -#endif - - 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 widget, - XtTranslations xlations, - XtTranslations unmergeXlations, - TMShortCard currIndex, - TMComplexBindProcs oldBindings, - TMShortCard numOldBindings, - TMComplexBindProcs newBindings, - TMShortCard *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 widget, - XtTranslations oldXlations, - XtTranslations newXlations, - _XtTranslateOp operation, - Widget source, - TMComplexBindProcs oldBindings, - TMComplexBindProcs newBindings, - TMShortCard *numNewRtn) -{ - XtTranslations newTable = NULL, 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( - 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( - Widget dest, - _XtTranslateOp operation, - Widget source, - XtTranslations newXlations) -{ - XtTranslations newTable, oldXlations; - XtTranslations accNewXlations; - EventMask oldMask = 0; - TMBindData bindData; - TMComplexBindProcs oldBindings = NULL; - TMShortCard numOldBindings = 0, 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( - 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( - 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( - 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( - 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( - Widget destination, Widget 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( - Widget destination, - Widget source) -{ - Cardinal 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( - XtTranslations xlations) -{ - return ((xlations->hasBindings) - ? ((ATranslations)xlations)->xlations->operation - : xlations->operation); -} -#endif - -void XtAugmentTranslations( - 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 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 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 widget, - XtTranslations xlations) -{ - ComposeTranslations(widget, XtTableUnmerge, (Widget)NULL, xlations); -} diff --git a/nx-X11/lib/Xt/Threads.c b/nx-X11/lib/Xt/Threads.c deleted file mode 100644 index aad17ca79..000000000 --- a/nx-X11/lib/Xt/Threads.c +++ /dev/null @@ -1,428 +0,0 @@ -/* $Xorg: Threads.c,v 1.4 2001/02/09 02:03:59 xorgcvs Exp $ */ - -/************************************************************ -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/Threads.c,v 3.6 2001/12/14 19:56:31 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" - -#ifdef XTHREADS - -#define xmalloc __XtMalloc -#define xfree XtFree -#include - -#ifndef NDEBUG -#define NDEBUG -#endif -#include -#include - -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(void) -{ - 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(void) -{ -#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(void) -{ -#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 -AppLock(XtAppContext app) -{ - 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 -AppUnlock(XtAppContext app) -{ - LockPtr app_lock = app->lock_info; -#ifdef _XMUTEX_NESTS - app_lock->level--; - xmutex_unlock(app_lock->mutex); -#else - xthread_t self; - - 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 -YieldAppLock( - XtAppContext app, - Boolean* push_thread, - Boolean* pushed_thread, - int* level) -{ - 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 == (int)app_lock->stack.size - 1) { - unsigned 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 -RestoreAppLock( - XtAppContext app, - int level, - Boolean* pushed_thread) -{ - 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 -FreeAppLock(XtAppContext app) -{ - unsigned 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 -InitAppLock(XtAppContext app) -{ - 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) */ - -void XtAppLock(XtAppContext app) -{ -#ifdef XTHREADS - if(app->lock) - (*app->lock)(app); -#endif -} - -void XtAppUnlock(XtAppContext app) -{ -#ifdef XTHREADS - if(app->unlock) - (*app->unlock)(app); -#endif -} - -void XtProcessLock(void) -{ -#ifdef XTHREADS - if(_XtProcessLock) - (*_XtProcessLock)(); -#endif -} - -void XtProcessUnlock(void) -{ -#ifdef XTHREADS - if(_XtProcessUnlock) - (*_XtProcessUnlock)(); -#endif -} - -Boolean XtToolkitThreadInitialize(void) -{ -#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/nx-X11/lib/Xt/ThreadsI.h b/nx-X11/lib/Xt/ThreadsI.h deleted file mode 100644 index 1492d7711..000000000 --- a/nx-X11/lib/Xt/ThreadsI.h +++ /dev/null @@ -1,130 +0,0 @@ -/* $Xorg: ThreadsI.h,v 1.4 2001/02/09 02:03:59 xorgcvs Exp $ */ - -/************************************************************ -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/ThreadsI.h,v 3.5 2001/12/14 19:56:31 dawes Exp $ */ - -#ifndef _XtThreadsI_h -#define _XtThreadsI_h - -#include - -#ifdef XTHREADS - -typedef struct _LockRec *LockPtr; - -typedef void (*ThreadAppProc)( - XtAppContext /* app */ -); - -typedef void (*ThreadAppYieldLockProc)( - XtAppContext, /* app */ - Boolean*, /* push_thread */ - Boolean*, /* pushed_thread */ - int* /* level */ -); - -typedef void (*ThreadAppRestoreLockProc)( - XtAppContext /* app */, - int, /* level */ - Boolean* /* pushed_thread */ -); - -extern void (*_XtProcessLock)( - void -); - -extern void (*_XtProcessUnlock)( - void -); - -extern void (*_XtInitAppLock)( - XtAppContext /* app */ -); - -#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) */ -#endif /* _XtThreadsI_h */ diff --git a/nx-X11/lib/Xt/TranslateI.h b/nx-X11/lib/Xt/TranslateI.h deleted file mode 100644 index 122487523..000000000 --- a/nx-X11/lib/Xt/TranslateI.h +++ /dev/null @@ -1,606 +0,0 @@ -/* $Xorg: TranslateI.h,v 1.4 2001/02/09 02:03:59 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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/TranslateI.h,v 1.3 2001/12/14 19:56:32 dawes Exp $ */ - -/* - * 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 struct _TMTypeMatchRec *TMTypeMatch; -typedef struct _TMModifierMatchRec *TMModifierMatch; -typedef struct _TMEventRec *TMEventPtr; - -typedef Boolean (*MatchProc)(TMTypeMatch typeMatch, - TMModifierMatch modMatch, - TMEventPtr eventSeq); - -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; - -typedef struct _TMTypeMatchRec{ - TMLongCard eventType; - TMLongCard eventCode; - TMLongCard eventCodeMask; - MatchProc matchEvent; -}TMTypeMatchRec; - -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; - -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<> 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( - Widget /* widget */, - XtGrabKind /* grab_kind */, - _XtBoolean /* spring_loaded */ -); - -extern String _XtPrintXlations( - Widget /* w */, - XtTranslations /* xlations */, - Widget /* accelWidget */, - _XtBoolean /* includeRHS */ -); - -extern void _XtRegisterGrabs( - Widget /* widget */ -); - -extern XtPointer _XtInitializeActionData( - struct _XtActionsRec * /* actions */, - Cardinal /* count */, - _XtBoolean /* inPlace */ -); - -extern void _XtAddEventSeqToStateTree( - EventSeqPtr /* eventSeq */, - TMParseStateTree /* stateTree */ -); - -extern Boolean _XtMatchUsingStandardMods( - TMTypeMatch /* typeMatch */, - TMModifierMatch /* modMatch */, - TMEventPtr /* eventSeq */ -); - -extern Boolean _XtMatchUsingDontCareMods( - TMTypeMatch /* typeMatch */, - TMModifierMatch /* modMatch */, - TMEventPtr /* eventSeq */ -); - -extern Boolean _XtRegularMatch( - TMTypeMatch /* typeMatch */, - TMModifierMatch /* modMatch */, - TMEventPtr /* eventSeq */ -); - -extern Boolean _XtMatchAtom( - TMTypeMatch /* typeMatch */, - TMModifierMatch /* modMatch */, - TMEventPtr /* eventSeq */ -); - -extern void _XtTranslateEvent( - Widget /* widget */, - XEvent* /* event */ -); - -#include "CallbackI.h" -#include "EventI.h" -#include "HookObjI.h" -#include "PassivGraI.h" -#include "ThreadsI.h" -#include "InitialI.h" -#include "ResourceI.h" -#include "StringDefs.h" - -extern void _XtBuildKeysymTables(Display *dpy, XtPerDisplay pd); - -#ifndef NO_MIT_HACKS -extern void _XtDisplayTranslations( - Widget /* widget */, - XEvent* /* event */, - String* /* params */, - Cardinal* /* num_params */ -); - -extern void _XtDisplayAccelerators( - Widget /* widget */, - XEvent* /* event */, - String* /* params */, - Cardinal* /* num_params */ -); - -extern void _XtDisplayInstalledAccelerators( - Widget /* widget */, - XEvent* /* event */, - String* /* params */, - Cardinal* /* num_params */ -); -#endif /* ifndef NO_MIT_HACKS */ - -extern void _XtPopupInitialize( - XtAppContext /* app_context */ -); - -extern void _XtBindActions( - Widget /* widget */, - XtTM /* tm_rec */ -); - -extern Boolean _XtComputeLateBindings( - Display* /* dpy */, - LateBindingsPtr /* lateModifiers */, - Modifiers* /* computed */, - Modifiers* /* computedMask */ -); - -extern XtTranslations _XtCreateXlations( - TMStateTree * /* stateTrees */, - TMShortCard /* numStateTrees */, - XtTranslations /* first */, - XtTranslations /* second */ -); - -extern Boolean _XtCvtMergeTranslations( - Display* /* dpy */, - XrmValuePtr /* args */, - Cardinal* /* num_args */, - XrmValuePtr /* from */, - XrmValuePtr /* to */, - XtPointer* /* closure_ret */ -); - -void _XtRemoveStateTreeByIndex( - XtTranslations /* xlations */, - TMShortCard /* i */); - -void _XtFreeTranslations( - XtAppContext /* app */, - XrmValuePtr /* toVal */, - XtPointer /* closure */, - XrmValuePtr /* args */, - Cardinal* /* num_args */ -); - -extern TMShortCard _XtGetModifierIndex( - Event* /* event */ -); - -extern TMShortCard _XtGetQuarkIndex( - TMParseStateTree /* stateTreePtr */, - XrmQuark /* quark */ -); - -extern XtTranslations _XtGetTranslationValue( - Widget /* widget */ -); - -extern TMShortCard _XtGetTypeIndex( - Event* /* event */ -); - -extern void _XtGrabInitialize( - XtAppContext /* app */ -); - -extern void _XtInstallTranslations( - Widget /* widget */ -); - -extern void _XtRemoveTranslations( - Widget /* widget */ -); - -extern void _XtDestroyTMData( - Widget /* widget */ -); - -extern void _XtMergeTranslations( - Widget /* widget */, - XtTranslations /* newXlations */, - _XtTranslateOp /* operation */ -); - -extern void _XtActionInitialize( - XtAppContext /* app */ -); - -extern TMStateTree _XtParseTreeToStateTree( - TMParseStateTree /* parseTree */ -); - -extern String _XtPrintActions( - ActionRec* /* actions */, - XrmQuark* /* quarkTbl */ -); - -extern String _XtPrintState( - TMStateTree /* stateTree */, - TMBranchHead /* branchHead */); - -extern String _XtPrintEventSeq( - EventSeqPtr /* eventSeq */, - Display* /* dpy */ -); - -typedef Boolean (*_XtTraversalProc)( - StatePtr /* state */, - XtPointer /* data */ -); - -extern void _XtTraverseStateTree( - TMStateTree /* tree */, - _XtTraversalProc /* func */, - XtPointer /* data */ -); - -extern void _XtTranslateInitialize( - void -); - -extern void _XtAddTMConverters( - ConverterTable /* table */ -); - -extern void _XtUnbindActions( - Widget /* widget */, - XtTranslations /* xlations */, - TMBindData /* bindData */ -); - -extern void _XtUnmergeTranslations( - Widget /* widget */, - XtTranslations /* xlations */ -); - -/* TMKey.c */ -extern void _XtAllocTMContext(XtPerDisplay pd); - diff --git a/nx-X11/lib/Xt/VarCreate.c b/nx-X11/lib/Xt/VarCreate.c deleted file mode 100644 index b3761e8b8..000000000 --- a/nx-X11/lib/Xt/VarCreate.c +++ /dev/null @@ -1,399 +0,0 @@ -/* $Xorg: VarCreate.c,v 1.4 2001/02/09 02:03:59 xorgcvs Exp $ */ - -/* - -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/VarCreate.c,v 3.6 2001/08/22 22:52:20 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include "StringDefs.h" -#include "Shell.h" -#include "VarargsI.h" -#include "CreateI.h" - -#if (defined(SUNSHLIB) || defined(AIXSHLIB)) && defined(SHAREDCODE) -#define XtToolkitInitialize _XtToolkitInitialize -#endif /* (SUNSHLIB || AIXSHLIB) && SHAREDCODE */ - -static Widget -_XtVaCreateWidget( - 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; -} - - -Widget -XtVaCreateWidget( - _Xconst char* name, - WidgetClass widget_class, - Widget parent, - ...) -{ - 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((String)name, widget_class, parent, var, - total_count); - va_end(var); - UNLOCK_APP(app); - return widget; -} - - -Widget -XtVaCreateManagedWidget( - _Xconst char* name, - WidgetClass widget_class, - Widget parent, - ...) -{ - 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((String)name, widget_class, parent, var, - total_count); - XtManageChild(widget); - va_end(var); - UNLOCK_APP(app); - return widget; -} - - -Widget -XtVaAppCreateShell( - _Xconst char* name, - _Xconst char* class, - WidgetClass widget_class, - Display* display, - ...) -{ - 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((String)name, (String)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; -} - - -Widget -XtVaCreatePopupShell( - _Xconst char* name, - WidgetClass widget_class, - Widget parent, - ...) -{ - 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((String)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; -} - -void -XtVaSetValues(Widget widget, ...) -{ - 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); -} - - -void -XtVaSetSubvalues(XtPointer base, XtResourceList resources, Cardinal num_resources, ...) -{ - 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); -} - -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) -{ - 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); -} - -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) -{ - 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. - */ - -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; - - 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); -} - -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; - - 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/nx-X11/lib/Xt/VarGet.c b/nx-X11/lib/Xt/VarGet.c deleted file mode 100644 index cdb425a71..000000000 --- a/nx-X11/lib/Xt/VarGet.c +++ /dev/null @@ -1,317 +0,0 @@ -/* $Xorg: VarGet.c,v 1.4 2001/02/09 02:03:59 xorgcvs Exp $ */ -/* - -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 - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/VarGet.c,v 1.7 2001/07/29 05:01:12 tsi Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include "VarargsI.h" -#include "StringDefs.h" - -static String XtNxtGetTypedArg = "xtGetTypedArg"; - -void -XtVaGetSubresources( - Widget widget, - XtPointer base, - _Xconst char* name, - _Xconst char* class, - XtResourceList resources, - Cardinal num_resources, - ...) -{ - 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); -} - - -void -XtVaGetApplicationResources(Widget widget, XtPointer base, XtResourceList resources, Cardinal num_resources, ...) -{ - 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 widget, - XtTypedArgList typed_arg, - XtResourceList resources, - Cardinal num_resources) -{ - String from_type = NULL; - Cardinal from_size = 0; - XrmValue from_val, to_val; - register Cardinal 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 > (unsigned) 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 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); -} - -void -XtVaGetValues(Widget widget, ...) -{ - 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); -} - -void -XtVaGetSubvalues(XtPointer base,XtResourceList resources, Cardinal num_resources, ...) -{ - 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/nx-X11/lib/Xt/Varargs.c b/nx-X11/lib/Xt/Varargs.c deleted file mode 100644 index 37d3c64db..000000000 --- a/nx-X11/lib/Xt/Varargs.c +++ /dev/null @@ -1,519 +0,0 @@ -/* $Xorg: Varargs.c,v 1.4 2001/02/09 02:03:59 xorgcvs Exp $ */ - -/* - -Copyright 1985, 1986, 1987, 1988, 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/Varargs.c,v 3.10 2001/12/14 19:56:32 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#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( - 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. - */ -void -_XtCountVaList(va_list var, int* total_count, int* typed_count) -{ - 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) { - (void)va_arg(var, String); - (void)va_arg(var, String); - (void)va_arg(var, XtArgVal); - (void)va_arg(var, int); - ++(*total_count); - ++(*typed_count); - } else if (strcmp(attr, XtVaNestedList) == 0) { - _XtCountNestedList(va_arg(var, XtTypedArgList), total_count, - typed_count); - } else { - (void)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. - */ -XtVarArgsList -XtVaCreateArgsList(XtPointer unused, ...) -{ - 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) { - (void)va_arg(var, String); - (void)va_arg(var, String); - (void)va_arg(var, XtArgVal); - (void)va_arg(var, int); - } else { - (void)va_arg(var, XtArgVal); - } - } - va_end(var); - - va_start(var,unused); - avlist = _XtVaCreateTypedArgList(var, count); - va_end(var); - return (XtVarArgsList)avlist; -} - - -XtTypedArgList _XtVaCreateTypedArgList(va_list var, register int count) -{ - 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 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) || - ((unsigned) 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 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. - */ -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 */ -{ - 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(Widget widget, XtResourceList *res_list, - Cardinal *number); - - -/* - * 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. - */ -void -_XtVaToArgList( - Widget widget, - va_list var, - int max_count, - ArgList *args_return, - Cardinal *num_args_return) -{ - 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 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( - 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. - */ -void -_XtVaToTypedArgList( - va_list var, - int max_count, - XtTypedArgList *args_return, - Cardinal *num_args_return) -{ - 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/nx-X11/lib/Xt/VarargsI.h b/nx-X11/lib/Xt/VarargsI.h deleted file mode 100644 index e15404aab..000000000 --- a/nx-X11/lib/Xt/VarargsI.h +++ /dev/null @@ -1,65 +0,0 @@ -/* $Xorg: VarargsI.h,v 1.4 2001/02/09 02:03:59 xorgcvs Exp $ */ - -/* - -Copyright 1985, 1986, 1987, 1988, 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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/VarargsI.h,v 3.6 2001/12/14 19:56:32 dawes Exp $ */ - -#ifndef _VarargsI_h_ -#define _VarargsI_h_ - -#include - -/* private routines */ - -extern void _XtCountVaList( - va_list /*var*/, int* /*total_count*/, int* /*typed_count*/ -); - -extern void _XtVaToArgList( - Widget /*widget*/, va_list /*var*/, int /*max_count*/, ArgList* /*args_return*/, Cardinal* /*num_args_return*/ -); - -extern void _XtVaToTypedArgList( - va_list /*var*/, int /*count*/, XtTypedArgList* /*args_return*/, Cardinal* /*num_args_return*/ -); - -extern XtTypedArgList _XtVaCreateTypedArgList( - va_list /*var*/, int /*count*/ -); - -extern void _XtFreeArgList( - ArgList /*args*/, int /*total_count*/, int /*typed_count*/ -); - -extern void _XtGetApplicationResources( - Widget /*w*/, XtPointer /*base*/, XtResourceList /*resources*/, Cardinal /*num_resources*/, ArgList /*args*/, Cardinal /*num_args*/, XtTypedArgList /*typed_args*/, Cardinal /*num_typed_args*/ -); - -extern 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*/ -); - -#endif /* _VarargsI_h_ */ diff --git a/nx-X11/lib/Xt/Vendor.c b/nx-X11/lib/Xt/Vendor.c deleted file mode 100644 index 42c289c16..000000000 --- a/nx-X11/lib/Xt/Vendor.c +++ /dev/null @@ -1,159 +0,0 @@ -/* $Xorg: Vendor.c,v 1.4 2001/02/09 02:03:59 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.7 2002/05/31 18:45:46 dawes Exp $ */ - -/* Make sure all wm properties can make it out of the resource manager */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include "StringDefs.h" -#include "Shell.h" -#include "ShellP.h" -#include "Vendor.h" -#include "VendorP.h" -#include - -/*************************************************************************** - * - * Vendor shell class record - * - ***************************************************************************/ - -#if defined(__UNIXOS2__) || defined(__CYGWIN__) -/* to fix the EditRes problem because of wrong linker semantics */ -extern WidgetClass vendorShellWidgetClass; - -#if defined(__UNIXOS2__) -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 - -#if defined(__CYGWIN__) -int __stdcall -DllMain(unsigned long mod_handle, unsigned long flag, void *routine) -{ - switch (flag) - { - case 1: /* DLL_PROCESS_ATTACH - process attach */ - vendorShellWidgetClass = (WidgetClass)(&vendorShellClassRec); - break; - case 0: /* DLL_PROCESS_DETACH - process detach */ - break; - } - return 1; -} -#endif -#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/nx-X11/lib/Xt/Vendor.h b/nx-X11/lib/Xt/Vendor.h deleted file mode 100644 index 65e7c38b0..000000000 --- a/nx-X11/lib/Xt/Vendor.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -* $Xorg: Vendor.h,v 1.5 2001/02/09 02:03:59 xorgcvs Exp $ -* $oHeader: Vendor.h,v 1.2 88/08/18 15:56:44 asente Exp $ -*/ - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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 - -#include - -/*********************************************************************** - * - * 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/nx-X11/lib/Xt/VendorP.h b/nx-X11/lib/Xt/VendorP.h deleted file mode 100644 index 08bf6890b..000000000 --- a/nx-X11/lib/Xt/VendorP.h +++ /dev/null @@ -1,103 +0,0 @@ -/* -* $Xorg: VendorP.h,v 1.4 2001/02/09 02:03:59 xorgcvs Exp $ -* $oHeader: VendorP.h,v 1.2 88/08/18 15:56:48 asente Exp $ -*/ - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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 - -/* 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/nx-X11/lib/Xt/Xt-def.cpp b/nx-X11/lib/Xt/Xt-def.cpp deleted file mode 100644 index 4f0420aa0..000000000 --- a/nx-X11/lib/Xt/Xt-def.cpp +++ /dev/null @@ -1,352 +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 - _XtWaitForSomething -#ifdef __UNIXOS2__ - _XtAddCallback - _XtRemoveCallback - _XtRemoveAllCallbacks - _XtPrintXlations - _XtAllocError - _XtCountVaList - _XtVaToArgList -#endif -/* $Xorg: Xt-def.cpp,v 1.3 2000/08/17 19:46:20 cpqbld Exp $ */ -/* $XFree86: xc/lib/Xt/Xt-def.cpp,v 1.3 2003/03/25 04:18:12 dawes Exp $ */ diff --git a/nx-X11/lib/Xt/Xtos.h b/nx-X11/lib/Xt/Xtos.h deleted file mode 100644 index 013b2416c..000000000 --- a/nx-X11/lib/Xt/Xtos.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -* $Xorg: Xtos.h,v 1.4 2001/02/09 02:03:59 xorgcvs Exp $ -*/ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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.12tsi 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 - -#ifdef CRAY -#define WORD64 -#endif - -#if defined (_LP64) || \ - defined(__alpha) || defined(__alpha__) || \ - defined(__ia64__) || defined(ia64) || \ - defined(__sparc64__) || \ - defined(__s390x__) || \ - (defined(__hppa__) && defined(__LP64__)) || \ - defined(__amd64__) || defined(amd64) || \ - defined(__powerpc64__) || \ - (defined(sgi) && (_MIPS_SZLONG == 64)) -#define LONG64 -#endif - -#endif /* _Xtos_h */ -/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/nx-X11/lib/Xt/jump_funcs b/nx-X11/lib/Xt/jump_funcs deleted file mode 100644 index 6a5dc2bd5..000000000 --- a/nx-X11/lib/Xt/jump_funcs +++ /dev/null @@ -1,756 +0,0 @@ -# $Xorg: jump_funcs,v 1.3 2000/08/17 19:46:20 cpqbld 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/nx-X11/lib/Xt/jump_ignore b/nx-X11/lib/Xt/jump_ignore deleted file mode 100644 index d2bfe7fcc..000000000 --- a/nx-X11/lib/Xt/jump_ignore +++ /dev/null @@ -1,15 +0,0 @@ -# $Xorg: jump_ignore,v 1.3 2000/08/17 19:46:21 cpqbld 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/nx-X11/lib/Xt/jump_vars b/nx-X11/lib/Xt/jump_vars deleted file mode 100644 index 2727363a2..000000000 --- a/nx-X11/lib/Xt/jump_vars +++ /dev/null @@ -1,71 +0,0 @@ -# $Xorg: jump_vars,v 1.3 2000/08/17 19:46:21 cpqbld 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/nx-X11/lib/Xt/libXt.elist b/nx-X11/lib/Xt/libXt.elist deleted file mode 100644 index 8f9fc8695..000000000 --- a/nx-X11/lib/Xt/libXt.elist +++ /dev/null @@ -1,42 +0,0 @@ -/* $Xorg: libXt.elist,v 1.3 2000/08/17 19:46:21 cpqbld Exp $ */ - -/************************************************************************* - * 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/nx-X11/lib/Xt/sharedlib.c b/nx-X11/lib/Xt/sharedlib.c deleted file mode 100644 index 699302ced..000000000 --- a/nx-X11/lib/Xt/sharedlib.c +++ /dev/null @@ -1,236 +0,0 @@ -/* $Xorg: sharedlib.c,v 1.4 2001/02/09 02:03:59 xorgcvs Exp $ */ - -/* - -Copyright 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -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.7 2002/05/31 18:45:46 dawes Exp $ */ - -#if (defined(SUNSHLIB) || defined(AIXSHLIB)) && !defined(SHAREDCODE) -#ifdef HAVE_CONFIG_H -#include -#endif -#include "IntrinsicI.h" -#include "VarargsI.h" -#include "ShellP.h" -#include "VendorP.h" -#include "CreateI.h" - - -#if defined(AIXSHLIB) || defined(__UNIXOS2__) -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(); -} - -Widget -XtInitialize( - _Xconst char* name, - _Xconst char* classname, - XrmOptionDescRec *options, - Cardinal num_options, - int *argc, - String *argv) -{ - extern Widget _XtInitialize(); - VENDORINIT - return _XtInitialize (name, classname, options, num_options, argc, argv); -} - -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) -{ - 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); -} - -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; - 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); -} - -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) -{ - 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); -} - -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; - 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/nx-X11/lib/Xt/util/Shell.ht b/nx-X11/lib/Xt/util/Shell.ht deleted file mode 100644 index c9e7e01ea..000000000 --- a/nx-X11/lib/Xt/util/Shell.ht +++ /dev/null @@ -1,97 +0,0 @@ -/* $Xorg: Shell.ht,v 1.5 2001/02/09 02:03:59 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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/util/Shell.ht,v 3.4 2001/07/29 05:01:12 tsi Exp $ */ - -#ifndef _XtShell_h -#define _XtShell_h - -#include -#include - -/*********************************************************************** - * - * Shell Widget - * - ***********************************************************************/ -/* - * Shell-specific resources names, classes, and a representation type. - */ - -#ifndef XTSTRINGDEFINES -#define _XtShell_h_Const const -#endif - -<<>> - -#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/nx-X11/lib/Xt/util/StrDefs.ct b/nx-X11/lib/Xt/util/StrDefs.ct deleted file mode 100644 index ea971f153..000000000 --- a/nx-X11/lib/Xt/util/StrDefs.ct +++ /dev/null @@ -1,54 +0,0 @@ -/* $Xorg: StrDefs.ct,v 1.4 2001/02/09 02:04:00 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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/util/StrDefs.ct,v 3.4 2001/07/29 05:01:12 tsi Exp $ */ - -#define Const const - -<<>> - diff --git a/nx-X11/lib/Xt/util/StrDefs.ht b/nx-X11/lib/Xt/util/StrDefs.ht deleted file mode 100644 index c23759c46..000000000 --- a/nx-X11/lib/Xt/util/StrDefs.ht +++ /dev/null @@ -1,64 +0,0 @@ -/* $Xorg: StrDefs.ht,v 1.4 2001/02/09 02:04:00 xorgcvs Exp $ */ - -/*********************************************************** - -Copyright 1987, 1988, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used 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/util/StrDefs.ht,v 3.4 2001/07/29 05:01:12 tsi Exp $ */ - -#ifndef _XtStringDefs_h_ -#define _XtStringDefs_h_ - -#ifndef XTSTRINGDEFINES -#define _XtStringDefs_h_Const const -#endif - -<<>> - -#ifndef XTSTRINGDEFINES -#undef _XtStringDefs_h_Const -#endif - -#endif /* _XtStringDefs_h_ */ diff --git a/nx-X11/lib/Xt/util/string.list b/nx-X11/lib/Xt/util/string.list deleted file mode 100644 index bef098c2f..000000000 --- a/nx-X11/lib/Xt/util/string.list +++ /dev/null @@ -1,399 +0,0 @@ -! $Xorg: string.list,v 1.3 2000/08/17 19:46:22 cpqbld 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/nx-X11/lib/Xv/Imakefile b/nx-X11/lib/Xv/Imakefile deleted file mode 100644 index cf8febf2a..000000000 --- a/nx-X11/lib/Xv/Imakefile +++ /dev/null @@ -1,30 +0,0 @@ -XCOMM $XFree86: xc/lib/Xv/Imakefile,v 1.7 2002/10/16 00:37:33 dawes Exp $ - -#define DoNormalLib NormalLibXv -#define DoSharedLib SharedLibXv -#define DoDebugLib DebugLibXv -#define DoProfileLib ProfileLibXv -#define LibName Xv -#define SoRev SOXVREV -#define LibHeaders NO - -#include - -#ifdef SharedXvReqs -REQUIREDLIBS = SharedXvReqs -#endif - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - - DEFINES = $(ALLOC_DEFINES) - SRCS = Xv.c - OBJS = Xv.o - LINTLIBS = $(LINTXLIB) - -#define IncludeSharedObjectInNormalLib - -#include - -DependTarget() diff --git a/nx-X11/lib/Xv/Xv-def.cpp b/nx-X11/lib/Xv/Xv-def.cpp deleted file mode 100644 index 30544cd8e..000000000 --- a/nx-X11/lib/Xv/Xv-def.cpp +++ /dev/null @@ -1,27 +0,0 @@ -LIBRARY Xv -VERSION LIBRARY_VERSION -EXPORTS -XvCreateImage -XvFreeAdaptorInfo -XvFreeEncodingInfo -XvGetPortAttribute -XvGetStill -XvGetVideo -XvGrabPort -XvListImageFormats -XvPutImage -XvPutStill -XvPutVideo -XvQueryAdaptors -XvQueryBestSize -XvQueryEncodings -XvQueryExtension -XvQueryPortAttributes -XvSelectPortNotify -XvSelectVideoNotify -XvSetPortAttribute -XvShmCreateImage -XvShmPutImage -XvStopVideo -XvUngrabPort -/* $XFree86$ */ diff --git a/nx-X11/lib/Xv/Xv.c b/nx-X11/lib/Xv/Xv.c deleted file mode 100644 index 0097a3fa5..000000000 --- a/nx-X11/lib/Xv/Xv.c +++ /dev/null @@ -1,1155 +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.17 2003/04/28 16:56:27 dawes Exp $ */ -/* $XdotOrg: xc/lib/Xv/Xv.c,v 1.3 2005/07/03 07:00:57 daniels 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 -#include "Xvlibint.h" -#include -#include -#include - -static XExtensionInfo _xv_info_data; -static XExtensionInfo *xv_info = &_xv_info_data; -static char *xv_extension_name = XvName; - -#define XvCheckExtension(dpy, i, val) \ - XextCheckExtension(dpy, i, xv_extension_name, val) - -static char *xv_error_string(); -static int xv_close_display(); -static Bool xv_wire_to_event(); - -static XExtensionHooks xv_extension_hooks = { - NULL, /* create_gc */ - NULL, /* copy_gc */ - NULL, /* flush_gc */ - NULL, /* free_gc */ - NULL, /* create_font */ - NULL, /* free_font */ - xv_close_display, /* close_display */ - xv_wire_to_event, /* wire_to_event */ - NULL, /* event_to_wire */ - NULL, /* error */ - xv_error_string /* error_string */ -}; - - -static char *xv_error_list[] = -{ - "BadPort", /* XvBadPort */ - "BadEncoding", /* XvBadEncoding */ - "BadControl" /* XvBadControl */ -}; - -static XEXT_GENERATE_CLOSE_DISPLAY (xv_close_display, xv_info) - - -static XEXT_GENERATE_FIND_DISPLAY (xv_find_display, xv_info, - xv_extension_name, - &xv_extension_hooks, - XvNumEvents, NULL) - - -static XEXT_GENERATE_ERROR_STRING (xv_error_string, xv_extension_name, - XvNumErrors, xv_error_list) - - -int -XvQueryExtension( - Display *dpy, - unsigned int *p_version, - unsigned int *p_revision, - unsigned int *p_requestBase, - unsigned int *p_eventBase, - unsigned int *p_errorBase -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvQueryExtensionReq *req; - xvQueryExtensionReply rep; - - XvCheckExtension(dpy, info, XvBadExtension); - - LockDisplay(dpy); - - XvGetReq(QueryExtension, req); - - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return XvBadExtension; - } - - *p_version = rep.version; - *p_revision = rep.revision; - *p_requestBase = info->codes->major_opcode; - *p_eventBase = info->codes->first_event; - *p_errorBase = info->codes->first_error; - - UnlockDisplay(dpy); - SyncHandle(); - - return Success; -} - -int -XvQueryAdaptors( - Display *dpy, - Window window, - unsigned int *p_nAdaptors, - XvAdaptorInfo **p_pAdaptors -){ - XExtDisplayInfo *info = xv_find_display(dpy); - 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; - - XvCheckExtension(dpy, info, XvBadExtension); - - LockDisplay(dpy); - - 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 */ - - if (rep.num_adaptors == 0) { - pas = NULL; - } else { - 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; iinum_adaptors = 0; - pa->name = (char *)NULL; - pa->formats = (XvFormat *)NULL; - pa++; - } - - pa = pas; - for (ii=0; iitype = 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; jjnum_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; - - Xfree(buffer); - UnlockDisplay(dpy); - SyncHandle(); - - return (Success); -} - - -void -XvFreeAdaptorInfo(XvAdaptorInfo *pAdaptors) -{ - - XvAdaptorInfo *pa; - int ii; - - if (!pAdaptors) return; - - pa = pAdaptors; - - for (ii=0; iinum_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 -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvQueryEncodingsReq *req; - xvQueryEncodingsReply rep; - int size, jj; - char *name; - XvEncodingInfo *pes, *pe; - char *buffer; - union - { - char *buffer; - char *string; - xvEncodingInfo *pe; - } u; - - XvCheckExtension(dpy, info, XvBadExtension); - - LockDisplay(dpy); - - 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; jjname = (char *)NULL; - pe->num_encodings = 0; - pe++; - } - - pe = pes; - for (jj=0; jjencoding_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; - - Xfree(buffer); - UnlockDisplay(dpy); - SyncHandle(); - - return (Success); -} - -void -XvFreeEncodingInfo(XvEncodingInfo *pEncodings) -{ - - XvEncodingInfo *pe; - int ii; - - if (!pEncodings) return; - - pe = pEncodings; - - for (ii=0; iinum_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 -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvPutVideoReq *req; - - XvCheckExtension(dpy, info, XvBadExtension); - - LockDisplay(dpy); - - 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; - - UnlockDisplay(dpy); - SyncHandle(); - - 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 -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvPutStillReq *req; - - XvCheckExtension(dpy, info, XvBadExtension); - - LockDisplay(dpy); - - 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; - - UnlockDisplay(dpy); - SyncHandle(); - - 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 -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvGetVideoReq *req; - - XvCheckExtension(dpy, info, XvBadExtension); - - LockDisplay(dpy); - - 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; - - UnlockDisplay(dpy); - SyncHandle(); - - 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 -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvGetStillReq *req; - - XvCheckExtension(dpy, info, XvBadExtension); - - LockDisplay(dpy); - - 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; - - UnlockDisplay(dpy); - SyncHandle(); - - return Success; -} - -int -XvStopVideo( - Display *dpy, - XvPortID port, - Drawable draw -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvStopVideoReq *req; - - XvCheckExtension(dpy, info, XvBadExtension); - - LockDisplay(dpy); - - XvGetReq(StopVideo, req); - req->port = port; - req->drawable = draw; - - UnlockDisplay(dpy); - SyncHandle(); - - return Success; -} - -int -XvGrabPort( - Display *dpy, - XvPortID port, - Time time -){ - XExtDisplayInfo *info = xv_find_display(dpy); - int result; - xvGrabPortReply rep; - xvGrabPortReq *req; - - XvCheckExtension(dpy, info, XvBadExtension); - - LockDisplay(dpy); - - XvGetReq(GrabPort, req); - req->port = port; - req->time = time; - - if (_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0) - rep.result = GrabSuccess; - - result = rep.result; - - UnlockDisplay(dpy); - SyncHandle(); - - return result; -} - -int -XvUngrabPort( - Display *dpy, - XvPortID port, - Time time -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvUngrabPortReq *req; - - XvCheckExtension(dpy, info, XvBadExtension); - - LockDisplay(dpy); - - XvGetReq(UngrabPort, req); - req->port = port; - req->time = time; - - UnlockDisplay(dpy); - SyncHandle(); - - return Success; -} - -int -XvSelectVideoNotify( - Display *dpy, - Drawable drawable, - Bool onoff -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvSelectVideoNotifyReq *req; - - XvCheckExtension(dpy, info, XvBadExtension); - - LockDisplay(dpy); - - XvGetReq(SelectVideoNotify, req); - req->drawable = drawable; - req->onoff = onoff; - - UnlockDisplay(dpy); - SyncHandle(); - - return Success; -} - -int -XvSelectPortNotify( - Display *dpy, - XvPortID port, - Bool onoff -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvSelectPortNotifyReq *req; - - XvCheckExtension(dpy, info, XvBadExtension); - - LockDisplay(dpy); - - XvGetReq(SelectPortNotify, req); - req->port = port; - req->onoff = onoff; - - UnlockDisplay(dpy); - SyncHandle(); - - return Success; -} - -int -XvSetPortAttribute ( - Display *dpy, - XvPortID port, - Atom attribute, - int value -) -{ - XExtDisplayInfo *info = xv_find_display(dpy); - xvSetPortAttributeReq *req; - - XvCheckExtension(dpy, info, XvBadExtension); - - LockDisplay(dpy); - - XvGetReq(SetPortAttribute, req); - req->port = port; - req->attribute = attribute; - req->value = value; - - UnlockDisplay(dpy); - SyncHandle(); - - return (Success); -} - -int -XvGetPortAttribute ( - Display *dpy, - XvPortID port, - Atom attribute, - int *p_value -) -{ - XExtDisplayInfo *info = xv_find_display(dpy); - xvGetPortAttributeReq *req; - xvGetPortAttributeReply rep; - - XvCheckExtension(dpy, info, XvBadExtension); - - LockDisplay(dpy); - - 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; - - UnlockDisplay(dpy); - SyncHandle(); - - return (Success); -} - -int -XvQueryBestSize( - Display *dpy, - XvPortID port, - Bool motion, - unsigned int vid_w, - unsigned int vid_h, - unsigned int drw_w, - unsigned int drw_h, - unsigned int *p_actual_width, - unsigned int *p_actual_height -) -{ - XExtDisplayInfo *info = xv_find_display(dpy); - xvQueryBestSizeReq *req; - xvQueryBestSizeReply rep; - - XvCheckExtension(dpy, info, XvBadExtension); - - LockDisplay(dpy); - - 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; - - UnlockDisplay(dpy); - SyncHandle(); - - return (Success); -} - - -XvAttribute* -XvQueryPortAttributes(Display *dpy, XvPortID port, int *num) -{ - XExtDisplayInfo *info = xv_find_display(dpy); - xvQueryPortAttributesReq *req; - xvQueryPortAttributesReply rep; - XvAttribute *ret = NULL; - - *num = 0; - - XvCheckExtension(dpy, info, NULL); - - LockDisplay(dpy); - - 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].min_value = Info.min; - ret[i].max_value = Info.max; - ret[i].name = marker; - _XRead(dpy, marker, Info.size); - marker += Info.size; - (*num)++; - } - } else - _XEatData(dpy, rep.length << 2); - } - - UnlockDisplay(dpy); - SyncHandle(); - - return ret; -} - -XvImageFormatValues * XvListImageFormats ( - Display *dpy, - XvPortID port, - int *num -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvListImageFormatsReq *req; - xvListImageFormatsReply rep; - XvImageFormatValues *ret = NULL; - - *num = 0; - - XvCheckExtension(dpy, info, NULL); - - LockDisplay(dpy); - - XvGetReq(ListImageFormats, req); - req->port = port; - - /* READ THE REPLY */ - - if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { - UnlockDisplay(dpy); - SyncHandle(); - return NULL; - } - - if(rep.num_formats) { - int size = (rep.num_formats * sizeof(XvImageFormatValues)); - - if((ret = Xmalloc(size))) { - xvImageFormatInfo Info; - int i; - - for(i = 0; i < rep.num_formats; 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; - (*num)++; - } - } else - _XEatData(dpy, rep.length << 2); - } - - UnlockDisplay(dpy); - SyncHandle(); - - return ret; -} - -XvImage * XvCreateImage ( - Display *dpy, - XvPortID port, - int id, - char *data, - int width, - int height -) { - XExtDisplayInfo *info = xv_find_display(dpy); - xvQueryImageAttributesReq *req; - xvQueryImageAttributesReply rep; - XvImage *ret = NULL; - - XvCheckExtension(dpy, info, NULL); - - LockDisplay(dpy); - - XvGetReq(QueryImageAttributes, req); - req->id = id; - req->port = port; - req->width = width; - req->height = height; - - /* READ THE REPLY */ - - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return NULL; - } - - if((ret = (XvImage*)Xmalloc(sizeof(XvImage) + (rep.num_planes << 3)))) { - ret->id = id; - ret->width = rep.width; - ret->height = rep.height; - ret->data_size = rep.data_size; - ret->num_planes = rep.num_planes; - ret->pitches = (int*)(&ret[1]); - ret->offsets = ret->pitches + rep.num_planes; - ret->data = data; - ret->obdata = NULL; - _XRead(dpy, (char*)(ret->pitches), rep.num_planes << 2); - _XRead(dpy, (char*)(ret->offsets), rep.num_planes << 2); - } else - _XEatData(dpy, rep.length << 2); - - UnlockDisplay(dpy); - SyncHandle(); - - return ret; -} - -XvImage * XvShmCreateImage ( - Display *dpy, - XvPortID port, - int id, - char *data, - int width, - int height, - XShmSegmentInfo *shminfo -){ - XvImage *ret; - - ret = XvCreateImage(dpy, port, id, data, width, height); - - if(ret) ret->obdata = (XPointer)shminfo; - - return ret; -} - -int XvPutImage ( - Display *dpy, - XvPortID port, - Drawable d, - GC gc, - XvImage *image, - 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 -){ - XExtDisplayInfo *info = xv_find_display(dpy); - xvPutImageReq *req; - int len; - - XvCheckExtension(dpy, info, XvBadExtension); - - LockDisplay(dpy); - - FlushGC(dpy, gc); - - XvGetReq(PutImage, req); - - req->port = port; - req->drawable = d; - req->gc = gc->gid; - req->id = image->id; - 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; - req->width = image->width; - req->height = image->height; - - len = (image->data_size + 3) >> 2; - SetReqLen(req, len, len); - - /* Yes it's kindof lame that we are sending the whole thing, - but for video all of it may be needed even if displaying - only a subsection, and I don't want to go through the - trouble of creating subregions to send */ - Data(dpy, (char *)image->data, image->data_size); - - UnlockDisplay(dpy); - SyncHandle(); - - return Success; -} - -int XvShmPutImage ( - Display *dpy, - XvPortID port, - Drawable d, - GC gc, - XvImage *image, - 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, - Bool send_event -){ - XExtDisplayInfo *info = xv_find_display(dpy); - XShmSegmentInfo *shminfo = (XShmSegmentInfo *)image->obdata; - xvShmPutImageReq *req; - - XvCheckExtension(dpy, info, XvBadExtension); - - LockDisplay(dpy); - - FlushGC(dpy, gc); - - XvGetReq(ShmPutImage, req); - - req->port = port; - req->drawable = d; - req->gc = gc->gid; - req->shmseg = shminfo->shmseg; - req->id = image->id; - 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; - req->offset = image->data - shminfo->shmaddr; - req->width = image->width; - req->height = image->height; - req->send_event = send_event; - - UnlockDisplay(dpy); - SyncHandle(); - - return Success; -} - - -static Bool -xv_wire_to_event(Display *dpy, XEvent *host, xEvent *wire) -{ - XExtDisplayInfo *info = xv_find_display(dpy); - XvEvent *re = (XvEvent *)host; - xvEvent *event = (xvEvent *)wire; - - XvCheckExtension(dpy, info, False); - - switch((event->u.u.type & 0x7F) - info->codes->first_event) - { - case 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; - break; - case 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; - break; - default: - return False; - } - - return (True); -} - - diff --git a/nx-X11/lib/Xv/Xvlibint.h b/nx-X11/lib/Xv/Xvlibint.h deleted file mode 100644 index 501a211e4..000000000 --- a/nx-X11/lib/Xv/Xvlibint.h +++ /dev/null @@ -1,76 +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. - -******************************************************************/ -/* $XFree86: xc/lib/Xv/Xvlibint.h,v 1.5 2001/07/25 15:04:53 dawes Exp $ */ - -#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 -#include -#include - -#if !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 = info->codes->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 = info->codes->major_opcode;\ - req->xvReqType = xv_/**/name;\ - req->length = (SIZEOF(xv/**/name/**/Req))>>2;\ - dpy->bufptr += SIZEOF(xv/**/name/**/Req);\ - dpy->request++ -#endif - - -#endif /* XVLIBINT_H */ diff --git a/nx-X11/lib/XvMC/Imakefile b/nx-X11/lib/XvMC/Imakefile deleted file mode 100644 index ee0bcded7..000000000 --- a/nx-X11/lib/XvMC/Imakefile +++ /dev/null @@ -1,49 +0,0 @@ -XCOMM $XFree86: xc/lib/XvMC/Imakefile,v 1.5 2002/10/16 00:37:33 dawes Exp $ - -#define DoNormalLib NormalLibXvMC -#define DoSharedLib SharedLibXvMC -#define DoDebugLib DebugLibXvMC -#define DoProfileLib ProfileLibXvMC -#define LibName XvMC -#define SoRev SOXVMCREV -#define LibHeaders NO - -#include - -#ifdef SharedXvMCReqs -REQUIREDLIBS = SharedXvMCReqs -#endif - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - -#if HasShm -SHM_DEFINES = -DHAS_SHM -#endif - - DEFINES = $(ALLOC_DEFINES) $(SHM_DEFINES) - INCLUDES = -I$(XF86OSSRC) - SRCS = XvMC.c - OBJS = XvMC.o - LINTLIBS = $(LINTXLIB) - -#include - -#define PassCDebugFlags - -#if defined(LinuxArchitecture) && BuildXF86DRI -#define IHaveSubdirs - -#if defined(i386Architecture) || defined(AMD64Architecture) -VIA_SUBDIRS = hw/via/unichrome hw/via/unichromeProA -INTEL_SUBDIRS = hw/i810 -#endif - -SUBDIRS = $(INTEL_SUBDIRS) $(VIA_SUBDIRS) wrapper - -MakeSubdirs($(SUBDIRS)) -DependSubdirs($(SUBDIRS)) -#endif - -DependTarget() diff --git a/nx-X11/lib/XvMC/XvMC-def.cpp b/nx-X11/lib/XvMC/XvMC-def.cpp deleted file mode 100644 index 645d03a99..000000000 --- a/nx-X11/lib/XvMC/XvMC-def.cpp +++ /dev/null @@ -1,8 +0,0 @@ -LIBRARY XvMC -VERSION LIBRARY_VERSION -EXPORTS - XvMCListSubpictureTypes - XvMCListSurfaceTypes - XvMCQueryExtension - XvMCQueryVersion -/* $XFree86$ */ diff --git a/nx-X11/lib/XvMC/XvMC.c b/nx-X11/lib/XvMC/XvMC.c deleted file mode 100644 index 8db64098c..000000000 --- a/nx-X11/lib/XvMC/XvMC.c +++ /dev/null @@ -1,599 +0,0 @@ -/* $XFree86: xc/lib/XvMC/XvMC.c,v 1.4 2001/11/14 21:54:38 mvojkovi Exp $ */ - -#define NEED_REPLIES - -#include -#include "XvMClibint.h" -#ifdef HAS_SHM -#ifndef Lynx -#include -#include -#else -#include -#include -#endif /* Lynx */ -#endif /* HAS_SHM */ -#include -#include -#include -#include - -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].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; -} - -Status XvMCGetDRInfo(Display *dpy, XvPortID port, - char **name, char **busID, - int *major, int *minor, - int *patchLevel, - int *isLocal) -{ - XExtDisplayInfo *info = xvmc_find_display(dpy); - xvmcGetDRInfoReply rep; - xvmcGetDRInfoReq *req; - char *tmpBuf = NULL; - CARD32 magic; - -#ifdef HAS_SHM - volatile CARD32 *shMem; - struct timezone here; - struct timeval now; - here.tz_minuteswest = 0; - here.tz_dsttime = 0; -#endif - - XvMCCheckExtension (dpy, info, BadImplementation); - - LockDisplay (dpy); - XvMCGetReq (GetDRInfo, req); - - req->port = port; - magic = 0; - req->magic = 0; -#ifdef HAS_SHM - req->shmKey = shmget(IPC_PRIVATE, 1024, IPC_CREAT | 0600); - - /* - * We fill a shared memory page with a repetitive pattern. If the - * X server can read this pattern, we probably have a local connection. - * Note that we can trigger the remote X server to read any shared - * page on the remote machine, so we shouldn't be able to guess and verify - * any complicated data on those pages. Thats the explanation of this - * otherwise stupid-looking pattern algorithm. - */ - - if (req->shmKey >= 0) { - shMem = (CARD32 *) shmat(req->shmKey, 0, 0); - shmctl( req->shmKey, IPC_RMID, 0); - if ( shMem ) { - - register volatile CARD32 *shMemC = shMem; - register int i; - - gettimeofday( &now, &here); - magic = now.tv_usec & 0x000FFFFF; - req->magic = magic; - i = 1024 / sizeof(CARD32); - while(i--) { - *shMemC++ = magic; - magic = ~magic; - } - } else { - req->shmKey = -1; - } - } -#else - req->shmKey = 0; -#endif - if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay (dpy); - SyncHandle (); -#ifdef HAS_SHM - if ( req->shmKey >= 0) { - shmdt( (const void *) shMem ); - } -#endif - return -1; - } -#ifdef HAS_SHM - shmdt( (const void *) shMem ); -#endif - - if (rep.length > 0) { - - int realSize = rep.length << 2; - - tmpBuf = (char *) Xmalloc(realSize); - if (tmpBuf) { - *name = (char *) Xmalloc(rep.nameLen); - if (*name) { - *busID = (char *) Xmalloc(rep.busIDLen); - if (! *busID) { - XFree(*name); - XFree(tmpBuf); - } - } else { - XFree(tmpBuf); - } - } - - if (*name && *busID && tmpBuf) { - - _XRead(dpy, tmpBuf, realSize); - strncpy(*name,tmpBuf,rep.nameLen); - strncpy(*busID,tmpBuf+rep.nameLen,rep.busIDLen); - XFree(tmpBuf); - - } else { - - _XEatData(dpy, realSize); - UnlockDisplay (dpy); - SyncHandle (); - return -1; - - } - } - - UnlockDisplay (dpy); - SyncHandle (); - *major = rep.major; - *minor = rep.minor; - *patchLevel = rep.patchLevel; - *isLocal = (req->shmKey > 0) ? rep.isLocal : 1; - return (rep.length > 0) ? Success : BadImplementation; -} - diff --git a/nx-X11/lib/XvMC/XvMClibint.h b/nx-X11/lib/XvMC/XvMClibint.h deleted file mode 100644 index 1db39249a..000000000 --- a/nx-X11/lib/XvMC/XvMClibint.h +++ /dev/null @@ -1,40 +0,0 @@ -/* $XFree86: xc/lib/XvMC/XvMClibint.h,v 1.4 2001/07/25 15:04:54 dawes Exp $ */ - -#ifndef _XVMCLIBINT_H -#define _XVMCLIBINT_H -#define NEED_REPLIES - -#include -#include -#include -#include - -#define XvMCCheckExtension(dpy, i, val) \ - XextCheckExtension(dpy, i, xvmc_extension_name, val) - - -#if !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/nx-X11/lib/XvMC/hw/i810/I810XvMC.c b/nx-X11/lib/XvMC/hw/i810/I810XvMC.c deleted file mode 100644 index 89aa3ea4b..000000000 --- a/nx-X11/lib/XvMC/hw/i810/I810XvMC.c +++ /dev/null @@ -1,4507 +0,0 @@ -/*************************************************************************** - -Copyright 2001 Intel Corporation. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL INTEL, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/************************************************************************* -** File libI810XvMC.c -** -** Authors: -** Matt Sottek -** Bob Paauwe -** -** -***************************************************************************/ -/* $XFree86: xc/lib/XvMC/hw/i810/I810XvMC.c,v 1.10 2002/10/30 12:52:01 alanh Exp $ */ -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include "I810XvMC.h" - -static int error_base; -static int event_base; - -/*************************************************************************** -// Function: i810_get_free_buffer -// Description: Allocates a free dma page using kernel ioctls, then -// programs the data into the already allocated dma buffer list. -// Arguments: pI810XvMC private data structure from the current context. -// Notes: We faked the drmMapBufs for the i810's security so now we have -// to insert an allocated page into the correct spot in the faked -// list to keep up appearences. -// Concept for this function was taken from Mesa sources. -// Returns: drmBufPtr containing the information about the allocated page. -***************************************************************************/ -drmBufPtr i810_get_free_buffer(i810XvMCContext *pI810XvMC) { - drmI810DMA dma; - drmBufPtr buf; - - dma.granted = 0; - dma.request_size = 4096; - while(!dma.granted) { - if(GET_BUFFER(pI810XvMC, dma) || !dma.granted) - FLUSH(pI810XvMC); - } /* No DMA granted */ - - buf = &(pI810XvMC->dmabufs->list[dma.request_idx]); - buf->idx = dma.request_idx; - buf->used = 0; - buf->total = dma.request_size; - buf->address = (drmAddress)dma.virtual; - return buf; -} - -/*************************************************************************** -// Function: free_privContext -// Description: Free's the private context structure if the reference -// count is 0. -***************************************************************************/ -void i810_free_privContext(i810XvMCContext *pI810XvMC) { - - I810_LOCK(pI810XvMC,DRM_LOCK_QUIESCENT); - - - pI810XvMC->ref--; - if(!pI810XvMC->ref) { - drmUnmapBufs(pI810XvMC->dmabufs); - drmUnmap(pI810XvMC->overlay.address,pI810XvMC->overlay.size); - drmUnmap(pI810XvMC->surfaces.address,pI810XvMC->surfaces.size); - drmClose(pI810XvMC->fd); - - free(pI810XvMC->dmabufs->list); - free(pI810XvMC); - } - - I810_UNLOCK(pI810XvMC); -} - - -/*************************************************************************** -// Function: XvMCCreateContext -// Description: Create a XvMC context for the given surface parameters. -// Arguments: -// display - Connection to the X server. -// port - XvPortID to use as avertised by the X connection. -// surface_type_id - Unique identifier for the Surface type. -// width - Width of the surfaces. -// height - Height of the surfaces. -// flags - one or more of the following -// XVMC_DIRECT - A direct rendered context is requested. -// -// Notes: surface_type_id and width/height parameters must match those -// returned by XvMCListSurfaceTypes. -// Returns: Status -***************************************************************************/ -Status XvMCCreateContext(Display *display, XvPortID port, - int surface_type_id, int width, int height, int flags, - XvMCContext *context) { - i810XvMCContext *pI810XvMC; - char busIdString[10]; - int priv_count; - uint *priv_data; - uint magic; - Status ret; - int major, minor; - - /* Verify Obvious things first */ - if(context == NULL) { - return XvMCBadContext; - } - - if(!(flags & XVMC_DIRECT)) { - /* Indirect */ - printf("Indirect Rendering not supported!\nUsing Direct."); - } - - /* Limit use to root for now */ - if(geteuid()) { - printf("Use of XvMC on i810 is currently limited to root\n"); - return BadAccess; - } - - /* FIXME: Check $DISPLAY for legal values here */ - - context->surface_type_id = surface_type_id; - context->width = (unsigned short)width; - context->height = (unsigned short)height; - context->flags = flags; - context->port = port; - /* - Width, Height, and flags are checked against surface_type_id - and port for validity inside the X server, no need to check - here. - */ - - /* Allocate private Context data */ - context->privData = (void *)malloc(sizeof(i810XvMCContext)); - if(!context->privData) { - printf("Unable to allocate resources for XvMC context.\n"); - return BadAlloc; - } - pI810XvMC = (i810XvMCContext *)context->privData; - - - /* Verify the XvMC extension exists */ - if(! XvMCQueryExtension(display, &event_base, - &error_base)) { - printf("XvMC Extension is not available!\n"); - return BadAlloc; - } - /* Verify XvMC version */ - ret = XvMCQueryVersion(display, &major, &minor); - if(ret) { - printf("XvMCQuery Version Failed, unable to determine protocol version\n"); - } - /* FIXME: Check Major and Minor here */ - - /* Check for drm */ - if(! drmAvailable()) { - printf("Direct Rendering is not avilable on this system!\n"); - return BadAlloc; - } - - /* - Build the Attribute Atoms, and Initialize the ones that exist - in Xv. - */ - pI810XvMC->xv_colorkey = XInternAtom(display,"XV_COLORKEY",0); - if(!pI810XvMC->xv_colorkey) { - return XvBadPort; - } - ret = XvGetPortAttribute(display,port,pI810XvMC->xv_colorkey, - &pI810XvMC->colorkey); - if(ret) { - return ret; - } - pI810XvMC->xv_brightness = XInternAtom(display,"XV_BRIGHTNESS",0); - pI810XvMC->xv_saturation = XInternAtom(display,"XV_SATURATION",0); - pI810XvMC->xv_contrast = XInternAtom(display,"XV_CONTRAST",0); - pI810XvMC->brightness = 0; - pI810XvMC->saturation = 0x80; /* 1.0 in 3.7 format */ - pI810XvMC->contrast = 0x40; /* 1.0 in 3.6 format */ - - /* Open DRI Device */ - if((pI810XvMC->fd = drmOpen("i810",NULL)) < 0) { - printf("DRM Device for i810 could not be opened.\n"); - free(busIdString); - free(pI810XvMC); - return BadAccess; - } /* !pI810XvMC->fd */ - - /* Get magic number and put it in privData for passing */ - drmGetMagic(pI810XvMC->fd,&magic); - context->flags = (unsigned long)magic; - - /* - Pass control to the X server to create a drm_context_t for us and - validate the with/height and flags. - */ - if((ret = _xvmc_create_context(display, context, &priv_count, &priv_data))) { - printf("Unable to create XvMC Context.\n"); - return ret; - } - - /* - X server returns a structure like this: - drm_context_t - fbBase - OverlayOffset - OverlaySize - SurfacesOffset - SurfacesSize - busIdString = 9 char + 1 - */ - if(priv_count != 9) { - printf("_xvmc_create_context() returned incorrect data size!\n"); - printf("\tExpected 9, got %d\n",priv_count); - _xvmc_destroy_context(display, context); - free(pI810XvMC); - return BadAlloc; - } - pI810XvMC->drmcontext = priv_data[0]; - pI810XvMC->fb_base = priv_data[1]; - pI810XvMC->overlay.offset = priv_data[2] + priv_data[1]; - pI810XvMC->overlay.size = priv_data[3]; - pI810XvMC->surfaces.offset = priv_data[4] + priv_data[1]; - pI810XvMC->surfaces.size = priv_data[5]; - strncpy(pI810XvMC->busIdString,(char *)&priv_data[6],9); - pI810XvMC->busIdString[9] = '\0'; - - /* Must free the private data we were passed from X */ - free(priv_data); - - /* Initialize private context values */ - pI810XvMC->current = 0; - pI810XvMC->lock = 0; - pI810XvMC->last_flip = 0; - pI810XvMC->dual_prime = 0; - - /* - Map dma Buffers: Not really, this would be a drmMapBufs - but due to the i810 security model we have to just create an - empty data structure to fake it. - */ - pI810XvMC->dmabufs = (drmBufMapPtr)malloc(sizeof(drmBufMap)); - if(pI810XvMC->dmabufs == NULL) { - printf("Dma Bufs could not be mapped.\n"); - _xvmc_destroy_context(display, context); - free(pI810XvMC); - return BadAlloc; - } /* pI810XvMC->dmabufs == NULL */ - memset(pI810XvMC->dmabufs, 0, sizeof(drmBufMap)); - pI810XvMC->dmabufs->list = (drmBufPtr)malloc(sizeof(drmBuf) * - I810_DMA_BUF_NR); - if(pI810XvMC->dmabufs->list == NULL) { - printf("Dma Bufs could not be mapped.\n"); - _xvmc_destroy_context(display, context); - free(pI810XvMC); - return BadAlloc; - } /* pI810XvMC->dmabufs->list == NULL */ - memset(pI810XvMC->dmabufs->list, 0, sizeof(drmBuf) * I810_DMA_BUF_NR); - - /* Map the Overlay memory */ - if(drmMap(pI810XvMC->fd,pI810XvMC->overlay.offset, - pI810XvMC->overlay.size,&(pI810XvMC->overlay.address)) < 0) { - printf("Unable to map Overlay at offset 0x%x and size 0x%x\n", - (unsigned int)pI810XvMC->overlay.offset,pI810XvMC->overlay.size); - _xvmc_destroy_context(display, context); - free(pI810XvMC->dmabufs->list); - free(pI810XvMC); - return BadAlloc; - } /* drmMap() < 0 */ - - /* Overlay Regs are offset 1024 into Overlay Map */ - pI810XvMC->oregs = (i810OverlayRec *) - ((unsigned char *)pI810XvMC->overlay.address + 1024); - - /* Map Surfaces */ - if(drmMap(pI810XvMC->fd,pI810XvMC->surfaces.offset, - pI810XvMC->surfaces.size,&(pI810XvMC->surfaces.address)) < 0) { - printf("Unable to map XvMC Surfaces.\n"); - _xvmc_destroy_context(display, context); - free(pI810XvMC->dmabufs->list); - free(pI810XvMC); - return BadAlloc; - } /* drmMap() < 0 */ - - /* - There is a tiny chance that someone was using the overlay and - issued a flip that hasn't finished. To be 100% sure I'll just - take the lock and sleep for the worst case time for a flip. - */ - I810_LOCK(pI810XvMC,DRM_LOCK_QUIESCENT); - usleep(20000); /* 1/50th Sec for 50hz refresh */ - - /* Set up Overlay regs with Initial Values */ - pI810XvMC->oregs->YRGB_VPH = 0; - pI810XvMC->oregs->UV_VPH = 0; - pI810XvMC->oregs->HORZ_PH = 0; - pI810XvMC->oregs->INIT_PH = 0; - pI810XvMC->oregs->DWINPOS = 0; - pI810XvMC->oregs->DWINSZ = (I810_XVMC_MAXHEIGHT << 16) | - I810_XVMC_MAXWIDTH; - pI810XvMC->oregs->SWID = I810_XVMC_MAXWIDTH | (I810_XVMC_MAXWIDTH << 15); - pI810XvMC->oregs->SWIDQW = (I810_XVMC_MAXWIDTH >> 3) | - (I810_XVMC_MAXWIDTH << 12); - pI810XvMC->oregs->SHEIGHT = I810_XVMC_MAXHEIGHT | - (I810_XVMC_MAXHEIGHT << 15); - pI810XvMC->oregs->YRGBSCALE = 0x80004000; /* scale factor 1 */ - pI810XvMC->oregs->UVSCALE = 0x80004000; /* scale factor 1 */ - pI810XvMC->oregs->OV0CLRC0 = 0x4000; /* brightness: 0 contrast: 1.0 */ - pI810XvMC->oregs->OV0CLRC1 = 0x80; /* saturation: bypass */ - - /* Destination Colorkey Setup */ - pI810XvMC->oregs->DCLRKV = RGB16ToColorKey(pI810XvMC->colorkey); - pI810XvMC->oregs->DCLRKM = 0x80070307; - - - pI810XvMC->oregs->SCLRKVH = 0; - pI810XvMC->oregs->SCLRKVL = 0; - pI810XvMC->oregs->SCLRKM = 0; /* source color key disable */ - pI810XvMC->oregs->OV0CONF = 0; /* two 720 pixel line buffers */ - - pI810XvMC->oregs->OV0CMD = VC_UP_INTERPOLATION | HC_UP_INTERPOLATION | - Y_ADJUST | YUV_420; - - pI810XvMC->ref = 1; - - I810_UNLOCK(pI810XvMC); - - return Success; - -} - -/*************************************************************************** -// Function: XvMCDestroyContext -// Description: Destorys the specified context. -// -// Arguments: -// display - Specifies the connection to the server. -// context - The context to be destroyed. -// -// Returns: Status -***************************************************************************/ -Status XvMCDestroyContext(Display *display, XvMCContext *context) { - i810XvMCContext *pI810XvMC; - - if(context == NULL) { - return (error_base + XvMCBadContext); - } - if(context->privData == NULL) { - return (error_base + XvMCBadContext); - } - pI810XvMC = (i810XvMCContext *)context->privData; - - /* Turn off the overlay */ - if(pI810XvMC->last_flip) { - I810_LOCK(pI810XvMC,DRM_LOCK_QUIESCENT); - - /* Make sure last flip is done */ - BLOCK_OVERLAY(pI810XvMC,pI810XvMC->current); - - pI810XvMC->oregs->OV0CMD = VC_UP_INTERPOLATION | HC_UP_INTERPOLATION | - Y_ADJUST; - pI810XvMC->current = !pI810XvMC->current; - if(pI810XvMC->current == 1) { - pI810XvMC->oregs->OV0CMD |= BUFFER1_FIELD0; - } - else { - pI810XvMC->oregs->OV0CMD |= BUFFER0_FIELD0; - } - OVERLAY_FLIP(pI810XvMC); - pI810XvMC->last_flip++; - - /* Wait for the flip */ - BLOCK_OVERLAY(pI810XvMC,pI810XvMC->current); - - I810_UNLOCK(pI810XvMC); - } - - /* Pass Control to the X server to destroy the drm_context_t */ - _xvmc_destroy_context(display, context); - - i810_free_privContext(pI810XvMC); - context->privData = NULL; - - return Success; -} - - -/*************************************************************************** -// Function: XvMCCreateSurface -***************************************************************************/ -Status XvMCCreateSurface( Display *display, XvMCContext *context, - XvMCSurface *surface) { - i810XvMCContext *pI810XvMC; - i810XvMCSurface *pI810Surface; - int priv_count; - uint *priv_data; - Status ret; - - if((surface == NULL) || (context == NULL) || (display == NULL)){ - return BadValue; - } - - pI810XvMC = (i810XvMCContext *)context->privData; - if(pI810XvMC == NULL) { - return (error_base + XvMCBadContext); - } - - - surface->privData = (i810XvMCSurface *)malloc(sizeof(i810XvMCSurface)); - if(!surface->privData) { - return BadAlloc; - } - pI810Surface = (i810XvMCSurface *)surface->privData; - - /* Initialize private values */ - pI810Surface->privContext = pI810XvMC; - pI810Surface->last_render = 0; - pI810Surface->last_flip = 0; - pI810Surface->second_field = 0; - - if((ret = _xvmc_create_surface(display, context, surface, - &priv_count, &priv_data))) { - free(pI810Surface); - printf("Unable to create XvMCSurface.\n"); - return ret; - } - - /* - _xvmc_create_subpicture returns 2 uints with the offset into - the DRM map for the Y surface and UV surface. - */ - if(priv_count != 2) { - printf("_xvmc_create_surface() return incorrect data size.\n"); - printf("Expected 2 got %d\n",priv_count); - free(priv_data); - free(pI810Surface); - return BadAlloc; - } - /* Data == Client Address, offset == Physical address offset */ - pI810Surface->data = pI810XvMC->surfaces.address; - pI810Surface->offset = pI810XvMC->surfaces.offset; - - - /* - i810's MC Engine needs surfaces of 2^x (x= 9,10,11,12) pitch - and the Tiler need 512k aligned surfaces, basically we are - stuck with fixed memory with pitch 1024 for Y data. UV = 512. - */ - pI810Surface->pitch = 10; - if((surface->surface_type_id == FOURCC_UYVY) || - (surface->surface_type_id == FOURCC_YUY2)) { - /* This is not implemented server side. */ - pI810Surface->pitch++; - } - - /* - offsets[0,1,2] == Offsets from either data or offset for the Y - U and V surfaces. - */ - pI810Surface->offsets[0] = priv_data[0]; - if(((unsigned long)pI810Surface->data + pI810Surface->offsets[0]) & 4095) { - printf("XvMCCreateSurface: Surface offset 0 is not 4096 aligned\n"); - } - - if((surface->surface_type_id == FOURCC_UYVY) || - (surface->surface_type_id == FOURCC_YUY2)) { - /* Packed surface, not fully implemented */ - pI810Surface->offsets[1] = 0; - pI810Surface->offsets[2] = 0; - } - else { - /* Planar surface */ - pI810Surface->offsets[1] = priv_data[1]; - if(((unsigned long)pI810Surface->data + pI810Surface->offsets[1]) & 2047) { - printf("XvMCCreateSurface: Surface offset 1 is not 2048 aligned\n"); - } - - pI810Surface->offsets[2] = ((unsigned long)pI810Surface->offsets[1] + - (1<<(pI810Surface->pitch - 1)) * 288); - if(((unsigned long)pI810Surface->data + pI810Surface->offsets[2]) & 2047) { - printf("XvMCCreateSurface: Surface offset 2 is not 2048 aligned\n"); - } - - } - - /* Free data returned from xvmc_create_surface */ - free(priv_data); - - /* Clear the surface to 0 */ - memset((void *)((unsigned long)pI810Surface->data + (unsigned long)pI810Surface->offsets[0]), - 0, ((1<pitch) * surface->height)); - - switch(surface->surface_type_id) { - case FOURCC_YV12: - case FOURCC_I420: - /* Destination buffer info command */ - pI810Surface->dbi1y = ((((unsigned int)pI810Surface->offset + - pI810Surface->offsets[0]) & ~0xfc000fff) | - (pI810Surface->pitch - 9)); - pI810Surface->dbi1u = ((((unsigned int)pI810Surface->offset + - pI810Surface->offsets[1]) & ~0xfc000fff) | - (pI810Surface->pitch - 10)); - pI810Surface->dbi1v = ((((unsigned int)pI810Surface->offset + - pI810Surface->offsets[2]) & ~0xfc000fff) | - (pI810Surface->pitch - 10)); - - /* Destination buffer variables command */ - pI810Surface->dbv1 = (0x8<<20) | (0x8<<16); - /* Map info command */ - pI810Surface->mi1y = (0x1<<24) | (1<<9) | (pI810Surface->pitch - 3); - pI810Surface->mi1u = (0x1<<24) | (1<<9) | (pI810Surface->pitch - 4); - pI810Surface->mi1v = (0x1<<24) | (1<<9) | (pI810Surface->pitch - 4); - - pI810Surface->mi2y = (((unsigned int)surface->height - 1)<<16) | - ((unsigned int)surface->width - 1); - pI810Surface->mi2u = (((unsigned int)surface->height - 1)<<15) | - (((unsigned int)surface->width - 1)>>1); - pI810Surface->mi2v = pI810Surface->mi2u; - - pI810Surface->mi3y = ((unsigned int)pI810Surface->offset + - pI810Surface->offsets[0]) & ~0x0000000f; - pI810Surface->mi3u = ((unsigned int)pI810Surface->offset + - pI810Surface->offsets[1]) & ~0x0000000f; - pI810Surface->mi3v = ((unsigned int)pI810Surface->offset + - pI810Surface->offsets[2]) & ~0x0000000f; - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - /* Destination buffer info command */ - pI810Surface->dbi1y = ((((unsigned int)pI810Surface->offset + - pI810Surface->offsets[0]) & ~0xfc000fff) | - (pI810Surface->pitch - 9)); - /* Destination buffer variables command */ - if(surface->surface_type_id == FOURCC_YUY2) { - pI810Surface->dbv1 = 0x5<<8; - pI810Surface->mi1y = 0x5<<24 | pI810Surface->pitch | 0x1<<21; - } - else { - pI810Surface->dbv1 = 0x4<<8; - pI810Surface->mi1y = 0x5<<24 | (pI810Surface->pitch - 3); - } - pI810Surface->mi2y = (((unsigned int)surface->width - 1)<<16) | - ((unsigned int)surface->height - 1); - pI810Surface->mi3y = ((unsigned int)pI810Surface->offset + - pI810Surface->offsets[0]) & ~0xfc000fff; - break; - } - pI810XvMC->ref++; - - return Success; -} - - -/*************************************************************************** -// Function: XvMCDestroySurface -***************************************************************************/ -Status XvMCDestroySurface(Display *display, XvMCSurface *surface) { - i810XvMCSurface *pI810Surface; - i810XvMCContext *pI810XvMC; - - if((display == NULL) || (surface == NULL)) { - return BadValue; - } - if(surface->privData == NULL) { - return (error_base + XvMCBadSurface); - } - - pI810Surface = (i810XvMCSurface *)surface->privData; - if(pI810Surface->last_flip) { - XvMCSyncSurface(display,surface); - } - pI810XvMC = (i810XvMCContext *)pI810Surface->privContext; - - _xvmc_destroy_surface(display,surface); - - i810_free_privContext(pI810XvMC); - - free(pI810Surface); - surface->privData = NULL; - return Success; -} - -/*************************************************************************** -// Function: XvMCCreateBlocks -***************************************************************************/ -Status XvMCCreateBlocks(Display *display, XvMCContext *context, - unsigned int num_blocks, - XvMCBlockArray *block) { - - if((display == NULL) || (context == NULL) || (num_blocks == 0)) { - return BadValue; - } - - block->blocks = (short *)malloc(num_blocks<<6 * sizeof(short)); - if(block->blocks == NULL) { - return BadAlloc; - } - - block->num_blocks = num_blocks; - block->context_id = context->context_id; - - block->privData = NULL; - - return Success; -} - -/*************************************************************************** -// Function: XvMCDestroyBlocks -***************************************************************************/ -Status XvMCDestroyBlocks(Display *display, XvMCBlockArray *block) { - if(display == NULL) { - return BadValue; - } - - free(block->blocks); - block->num_blocks = 0; - block->context_id = 0; - block->privData = NULL; - return Success; -} - -/*************************************************************************** -// Function: XvMCCreateMacroBlocks -***************************************************************************/ -Status XvMCCreateMacroBlocks(Display *display, XvMCContext *context, - unsigned int num_blocks, - XvMCMacroBlockArray *blocks) { - - if((display == NULL) || (context == NULL) || (blocks == NULL) || - (num_blocks == 0)) { - return BadValue; - } - memset(blocks,0,sizeof(XvMCMacroBlockArray)); - blocks->context_id = context->context_id; - blocks->privData = NULL; - - blocks->macro_blocks = (XvMCMacroBlock *) - malloc(num_blocks * sizeof(XvMCMacroBlock)); - if(blocks->macro_blocks == NULL) { - return BadAlloc; - } - blocks->num_blocks = num_blocks; - - return Success; -} - -/*************************************************************************** -// Function: XvMCDestroyMacroBlocks -***************************************************************************/ -Status XvMCDestroyMacroBlocks(Display *display, XvMCMacroBlockArray *block) { - if((display == NULL) || (block == NULL)) { - return BadValue; - } - if(block->macro_blocks) { - free(block->macro_blocks); - } - block->context_id = 0; - block->num_blocks = 0; - block->privData = NULL; - - return Success; -} - - -/*************************************************************************** -// Function: dp (Debug Print) -// Description: This function prints out in hex i * uint32_t at the address -// supplied. This enables you to print out the dma buffers from -// within the debugger even though they are not in your address space. -***************************************************************************/ -void dp(unsigned int *address, unsigned int i) { - int j; - - printf("DebugPrint:\n"); - for(j=0; jaddress; - *data++ = CMD_FLUSH; - *data++ = BOOLEAN_ENA_2; - *data++ = CMD_FLUSH; - *data++ = DEST_BUFFER_INFO; - *data++ = privTarget->dbi1y; - *data++ = DEST_BUFFER_VAR; - *data++ = privTarget->dbv1; - /* Past Surface */ - *data++ = CMD_MAP_INFO; - *data++ = privPast->mi1y; - *data++ = privPast->mi2y; - *data++ = privPast->mi3y; - /* Future Surface */ - *data++ = CMD_MAP_INFO; - *data++ = privFuture->mi1y | 0x1<<28; - *data++ = privFuture->mi2y; - *data++ = privFuture->mi3y; - - mc.idx = pDMA->idx; - mc.used = (unsigned long)data - (unsigned long)pDMA->address; - mc.last_render = ++pI810XvMC->last_render; - privTarget->last_render = pI810XvMC->last_render; - I810_MC(pI810XvMC,mc); -} - -static __inline__ void renderError(void) { - printf("Invalid Macroblock Parameters found.\n"); - return; -} - -/*************************************************************************** -// Function: renderIntrainFrame -// Description: inline function that sets hardware parameters for an Intra -// encoded macroblock in a Frame picture. -***************************************************************************/ -static __inline__ void renderIntrainFrame(uint **datay,uint **datau, - uint **datav, - XvMCMacroBlock *mb, - short *block_ptr) { - - register uint *dy = *datay; - register uint *du = *datau; - register uint *dv = *datav; - - /* Y Blocks */ - *dy++ = GFXBLOCK + 68; - *dy++ = (1<<30) | (3<<28) | (0xf<<24); - *dy++ = ((uint)mb->x<<20) | ((uint)mb->y<<4); - *dy++ = (16<<16) | 16; - *dy++ = 0; - *dy++ = 0; - PACK_INTRA_DATA(dy,block_ptr,256); - dy += 64; - block_ptr += 256; - /* End Y Blocks */ - - /* U Block */ - *du++ = GFXBLOCK + 20; - *du++ = (2<<30) | (1<<28) | (1<<23); - *du++ = (((uint)mb->x)<<19) | (((uint)mb->y)<<3); - *du++ = (8<<16) | 8; - *du++ = 0; - *du++ = 0; - PACK_INTRA_DATA(du,block_ptr,64); - du += 16; - block_ptr += 64; - - /* V Block */ - *dv++ = GFXBLOCK + 20; - *dv++ = (3<<30) | (1<<28) | (1<<22); - *dv++ = (((uint)mb->x)<<19) | (((uint)mb->y)<<3); - *dv++ = (8<<16) | 8; - *dv++ = 0; - *dv++ = 0; - PACK_INTRA_DATA(dv,block_ptr,64); - dv += 16; - block_ptr += 64; - - *datay = dy; - *datau = du; - *datav = dv; -} - -/*************************************************************************** -// Function: renderIntrainFrameDCT1 -// Description: inline function that sets hardware parameters for an Intra -// encoded macroblock in a Frame picture with DCT type 1. -***************************************************************************/ -static __inline__ void renderIntrainFrameDCT1(uint **datay,uint **datau, - uint **datav,XvMCMacroBlock *mb, - short *block_ptr,uint flags) { - - register uint *dy = *datay; - register uint *du = *datau; - register uint *dv = *datav; - - - /* Y Blocks */ - *dy++ = GFXBLOCK + 36; - *dy++ = (1<<30) | (2<<28) | (0x3<<26) | (0x2<<6); - *dy++ = ((uint)mb->x<<20) | ((uint)mb->y<<3); - *dy++ = (8<<16) | 16; - *dy++ = 0; - *dy++ = 0; - PACK_INTRA_DATA(dy,block_ptr,128); - dy += 32; - block_ptr += 128; - - /* Second Y block */ - *dy++ = GFXBLOCK + 36; - *dy++ = (1<<30) | (2<<28) | (0x3<<26) | (0x3<<6); - *dy++ = ((uint)mb->x<<20) | ((uint)mb->y<<3); - *dy++ = (8<<16) | 16; - *dy++ = 0; - *dy++ = 0; - PACK_INTRA_DATA(dy,block_ptr,128); - dy += 32; - block_ptr += 128; - /* End Y Blocks */ - - - /* U Block */ - *du++ = GFXBLOCK + 20; - *du++ = (2<<30) | (1<<28) | (1<<23); - *du++ = (((uint)mb->x)<<19) | (((uint)mb->y)<<3); - *du++ = (8<<16) | 8; - *du++ = 0; - *du++ = 0; - PACK_INTRA_DATA(du,block_ptr,64); - du += 16; - block_ptr += 64; - - /* V Block */ - *dv++ = GFXBLOCK + 20; - *dv++ = (3<<30) | (1<<28) | (1<<22); - *dv++ = (((uint)mb->x)<<19) | (((uint)mb->y)<<3); - *dv++ = (8<<16) | 8; - *dv++ = 0; - *dv++ = 0; - PACK_INTRA_DATA(dv,block_ptr,64); - dv += 16; - block_ptr += 64; - - *datay = dy; - *datau = du; - *datav = dv; -} - - -/*************************************************************************** -// Function: renderIntrainField -// Description: inline function that sets hardware parameters for an Intra -// encoded macroblock in Field pictures. -***************************************************************************/ -static __inline__ void renderIntrainField(uint **datay,uint **datau, - uint **datav, - XvMCMacroBlock *mb,short *block_ptr, - uint ps) { - - register uint *dy = *datay; - register uint *du = *datau; - register uint *dv = *datav; - - uint xy = ((uint)mb->x<<20) | ((uint)mb->y<<4); - uint dw1 = drps_table[~ps & 0x1]; - - /* Y Blocks */ - *dy++ = GFXBLOCK + 68; - *dy++ = (1<<30) | (3<<28) | (0xf<<24) | dw1; - *dy++ = xy; - *dy++ = (16<<16) | 16; - *dy++ = 0; - *dy++ = 0; - PACK_INTRA_DATA(dy,block_ptr,256); - dy += 64; - block_ptr += 256; - /* End Y Blocks */ - - xy >>= 1; - - /* U Block */ - *du++ = GFXBLOCK + 20; - *du++ = (2<<30) | (1<<28) | (1<<23) | dw1; - *du++ = xy; - *du++ = (8<<16) | 8; - *du++ = 0; - *du++ = 0; - PACK_INTRA_DATA(du,block_ptr,64); - du += 16; - block_ptr += 64; - - /* V Block */ - *dv++ = GFXBLOCK + 20; - *dv++ = (3<<30) | (1<<28) | (1<<22) | dw1; - *dv++ = xy; - *dv++ = (8<<16) | 8; - *dv++ = 0; - *dv++ = 0; - PACK_INTRA_DATA(dv,block_ptr,64); - dv += 16; - block_ptr += 64; - - *datay = dy; - *datau = du; - *datav = dv; -} - - -/*************************************************************************** -// Function: renderFieldinField -// Description: inline function that sets hardware parameters for a Field -// encoded macroblock in a Field Picture. -***************************************************************************/ -static __inline__ void renderFieldinField(uint **datay,uint **datau, - uint **datav, - XvMCMacroBlock *mb,short *block_ptr, - uint ps, uint flags) { - - register uint *dy = *datay; - register uint *du = *datau; - register uint *dv = *datav; - - /* Motion Vectors */ - short fmv[2]; - short bmv[2]; - /* gfxblock dword 1 */ - uint dw1; - - uint parity = ~ps & XVMC_TOP_FIELD; - - uint ysize = y_frame_bytes[mb->coded_block_pattern]; - uint usize = u_frame_bytes[mb->coded_block_pattern]; - uint vsize = v_frame_bytes[mb->coded_block_pattern]; - - uint xy = ((uint)mb->x<<20) | ((uint)mb->y<<4); - - /* i810 Specific flag used to identify the second field in a P frame */ - if(flags & 0x80000000) { - /* P Frame */ - if((mb->motion_vertical_field_select & XVMC_SELECT_FIRST_FORWARD) == - parity) { - /* Same parity, use reference field (map0) */ - dw1 = 1<<12 | ((0x2 + parity)<<6) | ((0x2 + parity)<<3) | - (((uint)mb->coded_block_pattern)<<22); - fmv[0] = mb->PMV[0][0][1]; - fmv[1] = mb->PMV[0][0][0]; - bmv[0] = 0; - bmv[1] = 0; - } - else { - /* - Opposite parity, set up as if it were backward - motion and use map1. - */ - dw1 = 2<<12 | ((0x2 + parity)<<6) | (0x3 - parity) | - (((uint)mb->coded_block_pattern)<<22); - bmv[0] = mb->PMV[0][0][1]; - bmv[1] = mb->PMV[0][0][0]; - fmv[0] = 0; - fmv[1] = 0; - } - } - else { - dw1 = type_table[mb->macroblock_type & 0xf] | - drps_table[~ps & 0x1] | - mvfs_table[mb->motion_vertical_field_select & 3] | - (((uint)mb->coded_block_pattern)<<22); - - fmv[0] = mb->PMV[0][0][1]; - fmv[1] = mb->PMV[0][0][0]; - - bmv[0] = mb->PMV[0][1][1]; - bmv[1] = mb->PMV[0][1][0]; - } - - /* Y Block */ - *dy++ = GFXBLOCK + 4 + (ysize>>2); - *dy++ = (1<<30) | (3<<28) | dw1; - *dy++ = xy; - *dy++ = (16<<16) | 16; - *dy++ = *(uint *)fmv; - *dy++ = *(uint *)bmv; - PACK_CORR_DATA(dy,block_ptr,ysize); - block_ptr = (short *)((unsigned long)block_ptr + ysize); - /* End Y Blocks */ - - fmv[0] /= 2; - fmv[1] /= 2; - bmv[0] /= 2; - bmv[1] /= 2; - xy >>= 1; - - /* U Block */ - *du++ = GFXBLOCK + 4 + (usize>>2); - *du++ = (2<<30) | (1<<28) | dw1; - *du++ = xy; - *du++ = (8<<16) | 8; - *du++ = *(uint *)fmv; - *du++ = *(uint *)bmv; - PACK_CORR_DATA(du,block_ptr,usize); - block_ptr = (short *)((unsigned long)block_ptr + usize); - - /* V Block */ - *dv++ = GFXBLOCK + 4 + (vsize>>2); - *dv++ = (3<<30) | (1<<28) | dw1; - *dv++ = xy; - *dv++ = (8<<16) | 8; - *dv++ = *(uint *)fmv; - *dv++ = *(uint *)bmv; - PACK_CORR_DATA(dv,block_ptr,vsize); - block_ptr = (short *)((unsigned long)block_ptr + vsize); - - *datay = dy; - *datau = du; - *datav = dv; -} - -/*************************************************************************** -// Function: render16x8inField -// Description: inline function that sets hardware parameters for a 16x8 -// encoded macroblock in a field picture. -***************************************************************************/ -static __inline__ void render16x8inField(uint **datay,uint **datau, - uint **datav, - XvMCMacroBlock *mb,short *block_ptr, - uint ps, uint flags) { - - register uint *dy = *datay; - register uint *du = *datau; - register uint *dv = *datav; - - /* Motion Vectors */ - short fmv[4]; - short bmv[4]; - /* gfxblock dword 1 */ - uint dw1[2]; - - uint y1size = y_first_field_bytes[mb->coded_block_pattern]; - uint y2size = y_second_field_bytes[mb->coded_block_pattern]; - uint usize = u_field_bytes[mb->coded_block_pattern]; - uint vsize = v_field_bytes[mb->coded_block_pattern]; - - uint parity = ~ps & XVMC_TOP_FIELD; - - uint xy = ((uint)mb->x<<20) | ((uint)mb->y<<4); - - /* i810 Specific flag used to identify the second field in a P frame */ - if(flags & 0x80000000) { - /* P Frame */ - if((mb->motion_vertical_field_select & XVMC_SELECT_FIRST_FORWARD) == - parity) { - /* Same parity, use reference field (map0) */ - dw1[0] = 1<<12 | ((0x2 + parity)<<6) | ((0x2 + parity)<<3) | - (((uint)mb->coded_block_pattern)<<22); - - fmv[0] = mb->PMV[0][0][1]; - fmv[1] = mb->PMV[0][0][0]; - bmv[0] = 0; - bmv[1] = 0; - } - else { - /* - Opposite parity, set up as if it were backward - motion and use map1. - */ - dw1[0] = 2<<12 | ((0x2 + parity)<<6) | (0x3 - parity) | - (((uint)mb->coded_block_pattern)<<22); - - bmv[0] = mb->PMV[0][0][1]; - bmv[1] = mb->PMV[0][0][0]; - fmv[0] = 0; - fmv[1] = 0; - } - if((mb->motion_vertical_field_select & XVMC_SELECT_SECOND_FORWARD) == - (parity<<2)) { - /* Same parity, use reference field (map0) */ - dw1[1] = 1<<12 | ((0x2 + parity)<<6) | ((0x2 + parity)<<3) | - ((((uint)mb->coded_block_pattern<<22) & (0x3<<22)) | - (((uint)mb->coded_block_pattern<<24) & (0x3<<26))); - - fmv[2] = mb->PMV[1][0][1]; - fmv[3] = mb->PMV[1][0][0]; - bmv[2] = 0; - bmv[3] = 0; - } - else { - /* - Opposite parity, set up as if it were backward - motion and use map1. - */ - dw1[1] = 2<<12 | ((0x2 + parity)<<6) | (0x3 - parity) | - ((((uint)mb->coded_block_pattern<<22) & (0x3<<22)) | - (((uint)mb->coded_block_pattern<<24) & (0x3<<26))); - - bmv[2] = mb->PMV[1][0][1]; - bmv[3] = mb->PMV[1][0][0]; - fmv[2] = 0; - fmv[3] = 0; - } - } - else { - dw1[0] = type_table[mb->macroblock_type & 0xf] | - drps_table[~ps & 0x1] | - mvfs_table[mb->motion_vertical_field_select & 3] | - (((uint)mb->coded_block_pattern)<<22); - - dw1[1] = type_table[mb->macroblock_type & 0xf] | - drps_table[~ps & 0x1] | - mvfs_table[(mb->motion_vertical_field_select>>2) & 0x3] | - ((((uint)mb->coded_block_pattern<<22) & (0x3<<22)) | - (((uint)mb->coded_block_pattern<<24) & (0x3<<26))); - - fmv[0] = mb->PMV[0][0][1]; - fmv[1] = mb->PMV[0][0][0]; - fmv[2] = mb->PMV[1][0][1]; - fmv[3] = mb->PMV[1][0][0]; - - bmv[0] = mb->PMV[0][1][1]; - bmv[1] = mb->PMV[0][1][0]; - bmv[2] = mb->PMV[1][1][1]; - bmv[3] = mb->PMV[1][1][0]; - } - - /* First Y Block */ - *dy++ = GFXBLOCK + 4 + (y1size>>2); - *dy++ = (1<<30) | (2<<28) | dw1[0]; - *dy++ = xy; - *dy++ = (8<<16) | 16; - *dy++ = *(uint *)fmv; - *dy++ = *(uint *)bmv; - PACK_CORR_DATA(dy,block_ptr,y1size); - block_ptr = (short *)((unsigned long)block_ptr + y1size); - - /* Second Y Block */ - *dy++ = GFXBLOCK + 4 + (y2size>>2); - *dy++ = (1<<30) | (2<<28) | dw1[1]; - *dy++ = (xy + 8); - *dy++ = (8<<16) | 16; - *dy++ = *(uint *)&fmv[2]; - *dy++ = *(uint *)&bmv[2]; - PACK_CORR_DATA(dy,block_ptr,y2size); - block_ptr = (short *)((unsigned long)block_ptr + y2size); - /* End Y Blocks */ - - fmv[0] /= 2; - fmv[1] /= 2; - fmv[2] /= 2; - fmv[3] /= 2; - - bmv[0] /= 2; - bmv[1] /= 2; - bmv[2] /= 2; - bmv[3] /= 2; - - xy >>= 1; - - /* U Blocks */ - *du++ = GFXBLOCK + 4 + (usize>>2); - *du++ = (2<<30) | (1<<28) | dw1[0]; - *du++ = xy; - *du++ = (4<<16) | 8; - *du++ = *(uint *)fmv; - *du++ = *(uint *)bmv; - PACK_CORR_DATA(du,block_ptr,usize); - block_ptr = (short *)((unsigned long)block_ptr + usize); - - /* Second U block */ - *du++ = GFXBLOCK + 4 + (usize>>2); - *du++ = (2<<30) | (1<<28) | dw1[1]; - *du++ = (xy + 4); - *du++ = (4<<16) | 8; - *du++ = *(uint *)&fmv[2]; - *du++ = *(uint *)&bmv[2]; - PACK_CORR_DATA(du,block_ptr,usize); - block_ptr = (short *)((unsigned long)block_ptr + usize); - /* End U Blocks */ - - /* V Blocks */ - *dv++ = GFXBLOCK + 4 + (vsize>>2); - *dv++ = (3<<30) | (1<<28) | dw1[0]; - *dv++ = xy; - *dv++ = (4<<16) | 8; - *dv++ = *(uint *)fmv; - *dv++ = *(uint *)bmv; - PACK_CORR_DATA(dv,block_ptr,vsize); - block_ptr = (short *)((unsigned long)block_ptr + vsize); - - /* Second V Block */ - *dv++ = GFXBLOCK + 4 + (vsize>>2); - *dv++ = (3<<30) | (1<<28) | dw1[1]; - *dv++ = (xy + 4); - *dv++ = (4<<16) | 8; - *dv++ = *(uint *)&fmv[2]; - *dv++ = *(uint *)&bmv[2]; - PACK_CORR_DATA(dv,block_ptr,vsize); - block_ptr = (short *)((unsigned long)block_ptr + vsize); - /* End V Blocks */ - - *datay = dy; - *datau = du; - *datav = dv; -} - -/*************************************************************************** -// Function: renderDualPrimeinField -// Description: inline function that sets hardware parameters for a Dual -// prime encoded macroblock in a field picture. -***************************************************************************/ -static __inline__ void renderDualPrimeinField(uint **datay,uint **datau, - uint **datav,XvMCMacroBlock *mb, - short *block_ptr,uint ps, - uint flags) { - - register uint *dy = *datay; - register uint *du = *datau; - register uint *dv = *datav; - - /* Motion Vectors */ - short fmv[2]; - short bmv[2]; - /* gfxblock dword 1 */ - uint dw1; - - - uint ysize = y_frame_bytes[mb->coded_block_pattern]; - uint usize = u_frame_bytes[mb->coded_block_pattern]; - uint vsize = v_frame_bytes[mb->coded_block_pattern]; - - uint xy = ((uint)mb->x<<20) | ((uint)mb->y<<4); - - - if(ps & XVMC_TOP_FIELD) { - dw1 = (mb->coded_block_pattern<<22) | 3<<12 | 2<<6 | 2<<3 | 3; - } - else { - dw1 = (mb->coded_block_pattern<<22) | 3<<12 | 3<<6 | 3<<3 | 2; - } - fmv[0] = mb->PMV[0][0][1]; - fmv[1] = mb->PMV[0][0][0]; - bmv[0] = mb->PMV[0][1][1]; - bmv[1] = mb->PMV[0][1][0]; - - /* Y Block */ - *dy++ = GFXBLOCK + 4 + (ysize>>2); - *dy++ = (1<<30) | (3<<28) | dw1; - *dy++ = xy; - *dy++ = (16<<16) | 16; - *dy++ = *(uint *)fmv; - *dy++ = *(uint *)bmv; - PACK_CORR_DATA(dy,block_ptr,ysize); - block_ptr = (short *)((unsigned long)block_ptr + ysize); - /* End Y Blocks */ - - fmv[0] /= 2; - fmv[1] /= 2; - bmv[0] /= 2; - bmv[1] /= 2; - xy >>= 1; - - /* U Block */ - *du++ = GFXBLOCK + 4 + (usize>>2); - *du++ = (2<<30) | (1<<28) | dw1; - *du++ = xy; - *du++ = (8<<16) | 8; - *du++ = *(uint *)fmv; - *du++ = *(uint *)bmv; - PACK_CORR_DATA(du,block_ptr,usize); - block_ptr = (short *)((unsigned long)block_ptr + usize); - - /* V Block */ - *dv++ = GFXBLOCK + 4 + (vsize>>2); - *dv++ = (3<<30) | (1<<28) | dw1; - *dv++ = xy; - *dv++ = (8<<16) | 8; - *dv++ = *(uint *)fmv; - *dv++ = *(uint *)bmv; - PACK_CORR_DATA(dv,block_ptr,vsize); - block_ptr = (short *)((unsigned long)block_ptr + vsize); - - *datay = dy; - *datau = du; - *datav = dv; -} - -/*************************************************************************** -// Function: renderFieldinFrame -// Description: inline function that sets hardware parameters for a Field -// encoded macroblock in a frame picture. -***************************************************************************/ -static __inline__ void renderFieldinFrame(uint **datay,uint **datau, - uint **datav, - XvMCMacroBlock *mb,short *block_ptr, - uint flags) { - - register uint *dy = *datay; - register uint *du = *datau; - register uint *dv = *datav; - - /* Motion Vectors */ - short fmv[4]; - short bmv[4]; - /* gfxblock dword 1 */ - uint dw1[2]; - - uint y1size = y_first_field_bytes[mb->coded_block_pattern]; - uint y2size = y_second_field_bytes[mb->coded_block_pattern]; - uint usize = u_field_bytes[mb->coded_block_pattern]; - uint vsize = v_field_bytes[mb->coded_block_pattern]; - - uint xy = ((uint)mb->x<<20) | ((uint)mb->y<<3); - - dw1[0] = type_table[mb->macroblock_type & 0xf] | (0x2<<6) | - mvfs_table[mb->motion_vertical_field_select & 3] | - (((uint)mb->coded_block_pattern)<<22); - - dw1[1] = type_table[mb->macroblock_type & 0xf] | (0x3<<6) | - mvfs_table[mb->motion_vertical_field_select>>2] | - (((mb->coded_block_pattern & 0x3) | - ((mb->coded_block_pattern & 0xc)<<2))<<22); - - fmv[0] = mb->PMV[0][0][1]/2; - fmv[1] = mb->PMV[0][0][0]; - fmv[2] = mb->PMV[1][0][1]/2; - fmv[3] = mb->PMV[1][0][0]; - - bmv[0] = mb->PMV[0][1][1]/2; - bmv[1] = mb->PMV[0][1][0]; - bmv[2] = mb->PMV[1][1][1]/2; - bmv[3] = mb->PMV[1][1][0]; - - /* First Y Block */ - *dy++ = GFXBLOCK + 4 + (y1size>>2); - *dy++ = (1<<30) | (2<<28) | dw1[0]; - *dy++ = xy; - *dy++ = (8<<16) | 16; - *dy++ = *(uint *)&fmv[0]; - *dy++ = *(uint *)&bmv[0]; - PACK_CORR_DATA(dy,block_ptr,y1size); - block_ptr = (short *)((unsigned long)block_ptr + y1size); - - /* Second Y Block */ - *dy++ = GFXBLOCK + 4 + (y2size>>2); - *dy++ = (1<<30) | (2<<28) | dw1[1]; - *dy++ = xy; - *dy++ = (8<<16) | 16; - *dy++ = *(uint *)&fmv[2]; - *dy++ = *(uint *)&bmv[2]; - PACK_CORR_DATA(dy,block_ptr,y2size); - block_ptr = (short *)((unsigned long)block_ptr + y2size); - /* End Y Blocks */ - - fmv[0] /= 2; - fmv[1] /= 2; - fmv[2] /= 2; - fmv[3] /= 2; - - bmv[0] /= 2; - bmv[1] /= 2; - bmv[2] /= 2; - bmv[3] /= 2; - - xy >>= 1; - - /* U Blocks */ - *du++ = GFXBLOCK + 4 + (usize>>2); - *du++ = (2<<30) | (1<<28) | dw1[0]; - *du++ = xy; - *du++ = (4<<16) | 8; - *du++ = *(uint *)&fmv[0]; - *du++ = *(uint *)&bmv[0]; - if(usize) { - PACK_CORR_DATA_SHORT(du,block_ptr); - } - - /* Second U Block */ - *du++ = GFXBLOCK + 4 + (usize>>2); - *du++ = (2<<30) | (1<<28) | dw1[1]; - *du++ = xy; - *du++ = (4<<16) | 8; - *du++ = *(uint *)&fmv[2]; - *du++ = *(uint *)&bmv[2]; - if(usize) { - block_ptr = (short *)((unsigned long)block_ptr + 16); - PACK_CORR_DATA_SHORT(du,block_ptr); - block_ptr = (short *)((unsigned long)block_ptr + 112); - } - /* End U Blocks */ - - /* V Blocks */ - *dv++ = GFXBLOCK + 4 + (vsize>>2); - *dv++ = (3<<30) | (1<<28) | dw1[0]; - *dv++ = xy; - *dv++ = (4<<16) | 8; - *dv++ = *(uint *)&fmv[0]; - *dv++ = *(uint *)&bmv[0]; - if(vsize) { - PACK_CORR_DATA_SHORT(dv,block_ptr); - } - - /* Second V Block */ - *dv++ = GFXBLOCK + 4 + (vsize>>2); - *dv++ = (3<<30) | (1<<28) | dw1[1]; - *dv++ = xy; - *dv++ = (4<<16) | 8; - *dv++ = *(uint *)&fmv[2]; - *dv++ = *(uint *)&bmv[2]; - if(vsize) { - block_ptr = (short *)((unsigned long)block_ptr + 16); - PACK_CORR_DATA_SHORT(dv,block_ptr); - block_ptr = (short *)((unsigned long)block_ptr + 112); - } - /* End V Blocks */ - - *datay = dy; - *datau = du; - *datav = dv; -} - -/*************************************************************************** -// Function: renderFieldinFrameDCT0 -// Description: inline function that sets hardware parameters for a Field -// encoded macroblock in a frame picture with DCT0. -***************************************************************************/ -static __inline__ void renderFieldinFrameDCT0(uint **datay,uint **datau, - uint **datav,XvMCMacroBlock *mb, - short *block_ptr,uint flags) { - - register uint *dy = *datay; - register uint *du = *datau; - register uint *dv = *datav; - - /* Motion Vectors */ - short fmv[4]; - short bmv[4]; - /* CBP */ - uint cbp = (uint)mb->coded_block_pattern; - /* gfxblock dword 1 */ - uint dw1[2]; - - short * top_left_b = NULL; - short * top_right_b = NULL; - short * bottom_left_b = NULL; - short * bottom_right_b = NULL; - - unsigned int ysize = y_dct0_field_bytes[cbp]; - unsigned int usize = u_field_bytes[cbp]; - unsigned int vsize = v_field_bytes[cbp]; - - uint xy = ((uint)mb->x<<20) | ((uint)mb->y<<3); - - dw1[0] = type_table[mb->macroblock_type & 0xf] | (0x2<<6) | - mvfs_table[mb->motion_vertical_field_select & 3] | - ((cbp | ((cbp<<2) & 0x30))<<22); - - dw1[1] = type_table[mb->macroblock_type & 0xf] | (0x3<<6) | - mvfs_table[mb->motion_vertical_field_select>>2] | - ((cbp | ((cbp<<2) & 0x30))<<22); - - - fmv[0] = mb->PMV[0][0][1]/2; - fmv[1] = mb->PMV[0][0][0]; - fmv[2] = mb->PMV[1][0][1]/2; - fmv[3] = mb->PMV[1][0][0]; - - bmv[0] = mb->PMV[0][1][1]/2; - bmv[1] = mb->PMV[0][1][0]; - bmv[2] = mb->PMV[1][1][1]/2; - bmv[3] = mb->PMV[1][1][0]; - - /* - The i810 cannot use DCT0 directly with field motion, we have to - interlace the data for it. We use a zero block when the CBP has - one half of the to-be-interlaced data but not the other half. - */ - top_left_b = &empty_block[0]; - if(cbp & 0x20) { - top_left_b = block_ptr; - block_ptr += 64; - } - - top_right_b = &empty_block[0]; - if(cbp & 0x10) { - top_right_b = block_ptr; - block_ptr += 64; - } - - bottom_left_b = &empty_block[0]; - if(cbp & 0x8) { - bottom_left_b = block_ptr; - block_ptr += 64; - } - - bottom_right_b = &empty_block[0]; - if(cbp & 0x4) { - bottom_right_b = block_ptr; - block_ptr += 64; - } - - /* First Y Block */ - *dy++ = GFXBLOCK + 4 + (ysize>>2); - *dy++ = (1<<30) | (2<<28) | dw1[0]; - *dy++ = xy; - *dy++ = (8<<16) | 16; - *dy++ = *(uint *)&fmv[0]; - *dy++ = *(uint *)&bmv[0]; - if(dw1[0] & (1<<27)) { - PACK_CORR_DATA_0to1(dy,top_left_b,bottom_left_b); - } - if(dw1[0] & (1<<26)) { - PACK_CORR_DATA_0to1(dy,top_right_b,bottom_right_b); - } - - /* Second Y Block */ - *dy++ = GFXBLOCK + 4 + (ysize>>2); - *dy++ = (1<<30) | (2<<28) | dw1[1]; - *dy++ = xy; - *dy++ = (8<<16) | 16; - *dy++ = *(uint *)&fmv[2]; - *dy++ = *(uint *)&bmv[2]; - if(dw1[1] & (1<<27)) { - top_left_b = (short *)((unsigned long)top_left_b + 16); - bottom_left_b = (short *)((unsigned long)bottom_left_b + 16); - PACK_CORR_DATA_0to1(dy,top_left_b,bottom_left_b); - } - if(dw1[1] & (1<<26)) { - top_right_b = (short *)((unsigned long)top_right_b + 16); - bottom_right_b = (short *)((unsigned long)bottom_right_b + 16); - PACK_CORR_DATA_0to1(dy,top_right_b,bottom_right_b); - } - /* End Y Blocks */ - - fmv[0] /= 2; - fmv[1] /= 2; - fmv[2] /= 2; - fmv[3] /= 2; - - bmv[0] /= 2; - bmv[1] /= 2; - bmv[2] /= 2; - bmv[3] /= 2; - - xy >>= 1; - - /* U Blocks */ - *du++ = GFXBLOCK + 4 + (usize>>2); - *du++ = (2<<30) | (1<<28) | dw1[0]; - *du++ = xy; - *du++ = (4<<16) | 8; - *du++ = *(uint *)&fmv[0]; - *du++ = *(uint *)&bmv[0]; - if(usize) { - PACK_CORR_DATA_SHORT(du,block_ptr); - } - - /* Second U Block */ - *du++ = GFXBLOCK + 4 + (usize>>2); - *du++ = (2<<30) | (1<<28) | dw1[1]; - *du++ = xy; - *du++ = (4<<16) | 8; - *du++ = *(uint *)&fmv[2]; - *du++ = *(uint *)&bmv[2]; - if(usize) { - block_ptr = (short *)((unsigned long)block_ptr + 16); - PACK_CORR_DATA_SHORT(du,block_ptr); - block_ptr = (short *)((unsigned long)block_ptr + 112); - } - /* End U Blocks */ - - /* V Blocks */ - *dv++ = GFXBLOCK + 4 + (vsize>>2); - *dv++ = (3<<30) | (1<<28) | dw1[0]; - *dv++ = xy; - *dv++ = (4<<16) | 8; - *dv++ = *(uint *)&fmv[0]; - *dv++ = *(uint *)&bmv[0]; - if(vsize) { - PACK_CORR_DATA_SHORT(dv,block_ptr); - } - - /* Second V Block */ - *dv++ = GFXBLOCK + 4 + (vsize>>2); - *dv++ = (3<<30) | (1<<28) | dw1[1]; - *dv++ = xy; - *dv++ = (4<<16) | 8; - *dv++ = *(uint *)&fmv[2]; - *dv++ = *(uint *)&bmv[2]; - if(vsize) { - block_ptr = (short *)((unsigned long)block_ptr + 16); - PACK_CORR_DATA_SHORT(dv,block_ptr); - block_ptr = (short *)((unsigned long)block_ptr + 112); - } - /* End V Blocks */ - - *datay = dy; - *datau = du; - *datav = dv; -} - -/*************************************************************************** -// Function: renderFrameinFrame -// Description: inline function that sets hardware parameters for a Frame -// encoded macroblock in a frame picture. -***************************************************************************/ -static __inline__ void renderFrameinFrame(uint **datay,uint **datau, - uint **datav, - XvMCMacroBlock *mb,short *block_ptr, - uint flags) { - - register uint *dy = *datay; - register uint *du = *datau; - register uint *dv = *datav; - - /* Motion Vectors */ - short fmv[2]; - short bmv[2]; - /* gfxblock dword 1 */ - uint dw1; - - unsigned int ysize = y_frame_bytes[mb->coded_block_pattern]; - unsigned int usize = u_frame_bytes[mb->coded_block_pattern]; - unsigned int vsize = v_frame_bytes[mb->coded_block_pattern]; - - uint xy = ((uint)mb->x<<20) | ((uint)mb->y<<4); - - dw1 = type_table[mb->macroblock_type & 0xf] | - (((uint)mb->coded_block_pattern)<<22); - - - fmv[0] = mb->PMV[0][0][1]; - fmv[1] = mb->PMV[0][0][0]; - - bmv[0] = mb->PMV[0][1][1]; - bmv[1] = mb->PMV[0][1][0]; - - /* Y Block */ - *dy++ = GFXBLOCK + 4 + (ysize>>2); - *dy++ = (1<<30) | (3<<28) | dw1; - *dy++ = xy; - *dy++ = (16<<16) | 16; - *dy++ = *(uint *)fmv; - *dy++ = *(uint *)bmv; - PACK_CORR_DATA(dy,block_ptr,ysize); - block_ptr = (short *)((unsigned long)block_ptr + ysize); - /* End Y Blocks */ - - fmv[0] /= 2; - fmv[1] /= 2; - - bmv[0] /= 2; - bmv[1] /= 2; - - xy >>= 1; - - /* U Block */ - *du++ = GFXBLOCK + 4 + (usize>>2); - *du++ = (2<<30) | (1<<28) | dw1; - *du++ = xy; - *du++ = (8<<16) | 8; - *du++ = *(uint *)fmv; - *du++ = *(uint *)bmv; - PACK_CORR_DATA(du,block_ptr,usize); - block_ptr = (short *)((unsigned long)block_ptr + usize); - /* End U Block */ - - /* V Block */ - *dv++ = GFXBLOCK + 4 + (vsize>>2); - *dv++ = (3<<30) | (1<<28) | dw1; - *dv++ = xy; - *dv++ = (8<<16) | 8; - *dv++ = *(uint *)fmv; - *dv++ = *(uint *)bmv; - PACK_CORR_DATA(dv,block_ptr,vsize); - block_ptr = (short *)((unsigned long)block_ptr + vsize); - /* End V Block */ - - *datay = dy; - *datau = du; - *datav = dv; -} - -/*************************************************************************** -// Function: renderFrameinFrameDCT1 -// Description: inline function that sets hardware parameters for a Frame -// encoded macroblock in a frame picture with DCT type 1. -***************************************************************************/ -static __inline__ void renderFrameinFrameDCT1(uint **datay,uint **datau, - uint **datav,XvMCMacroBlock *mb, - short *block_ptr,uint flags) { - - register uint *dy = *datay; - register uint *du = *datau; - register uint *dv = *datav; - - /* Motion Vectors */ - short fmv[4]; - short bmv[4]; - - short * top_left_b = NULL; - short * top_right_b = NULL; - short * bottom_left_b = NULL; - short * bottom_right_b = NULL; - - uint temp_bp = 0; - - uint ysize = y_dct1_frame_bytes[mb->coded_block_pattern]; - uint usize = u_frame_bytes[mb->coded_block_pattern]; - uint vsize = v_frame_bytes[mb->coded_block_pattern]; - - uint xy = ((uint)mb->x<<20) | ((uint)mb->y<<4); - - uint dw1 = type_table[mb->macroblock_type & 0xf] | - (((uint)mb->coded_block_pattern)<<22); - - fmv[0] = mb->PMV[0][0][1]; - fmv[1] = mb->PMV[0][0][0]; - - bmv[0] = mb->PMV[0][1][1]; - bmv[1] = mb->PMV[0][1][0]; - - /* - It is easiest to find out what blocks are in need of reading first - rather than as we go. - */ - top_left_b = &empty_block[0]; - if(dw1 & (1<<27)) { - temp_bp |= (1<<25); - top_left_b = block_ptr; - block_ptr += 64; - } - - top_right_b = &empty_block[0]; - if(dw1 & (1<<26)) { - temp_bp |= (1<<24); - top_right_b = block_ptr; - block_ptr += 64; - } - - bottom_left_b = &empty_block[0]; - if(dw1 & (1<<25)) { - temp_bp |= (1<<27); - bottom_left_b = block_ptr; - block_ptr += 64; - } - - bottom_right_b = &empty_block[0]; - if(dw1 & (1<<24)) { - temp_bp |= (1<<26); - bottom_right_b = block_ptr; - block_ptr += 64; - } - dw1 |= temp_bp; - - /* Y Block */ - *dy++ = GFXBLOCK + 4 + (ysize>>2); - *dy++ = (1<<30) | (3<<28) | dw1; - *dy++ = xy; - *dy++ = (16<<16) | 16; - *dy++ = *(uint *)fmv; - *dy++ = *(uint *)bmv; - if(dw1 & (1<<27)) { - PACK_CORR_DATA_1to0(dy,top_left_b,bottom_left_b); - top_left_b = (short *)((unsigned long)top_left_b + 64); - bottom_left_b = (short *)((unsigned long)bottom_left_b + 64); - } - if(dw1 & (1<<26)) { - PACK_CORR_DATA_1to0(dy,top_right_b,bottom_right_b); - top_right_b = (short *)((unsigned long)top_right_b + 64); - bottom_right_b = (short *)((unsigned long)bottom_right_b + 64); - } - if(dw1 & (1<<27)) { - PACK_CORR_DATA_1to0(dy,top_left_b,bottom_left_b); - } - if(dw1 & (1<<26)) { - PACK_CORR_DATA_1to0(dy,top_right_b,bottom_right_b); - } - /* End Y Block */ - - fmv[0] /= 2; - fmv[1] /= 2; - - bmv[0] /= 2; - bmv[1] /= 2; - - xy >>= 1; - - /* U Block */ - *du++ = GFXBLOCK + 4 + (usize>>2); - *du++ = (2<<30) | (1<<28) | dw1; - *du++ = xy; - *du++ = (8<<16) | 8; - *du++ = *(uint *)fmv; - *du++ = *(uint *)bmv; - PACK_CORR_DATA(du,block_ptr,usize); - block_ptr = (short *)((unsigned long)block_ptr + usize); - - /* V Block */ - *dv++ = GFXBLOCK + 4 + (vsize>>2); - *dv++ = (3<<30) | (1<<28) | dw1; - *dv++ = xy; - *dv++ = (8<<16) | 8; - *dv++ = *(uint *)fmv; - *dv++ = *(uint *)bmv; - PACK_CORR_DATA(dv,block_ptr,vsize); - block_ptr = (short *)((unsigned long)block_ptr + vsize); - - *datay = dy; - *datau = du; - *datav = dv; -} - -/*************************************************************************** -// Function: renderDualPrimeinFrame -// Description: inline function that sets hardware parameters for a Dual -// Prime encoded macroblock in a frame picture with dct 1. -***************************************************************************/ -static __inline__ void renderDualPrimeinFrame(uint **datay,uint **datau, - uint **datav,XvMCMacroBlock *mb, - short *block_ptr,uint flags) { - - register uint *dy = *datay; - register uint *du = *datau; - register uint *dv = *datav; - - /* Motion Vectors */ - short fmv[4]; - short bmv[4]; - /* gfxblock dword 1 */ - uint dw1[2]; - - uint y1size = y_first_field_bytes[mb->coded_block_pattern]; - uint y2size = y_second_field_bytes[mb->coded_block_pattern]; - uint usize = u_field_bytes[mb->coded_block_pattern]; - uint vsize = v_field_bytes[mb->coded_block_pattern]; - - uint xy = ((uint)mb->x<<20) | ((uint)mb->y<<3); - - /* - Past Surface (map 0) is used for same parity prediction, - Future surface (map 1) is used for opposite. - */ - dw1[0] = (((uint)mb->coded_block_pattern)<<22) | - 3<<12 | 2<<6 | 2<<3 | 3; - dw1[1] = (((mb->coded_block_pattern & 0x3) | - ((mb->coded_block_pattern & 0xc)<<2))<<22) | - 3<<12 | 3<<6 | 3<<3 | 2; - - fmv[0] = mb->PMV[0][0][1]; - fmv[1] = mb->PMV[0][0][0]; - bmv[0] = mb->PMV[1][0][1]; - bmv[1] = mb->PMV[1][0][0]; - - fmv[2] = mb->PMV[0][0][1]; - fmv[3] = mb->PMV[0][0][0]; - bmv[2] = mb->PMV[1][1][1]; - bmv[3] = mb->PMV[1][1][0]; - - /* First Y Block */ - *dy++ = GFXBLOCK + 4 + (y1size>>2); - *dy++ = (1<<30) | (2<<28) | dw1[0]; - *dy++ = xy; - *dy++ = (8<<16) | 16; - *dy++ = *(uint *)fmv; - *dy++ = *(uint *)bmv;; - PACK_CORR_DATA(dy,block_ptr,y1size); - block_ptr = (short *)((unsigned long)block_ptr + y1size); - - /* Second Y Block */ - *dy++ = GFXBLOCK + 4 + (y2size>>2); - *dy++ = (1<<30) | (2<<28) | dw1[1]; - *dy++ = xy; - *dy++ = (8<<16) | 16; - *dy++ = *(uint *)&fmv[2]; - *dy++ = *(uint *)&bmv[2]; - PACK_CORR_DATA(dy,block_ptr,y2size); - block_ptr = (short *)((unsigned long)block_ptr + y2size); - - fmv[0] /= 2; - fmv[1] /= 2; - bmv[0] /= 2; - bmv[1] /= 2; - - fmv[2] /= 2; - fmv[3] /= 2; - bmv[2] /= 2; - bmv[3] /= 2; - - xy >>= 1; - - /* U Blocks */ - *du++ = GFXBLOCK + 4 + (usize>>2); - *du++ = (2<<30) | (1<<28) | dw1[0]; - *du++ = xy; - *du++ = (4<<16) | 8; - *du++ = *(uint *)fmv; - *du++ = *(uint *)bmv; - if(dw1[0] & (1<<23)) { - PACK_CORR_DATA_SHORT(du,block_ptr); - } - - /* Second U Block */ - *du++ = GFXBLOCK + 4 + (usize>>2); - *du++ = (2<<30) | (1<<28) | dw1[1]; - *du++ = xy; - *du++ = (4<<16) | 8; - *du++ = *(uint *)&fmv[2]; - *du++ = *(uint *)&bmv[2]; - if(dw1[1] & (1<<23)) { - block_ptr = (short *)((unsigned long)block_ptr + 16); - PACK_CORR_DATA_SHORT(du,block_ptr); - block_ptr = (short *)((unsigned long)block_ptr + 112); - } - /* End U Blocks */ - - /* V Blocks */ - *dv++ = GFXBLOCK + 4 + (vsize>>2); - *dv++ = (3<<30) | (1<<28) | dw1[0]; - *dv++ = xy; - *dv++ = (4<<16) | 8; - *dv++ = *(uint *)fmv; - *dv++ = *(uint *)bmv; - if(dw1[0] & (1<<22)) { - PACK_CORR_DATA_SHORT(dv,block_ptr); - } - - /* Second V Block */ - *dv++ = GFXBLOCK + 4 + (vsize>>2); - *dv++ = (3<<30) | (1<<28) | dw1[1]; - *dv++ = xy; - *dv++ = (4<<16) | 8; - *dv++ = *(uint *)&fmv[2]; - *dv++ = *(uint *)&bmv[2]; - if(dw1[1] & (1<<22)) { - block_ptr = (short *)((unsigned long)block_ptr + 16); - PACK_CORR_DATA_SHORT(dv,block_ptr); - block_ptr = (short *)((unsigned long)block_ptr + 112); - } - /* End V Blocks */ - - *datay = dy; - *datau = du; - *datav = dv; -} - -/*************************************************************************** -// Function: renderDualPrimeinFrameDCT0 -// Description: inline function that sets hardware parameters for a Dual -// Prime encoded macroblock in a frame picture with dct 0. -***************************************************************************/ -static __inline__ void renderDualPrimeinFrameDCT0(uint **datay,uint **datau, - uint **datav, - XvMCMacroBlock *mb, - short *block_ptr, - uint flags) { - - register uint *dy = *datay; - register uint *du = *datau; - register uint *dv = *datav; - - /* Motion Vectors */ - short fmv[4]; - short bmv[4]; - /* gfxblock dword 1 */ - uint dw1[2]; - - short * top_left_b = NULL; - short * top_right_b = NULL; - short * bottom_left_b = NULL; - short * bottom_right_b = NULL; - - uint cbp = (uint)mb->coded_block_pattern; - - uint ysize = y_dct0_field_bytes[cbp]; - uint usize = u_field_bytes[cbp]; - uint vsize = v_field_bytes[cbp]; - - uint xy = ((uint)mb->x<<20) | ((uint)mb->y<<3); - - /* - Past Surface (map 0) is used for same parity prediction, - Future surface (map 1) is used for opposite. - */ - dw1[0] = ((cbp | ((cbp<<2) & 0x30))<<22) | - 3<<12 | 2<<6 | 2<<3 | 3; - dw1[1] = ((cbp | ((cbp<<2) & 0x30))<<22) | - 3<<12 | 3<<6 | 3<<3 | 2; - - fmv[0] = mb->PMV[0][0][1]; - fmv[1] = mb->PMV[0][0][0]; - bmv[0] = mb->PMV[1][0][1]; - bmv[1] = mb->PMV[1][0][0]; - - fmv[2] = mb->PMV[0][0][1]; - fmv[3] = mb->PMV[0][0][0]; - bmv[2] = mb->PMV[1][1][1]; - bmv[3] = mb->PMV[1][1][0]; - - /* - The i810 cannot use DCT0 directly with field motion, we have to - interlace the data for it. We use a zero block when the CBP has - one half of the to-be-interlaced data but not the other half. - */ - top_left_b = &empty_block[0]; - if(cbp & 0x20) { - top_left_b = block_ptr; - block_ptr += 64; - } - - top_right_b = &empty_block[0]; - if(cbp & 0x10) { - top_right_b = block_ptr; - block_ptr += 64; - } - - bottom_left_b = &empty_block[0]; - if(cbp & 0x8) { - bottom_left_b = block_ptr; - block_ptr += 64; - } - - bottom_right_b = &empty_block[0]; - if(cbp & 0x4) { - bottom_right_b = block_ptr; - block_ptr += 64; - } - - /* First Y Block */ - *dy++ = GFXBLOCK + 4 + (ysize>>2); - *dy++ = (1<<30) | (2<<28) | dw1[0]; - *dy++ = xy; - *dy++ = (8<<16) | 16; - *dy++ = *(uint *)fmv; - *dy++ = *(uint *)bmv; - if(cbp & 0x20) { - PACK_CORR_DATA_0to1(dy,top_left_b,bottom_left_b); - } - if(cbp & 0x10) { - PACK_CORR_DATA_0to1(dy,top_right_b,bottom_right_b); - } - - /* Second Y Block */ - *dy++ = GFXBLOCK + 4 + (ysize>>2); - *dy++ = (1<<30) | (2<<28) | dw1[1]; - *dy++ = xy; - *dy++ = (8<<16) | 16; - *dy++ = *(uint *)&fmv[2]; - *dy++ = *(uint *)&bmv[2]; - if(cbp & 0x20) { - top_left_b = (short *)((unsigned long)top_left_b + 16); - bottom_left_b = (short *)((unsigned long)bottom_left_b + 16); - PACK_CORR_DATA_0to1(dy,top_left_b,bottom_left_b); - } - if(cbp & 0x10) { - top_right_b = (short *)((unsigned long)top_right_b + 16); - bottom_right_b = (short *)((unsigned long)bottom_right_b + 16); - PACK_CORR_DATA_0to1(dy,top_right_b,bottom_right_b); - } - /* End Y Blocks */ - - - fmv[0] /= 2; - fmv[1] /= 2; - bmv[0] /= 2; - bmv[1] /= 2; - - fmv[2] /= 2; - fmv[3] /= 2; - bmv[2] /= 2; - bmv[3] /= 2; - - xy >>= 1; - - /* U Blocks */ - *du++ = GFXBLOCK + 4 + (usize>>2); - *du++ = (2<<30) | (1<<28) | dw1[0]; - *du++ = xy; - *du++ = (4<<16) | 8; - *du++ = *(uint *)fmv; - *du++ = *(uint *)bmv; - if(cbp & (1<<23)) { - PACK_CORR_DATA_SHORT(du,block_ptr); - } - - /* Second U Block */ - *du++ = GFXBLOCK + 4 + (usize>>2); - *du++ = (2<<30) | (1<<28) | dw1[1]; - *du++ = xy; - *du++ = (4<<16) | 8; - *du++ = *(uint *)&fmv[2]; - *du++ = *(uint *)&bmv[2]; - if(cbp & (1<<23)) { - block_ptr = (short *)((unsigned long)block_ptr + 16); - PACK_CORR_DATA_SHORT(du,block_ptr); - block_ptr = (short *)((unsigned long)block_ptr + 112); - } - /* End U Blocks */ - - /* V Blocks */ - *dv++ = GFXBLOCK + 4 + (vsize>>2); - *dv++ = (3<<30) | (1<<28) | dw1[0]; - *dv++ = xy; - *dv++ = (4<<16) | 8; - *dv++ = *(uint *)fmv; - *dv++ = *(uint *)bmv; - if(cbp & (1<<22)) { - PACK_CORR_DATA_SHORT(dv,block_ptr); - } - - /* Second V Block */ - *dv++ = GFXBLOCK + 4 + (vsize>>2); - *dv++ = (3<<30) | (1<<28) | dw1[1]; - *dv++ = xy; - *dv++ = (4<<16) | 8; - *dv++ = *(uint *)&fmv[2]; - *dv++ = *(uint *)&bmv[2]; - if(cbp & (1<<22)) { - block_ptr = (short *)((unsigned long)block_ptr + 16); - PACK_CORR_DATA_SHORT(dv,block_ptr); - block_ptr = (short *)((unsigned long)block_ptr + 112); - } - /* End V Blocks */ - - *datay = dy; - *datau = du; - *datav = dv; -} - - -/*************************************************************************** -// Function: XvMCRenderSurface -// Description: This function does the actual HWMC. Given a list of -// macroblock structures it dispatched the hardware commands to execute -// them. DMA buffer containing Y data are dispatched as they fill up -// U and V DMA buffers are queued until all Y's are done. This minimizes -// the context flipping and flushing required when switching between Y -// U and V surfaces. -***************************************************************************/ -#define UV_QUEUE 14 -Status XvMCRenderSurface(Display *display, XvMCContext *context, - unsigned int picture_structure, - XvMCSurface *target_surface, - XvMCSurface *past_surface, - XvMCSurface *future_surface, - unsigned int flags, - unsigned int num_macroblocks, - unsigned int first_macroblock, - XvMCMacroBlockArray *macroblock_array, - XvMCBlockArray *blocks) { - /* Dma Data Structures */ - drmBufPtr pDMAy = NULL,pDMAu[UV_QUEUE],pDMAv[UV_QUEUE]; - int u_index = 0,v_index = 0; - int dirty_context = 1; - - /* Block Pointer */ - short *block_ptr; - /* Current Macroblock Pointer */ - XvMCMacroBlock *mb; - - drm_i810_mc_t mc; - int i,j; - i810XvMCSurface *privTarget; - i810XvMCSurface *privFuture = NULL; - i810XvMCSurface *privPast = NULL; - i810XvMCContext *pI810XvMC; - - /* DMA Pointers set to NULL */ - uint *datay = NULL; - uint *datau = NULL; - uint *datav = NULL; - - - /* Check Parameters for validity */ - if((target_surface == NULL) || (context == NULL) || (display == NULL)) { - printf("Error, Invalid Target,Context, or DIsplay!\n"); - return BadValue; - } - - if(num_macroblocks == 0) {return Success;} - if((macroblock_array == NULL) || (blocks == NULL)) {return BadValue;} - if(context->privData == NULL) {return BadValue;} - pI810XvMC = (i810XvMCContext *)context->privData; - - - if(target_surface->privData == NULL) { - printf("Error, Invalid Target Surface!\n"); - return BadValue; - } - privTarget = (i810XvMCSurface *)target_surface->privData; - - if(macroblock_array->num_blocks < (num_macroblocks + first_macroblock)) { - printf("Error, Too many macroblocks requested for MB array size.\n"); - return BadValue; - } - - /* Test For YV12 Surface */ - if(context->surface_type_id != FOURCC_YV12) { - printf("Error, HWMC only possible on YV12 Surfaces\n"); - return BadValue; - } - - /* P Frame Test */ - if(past_surface == NULL) { - /* Just to avoid some ifs later. */ - privPast = privTarget; - } - else { - if(past_surface->privData == NULL) { - printf("Error, Invalid Past Surface!\n"); - return BadValue; - } - privPast = (i810XvMCSurface *)past_surface->privData; - } - - - /* B Frame Test */ - if(future_surface == NULL) { - privFuture = privTarget; - if(pI810XvMC->dual_prime) { - privFuture = privPast; - /* I810 Specific flag for marking when dual prime is in use. */ - flags |= 0x40000000; - } - - /* - References are different for the Second Field Picture. The - i810 needs to know if it is the second field picture in a - P picture. We use a Private flag to mark this. - */ - if(flags & XVMC_SECOND_FIELD) { - /* I810 Specific flag for marking second fields. */ - flags |= 0x80000000; - } - } - else { - if((future_surface->privData == NULL) || (past_surface == NULL)) { - printf("Error, Invalid Future Surface or No Past Surface!\n"); - return BadValue; - } - privFuture = (i810XvMCSurface *)future_surface->privData; - - /* - Undo Second Field flag since the second field in B frames is just like - the first. - */ - flags &= ~0x80000000; - } - - /* Lock For DMA */ - I810_LOCK(pI810XvMC,0); - - for(i=first_macroblock; i<(num_macroblocks + first_macroblock); i++) { - /* Set up values needed for each macroblock */ - mb = ¯oblock_array->macro_blocks[i]; - block_ptr = &(blocks->blocks[mb->index<<6]); - - /* Lockup can happen if the coordinates are too far out of range */ - if(mb->x > target_surface->width>>4) { - mb->x = 0; - } - if(mb->y > target_surface->height>>4) { - mb->y = 0; - } - - /* If buffers are almost full dispatch them */ - if(datay) { - pDMAy->used = (unsigned long)datay - (unsigned long)pDMAy->address; - if(pDMAy->used > 3520) { - if(dirty_context) { - dispatchYContext(privTarget,privPast,privFuture,pI810XvMC); - } - dirty_context = 0; - mc.idx = pDMAy->idx; - mc.used = pDMAy->used; - datay = NULL; - mc.last_render = ++pI810XvMC->last_render; - privTarget->last_render = pI810XvMC->last_render; - I810_MC(pI810XvMC,mc); - } /* datay near full */ - } /* if(datay) */ - if(datau) { - pDMAu[u_index]->used = (unsigned long)datau - (unsigned long)pDMAu[u_index]->address; - if(pDMAu[u_index]->used > 3904) { - u_index++; - datau = NULL; - if(u_index == UV_QUEUE) { - for(j=0; jidx; - mc.used = pDMAu[j]->used; - mc.last_render = ++pI810XvMC->last_render; - privTarget->last_render = pI810XvMC->last_render; - I810_MC(pI810XvMC,mc); - } - u_index = 0; - dirty_context = 1; - } /* if(u_index == UV_QUEUE) */ - } /* datau near full */ - } /* if(datau) */ - if(datav) { - pDMAv[v_index]->used = (unsigned long)datav - (unsigned long)pDMAv[v_index]->address; - if(pDMAv[v_index]->used > 3904) { - v_index++; - datav = NULL; - if(v_index == UV_QUEUE) { - for(j=0; jidx; - mc.used = pDMAv[j]->used; - mc.last_render = ++pI810XvMC->last_render; - privTarget->last_render = pI810XvMC->last_render; - I810_MC(pI810XvMC,mc); - } - v_index = 0; - dirty_context = 1; - } /* if(v_index == UV_QUEUE) */ - } /* datav near full */ - } /* if(datav) */ - - /* Allocate buffers if this is the first loop,or if we just dispatched */ - if(datay == NULL) { - pDMAy = i810_get_free_buffer(pI810XvMC); - datay = pDMAy->address; - }/* if(datay == NULL) */ - if(datau == NULL) { - pDMAu[u_index] = i810_get_free_buffer(pI810XvMC); - datau = pDMAu[u_index]->address; - if(u_index == 0) { - *datau++ = CMD_FLUSH; - *datau++ = BOOLEAN_ENA_2; - *datau++ = CMD_FLUSH; - *datau++ = DEST_BUFFER_INFO; - *datau++ = privTarget->dbi1u; - *datau++ = DEST_BUFFER_VAR; - *datau++ = privTarget->dbv1; - /* Past Surface */ - *datau++ = CMD_MAP_INFO; - *datau++ = privPast->mi1u; - *datau++ = privPast->mi2u; - *datau++ = privPast->mi3u; - /* Future Surface */ - *datau++ = CMD_MAP_INFO; - *datau++ = privFuture->mi1u | 0x1<<28; - *datau++ = privFuture->mi2u; - *datau++ = privFuture->mi3u; - } - } /* if(datau == NULL) */ - if(datav == NULL) { - pDMAv[v_index] = i810_get_free_buffer(pI810XvMC); - datav = pDMAv[v_index]->address; - if(v_index == 0) { - *datav++ = CMD_FLUSH; - *datav++ = BOOLEAN_ENA_2; - *datav++ = CMD_FLUSH; - *datav++ = DEST_BUFFER_INFO; - *datav++ = privTarget->dbi1v; - *datav++ = DEST_BUFFER_VAR; - *datav++ = privTarget->dbv1; - /* Past Surface */ - *datav++ = CMD_MAP_INFO; - *datav++ = privPast->mi1v; - *datav++ = privPast->mi2v; - *datav++ = privPast->mi3v; - /* Future Surface */ - *datav++ = CMD_MAP_INFO; - *datav++ = privFuture->mi1v | 0x1<<28; - *datav++ = privFuture->mi2v; - *datav++ = privFuture->mi3v; - } - }/* if(datav == NULL) */ - - /* Catch no pattern case */ - if(!(mb->macroblock_type & 0x8)) { - mb->coded_block_pattern = 0; - } - - - if(mb->motion_type == XVMC_PREDICTION_DUAL_PRIME) { - /* - By default the maps will not be set up for dual - prime. We have to change them. - */ - if(!pI810XvMC->dual_prime) { - pI810XvMC->dual_prime = 1; - privFuture = privPast; - /* Y */ - *datay++ = CMD_MAP_INFO; - *datay++ = privFuture->mi1y | 0x1<<28; - *datay++ = privFuture->mi2y; - *datay++ = privFuture->mi3y; - /* U */ - *datau++ = CMD_MAP_INFO; - *datau++ = privFuture->mi1u | 0x1<<28; - *datau++ = privFuture->mi2u; - *datau++ = privFuture->mi3u; - /* V */ - *datav++ = CMD_MAP_INFO; - *datav++ = privFuture->mi1v | 0x1<<28; - *datav++ = privFuture->mi2v; - *datav++ = privFuture->mi3v; - } - } - if((pI810XvMC->dual_prime) && - (mb->motion_type != XVMC_PREDICTION_DUAL_PRIME)) { - pI810XvMC->dual_prime = 0; - privFuture = privTarget; - /* Y */ - *datay++ = CMD_MAP_INFO; - *datay++ = privFuture->mi1y | 0x1<<28; - *datay++ = privFuture->mi2y; - *datay++ = privFuture->mi3y; - /* U */ - *datau++ = CMD_MAP_INFO; - *datau++ = privFuture->mi1u | 0x1<<28; - *datau++ = privFuture->mi2u; - *datau++ = privFuture->mi3u; - /* V */ - *datav++ = CMD_MAP_INFO; - *datav++ = privFuture->mi1v | 0x1<<28; - *datav++ = privFuture->mi2v; - *datav++ = privFuture->mi3v; - } - - - /* Frame Picture */ - if((picture_structure & XVMC_FRAME_PICTURE) == XVMC_FRAME_PICTURE) { - /* Intra Blocks */ - if(mb->macroblock_type & XVMC_MB_TYPE_INTRA) { - if(mb->dct_type) { - renderIntrainFrameDCT1(&datay,&datau,&datav,mb,block_ptr,flags); - continue; - } - renderIntrainFrame(&datay,&datau,&datav,mb,block_ptr); - continue; - } - switch((mb->motion_type & 0x3) | (mb->dct_type<<2)) { - case 0x2: /* Frame DCT0 */ - renderFrameinFrame(&datay,&datau,&datav,mb,block_ptr,flags); - continue; - case 0x5: /* Field DCT1 */ - renderFieldinFrame(&datay,&datau,&datav,mb,block_ptr,flags); - continue; - case 0x6: /* Frame DCT1 */ - renderFrameinFrameDCT1(&datay,&datau,&datav,mb,block_ptr,flags); - continue; - case 0x1: /* Field DCT0 */ - renderFieldinFrameDCT0(&datay,&datau,&datav,mb,block_ptr,flags); - continue; - case 0x3: /* Dual Prime DCT0 */ - renderDualPrimeinFrame(&datay,&datau,&datav,mb,block_ptr,flags); - continue; - case 0x7: /* Dual Prime DCT1 */ - renderDualPrimeinFrameDCT0(&datay,&datau,&datav,mb,block_ptr,flags); - continue; - default: /* No Motion Type */ - renderError(); - continue; - } /* Switch */ - } /* Frame Picture */ - - /* Field Pictures */ - if(mb->macroblock_type & XVMC_MB_TYPE_INTRA) { - renderIntrainField(&datay,&datau,&datav,mb,block_ptr,picture_structure); - continue; - } - switch(mb->motion_type & 0x3) { - case 0x1: /* Field Motion */ - renderFieldinField(&datay,&datau,&datav,mb,block_ptr,picture_structure, - flags); - continue; - case 0x2: /* 16x8 Motion */ - render16x8inField(&datay,&datau,&datav,mb,block_ptr,picture_structure, - flags); - continue; - case 0x3: /* Dual Prime */ - renderDualPrimeinField(&datay,&datau,&datav,mb,block_ptr, - picture_structure,flags); - continue; - default: /* No Motion Type */ - renderError(); - continue; - } - continue; - - } /* for each Macroblock */ - - /* Dispatch remaining DMA buffers */ - if(dirty_context) { - dispatchYContext(privTarget,privPast,privFuture,pI810XvMC); - } - mc.idx = pDMAy->idx; - mc.used = (unsigned long)datay - (unsigned long)pDMAy->address; - mc.last_render = ++pI810XvMC->last_render; - privTarget->last_render = pI810XvMC->last_render; - I810_MC(pI810XvMC,mc); - - pDMAu[u_index]->used = (unsigned long)datau - (unsigned long)pDMAu[u_index]->address; - for(j=0; j<=u_index; j++) { - mc.idx = pDMAu[j]->idx; - mc.used = pDMAu[j]->used; - mc.last_render = ++pI810XvMC->last_render; - privTarget->last_render = pI810XvMC->last_render; - I810_MC(pI810XvMC,mc); - } - pDMAv[v_index]->used = (unsigned long)datav - (unsigned long)pDMAv[v_index]->address; - for(j=0; j<=v_index; j++) { - mc.idx = pDMAv[j]->idx; - mc.used = pDMAv[j]->used; - mc.last_render = ++pI810XvMC->last_render; - privTarget->last_render = pI810XvMC->last_render; - I810_MC(pI810XvMC,mc); - } - - I810_UNLOCK(pI810XvMC); - - return Success; -} - -/*************************************************************************** -// Function: XvMCPutSurface -// Description: -// Arguments: -// display: Connection to X server -// surface: Surface to be displayed -// draw: X Drawable on which to display the surface -// srcx: X coordinate of the top left corner of the region to be -// displayed within the surface. -// srcy: Y coordinate of the top left corner of the region to be -// displayed within the surface. -// srcw: Width of the region to be displayed. -// srch: Height of the region to be displayed. -// destx: X cordinate of the top left corner of the destination region -// in the drawable coordinates. -// desty: Y cordinate of the top left corner of the destination region -// in the drawable coordinates. -// destw: Width of the destination region. -// desth: Height of the destination region. -// flags: One or more of the following. -// XVMC_TOP_FIELD - Display only the Top field of the surface. -// XVMC_BOTTOM_FIELD - Display only the Bottom Field of the surface. -// XVMC_FRAME_PICTURE - Display both fields or frame. -// -// Info: Portions of this function derived from i810_video.c (XFree86) -// -// This function is organized so that we wait as long as possible before -// touching the overlay registers. Since we don't know that the last -// flip has happened yet we want to give the overlay as long as -// possible to catch up before we have to check on its progress. This -// makes it unlikely that we have to wait on the last flip. -***************************************************************************/ -Status XvMCPutSurface(Display *display,XvMCSurface *surface, - Drawable draw, short srcx, short srcy, - unsigned short srcw, unsigned short srch, - short destx, short desty, - unsigned short destw, unsigned short desth, - int flags) { - i810XvMCContext *pI810XvMC; - i810XvMCSurface *pI810Surface; - i810OverlayRecPtr pORegs; - unsigned int ysrc_offset,uvsrc_offset; - Box extents; - uint window_width,window_height; - unsigned int xscaleInt = 0,xscaleFract = 0,yscaleInt = 0,yscaleFract = 0; - unsigned int xscaleFractUV = 0,xscaleIntUV = 0,yscaleFractUV = 0; - unsigned int yscaleIntUV = 0,yPitch = 0,uvPitch = 0; - unsigned int ovcmd = 0; - uint d; - double xscale,yscale; - int diff; - int clipped_srcx, clipped_srcy, clipped_destx, clipped_desty; - int clipped_srcw, clipped_srch, clipped_destw, clipped_desth; - uint x1,y1,root_width,root_height; - int x2 = 0, y2 = 0,unused; - uint nChilds; - int stat; - Window win,root,parent,*pChilds; - - - if((display == NULL) || (surface == NULL)) { - return BadValue; - } - - if(surface->privData == NULL) { - return (error_base + XvMCBadSurface); - } - pI810Surface = (i810XvMCSurface *)surface->privData; - pI810XvMC = (i810XvMCContext *)pI810Surface->privContext; - pORegs = (i810OverlayRecPtr)pI810XvMC->oregs; - - - switch(surface->surface_type_id) { - case FOURCC_YV12: - case FOURCC_I420: - yPitch = (srcw + 7) & ~7; - uvPitch = ((srcw>>1) + 7) & ~7; - if((flags & XVMC_FRAME_PICTURE) != XVMC_FRAME_PICTURE) { - srch = srch>>1; - } - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - /* FIXME: Non Planar not fully implemented. */ - return BadValue; - yPitch = ((srcw + 7) & ~7) << 1; - break; - }/* switch(surface->surface_type_id) */ - - /* - FIXME: This should be using the DRI's clip rect but that isn't - all hooked up yet. This has some latency but we get by. - */ - win = draw; - XQueryTree(display,win,&root,&parent,&pChilds,&nChilds); - if(nChilds) XFree(pChilds); - XGetGeometry(display,win, &root, &x2, &y2, &window_width, - &window_height, &d, &d); - x1 = x2; - y1 = y2; - win = parent; - do { - XQueryTree(display,win,&root,&parent,&pChilds,&nChilds); - if(nChilds) XFree(pChilds); - XGetGeometry(display,win, &root, &x2, &y2, &d, &d, &d, &d); - x1 += x2; - y1 += y2; - win = parent; - }while(win != root); - XGetGeometry(display,root, &root, &unused, &unused, - &root_width, &root_height, &d, &d); - - /* Left edge of Video window clipped to screen */ - extents.x1 = 0; - if(x1 > extents.x1) { - extents.x1 = x1; - } - /* Right edge of Video window clipped to screen */ - extents.x2 = root_width; - if(extents.x2 > (x1 + window_width)) { - extents.x2 = x1 + window_width; - } - /* Top edge of Video window clipped to screen */ - extents.y1 = 0; - if(y1 > extents.y1) { - extents.y1 = y1; - } - /* Bottom edge of Video window clipped to screen */ - extents.y2 = root_height; - if(extents.y2 > (y1 + window_height)) { - extents.y2 = y1 + window_height; - } - - /* - Clipping is more difficult than is seems. We need to keep the - scaling factors even if the destination window needs to be clipped. - We clip the destination window first then apply a scaled version - to the source window. - */ - - /* Put destination coords in screen coords */ - destx += x1; - desty += y1; - - /* Scale factors requested */ - xscale = (double)srcw / (double)destw; - yscale = (double)srch / (double)desth; - - /* - If destination window needs to be clipped we actually adjust both - the src and dest window so as to keep the scaling that was requested - */ - clipped_srcx = srcx; - clipped_srcy = srcy; - clipped_destx = destx; - clipped_desty = desty; - clipped_srcw = srcw; - clipped_srch = srch; - clipped_destw = destw; - clipped_desth = desth; - - /* Clip to the source surface boundaries */ - if(clipped_srcx < 0) { - clipped_destx += (0 - clipped_srcx) / xscale; - clipped_srcw -= clipped_srcx; - clipped_destw -= clipped_srcx / xscale; - clipped_srcx = 0; - } - if((clipped_srcw + clipped_srcx) > surface->width) { - clipped_srcw = surface->width - clipped_srcx; - clipped_destw -= (clipped_srcw - srcw) / xscale; - } - if(clipped_srcy < 0) { - clipped_desty += (0 - clipped_srcy) / yscale; - clipped_srch -= clipped_srcy; - clipped_desth -= clipped_srcy / yscale; - clipped_srcy = 0; - } - if((clipped_srch + clipped_srcy) > surface->height) { - clipped_srch = surface->height - clipped_srcy; - clipped_desth -= (clipped_srch - srch) / yscale; - } - - /* Clip to the extents */ - if(clipped_destx < extents.x1) { - diff = extents.x1 - clipped_destx; - clipped_srcx += diff * xscale; - clipped_srcw -= diff * xscale; - clipped_destw -= diff; - clipped_destx = extents.x1; - } - - diff = (clipped_destx + clipped_destw) - extents.x2; - if(diff > 0) { - clipped_destw -= diff; - clipped_srcw -= diff * xscale; - } - - if(clipped_desty < extents.y1) { - diff = extents.y1 - clipped_desty; - clipped_srcy += diff * yscale; - clipped_srch -= diff * yscale; - clipped_desth -= diff; - clipped_desty = 0; - } - - diff = (clipped_desty + clipped_desth) - extents.y2; - if(diff > 0) { - clipped_desth -= diff; - clipped_srch -= diff * yscale; - } - - /* If the whole window is clipped turn off the overlay */ - if((clipped_destx + clipped_destw < extents.x1) || - (clipped_desty + clipped_desth < extents.y1) || - (clipped_destx > extents.x2) || - (clipped_desty > extents.y2)) { - return XvMCHideSurface(display, surface); - } - - /* - Adjust the source offset width and height according to the clipped - destination window. - */ - ysrc_offset = ((clipped_srcx + 1) & ~1) + - ((clipped_srcy + 1) & ~1) * (1<pitch); - uvsrc_offset = (clipped_srcx>>1) + - (clipped_srcy>>1) * (1<<(pI810Surface->pitch - 1)); - - /* - Initially, YCbCr and Overlay Enable and - vertical chrominance up interpolation and horozontal chrominance - up interpolation - */ - ovcmd = VC_UP_INTERPOLATION | HC_UP_INTERPOLATION | - Y_ADJUST | OVERLAY_ENABLE; - - if ((clipped_destw != clipped_srcw) || - (clipped_desth != clipped_srch)) { - xscaleInt = (clipped_srcw / clipped_destw) & 0x3; - xscaleFract = (clipped_srcw << 12) / clipped_destw; - yscaleInt = (clipped_srch / clipped_desth) & 0x3; - yscaleFract = (clipped_srch << 12) / clipped_desth; - - if (clipped_destw > clipped_srcw) { - /* horizontal up-scaling */ - ovcmd &= ~HORIZONTAL_CHROMINANCE_FILTER; - ovcmd &= ~HORIZONTAL_LUMINANCE_FILTER; - ovcmd |= (HC_UP_INTERPOLATION | HL_UP_INTERPOLATION); - } - - if (clipped_desth > clipped_srch) { - /* vertical up-scaling */ - ovcmd &= ~VERTICAL_CHROMINANCE_FILTER; - ovcmd &= ~VERTICAL_LUMINANCE_FILTER; - ovcmd |= (VC_UP_INTERPOLATION | VL_UP_INTERPOLATION); - } - - if (clipped_destw < clipped_srcw) { - /* horizontal down-scaling */ - ovcmd &= ~HORIZONTAL_CHROMINANCE_FILTER; - ovcmd &= ~HORIZONTAL_LUMINANCE_FILTER; - ovcmd |= (HC_DOWN_INTERPOLATION | HL_DOWN_INTERPOLATION); - } - - if (clipped_desth < clipped_srch) { - /* vertical down-scaling */ - ovcmd &= ~VERTICAL_CHROMINANCE_FILTER; - ovcmd &= ~VERTICAL_LUMINANCE_FILTER; - ovcmd |= (VC_DOWN_INTERPOLATION | VL_DOWN_INTERPOLATION); - } - - /* now calculate the UV scaling factor */ - if (xscaleFract) { - xscaleFractUV = xscaleFract >> MINUV_SCALE; - ovcmd &= ~HC_DOWN_INTERPOLATION; - ovcmd |= HC_UP_INTERPOLATION; - } - - if (xscaleInt) { - xscaleIntUV = xscaleInt >> MINUV_SCALE; - if (xscaleIntUV) { - ovcmd &= ~HC_UP_INTERPOLATION; - } - } - - if (yscaleFract) { - yscaleFractUV = yscaleFract >> MINUV_SCALE; - ovcmd &= ~VC_DOWN_INTERPOLATION; - ovcmd |= VC_UP_INTERPOLATION; - } - - if (yscaleInt) { - yscaleIntUV = yscaleInt >> MINUV_SCALE; - if (yscaleIntUV) { - ovcmd &= ~VC_UP_INTERPOLATION; - ovcmd |= VC_DOWN_INTERPOLATION; - } - } - - }/* if((destw != srcw) || (desth != srch)) */ - - /* Lock the DRM */ - I810_LOCK(pI810XvMC,0); - - /* Block until rendering on this surface is finished */ - stat = XVMC_RENDERING; - while(stat & XVMC_RENDERING) { - XvMCGetSurfaceStatus(display,surface,&stat); - } - /* Block until the last flip is finished */ - if(pI810XvMC->last_flip) { - BLOCK_OVERLAY(pI810XvMC,pI810XvMC->current); - } - - pI810XvMC->current = !pI810XvMC->current; - pORegs->OV0CMD = ovcmd; - - if ((clipped_destw != clipped_srcw) || - (clipped_desth != clipped_srch)) { - pORegs->YRGBSCALE = (xscaleInt << 15) | - ((xscaleFract & 0xFFF) << 3) | (yscaleInt) | - ((yscaleFract & 0xFFF) << 20); - - pORegs->UVSCALE = yscaleIntUV | ((xscaleFractUV & 0xFFF) << 3) | - ((yscaleFractUV & 0xFFF) << 20); - } - else { - /* Normal 1:1 scaling */ - pORegs->YRGBSCALE = 0x80004000; - pORegs->UVSCALE = 0x80004000; - } - - pORegs->SHEIGHT = clipped_srch | (clipped_srch << 15); - pORegs->DWINPOS = (clipped_desty << 16) | clipped_destx; - pORegs->DWINSZ = ((clipped_desth<< 16) | (clipped_destw)); - - /* Attributes */ - pORegs->OV0CLRC0 = ((pI810XvMC->contrast & 0x1ff)<<8) | - (pI810XvMC->brightness & 0xff); - pORegs->OV0CLRC1 = (pI810XvMC->saturation & 0x3ff); - - /* Destination Colorkey Setup */ - pI810XvMC->oregs->DCLRKV = RGB16ToColorKey(pI810XvMC->colorkey); - - /* buffer locations, add the offset from the clipping */ - if(pI810XvMC->current) { - pORegs->OBUF_1Y = (unsigned long)pI810Surface->offset + - (unsigned long)pI810Surface->offsets[0] + ysrc_offset; - pORegs->OBUF_1V = (unsigned long)pI810Surface->offset + - (unsigned long)pI810Surface->offsets[2] + uvsrc_offset; - pORegs->OBUF_1U = (unsigned long)pI810Surface->offset + - (unsigned long)pI810Surface->offsets[1] + uvsrc_offset; - } - else { - pORegs->OBUF_0Y = (unsigned long)pI810Surface->offset + - (unsigned long)pI810Surface->offsets[0] + ysrc_offset; - pORegs->OBUF_0V = (unsigned long)pI810Surface->offset + - (unsigned long)pI810Surface->offsets[2] + uvsrc_offset; - pORegs->OBUF_0U = (unsigned long)pI810Surface->offset + - (unsigned long)pI810Surface->offsets[1] + uvsrc_offset; - } - - switch(surface->surface_type_id) { - case FOURCC_YV12: - case FOURCC_I420: - pORegs->SWID = (uvPitch << 16) | yPitch; - pORegs->SWIDQW = (uvPitch << 13) | (yPitch >> 3); - pORegs->OV0STRIDE = (1<pitch) | - ((1<pitch) << 15); - pORegs->OV0CMD &= ~SOURCE_FORMAT; - pORegs->OV0CMD |= YUV_420; - if((flags & XVMC_FRAME_PICTURE) != XVMC_FRAME_PICTURE) { - /* Top Field Only */ - if(flags & XVMC_TOP_FIELD) { - if(pI810XvMC->current == 1) { - pORegs->OV0CMD |= (VERTICAL_PHASE_BOTH | FLIP_TYPE_FIELD | - BUFFER1_FIELD0); - } - else { - pORegs->OV0CMD |= (VERTICAL_PHASE_BOTH | FLIP_TYPE_FIELD | - BUFFER0_FIELD0); - } - pORegs->YRGB_VPH = 1<<15 | 1<<31; - pORegs->UV_VPH = 3<<14 | 3<<30; - pORegs->INIT_PH = 0x06 | 0x18; - } - /* Bottom Field Only */ - else { - if(pI810XvMC->current == 1) { - pORegs->OV0CMD |= (VERTICAL_PHASE_BOTH | FLIP_TYPE_FIELD | - BUFFER1_FIELD1); - } - else { - pORegs->OV0CMD |= (VERTICAL_PHASE_BOTH | FLIP_TYPE_FIELD | - BUFFER0_FIELD1); - } - pORegs->YRGB_VPH = 0; - pORegs->UV_VPH = 7<<29 | 7<<13; - pORegs->INIT_PH = 0x06; - } - } - /* Frame Picture */ - else { - if(pI810XvMC->current == 1) { - pORegs->OV0CMD |= BUFFER1_FIELD0; - } - else { - pORegs->OV0CMD |= BUFFER0_FIELD0; - } - pORegs->YRGB_VPH = 0; - pORegs->UV_VPH = 0; - pORegs->INIT_PH = 0; - } - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - pORegs->SWID = srcw; - pORegs->SWIDQW = srcw >> 3; - pORegs->OV0STRIDE = pI810Surface->pitch; - pORegs->OV0CMD &= ~SOURCE_FORMAT; - pORegs->OV0CMD |= YUV_422; - pORegs->OV0CMD &= ~OV_BYTE_ORDER; - if (surface->surface_type_id == FOURCC_UYVY) { - pORegs->OV0CMD |= Y_SWAP; - } - - pORegs->OV0CMD &= ~BUFFER_AND_FIELD; - if(pI810XvMC->current == 1) { - pORegs->OV0CMD |= BUFFER1_FIELD0; - } - else { - pORegs->OV0CMD |= BUFFER0_FIELD0; - } - - break; - } /* switch(surface->surface_type_id) */ - - - - OVERLAY_FLIP(pI810XvMC); - - /* - The Overlay only flips when it knows you changed - something. So the first time change stuff while it - is watching to be sure. - */ - if(!pI810XvMC->last_flip) { - pORegs->OV0CMD &= ~0x4; - if(pI810XvMC->current == 1) { - pORegs->OV0CMD |= BUFFER1_FIELD0; - } - else { - pORegs->OV0CMD |= BUFFER0_FIELD0; - } - } - pI810Surface->last_flip = ++pI810XvMC->last_flip; - I810_UNLOCK(pI810XvMC); - - return Success; -} - -/*************************************************************************** -// Function: XvMCSyncSurface -// Arguments: -// display - Connection to the X server -// surface - The surface to synchronize -// Info: -// Returns: Status -***************************************************************************/ -Status XvMCSyncSurface(Display *display,XvMCSurface *surface) { - Status ret; - int stat=0; - /* - FIXME: Perhaps a timer here to prevent lockup? - FIXME: Perhaps a usleep to not be busy waiting? - */ - do { - ret = XvMCGetSurfaceStatus(display,surface,&stat); - }while(!ret && (stat & XVMC_RENDERING)); - return ret; -} - -/*************************************************************************** -// Function: XvMCFlushSurface -// Description: -// This function commits pending rendering requests to ensure that they -// wll be completed in a finite amount of time. -// Arguments: -// display - Connection to X server -// surface - Surface to flush -// Info: -// This command is a noop for i810 becuase we always dispatch buffers in -// render. There is little gain to be had with 4k buffers. -// Returns: Status -***************************************************************************/ -Status XvMCFlushSurface(Display * display, XvMCSurface *surface) { - return Success; -} - -/*************************************************************************** -// Function: XvMCGetSurfaceStatus -// Description: -// Arguments: -// display: connection to X server -// surface: The surface to query -// stat: One of the Following -// XVMC_RENDERING - The last XvMCRenderSurface command has not -// completed. -// XVMC_DISPLAYING - The surface is currently being displayed or a -// display is pending. -***************************************************************************/ -Status XvMCGetSurfaceStatus(Display *display, XvMCSurface *surface, - int *stat) { - i810XvMCSurface *privSurface; - i810XvMCContext *pI810XvMC; - int temp; - - if((display == NULL) || (surface == NULL) || (stat == NULL)) { - return BadValue; - } - if(surface->privData == NULL) { - return BadValue; - } - *stat = 0; - privSurface = surface->privData; - - pI810XvMC = privSurface->privContext; - if(pI810XvMC == NULL) { - return (error_base + XvMCBadSurface); - } - - I810_LOCK(pI810XvMC,0); - if(privSurface->last_flip) { - /* This can not happen */ - if(pI810XvMC->last_flip < privSurface->last_flip) { - printf("Error: Context last flip is less than surface last flip.\n"); - return BadValue; - } - /* - If the context has 2 or more flips after this surface it - cannot be displaying. Don't bother to check. - */ - if(!(pI810XvMC->last_flip > (privSurface->last_flip + 1))) { - /* - If this surface was the last flipped it is either displaying - or about to be so don't bother checking. - */ - if(pI810XvMC->last_flip == privSurface->last_flip) { - *stat |= XVMC_DISPLAYING; - } - else { - /* - In this case there has been one more flip since our surface's - but we need to check if it is finished or not. - */ - temp = GET_FSTATUS(pI810XvMC); - if(((temp & (1<<20))>>20) != pI810XvMC->current) { - *stat |= XVMC_DISPLAYING; - } - } - } - } - - if(privSurface->last_render && - (privSurface->last_render > GET_RSTATUS(pI810XvMC))) { - *stat |= XVMC_RENDERING; - } - I810_UNLOCK(pI810XvMC); - - return Success; -} - -/*************************************************************************** -// -// Surface manipulation functions -// -***************************************************************************/ - -/*************************************************************************** -// Function: XvMCHideSurface -// Description: Stops the display of a surface. -// Arguments: -// display - Connection to the X server. -// surface - surface to be hidden. -// -// Returns: Status -***************************************************************************/ -Status XvMCHideSurface(Display *display, XvMCSurface *surface) { - i810XvMCSurface *pI810Surface; - i810XvMCContext *pI810XvMC; - int ss, xx; - - /* Did we get a good display and surface passed into us? */ - if(display == NULL) { - return BadValue; - } - - if(surface == NULL) { - return (error_base + XvMCBadSurface); - } - - XvMCSyncSurface(display, surface); - - /* Get surface private data pointer */ - if(surface->privData == NULL) { - return (error_base + XvMCBadSurface); - } - pI810Surface = (i810XvMCSurface *)surface->privData; - - /* - Get the status of the surface, if it is not currently displayed - we don't need to worry about it. - */ - if((xx = XvMCGetSurfaceStatus(display, surface, &ss)) != Success) { - return xx; - } - if(! (ss & XVMC_DISPLAYING)) { - return Success; - } - - /* Get the associated context pointer */ - pI810XvMC = (i810XvMCContext *)pI810Surface->privContext; - if(pI810XvMC == NULL) { - return (error_base + XvMCBadSurface); - } - - if(pI810XvMC->last_flip) { - I810_LOCK(pI810XvMC,DRM_LOCK_QUIESCENT); - - /* Make sure last flip is done */ - BLOCK_OVERLAY(pI810XvMC,pI810XvMC->current); - - /* Set the registers to turn the overlay off */ - pI810XvMC->oregs->OV0CMD = VC_UP_INTERPOLATION | HC_UP_INTERPOLATION | - Y_ADJUST; - pI810XvMC->current = !pI810XvMC->current; - if(pI810XvMC->current == 1) { - pI810XvMC->oregs->OV0CMD |= BUFFER1_FIELD0; - } - else { - pI810XvMC->oregs->OV0CMD |= BUFFER0_FIELD0; - } - OVERLAY_FLIP(pI810XvMC); - /* - Increment the context flip but not the surface. This way no - surface has the last flip #. - */ - pI810XvMC->last_flip++; - - - /* Now wait until the hardware reads the registers and makes the change. */ - BLOCK_OVERLAY(pI810XvMC,pI810XvMC->current) - - I810_UNLOCK(pI810XvMC); - } - - return Success; -} - - - - -/*************************************************************************** -// -// Functions that deal with subpictures -// -***************************************************************************/ - - - -/*************************************************************************** -// Function: XvMCCreateSubpicture -// Description: This creates a subpicture by filling out the XvMCSubpicture -// structure passed to it and returning Success. -// Arguments: -// display - Connection to the X server. -// context - The context to create the subpicture for. -// subpicture - Pre-allocated XvMCSubpicture structure to be filled in. -// width - of subpicture -// height - of subpicture -// xvimage_id - The id describing the XvImage format. -// -// Returns: Status -***************************************************************************/ -Status XvMCCreateSubpicture(Display *display, XvMCContext *context, - XvMCSubpicture *subpicture, - unsigned short width, unsigned short height, - int xvimage_id) { - i810XvMCContext *pI810XvMC; - i810XvMCSubpicture *pI810Subpicture; - int priv_count; - uint *priv_data; - Status ret; - - if((subpicture == NULL) || (context == NULL) || (display == NULL)){ - return BadValue; - } - - pI810XvMC = (i810XvMCContext *)context->privData; - if(pI810XvMC == NULL) { - return (error_base + XvMCBadContext); - } - - - subpicture->context_id = context->context_id; - subpicture->xvimage_id = xvimage_id; - - /* These need to be checked to make sure they are not too big! */ - subpicture->width = width; - subpicture->height = height; - - subpicture->privData = - (i810XvMCSubpicture *)malloc(sizeof(i810XvMCSubpicture)); - - if(!subpicture->privData) { - return BadAlloc; - } - pI810Subpicture = (i810XvMCSubpicture *)subpicture->privData; - - - if((ret = _xvmc_create_subpicture(display, context, subpicture, - &priv_count, &priv_data))) { - printf("Unable to create XvMCSubpicture.\n"); - return ret; - } - - if(priv_count != 1) { - printf("_xvmc_create_subpicture() returned incorrect data size.\n"); - printf("Expected 1 got %d\n",priv_count); - free(priv_data); - return BadAlloc; - } - /* Data == Client Address, offset == Physical address offset */ - pI810Subpicture->data = pI810XvMC->surfaces.address; - pI810Subpicture->offset = pI810XvMC->surfaces.offset; - - /* Initialize private values */ - pI810Subpicture->privContext = pI810XvMC; - - pI810Subpicture->last_render = 0; - pI810Subpicture->last_flip = 0; - - /* Based on the xvimage_id we will need to set the other values */ - subpicture->num_palette_entries = 16; - subpicture->entry_bytes = 3; - strcpy(subpicture->component_order,"YUV"); - - /* - i810's MC Engine needs surfaces of 2^x (x= 9,10,11,12) pitch - and the Tiler need 512k aligned surfaces, basically we are - stuck with fixed memory with pitch 1024. - */ - pI810Subpicture->pitch = 10; - - /* - offsets[0] == offset into the map described by either - address (Client memeory address) or offset (physical offset from fb base) - */ - pI810Subpicture->offsets[0] = priv_data[0]; - if(((unsigned long)pI810Subpicture->data + pI810Subpicture->offsets[0]) & 4095) { - printf("XvMCCreateSubpicture: Subpicture offset 0 is not 4096 aligned\n"); - } - - /* Free data returned from xvmc_create_surface */ - free(priv_data); - - /* Clear the surface to 0 */ - memset((void *)((unsigned long)pI810Subpicture->data + (unsigned long)pI810Subpicture->offsets[0]), - 0, ((1<pitch) * subpicture->height)); - - switch(subpicture->xvimage_id) { - case FOURCC_IA44: - case FOURCC_AI44: - /* Destination buffer info command */ - pI810Subpicture->dbi1 = ((((unsigned int)pI810Subpicture->offset + - pI810Subpicture->offsets[0]) & ~0xfc000fff) | - (pI810Subpicture->pitch - 9)); - - /* Destination buffer variables command */ - pI810Subpicture->dbv1 = (0x8<<20) | (0x8<<16); - - /* Map info command */ - pI810Subpicture->mi1 = (0x0<<24) | (3<<21) | (1<<9) | - (pI810Subpicture->pitch - 3); - - pI810Subpicture->mi2 = (((unsigned int)subpicture->height - 1)<<16) | - ((unsigned int)subpicture->width - 1); - - pI810Subpicture->mi3 = ((unsigned int)pI810Subpicture->offset + - pI810Subpicture->offsets[0]) & ~0xfc00000f; - break; - default: - free(subpicture->privData); - return BadMatch; - } - - pI810XvMC->ref++; - return Success; -} - - - -/*************************************************************************** -// Function: XvMCClearSubpicture -// Description: Clear the area of the given subpicture to "color". -// structure passed to it and returning Success. -// Arguments: -// display - Connection to the X server. -// subpicture - Subpicture to clear. -// x, y, width, height - rectangle in the subpicture to clear. -// color - The data to file the rectangle with. -// -// Returns: Status -***************************************************************************/ -Status XvMCClearSubpicture(Display *display, XvMCSubpicture *subpicture, - short x, short y, - unsigned short width, unsigned short height, - unsigned int color) { - - i810XvMCContext *pI810XvMC; - i810XvMCSubpicture *pI810Subpicture; - int i; - - if((subpicture == NULL) || (display == NULL)){ - return BadValue; - } - - if(!subpicture->privData) { - return (error_base + XvMCBadSubpicture); - } - pI810Subpicture = (i810XvMCSubpicture *)subpicture->privData; - - pI810XvMC = (i810XvMCContext *)pI810Subpicture->privContext; - if(pI810XvMC == NULL) { - return (error_base + XvMCBadSubpicture); - } - - if((x < 0) || (x + width > subpicture->width)) { - return BadValue; - } - - if((y < 0) || (y + height > subpicture->height)) { - return BadValue; - } - - for(i=y; idata + - (unsigned long)pI810Subpicture->offsets[0] + x + - (1<pitch) * i),(char)color,width); - } - - return Success; -} - -/*************************************************************************** -// Function: XvMCCompositeSubpicture -// Description: Composite the XvImae on the subpicture. This composit uses -// non-premultiplied alpha. Destination alpha is utilized -// except for with indexed subpictures. Indexed subpictures -// use a simple "replace". -// Arguments: -// display - Connection to the X server. -// subpicture - Subpicture to clear. -// image - the XvImage to be used as the source of the composite. -// srcx, srcy, width, height - The rectangle from the image to be used. -// dstx, dsty - location in the subpicture to composite the source. -// -// Returns: Status -***************************************************************************/ -Status XvMCCompositeSubpicture(Display *display, XvMCSubpicture *subpicture, - XvImage *image, - short srcx, short srcy, - unsigned short width, unsigned short height, - short dstx, short dsty) { - - i810XvMCContext *pI810XvMC; - i810XvMCSubpicture *pI810Subpicture; - int i; - - if((subpicture == NULL) || (display == NULL)){ - return BadValue; - } - - if(!subpicture->privData) { - return (error_base + XvMCBadSubpicture); - } - pI810Subpicture = (i810XvMCSubpicture *)subpicture->privData; - - pI810XvMC = (i810XvMCContext *)pI810Subpicture->privContext; - if(pI810XvMC == NULL) { - return (error_base + XvMCBadSubpicture); - } - - if((srcx < 0) || (srcx + width > image->width)) { - return BadValue; - } - - if((dstx < 0) || (dstx + width > subpicture->width)) { - return BadValue; - } - - if((srcy < 0) || (srcy + height > image->height)) { - return BadValue; - } - - if((dsty < 0) || (dsty + height > subpicture->height)) { - return BadValue; - } - - for(i=0; idata + - (unsigned long)pI810Subpicture->offsets[0] + dstx + - (1<pitch) * (i + dsty)), - (void *)((unsigned long)image->data + - (unsigned long)image->offsets[0] + srcx + - image->pitches[0] * (i + srcy)) - ,width); - } - - return Success; - -} - - -/*************************************************************************** -// Function: XvMCDestroySubpicture -// Description: Destroys the specified subpicture. -// Arguments: -// display - Connection to the X server. -// subpicture - Subpicture to be destroyed. -// -// Returns: Status -***************************************************************************/ -Status XvMCDestroySubpicture(Display *display, XvMCSubpicture *subpicture) { - - i810XvMCSubpicture *pI810Subpicture; - i810XvMCContext *pI810XvMC; - - if((display == NULL) || (subpicture == NULL)) { - return BadValue; - } - if(!subpicture->privData) { - return (error_base + XvMCBadSubpicture); - } - pI810Subpicture = (i810XvMCSubpicture *)subpicture->privData; - - pI810XvMC = (i810XvMCContext *)pI810Subpicture->privContext; - if(!pI810XvMC) { - return (error_base + XvMCBadSubpicture); - } - - - if(pI810Subpicture->last_render) { - XvMCSyncSubpicture(display,subpicture); - } - - _xvmc_destroy_subpicture(display,subpicture); - - i810_free_privContext(pI810XvMC); - - free(pI810Subpicture); - subpicture->privData = NULL; - return Success; -} - - -/*************************************************************************** -// Function: XvMCSetSubpicturePalette -// Description: Set the subpictures palette -// Arguments: -// display - Connection to the X server. -// subpicture - Subpiture to set palette for. -// palette - A pointer to an array holding the palette data. The array -// is num_palette_entries * entry_bytes in size. -// Returns: Status -***************************************************************************/ - -Status XvMCSetSubpicturePalette(Display *display, XvMCSubpicture *subpicture, - unsigned char *palette) { - i810XvMCSubpicture *privSubpicture; - int i,j; - - if((display == NULL) || (subpicture == NULL)) { - return BadValue; - } - if(subpicture->privData == NULL) { - return (error_base + XvMCBadSubpicture); - } - privSubpicture = (i810XvMCSubpicture *)subpicture->privData; - - j=0; - for(i=0; i<16; i++) { - privSubpicture->palette[0][i] = palette[j++]; - privSubpicture->palette[1][i] = palette[j++]; - privSubpicture->palette[2][i] = palette[j++]; - } - return Success; -} - -/*************************************************************************** -// Function: XvMCBlendSubpicture -// Description: -// The behavior of this function is different depending on whether -// or not the XVMC_BACKEND_SUBPICTURE flag is set in the XvMCSurfaceInfo. -// i810 only support frontend behavior. -// -// XVMC_BACKEND_SUBPICTURE not set ("frontend" behavior): -// -// XvMCBlendSubpicture is a no-op in this case. -// -// Arguments: -// display - Connection to the X server. -// subpicture - The subpicture to be blended into the video. -// target_surface - The surface to be displayed with the blended subpic. -// source_surface - Source surface prior to blending. -// subx, suby, subw, subh - The rectangle from the subpicture to use. -// surfx, surfy, surfw, surfh - The rectangle in the surface to blend -// blend the subpicture rectangle into. Scaling can ocure if -// XVMC_SUBPICTURE_INDEPENDENT_SCALING is set. -// -// Returns: Status -***************************************************************************/ -Status XvMCBlendSubpicture(Display *display, XvMCSurface *target_surface, - XvMCSubpicture *subpicture, - short subx, short suby, - unsigned short subw, unsigned short subh, - short surfx, short surfy, - unsigned short surfw, unsigned short surfh) { - - return BadMatch; -} - - - -/*************************************************************************** -// Function: XvMCBlendSubpicture2 -// Description: -// The behavior of this function is different depending on whether -// or not the XVMC_BACKEND_SUBPICTURE flag is set in the XvMCSurfaceInfo. -// i810 only supports frontend blending. -// -// XVMC_BACKEND_SUBPICTURE not set ("frontend" behavior): -// -// XvMCBlendSubpicture2 blends the source_surface and subpicture and -// puts it in the target_surface. This does not effect the status of -// the source surface but will cause the target_surface to query -// XVMC_RENDERING until the blend is completed. -// -// Arguments: -// display - Connection to the X server. -// subpicture - The subpicture to be blended into the video. -// target_surface - The surface to be displayed with the blended subpic. -// source_surface - Source surface prior to blending. -// subx, suby, subw, subh - The rectangle from the subpicture to use. -// surfx, surfy, surfw, surfh - The rectangle in the surface to blend -// blend the subpicture rectangle into. Scaling can ocure if -// XVMC_SUBPICTURE_INDEPENDENT_SCALING is set. -// -// Returns: Status -***************************************************************************/ -Status XvMCBlendSubpicture2(Display *display, - XvMCSurface *source_surface, - XvMCSurface *target_surface, - XvMCSubpicture *subpicture, - short subx, short suby, - unsigned short subw, unsigned short subh, - short surfx, short surfy, - unsigned short surfw, unsigned short surfh) { - drmBufPtr pDMA; - unsigned int *data; - i810XvMCContext *pI810XvMC; - i810XvMCSubpicture *privSubpicture; - i810XvMCSurface *privTarget; - i810XvMCSurface *privSource; - drm_i810_mc_t mc; - int i,j; - - if(display == NULL) { - return BadValue; - } - - if(subpicture == NULL) { - return (error_base + XvMCBadSubpicture); - } - - if((target_surface == NULL) || (source_surface == NULL)) { - return (error_base + XvMCBadSurface); - } - - if((subpicture->xvimage_id != FOURCC_AI44) && - (subpicture->xvimage_id != FOURCC_IA44)) { - return (error_base + XvMCBadSubpicture); - } - - if(!subpicture->privData) { - return (error_base + XvMCBadSubpicture); - } - privSubpicture = (i810XvMCSubpicture *)subpicture->privData; - - pI810XvMC = (i810XvMCContext *)privSubpicture->privContext; - if(pI810XvMC == NULL) { - return (error_base + XvMCBadSubpicture); - } - - if(!target_surface->privData) { - return (error_base + XvMCBadSurface); - } - privTarget = (i810XvMCSurface *)target_surface->privData; - - if(!source_surface->privData) { - return (error_base + XvMCBadSurface); - } - privSource = (i810XvMCSurface *)source_surface->privData; - - - /* Check that size isn't bigger than subpicture */ - if((subx + subw) > subpicture->width) { - return BadValue; - } - if((suby + subh) > subpicture->height) { - return BadValue; - } - /* Check that dest isn't bigger than surface */ - if((surfx + surfw) > target_surface->width) { - return BadValue; - } - if((surfy + surfh) > target_surface->height) { - return BadValue; - } - /* Make sure surfaces match */ - if(target_surface->width != source_surface->width) { - return BadValue; - } - if(target_surface->height != source_surface->height) { - return BadValue; - } - - /* Lock For DMA */ - I810_LOCK(pI810XvMC,0); - - /* Allocate DMA buffer */ - pDMA = i810_get_free_buffer(pI810XvMC); - data = pDMA->address; - - /* Copy Y data first */ - /* SOURCE_COPY_BLT */ - *data++ = (2<<29) | (0x43<<22) | 0x4; - *data++ = (0xcc<<16) | (1<<26) | (1<pitch); - *data++ = (target_surface->height<<16) | target_surface->width; - *data++ = privTarget->offset + privTarget->offsets[0]; - *data++ = (1<pitch); - *data++ = privSource->offset + privSource->offsets[0]; - - /* Select Context 1 for loading */ - *data++ = CMD_FLUSH; - *data++ = (5<<23) | (1<<17) | (1<<8); - *data++ = CMD_FLUSH; - - /* Load Palette */ - *data++ = MAP_PALETTE_LOAD; - /* 16 levels of alpha for each Y */ - switch(subpicture->xvimage_id) { - case FOURCC_IA44: - for(i=0; i<16; i++) { - for(j=0; j<16; j++) { - *data++ = (j<<12) | (j<<8) | privSubpicture->palette[0][i]; - } - } - break; - case FOURCC_AI44: - for(i=0; i<16; i++) { - for(j=0; j<16; j++) { - *data++ = (i<<12) | (i<<8) | privSubpicture->palette[0][j]; - } - } - break; - } - /* TARGET */ - /* *data++ = CMD_FLUSH; */ - /* *data++ = BOOLEAN_ENA_2; */ - *data++ = CMD_FLUSH; - *data++ = DEST_BUFFER_INFO; - *data++ = privTarget->dbi1y; - *data++ = DEST_BUFFER_VAR; - *data++ = privTarget->dbv1; - - /* ALPHA */ - *data++ = CMD_MAP_INFO; - *data++ = privSubpicture->mi1; - *data++ = privSubpicture->mi2; - *data++ = privSubpicture->mi3; - - *data++ = VERTEX_FORMAT | (1<<8) | (3<<1); - *data++ = BOOLEAN_ENA_1; - *data++ = SRC_DEST_BLEND_MONO | (0x940); - /* Map Filter */ - *data++ = (3<<29) | (0x1c<<24) | (2<<19) | (0x224); - - /* Use context 1 */ - *data++ = CMD_FLUSH; - *data++ = (5<<23) | (1<<16) | 1; - *data++ = CMD_FLUSH; - - /* Drawing Rect Info */ - *data++ = DRAWING_RECT_INFO; - *data++ = 0x0; - *data++ = 0x0; - *data++ = 0x0; - *data++ = 0x0; - *data++ = 0x0; - - /* GFXPRIMITIVE RECTANGLE */ - *data++ = (3<<29) | (0x1f<<24) | (0x7<<18) | 11; - /* Bottom Right Vertex */ - *(float *)data++ = (float) (surfx + surfw); - *(float *)data++ = (float) (surfy + surfh); - *(float *)data++ = (float) (subx + subw); - *(float *)data++ = (float) (suby + subh); - /* Bottom Left Vertex */ - *(float *)data++ = (float) surfx; - *(float *)data++ = (float) (surfy + surfh); - *(float *)data++ = (float) subx; - *(float *)data++ = (float) (suby + subh); - /* Top Left Vertex */ - *(float *)data++ = (float) surfx; - *(float *)data++ = (float) surfy; - *(float *)data++ = (float) subx; - *(float *)data++ = (float) suby; - - /* Load and Use Context 0 */ - *data++ = CMD_FLUSH; - *data++ = (5<<23) | (1<<17) | (1<<16); - *data++ = CMD_FLUSH; - - /* U data */ - /* SOURCE_COPY_BLT */ - *data++ = (2<<29) | (0x43<<22) | 0x4; - *data++ = (0xcc<<16) | (1<<26) | (1<<(privTarget->pitch - 1)); - *data++ = (target_surface->height<<15) | (target_surface->width>>1); - *data++ = (unsigned long)privTarget->offset + (unsigned long)privTarget->offsets[1]; - *data++ = (1<<(privSource->pitch - 1)); - *data++ = (unsigned long)privSource->offset + (unsigned long)privSource->offsets[1]; - - /* Context 1 select */ - *data++ = CMD_FLUSH; - *data++ = (5<<23) | (1<<17) | (1<<8); - *data++ = CMD_FLUSH; - /* ALPHA PALETTE */ - *data++ = MAP_PALETTE_LOAD; - /* 16 levels of alpha for each Y */ - switch(subpicture->xvimage_id) { - case FOURCC_IA44: - for(i=0; i<16; i++) { - for(j=0; j<16; j++) { - *data++ = (j<<12) | (j<<8) | privSubpicture->palette[2][i]; - } - } - break; - case FOURCC_AI44: - for(i=0; i<16; i++) { - for(j=0; j<16; j++) { - *data++ = (i<<12) | (i<<8) | privSubpicture->palette[2][j]; - } - } - break; - } - /* TARGET */ - *data++ = CMD_FLUSH; - *data++ = BOOLEAN_ENA_2; - *data++ = CMD_FLUSH; - *data++ = DEST_BUFFER_INFO; - *data++ = privTarget->dbi1u; - *data++ = DEST_BUFFER_VAR; - *data++ = privTarget->dbv1; - - /* ALPHA */ - *data++ = CMD_MAP_INFO; - *data++ = privSubpicture->mi1; - *data++ = privSubpicture->mi2; - *data++ = privSubpicture->mi3; - - *data++ = VERTEX_FORMAT | (1<<8) | (3<<1); - *data++ = BOOLEAN_ENA_1; - *data++ = SRC_DEST_BLEND_MONO | (0x940); - /* Map Filter */ - *data++ = (3<<29) | (0x1c<<24) | (2<<19) | (1<<16) | (0x224); - - /* Use context 1 */ - *data++ = CMD_FLUSH; - *data++ = (5<<23) | (1<<16) | 1; - *data++ = CMD_FLUSH; - - /* Drawing Rect Info */ - *data++ = (3<<29) | (0x1d<<24) | (0x80<<16) | 3; - *data++ = 0; - *data++ = 0; - *data++ = 0; - *data++ = 0; - *data++ = 0; - - /* Rectangle */ - *data++ = (3<<29) | (0x1f<<24) | (0x7<<18) | 11; - /* Bottom Right */ - *(float *)data++ = (float) ((surfx + surfw)>>1); - *(float *)data++ = (float) ((surfy + surfh)>>1); - *(float *)data++ = (float) subx + subw; - *(float *)data++ = (float) suby + subh; - /* Bottom Left */ - *(float *)data++ = (float) (surfx>>1); - *(float *)data++ = (float) ((surfy + surfh)>>1); - *(float *)data++ = (float) subx; - *(float *)data++ = (float) suby + subh; - /* Top Left */ - *(float *)data++ = (float) (surfx>>1); - *(float *)data++ = (float) (surfy>>1); - *(float *)data++ = (float) subx; - *(float *)data++ = (float) suby; - - /* Load and Use Context 0 */ - *data++ = CMD_FLUSH; - *data++ = (5<<23) | (1<<17) | (1<<16); - *data++ = CMD_FLUSH; - - /* V data */ - /* SOURCE_COPY_BLT */ - *data++ = (2<<29) | (0x43<<22) | 0x4; - *data++ = (0xcc<<16) | (1<<26) | (1<<(privTarget->pitch - 1)); - *data++ = (target_surface->height<<15) | (target_surface->width>>1); - *data++ = (unsigned long)privTarget->offset + (unsigned long)privTarget->offsets[2]; - *data++ = (1<<(privSource->pitch - 1)); - *data++ = (unsigned long)privSource->offset + (unsigned long)privSource->offsets[2]; - - /* Context 1 select */ - *data++ = CMD_FLUSH; - *data++ = (5<<23) | (1<<17) | (1<<8); - *data++ = CMD_FLUSH; - - /* ALPHA PALETTE */ - *data++ = MAP_PALETTE_LOAD; - /* 16 levels of alpha for each Y */ - switch(subpicture->xvimage_id) { - case FOURCC_IA44: - for(i=0; i<16; i++) { - for(j=0; j<16; j++) { - *data++ = (j<<12) | (j<<8) | privSubpicture->palette[1][i]; - } - } - break; - case FOURCC_AI44: - for(i=0; i<16; i++) { - for(j=0; j<16; j++) { - *data++ = (i<<12) | (i<<8) | privSubpicture->palette[1][j]; - } - } - break; - } - /* TARGET */ - *data++ = CMD_FLUSH; - *data++ = BOOLEAN_ENA_2; - *data++ = CMD_FLUSH; - *data++ = DEST_BUFFER_INFO; - *data++ = privTarget->dbi1v; - *data++ = DEST_BUFFER_VAR; - *data++ = privTarget->dbv1; - - /* ALPHA */ - *data++ = CMD_MAP_INFO; - *data++ = privSubpicture->mi1; - *data++ = privSubpicture->mi2; - *data++ = privSubpicture->mi3; - - *data++ = VERTEX_FORMAT | (1<<8) | (3<<1); - *data++ = BOOLEAN_ENA_1; - *data++ = SRC_DEST_BLEND_MONO | (0x940); - /* Map Filter */ - *data++ = (3<<29) | (0x1c<<24) | (2<<19) | (1<<16) | (0x224); - - /* Use context 1 */ - *data++ = CMD_FLUSH; - *data++ = (5<<23) | (1<<16) | 1; - *data++ = CMD_FLUSH; - - /* Drawing Rect Info */ - *data++ = (3<<29) | (0x1d<<24) | (0x80<<16) | 3; - *data++ = 0; - *data++ = 0; - *data++ = 0; - *data++ = 0; - *data++ = 0; - - /* Rectangle */ - *data++ = (3<<29) | (0x1f<<24) | (0x7<<18) | 11; - /* Bottom Right */ - *(float *)data++ = (float) ((surfx + surfw)>>1); - *(float *)data++ = (float) ((surfy + surfh)>>1); - *(float *)data++ = (float) subx + subw; - *(float *)data++ = (float) suby + subh; - /* Bottom Left */ - *(float *)data++ = (float) (surfx>>1); - *(float *)data++ = (float) ((surfy + surfh)>>1); - *(float *)data++ = (float) subx; - *(float *)data++ = (float) suby + subh; - /* Top Left */ - *(float *)data++ = (float) (surfx>>1); - *(float *)data++ = (float) (surfy>>1); - *(float *)data++ = (float) subx; - *(float *)data++ = (float) suby; - - /* Load and Use Context 0 */ - *data++ = CMD_FLUSH; - *data++ = (5<<23) | (1<<17) | (1<<16); - *data++ = CMD_FLUSH; - - - /* Dispatch */ - pDMA->used = (unsigned long)data - (unsigned long)pDMA->address; - mc.idx = pDMA->idx; - mc.used = pDMA->used; - mc.last_render = ++pI810XvMC->last_render; - privTarget->last_render = pI810XvMC->last_render; - I810_MC(pI810XvMC,mc); - - I810_UNLOCK(pI810XvMC); - return Success; -} - - - -/*************************************************************************** -// Function: XvMCSyncSubpicture -// Description: This function blocks until all composite/clear requests on -// the subpicture have been complete. -// Arguments: -// display - Connection to the X server. -// subpicture - The subpicture to synchronize -// -// Returns: Status -***************************************************************************/ -Status XvMCSyncSubpicture(Display *display, XvMCSubpicture *subpicture) { - Status ret; - int stat=0; - do { - ret = XvMCGetSubpictureStatus(display,subpicture,&stat); - }while(!ret && (stat & XVMC_RENDERING)); - return ret; -} - - - -/*************************************************************************** -// Function: XvMCFlushSubpicture -// Description: This function commits pending composite/clear requests to -// ensure that they will be completed in a finite amount of -// time. -// Arguments: -// display - Connection to the X server. -// subpicture - The subpicture whos compsiting should be flushed -// -// Returns: Status -// NOTES: i810 always dispatches commands so flush is a no-op -***************************************************************************/ -Status XvMCFlushSubpicture(Display *display, XvMCSubpicture *subpicture) { - if(display == NULL) { - return BadValue; - } - if(subpicture == NULL) { - return (error_base + XvMCBadSubpicture); - } - - return Success; -} - - - -/*************************************************************************** -// Function: XvMCGetSubpictureStatus -// Description: This function gets the current status of a subpicture -// -// Arguments: -// display - Connection to the X server. -// subpicture - The subpicture whos status is being queried -// stat - The status of the subpicture. It can be any of the following -// OR'd together: -// XVMC_RENDERING - Last composite or clear request not completed -// XVMC_DISPLAYING - Suppicture currently being displayed. -// -// Returns: Status -// Notes: i810 always blends into a third surface so the subpicture is -// never actually displaying, only a copy of it is displaying. We only -// have to worry about the rendering case. -***************************************************************************/ -Status XvMCGetSubpictureStatus(Display *display, XvMCSubpicture *subpicture, - int *stat) { - - i810XvMCSubpicture *privSubpicture; - i810XvMCContext *pI810XvMC; - - if((display == NULL) || (stat == NULL)) { - return BadValue; - } - if((subpicture == NULL) || (subpicture->privData == NULL)) { - return (error_base + XvMCBadSubpicture); - } - *stat = 0; - privSubpicture = (i810XvMCSubpicture *)subpicture->privData; - - pI810XvMC = (i810XvMCContext *)privSubpicture->privContext; - if(pI810XvMC == NULL) { - return (error_base + XvMCBadSubpicture); - } - - I810_LOCK(pI810XvMC,0); - - if(privSubpicture->last_render && - (privSubpicture->last_render > GET_RSTATUS(pI810XvMC))) { - *stat |= XVMC_RENDERING; - } - I810_UNLOCK(pI810XvMC); - - return Success; -} - -#define NUM_XVMC_ATTRIBUTES 4 -static XvAttribute I810_XVMC_ATTRIBUTES[] = { - {XvGettable | XvSettable, 0, 0xffffff, "XV_COLORKEY"}, - {XvGettable | XvSettable, -127, +127, "XV_BRIGHTNESS"}, - {XvGettable | XvSettable, 0, 0x1ff, "XV_CONTRAST"}, - {XvGettable | XvSettable, 0, 0x3ff, "XV_SATURATION"} -}; - - -/*************************************************************************** -// Function: XvMCQueryAttributes -// Description: An array of XvAttributes of size "number" is returned by -// this function. If there are no attributes, NULL is returned and number -// is set to 0. The array may be freed with xfree(). -// -// Arguments: -// display - Connection to the X server. -// context - The context whos attributes we are querying. -// number - The number of returned atoms. -// -// Returns: -// An array of XvAttributes. -// Notes: -// For i810 we support these Attributes: -// XV_COLORKEY: The colorkey value, initialized from the Xv value at -// context creation time. -// XV_BRIGHTNESS -// XV_CONTRAST -// XV_SATURATION -***************************************************************************/ -XvAttribute *XvMCQueryAttributes(Display *display, XvMCContext *context, - int *number) { - i810XvMCContext *pI810XvMC; - XvAttribute *attributes; - - if(number == NULL) { - return NULL; - } - if(display == NULL) { - *number = 0; - return NULL; - } - if(context == NULL) { - *number = 0; - return NULL; - } - pI810XvMC = context->privData; - if(pI810XvMC == NULL) { - *number = 0; - return NULL; - } - - attributes = (XvAttribute *)malloc(NUM_XVMC_ATTRIBUTES * - sizeof(XvAttribute)); - if(attributes == NULL) { - *number = 0; - return NULL; - } - - memcpy(attributes,I810_XVMC_ATTRIBUTES,(NUM_XVMC_ATTRIBUTES * - sizeof(XvAttribute))); - - *number = NUM_XVMC_ATTRIBUTES; - return attributes; -} - -/*************************************************************************** -// Function: XvMCSetAttribute -// Description: This function sets a context-specific attribute. -// -// Arguments: -// display - Connection to the X server. -// context - The context whos attributes we are querying. -// attribute - The X atom of the attribute to be changed. -// value - The new value for the attribute. -// -// Returns: -// Status -// Notes: -// For i810 we support these Attributes: -// XV_COLORKEY: The colorkey value, initialized from the Xv value at -// context creation time. -// XV_BRIGHTNESS -// XV_CONTRAST -// XV_SATURATION -***************************************************************************/ -Status XvMCSetAttribute(Display *display, XvMCContext *context, - Atom attribute, int value) { - i810XvMCContext *pI810XvMC; - - if(display == NULL) { - return BadValue; - } - if(context == NULL) { - return (error_base + XvMCBadContext); - } - pI810XvMC = context->privData; - if(pI810XvMC == NULL) { - return (error_base + XvMCBadContext); - } - - if(attribute == pI810XvMC->xv_colorkey) { - if((value < I810_XVMC_ATTRIBUTES[0].min_value) || - (value > I810_XVMC_ATTRIBUTES[0].max_value)) { - return BadValue; - } - pI810XvMC->colorkey = value; - return Success; - } - if(attribute == pI810XvMC->xv_brightness) { - if((value < I810_XVMC_ATTRIBUTES[1].min_value) || - (value > I810_XVMC_ATTRIBUTES[1].max_value)) { - return BadValue; - } - pI810XvMC->brightness = value; - return Success; - } - if(attribute == pI810XvMC->xv_saturation) { - if((value < I810_XVMC_ATTRIBUTES[2].min_value) || - (value > I810_XVMC_ATTRIBUTES[2].max_value)) { - return BadValue; - } - pI810XvMC->saturation = value; - return Success; - } - if(attribute == pI810XvMC->xv_contrast) { - if((value < I810_XVMC_ATTRIBUTES[3].min_value) || - (value > I810_XVMC_ATTRIBUTES[3].max_value)) { - return BadValue; - } - pI810XvMC->contrast = value; - return Success; - } - return BadValue; -} - -/*************************************************************************** -// Function: XvMCGetAttribute -// Description: This function queries a context-specific attribute and -// returns the value. -// -// Arguments: -// display - Connection to the X server. -// context - The context whos attributes we are querying. -// attribute - The X atom of the attribute to be queried -// value - The returned attribute value -// -// Returns: -// Status -// Notes: -// For i810 we support these Attributes: -// XV_COLORKEY: The colorkey value, initialized from the Xv value at -// context creation time. -// XV_BRIGHTNESS -// XV_CONTRAST -// XV_SATURATION -***************************************************************************/ -Status XvMCGetAttribute(Display *display, XvMCContext *context, - Atom attribute, int *value) { - i810XvMCContext *pI810XvMC; - - if(display == NULL) { - return BadValue; - } - if(context == NULL) { - return (error_base + XvMCBadContext); - } - pI810XvMC = context->privData; - if(pI810XvMC == NULL) { - return (error_base + XvMCBadContext); - } - if(value == NULL) { - return BadValue; - } - - if(attribute == pI810XvMC->xv_colorkey) { - *value = pI810XvMC->colorkey; - return Success; - } - if(attribute == pI810XvMC->xv_brightness) { - *value = pI810XvMC->brightness; - return Success; - } - if(attribute == pI810XvMC->xv_saturation) { - *value = pI810XvMC->saturation; - return Success; - } - if(attribute == pI810XvMC->xv_contrast) { - *value = pI810XvMC->contrast; - return Success; - } - return BadValue; -} - - - - diff --git a/nx-X11/lib/XvMC/hw/i810/I810XvMC.h b/nx-X11/lib/XvMC/hw/i810/I810XvMC.h deleted file mode 100644 index ba8c792d0..000000000 --- a/nx-X11/lib/XvMC/hw/i810/I810XvMC.h +++ /dev/null @@ -1,469 +0,0 @@ -/*************************************************************************** - -Copyright 2001 Intel Corporation. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL INTEL, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/*************************************************************************** - * libI810XvMC.h: MC Driver i810 includes - * - * Authors: - * Matt Sottek - * - * - ***************************************************************************/ -/* $XFree86: xc/lib/XvMC/hw/i810/I810XvMC.h,v 1.3 2002/10/30 12:52:02 alanh Exp $ */ - - -#ifndef I810XVMC_H -#define I810XVMC_H - -/* #define XVMC_DEBUG(x) do {x; }while(0); */ -#define XVMC_DEBUG(x) - -#include "xf86drm.h" -#include "i810_common.h" -#include - - -/*************************************************************************** -// i810OverlayRec: Structure that is used to reference the overlay -// register memory. A i810OverlayRecPtr is set to the address of the -// allocated overlay registers. -***************************************************************************/ -typedef struct _i810OverlayRec { - unsigned int OBUF_0Y; - unsigned int OBUF_1Y; - unsigned int OBUF_0U; - unsigned int OBUF_0V; - unsigned int OBUF_1U; - unsigned int OBUF_1V; - unsigned int OV0STRIDE; - unsigned int YRGB_VPH; - unsigned int UV_VPH; - unsigned int HORZ_PH; - unsigned int INIT_PH; - unsigned int DWINPOS; - unsigned int DWINSZ; - unsigned int SWID; - unsigned int SWIDQW; - unsigned int SHEIGHT; - unsigned int YRGBSCALE; - unsigned int UVSCALE; - unsigned int OV0CLRC0; - unsigned int OV0CLRC1; - unsigned int DCLRKV; - unsigned int DCLRKM; - unsigned int SCLRKVH; - unsigned int SCLRKVL; - unsigned int SCLRKM; - unsigned int OV0CONF; - unsigned int OV0CMD; -} i810OverlayRec, *i810OverlayRecPtr; - - -/*************************************************************************** -// i810XvMCDrmMap: Holds the data about the DRM maps -***************************************************************************/ -typedef struct _i810XvMCDrmMap { - drm_handle_t offset; - drmAddress address; - unsigned int size; -} i810XvMCDrmMap, *i810XvMCDrmMapPtr; - -/*************************************************************************** -// i810XvMCContext: Private Context data referenced via the privData -// pointer in the XvMCContext structure. -***************************************************************************/ -typedef struct _i810XvMCContext { - int fd; /* File descriptor for /dev/dri */ - i810XvMCDrmMap overlay; - i810XvMCDrmMap surfaces; - drmBufMapPtr dmabufs; /* Data structure to hold available dma buffers */ - drm_context_t drmcontext; - unsigned int last_render; - unsigned int last_flip; - unsigned short ref; - unsigned short current; - int lock; /* Lightweight lock to avoid locking twice */ - char busIdString[10]; /* PCI:0:1:0 or PCI:0:2:0 */ - i810OverlayRecPtr oregs; - unsigned int dual_prime; /* Flag to identify when dual prime is in use. */ - unsigned int fb_base; - Atom xv_colorkey; - Atom xv_brightness; - Atom xv_contrast; - Atom xv_saturation; - int brightness; - int saturation; - int contrast; - int colorkey; -} i810XvMCContext; - -/*************************************************************************** -// i810XvMCSurface: Private data structure for each XvMCSurface. This -// structure is referenced by the privData pointer in the XvMCSurface -// structure. -***************************************************************************/ -typedef struct _i810XvMCSurface { - unsigned int pitch; - unsigned int dbi1y; /* Destination buffer info command word 1 for Y */ - unsigned int dbi1u; /* Destination buffer info command word 1 for U */ - unsigned int dbi1v; /* Destination buffer info command word 1 for V */ - unsigned int dbv1; /* Destination buffer variables command word 1 */ - unsigned int mi1y; /* Map Info command word 1 (Minus bit 28) for Y */ - unsigned int mi1u; /* Map Info command word 1 (Minus bit 28) for U */ - unsigned int mi1v; /* Map Info command word 1 (Minus bit 28) for V */ - unsigned int mi2y; /* Map info command word 2 for y */ - unsigned int mi2u; /* Map info command word 2 for y */ - unsigned int mi2v; /* Map info command word 2 for y */ - unsigned int mi3y; /* Map info command word 3 */ - unsigned int mi3u; /* Map info command word 3 */ - unsigned int mi3v; /* Map info command word 3 */ - unsigned int last_render; - unsigned int last_flip; - unsigned int second_field; /* Flags a surface that is only half done */ - drmAddress data; - drm_handle_t offset; - unsigned int offsets[3]; - i810XvMCContext *privContext; -} i810XvMCSurface; - -/*************************************************************************** -// i810XvMCSubpicture: Private data structure for each XvMCSubpicture. This -// structure is referenced by the privData pointer in the XvMCSubpicture -// structure. -***************************************************************************/ -typedef struct _i810XvMCSubpicture { - unsigned int pitch; - unsigned int dbi1; /* Destination buffer info command word 1 */ - unsigned int dbv1; /* Destination buffer variables command word */ - unsigned int mi1; /* Map Info command word 1 (Minus bit 28) */ - unsigned int mi2; /* Map info command word 2 */ - unsigned int mi3; /* Map info command word 3 */ - unsigned int last_render; - unsigned int last_flip; - drmAddress data; - drm_handle_t offset; - unsigned int offsets[1]; - unsigned char palette[3][16]; - i810XvMCContext *privContext; -} i810XvMCSubpicture; - -typedef struct _Box { - int x1,y1,x2,y2; -} Box, *BoxPtr; - -/*************************************************************************** -// drm_i810_overlay_t: Structure returned by overlay info ioctl. -// NOTE: If you change this structure you will have to change the equiv. -// structure in the kernel. -***************************************************************************/ -typedef struct _drm_i810_overlay_t { - unsigned int offset; - unsigned int physical; -} drm_i810_overlay_t; - -/*************************************************************************** -// drm_i810_dma_t: Structure used by dma allocation ioctl. -// NOTE: If you change this structure you will have to change the equiv. -// structure in the kernel. -***************************************************************************/ -typedef struct _drm_i810_dma { - void *virtual; - int request_idx; - int request_size; - int granted; -} drm_i810_dma_t; - -/*************************************************************************** -// drm_i810_mc_t: Structure used by mc dispatch ioctl. -// NOTE: If you change this structure you will have to change the equiv. -// structure in the kernel. -***************************************************************************/ -typedef struct _drm_i810_mc { - int idx; /* buffer index */ - int used; /* nr bytes in use */ - int num_blocks; /* number of GFXBlocks */ - int *length; /* List of lengths for GFXBlocks */ - unsigned int last_render; /* Last render request */ -} drm_i810_mc_t; - -/* Subpicture fourcc */ -#define FOURCC_IA44 0x34344149 - -/* Static Parameters */ -#define I810_XVMC_MAXWIDTH 720 -#define I810_XVMC_MAXHEIGHT 576 -#define I810_DEFAULT16_COLORKEY 31 -#define I810_DMA_BUF_NR 256 - -/* COMMANDS */ -#define CMD_FLUSH ((4<<23) | 0x1) -#define BOOLEAN_ENA_1 ((3<<29) | (3<<24) | (3<<2)) -#define BOOLEAN_ENA_2 ((3<<29) | (4<<24) | (3<<16) | (1<<3) | (1<<2)) -#define DEST_BUFFER_INFO (0x15<<23) -#define DEST_BUFFER_VAR ((0x3<<29) | (0x1d<<24) | (0x85<<16)) -#define DRAWING_RECT_INFO ((3<<29) | (0x1d<<24) | (0x80<<16) | 3) -#define GFXBLOCK ((0x3<<29) | (0x1e<<24)) -#define CMD_MAP_INFO ((0x3<<29) | (0x1d<<24) | 0x2) -#define MAP_PALETTE_LOAD ((3<<29) | (0x1d<<24) | (0x82<<16) | 0xff) -#define VERTEX_FORMAT ((3<<29) | (0x5<<24)) -#define SRC_DEST_BLEND_MONO ((3<<29) | (8<<24)) - -/* Bit Patterns */ - -/* - * OV0CMD - Overlay Command Register - */ -#define VERTICAL_CHROMINANCE_FILTER 0x70000000 -#define VC_SCALING_OFF 0x00000000 -#define VC_LINE_REPLICATION 0x10000000 -#define VC_UP_INTERPOLATION 0x20000000 -#define VC_PIXEL_DROPPING 0x50000000 -#define VC_DOWN_INTERPOLATION 0x60000000 -#define VERTICAL_LUMINANCE_FILTER 0x0E000000 -#define VL_SCALING_OFF 0x00000000 -#define VL_LINE_REPLICATION 0x02000000 -#define VL_UP_INTERPOLATION 0x04000000 -#define VL_PIXEL_DROPPING 0x0A000000 -#define VL_DOWN_INTERPOLATION 0x0C000000 -#define HORIZONTAL_CHROMINANCE_FILTER 0x01C00000 -#define HC_SCALING_OFF 0x00000000 -#define HC_LINE_REPLICATION 0x00400000 -#define HC_UP_INTERPOLATION 0x00800000 -#define HC_PIXEL_DROPPING 0x01400000 -#define HC_DOWN_INTERPOLATION 0x01800000 -#define HORIZONTAL_LUMINANCE_FILTER 0x00380000 -#define HL_SCALING_OFF 0x00000000 -#define HL_LINE_REPLICATION 0x00080000 -#define HL_UP_INTERPOLATION 0x00100000 -#define HL_PIXEL_DROPPING 0x00280000 -#define HL_DOWN_INTERPOLATION 0x00300000 - -#define Y_ADJUST 0x00010000 -#define OV_BYTE_ORDER 0x0000C000 -#define UV_SWAP 0x00004000 -#define Y_SWAP 0x00008000 -#define Y_AND_UV_SWAP 0x0000C000 -#define SOURCE_FORMAT 0x00003C00 -#define RGB_555 0x00000800 -#define RGB_565 0x00000C00 -#define YUV_422 0x00002000 -#define YUV_411 0x00002400 -#define YUV_420 0x00003000 -#define YUV_410 0x00003800 -#define VERTICAL_PHASE_BOTH 0x00000020 -#define FLIP_TYPE_FIELD 0x00000020 -#define FLIP_TYPE_FRAME 0x00000000 -#define BUFFER_AND_FIELD 0x00000006 -#define BUFFER0_FIELD0 0x00000000 -#define BUFFER0_FIELD1 0x00000002 -#define BUFFER1_FIELD0 0x00000004 -#define BUFFER1_FIELD1 0x00000006 -#define OVERLAY_ENABLE 0x00000001 - -/* - * DOV0STA - Display/Overlay 0 Status Register - */ -#define DOV0STA 0x30008 -#define OV0ADD 0x30000 -#define MINUV_SCALE 0x1 - -#define RGB16ToColorKey(c) \ - (((c & 0xF800) << 8) | ((c & 0x07E0) << 5) | ((c & 0x001F) << 3)) - -/* Locking Macros lightweight lock used to prevent relocking */ -#define I810_LOCK(c,f) \ - if(!c->lock) { \ - drmGetLock(c->fd, c->drmcontext, f); \ - } \ - c->lock++; - -#define I810_UNLOCK(c) \ - c->lock--; \ - if(!c->lock) { \ - drmUnlock(c->fd, c->drmcontext); \ - } - -/* - Block until the passed in value (n) is the active - buffer on the overlay. -*/ -#define BLOCK_OVERLAY(c,n) \ - do { \ - int temp,i=0; \ - while(i < 100000) { \ - temp = GET_FSTATUS(c); \ - if(((temp & (1<<20))>>20) == n) { \ - break; \ - } \ - usleep(10); \ - } \ - if(i == 100000) { \ - printf("Overlay Lockup.\n"); \ - return BadAlloc; \ - } \ - }while(0); - -#define OVERLAY_INFO(c,i) drmCommandRead(c->fd, DRM_I810_OV0INFO, &i, sizeof(i)) -#define OVERLAY_FLIP(c) drmCommandNone(c->fd, DRM_I810_OV0FLIP) -#define GET_FSTATUS(c) drmCommandNone(c->fd, DRM_I810_FSTATUS) -#define I810_MC(c,mc) drmCommandWrite(c->fd, DRM_I810_MC, &mc, sizeof(mc)) -#define GET_RSTATUS(c) drmCommandNone(c->fd, DRM_I810_RSTATUS) -#define GET_BUFFER(c,dma) drmCommandWriteRead(c->fd, DRM_I810_GETBUF, &dma, sizeof(drmI810DMA)) -#define FLUSH(c) drmCommandNone(c->fd, DRM_I810_FLUSH) - -/* - Definitions for temporary wire protocol hooks to be replaced - when a HW independent libXvMC is created. -*/ -extern Status _xvmc_create_context(Display *dpy, XvMCContext *context, - int *priv_count, uint **priv_data); - -extern Status _xvmc_destroy_context(Display *dpy, XvMCContext *context); - -extern Status _xvmc_create_surface(Display *dpy, XvMCContext *context, - XvMCSurface *surface, int *priv_count, - uint **priv_data); - -extern Status _xvmc_destroy_surface(Display *dpy, XvMCSurface *surface); - -extern Status _xvmc_create_subpicture(Display *dpy, XvMCContext *context, - XvMCSubpicture *subpicture, - int *priv_count, uint **priv_data); - -extern Status _xvmc_destroy_subpicture(Display *dpy, - XvMCSubpicture *subpicture); - -/* - Prototypes -*/ -drmBufPtr i810_get_free_buffer(i810XvMCContext *pI810XvMC); -void i810_free_privContext(i810XvMCContext *pI810XvMC); -void dp(unsigned int *address, unsigned int i); - -#endif - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/nx-X11/lib/XvMC/hw/i810/Imakefile b/nx-X11/lib/XvMC/hw/i810/Imakefile deleted file mode 100644 index b7956d01e..000000000 --- a/nx-X11/lib/XvMC/hw/i810/Imakefile +++ /dev/null @@ -1,44 +0,0 @@ -XCOMM $XFree86: xc/lib/XvMC/hw/i810/Imakefile,v 1.2 2002/10/30 12:52:02 alanh Exp $ -#define DoNormalLib NormalLibXvMC -#define DoSharedLib SharedLibXvMC -#define DoDebugLib DebugLibXvMC -#define DoProfileLib ProfileLibXvMC -#define LibName I810XvMC -#define SoRev SOXVMCREV -#define LibHeaders NO - -#include - -#ifdef SharedXvMCReqs -REQUIREDLIBS = SharedXvMCReqs -#endif - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - - DEFINES = $(ALLOC_DEFINES) -DTRUE=1 -DFALSE=0 - INCLUDES = -I$(XINCLUDESRC) -I$(INCLUDESRC) -I$(XLIBSRC) -I$(EXTINCSRC) \ - -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(DRMSRCDIR)/shared-core \ - -I$(XF86DRIVERSRC)/i810 - SRCS = I810XvMC.c - OBJS = I810XvMC.o xf86drm.o xf86drmHash.o xf86drmRandom.o xf86drmSL.o - LINTLIBS = $(LINTXLIB) - - -#include - - -#if defined(LinuxArchitecture) - -LIBDRM_DIR = ../../../../extras/drm/libdrm - -LinkSourceFile(xf86drm.c,$(LIBDRM_DIR)) -LinkSourceFile(xf86drmHash.c,$(LIBDRM_DIR)) -LinkSourceFile(xf86drmRandom.c,$(LIBDRM_DIR)) -LinkSourceFile(xf86drmSL.c,$(LIBDRM_DIR)) - -#endif - -DependTarget() - diff --git a/nx-X11/lib/XvMC/hw/via/driDrawable.c b/nx-X11/lib/XvMC/hw/via/driDrawable.c deleted file mode 100644 index 35934d89d..000000000 --- a/nx-X11/lib/XvMC/hw/via/driDrawable.c +++ /dev/null @@ -1,176 +0,0 @@ -/***************************************************************************** - * driDrawable.c: Lean Version of DRI utilities. - * - * Copyright (c) 2005 Thomas Hellstrom. 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 - * AUTHOR(S) OR 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include "xf86drm.h" -#include "drm.h" -#include "xf86dri.h" -#include "drm_sarea.h" -#include "driDrawable.h" - - -static unsigned -drawStamp(volatile drm_sarea_t *pSarea, int index) -{ - return pSarea->drawableTable[index].stamp; -} - -int -getDRIDrawableInfoLocked(void *drawHash, Display *display, int screen, Drawable draw, - unsigned lockFlags, int drmFD, drm_context_t drmContext, - drmAddress sarea, Bool updateInfo, drawableInfo **info, - unsigned long infoSize) -{ - drawableInfo *drawInfo; - void *res; - drm_drawable_t drmDraw=0; - volatile drm_sarea_t *pSarea = (drm_sarea_t *) sarea; - drm_clip_rect_t *clipFront, *clipBack; - - int ret; - - - if (drmHashLookup(drawHash, (unsigned long) draw, &res)) { - - /* - * The drawable is unknown to us. Create it and put it in the - * hash table. - */ - - DRM_UNLOCK(drmFD, &pSarea->lock, drmContext); - if (!uniDRICreateDrawable(display, screen, draw, - &drmDraw)) { - DRM_LOCK(drmFD, &pSarea->lock, drmContext, lockFlags); - return 1; - } - DRM_LOCK(drmFD, &pSarea->lock, drmContext, lockFlags); - - - drawInfo = (drawableInfo *) malloc(infoSize); - if (!drawInfo) return 1; - - drawInfo->drmDraw = drmDraw; - drawInfo->stamp = 0; - drawInfo->clipFront = 0; - drawInfo->clipBack = 0; - - drmHashInsert( drawHash, (unsigned long) draw, drawInfo); - - } else { - drawInfo = res; - } - - - drawInfo->touched = FALSE; - while (!drawInfo->clipFront || drawInfo->stamp != drawStamp(pSarea, drawInfo->index)) { - - /* - * The drawable has been touched since we last got info about it. - * obtain new info from the X server. - */ - - drawInfo->touched = TRUE; - - if (updateInfo || !drawInfo->clipFront) { - DRM_UNLOCK(drmFD, &pSarea->lock, drmContext); - - ret = uniDRIGetDrawableInfo(display, screen, draw, - &drawInfo->index, &drawInfo->stamp, &drawInfo->x, - &drawInfo->y, &drawInfo->w, &drawInfo->h, - &drawInfo->numClipFront, &clipFront, - &drawInfo->backX, &drawInfo->backY, - &drawInfo->numClipBack, &clipBack); - - DRM_LIGHT_LOCK(drmFD, &pSarea->lock, drmContext); - - /* - * Error. Probably the drawable is destroyed. Return error and old values. - */ - - if (!ret) { - free(drawInfo); - drawInfo = NULL; - drmHashDelete(drawHash, (unsigned long) draw); - - DRM_UNLOCK(drmFD, &pSarea->lock, drmContext); - uniDRIDestroyDrawable( display, screen, draw); - DRM_LOCK(drmFD, &pSarea->lock, drmContext, lockFlags); - - return 1; - } - - if (drawInfo->stamp != drawStamp(pSarea, drawInfo->index)) { - - /* - * The info is already outdated. Sigh. Have another go. - */ - - XFree(clipFront); - XFree(clipBack); - continue; - } - - if (drawInfo->clipFront) XFree(drawInfo->clipFront); - drawInfo->clipFront = clipFront; - if (drawInfo->clipBack) XFree(drawInfo->clipBack); - drawInfo->clipBack = clipBack; - } else { - if (!drawInfo->clipFront) drawInfo->clipFront = (drm_clip_rect_t *) ~0UL; - drawInfo->stamp = drawStamp(pSarea, drawInfo->index); - } - } - *info = drawInfo; - return 0; -} - -void -driDestroyHashContents(void *drawHash) -{ - unsigned long key; - void *content; - drawableInfo *drawInfo; - - - if (drmHashFirst(drawHash, &key, &content) < 1) - return; - drawInfo = (drawableInfo *) content; - if (drawInfo->clipBack) XFree(drawInfo->clipBack); - if (drawInfo->clipFront) XFree(drawInfo->clipFront); - free(drawInfo); - while(drmHashNext(drawHash, &key, &content) == 1) { - drawInfo = (drawableInfo *) content; - if (drawInfo->clipBack) XFree(drawInfo->clipBack); - if (drawInfo->clipFront) XFree(drawInfo->clipFront); - free(drawInfo); - } - - return ; -} - - diff --git a/nx-X11/lib/XvMC/hw/via/driDrawable.h b/nx-X11/lib/XvMC/hw/via/driDrawable.h deleted file mode 100644 index e5651058b..000000000 --- a/nx-X11/lib/XvMC/hw/via/driDrawable.h +++ /dev/null @@ -1,64 +0,0 @@ -/***************************************************************************** - * driDrawable.h: Lean Version of DRI utilities. - * - * Copyright (c) 2005 Thomas Hellstrom. 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 - * AUTHOR(S) OR 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. - */ - -#ifndef _DRIDRAWABLE_H -#define _DRIDRAWABLE_H - -typedef struct _drawableInfo { - drm_drawable_t drmDraw; - unsigned stamp; - unsigned index; - drm_clip_rect_t *clipFront; - drm_clip_rect_t *clipBack; - int x; - int y; - int w; - int h; - int backX; - int backY; - int numClipFront; - int numClipBack; - Bool touched; -} drawableInfo; - -/* - * Get updated info about the drawable "draw". The drawableInfo record returned is malloced - * and administrated internally. Never free it unless you know exactly what you are doing. - * The drm hash table "drawHash" needs to be initialized externally. - */ - -extern int -getDRIDrawableInfoLocked (void *drawHash, Display *display, int screen, Drawable draw, - unsigned lockFlags, int drmFD, drm_context_t drmContext, - drmAddress sarea, Bool updateInfo, drawableInfo **info, - unsigned long infoSize); - -/* - * Free all resources created by the above function. Typically done on exit. - */ - -extern void -driDestroyHashContents(void *drawHash); - -#endif diff --git a/nx-X11/lib/XvMC/hw/via/unichrome/Imakefile b/nx-X11/lib/XvMC/hw/via/unichrome/Imakefile deleted file mode 100644 index bc9120972..000000000 --- a/nx-X11/lib/XvMC/hw/via/unichrome/Imakefile +++ /dev/null @@ -1,51 +0,0 @@ -#define DoNormalLib NormalLibXvMC -#define DoSharedLib SharedLibXvMC -#define DoDebugLib DebugLibXvMC -#define DoProfileLib ProfileLibXvMC -#define LibName viaXvMC -#define SoRev SOXVMCREV -#define LibHeaders NO - -#include - -#ifdef SharedXvMCReqs -REQUIREDLIBS = SharedXvMCReqs -lXv -#endif - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - - DEFINES = $(ALLOC_DEFINES) -DTRUE=1 -DFALSE=0 - INCLUDES = -I$(XINCLUDESRC) -I$(INCLUDESRC) -I$(XLIBSRC) -I$(EXTINCSRC) \ - -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(DRMSRCDIR)/shared-core \ - -I$(XF86OSSRC)/linux/drm/kernel -I$(XF86DRIVERSRC)/via - SRCS = viaLowLevel.c - OBJS = viaXvMC.o viaLowLevel.o xf86drm.o xf86drmHash.o \ - xf86drmRandom.o xf86drmSL.o xf86dri.o driDrawable.o - LINTLIBS = $(LINTXLIB) - - -#include - - -#if defined(LinuxArchitecture) - -LIBDRM_DIR = ../../../../../extras/drm/libdrm - -LinkSourceFile(xf86drm.c,$(LIBDRM_DIR)) -LinkSourceFile(xf86drmHash.c,$(LIBDRM_DIR)) -LinkSourceFile(xf86drmRandom.c,$(LIBDRM_DIR)) -LinkSourceFile(xf86drmSL.c,$(LIBDRM_DIR)) -LinkSourceFile(viaLowLevel.h,..) -LinkSourceFile(driDrawable.h,..) -LinkSourceFile(viaXvMCPriv.h,..) -LinkSourceFile(xf86dri.h,..) -LinkSourceFile(xf86dristr.h,..) -LinkSourceFile(xf86dri.c,..) -LinkSourceFile(driDrawable.c,..) -LinkSourceFile(viaXvMC.c,..) -#endif - -DependTarget() - diff --git a/nx-X11/lib/XvMC/hw/via/unichrome/viaLowLevel.c b/nx-X11/lib/XvMC/hw/via/unichrome/viaLowLevel.c deleted file mode 100644 index 1add1ca5d..000000000 --- a/nx-X11/lib/XvMC/hw/via/unichrome/viaLowLevel.c +++ /dev/null @@ -1,1056 +0,0 @@ -/***************************************************************************** - * VIA Unichrome XvMC extension client lib. - * - * Copyright (c) 2004 Thomas Hellström. All rights reserved. - * Copyright (c) 2003 Andreas Robinson. 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 - * AUTHOR(S) OR 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. - */ - - -/* - * Low-level functions that deal directly with the hardware. In the future, - * these functions might be implemented in a kernel module. Also, some of them - * would benefit from DMA. - * - * Authors: Andreas Robinson 2003. Thomas Hellström 2004. - */ - - - -#include "viaXvMCPriv.h" -#include "viaLowLevel.h" -#include -#include -#include - -typedef struct{ - CARD32 agp_buffer[LL_AGP_CMDBUF_SIZE]; - CARD32 pci_buffer[LL_PCI_CMDBUF_SIZE]; - unsigned agp_pos; - unsigned pci_pos; - unsigned flip_pos; - int use_agp; - int agp_mode; - int agp_header_start; - int agp_index; - int fd; - drm_context_t *drmcontext; - drmLockPtr hwLock; - drmAddress mmioAddress; - drmAddress fbAddress; - unsigned fbStride; - unsigned fbDepth; - unsigned width; - unsigned height; - unsigned curWaitFlags; - int performLocking; - unsigned errors; - drm_via_mem_t tsMem; - CARD32 tsOffset; - volatile CARD32 *tsP; - CARD32 curTimeStamp; - CARD32 lastReadTimeStamp; - int agpSync; - CARD32 agpSyncTimeStamp; - unsigned chipId; -}XvMCLowLevel; - - - - - -/* - * For Other architectures than i386 these might have to be modified for - * bigendian etc. - */ - -#define MPEGIN(xl,reg) \ - *((volatile CARD32 *)(((CARD8 *)(xl)->mmioAddress) + 0xc00 + (reg))) - -#define VIDIN(ctx,reg) \ - *((volatile CARD32 *)(((CARD8 *)(ctx)->mmioAddress) + 0x200 + (reg))) - -#define REGIN(ctx,reg) \ - *((volatile CARD32 *)(((CARD8 *)(ctx)->mmioAddress) + 0x0000 + (reg))) - -#define HQV_CONTROL 0x1D0 -#define HQV_SRC_STARTADDR_Y 0x1D4 -#define HQV_SRC_STARTADDR_U 0x1D8 -#define HQV_SRC_STARTADDR_V 0x1DC -#define HQV_MINIFY_DEBLOCK 0x1E8 - -#define HQV_SW_FLIP 0x00000010 -#define HQV_FLIP_STATUS 0x00000001 -#define HQV_SUBPIC_FLIP 0x00008000 -#define HQV_FLIP_ODD 0x00000020 -#define HQV_DEINTERLACE 0x00010000 -#define HQV_FIELD_2_FRAME 0x00020000 -#define HQV_FRAME_2_FIELD 0x00040000 -#define HQV_FIELD_UV 0x00100000 -#define HQV_DEBLOCK_HOR 0x00008000 -#define HQV_DEBLOCK_VER 0x80000000 - -#define V_COMPOSE_MODE 0x98 -#define V1_COMMAND_FIRE 0x80000000 -#define V3_COMMAND_FIRE 0x40000000 - -/* SUBPICTURE Registers */ -#define SUBP_CONTROL_STRIDE 0x1C0 -#define SUBP_STARTADDR 0x1C4 -#define RAM_TABLE_CONTROL 0x1C8 -#define RAM_TABLE_READ 0x1CC - -/* SUBP_CONTROL_STRIDE 0x3c0 */ -#define SUBP_HQV_ENABLE 0x00010000 -#define SUBP_IA44 0x00020000 -#define SUBP_AI44 0x00000000 -#define SUBP_STRIDE_MASK 0x00001fff -#define SUBP_CONTROL_MASK 0x00070000 - -/* RAM_TABLE_CONTROL 0x3c8 */ -#define RAM_TABLE_RGB_ENABLE 0x00000007 - - -#define VIA_REG_STATUS 0x400 -#define VIA_REG_GEMODE 0x004 -#define VIA_REG_SRCBASE 0x030 -#define VIA_REG_DSTBASE 0x034 -#define VIA_REG_PITCH 0x038 -#define VIA_REG_SRCCOLORKEY 0x01C -#define VIA_REG_KEYCONTROL 0x02C -#define VIA_REG_SRCPOS 0x008 -#define VIA_REG_DSTPOS 0x00C -#define VIA_REG_GECMD 0x000 -#define VIA_REG_DIMENSION 0x010 /* width and height */ -#define VIA_REG_FGCOLOR 0x018 - - -#define VIA_VR_QUEUE_BUSY 0x00020000 /* Virtual Queue is busy */ -#define VIA_CMD_RGTR_BUSY 0x00000080 /* Command Regulator is busy */ -#define VIA_2D_ENG_BUSY 0x00000001 /* 2D Engine is busy */ -#define VIA_3D_ENG_BUSY 0x00000002 /* 3D Engine is busy */ -#define VIA_GEM_8bpp 0x00000000 -#define VIA_GEM_16bpp 0x00000100 -#define VIA_GEM_32bpp 0x00000300 -#define VIA_GEC_BLT 0x00000001 -#define VIA_PITCH_ENABLE 0x80000000 -#define VIA_GEC_INCX 0x00000000 -#define VIA_GEC_DECY 0x00004000 -#define VIA_GEC_INCY 0x00000000 -#define VIA_GEC_DECX 0x00008000 -#define VIA_GEC_FIXCOLOR_PAT 0x00002000 - - -#define VIA_BLIT_CLEAR 0x00 -#define VIA_BLIT_COPY 0xCC -#define VIA_BLIT_FILL 0xF0 -#define VIA_BLIT_SET 0xFF - -#define VIA_SYNCWAITTIMEOUT 50000 /* Might be a bit conservative */ -#define VIA_DMAWAITTIMEOUT 150000 -#define VIA_VIDWAITTIMEOUT 50000 -#define VIA_XVMC_DECODERTIMEOUT 50000 /*(microseconds)*/ - -#define H1_ADDR(val) (((val) >> 2) | 0xF0000000) -#define WAITFLAGS(xl, flags) \ - (xl)->curWaitFlags |= (flags) -#define BEGIN_RING_AGP(xl,size) \ - do { \ - if ((xl)->agp_pos > (LL_AGP_CMDBUF_SIZE-(size))) { \ - agpFlush(xl); \ - } \ - } while(0) -#define OUT_RING_AGP(xl, val) \ - (xl)->agp_buffer[(xl)->agp_pos++] = (val) -#define OUT_RING_QW_AGP(xl, val1, val2) \ - do { \ - (xl)->agp_buffer[(xl)->agp_pos++] = (val1); \ - (xl)->agp_buffer[(xl)->agp_pos++] = (val2); \ - } while (0) - - -#define LL_HW_LOCK(xl) \ - do { \ - DRM_LOCK((xl)->fd,(xl)->hwLock,*(xl)->drmcontext,0); \ - } while(0); -#define LL_HW_UNLOCK(xl) \ - do { \ - DRM_UNLOCK((xl)->fd,(xl)->hwLock,*(xl)->drmcontext); \ - } while(0); - - -/* - * We want to have two concurrent types of thread taking the hardware - * lock simulataneously. One is the video out thread that needs immediate - * access to flip an image. The other is everything else which may have - * the lock for quite some time. This is only so the video out thread can - * sneak in and display an image while other resources are busy. - */ - - -void -hwlLock(void *xlp, int videoLock) -{ - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - LL_HW_LOCK(xl); -} - -void -hwlUnlock(void *xlp, int videoLock) -{ - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - LL_HW_UNLOCK(xl); -} - -static unsigned -timeDiff(struct timeval *now,struct timeval *then) { - return (now->tv_usec >= then->tv_usec) ? - now->tv_usec - then->tv_usec : - 1000000 - (then->tv_usec - now->tv_usec); -} - -void -setAGPSyncLowLevel(void *xlp, int val, CARD32 timeStamp) -{ - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - xl->agpSync = val; - xl->agpSyncTimeStamp = timeStamp; -} - -CARD32 -viaDMATimeStampLowLevel(void *xlp) -{ - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - if (xl->use_agp) { - viaBlit(xl, 32, xl->tsOffset, 1, xl->tsOffset, 1, 1, 1, 0, 0, - VIABLIT_FILL, xl->curTimeStamp); - return xl->curTimeStamp++; - } - return 0; -} - -static void -viaDMAWaitTimeStamp(XvMCLowLevel *xl, CARD32 timeStamp, int doSleep) -{ - struct timeval now, then; - struct timezone here; - struct timespec sleep, rem; - - if (xl->use_agp && (timeStamp > xl->lastReadTimeStamp)) { - sleep.tv_nsec = 1; - sleep.tv_sec = 0; - here.tz_minuteswest = 0; - here.tz_dsttime = 0; - gettimeofday(&then,&here); - - while(timeStamp > (xl->lastReadTimeStamp = *xl->tsP)) { - gettimeofday(&now,&here); - if (timeDiff(&now,&then) > VIA_DMAWAITTIMEOUT) { - if((timeStamp > (xl->lastReadTimeStamp = *xl->tsP))) { - xl->errors |= LL_DMA_TIMEDOUT; - break; - } - } - if (doSleep) nanosleep(&sleep, &rem); - } - } -} - -static int -viaDMAInitTimeStamp(XvMCLowLevel *xl) -{ - int ret = 0; - - if (xl->use_agp) { - xl->tsMem.context = *(xl->drmcontext); - xl->tsMem.size = 64; - xl->tsMem.type = VIA_MEM_VIDEO; - if (drmCommandWriteRead(xl->fd, DRM_VIA_ALLOCMEM, &xl->tsMem, sizeof(xl->tsMem)) < 0) - return ret; - if (xl->tsMem.size != 64) - return -1; - xl->tsOffset = (xl->tsMem.offset + 31) & ~31; - xl->tsP = (CARD32 *)xl->fbAddress + (xl->tsOffset >> 2); - xl->curTimeStamp = 1; - *xl->tsP = 0; - } - return 0; -} - -static int -viaDMACleanupTimeStamp(XvMCLowLevel *xl) -{ - - if (!(xl->tsMem.size) || !xl->use_agp) return 0; - return drmCommandWrite(xl->fd, DRM_VIA_FREEMEM, &xl->tsMem, sizeof(xl->tsMem)); -} - - -static CARD32 -viaMpegGetStatus(XvMCLowLevel *xl) -{ - return MPEGIN(xl,0x54); -} - -static int -viaMpegIsBusy(XvMCLowLevel *xl, CARD32 mask, CARD32 idle) -{ - CARD32 tmp = viaMpegGetStatus(xl); - - /* - * Error detected. - * FIXME: Are errors really shown when error concealment is on? - */ - - if (tmp & 0x70) return 0; - - return (tmp & mask) != idle; -} - - -static void -syncDMA(XvMCLowLevel *xl, unsigned int doSleep) -{ - - /* - * Ideally, we'd like to have an interrupt wait here, but, according to second hand - * information, the hardware does not support this, although earlier S3 chips do that. - * It is therefore not implemented into the DRM, and we'll do a user space wait here. - */ - - struct timeval now, then; - struct timezone here; - struct timespec sleep, rem; - - sleep.tv_nsec = 1; - sleep.tv_sec = 0; - here.tz_minuteswest = 0; - here.tz_dsttime = 0; - gettimeofday(&then,&here); - while( !(REGIN(xl, VIA_REG_STATUS) & VIA_VR_QUEUE_BUSY)) { - gettimeofday(&now,&here); - if (timeDiff(&now,&then) > VIA_DMAWAITTIMEOUT) { - if( !(REGIN(xl, VIA_REG_STATUS) & VIA_VR_QUEUE_BUSY)) { - xl->errors |= LL_DMA_TIMEDOUT; - break; - } - } - if (doSleep) nanosleep(&sleep, &rem); - } - while( REGIN(xl, VIA_REG_STATUS) & VIA_CMD_RGTR_BUSY ) { - gettimeofday(&now,&here); - if (timeDiff(&now,&then) > VIA_DMAWAITTIMEOUT) { - if( REGIN(xl, VIA_REG_STATUS) & VIA_CMD_RGTR_BUSY ) { - xl->errors |= LL_DMA_TIMEDOUT; - break; - } - } - if (doSleep) nanosleep(&sleep, &rem); - } -} - -static void -syncVideo(XvMCLowLevel *xl, unsigned int doSleep) -{ - /* - * Wait for HQV completion. Nothing strange here. We assume that the HQV - * Handles syncing to the V1 / V3 engines by itself. It should be safe to - * always wait for SUBPIC_FLIP completion although subpictures are not always - * used. - */ - - struct timeval now, then; - struct timezone here; - struct timespec sleep, rem; - - sleep.tv_nsec = 1; - sleep.tv_sec = 0; - here.tz_minuteswest = 0; - here.tz_dsttime = 0; - gettimeofday(&then,&here); - while(VIDIN(xl, HQV_CONTROL) & (HQV_SW_FLIP | HQV_SUBPIC_FLIP)) { - gettimeofday(&now,&here); - if (timeDiff(&now,&then) > VIA_SYNCWAITTIMEOUT) { - if(VIDIN(xl, HQV_CONTROL) & (HQV_SW_FLIP | HQV_SUBPIC_FLIP)) { - xl->errors |= LL_VIDEO_TIMEDOUT; - break; - } - } - if (doSleep) nanosleep(&sleep, &rem); - } -} - -static void -syncAccel(XvMCLowLevel *xl, unsigned int mode, unsigned int doSleep) -{ - struct timeval now, then; - struct timezone here; - struct timespec sleep, rem; - CARD32 mask = ((mode & LL_MODE_2D) ? VIA_2D_ENG_BUSY : 0) | - ((mode & LL_MODE_3D) ? VIA_3D_ENG_BUSY : 0); - - sleep.tv_nsec = 1; - sleep.tv_sec = 0; - here.tz_minuteswest = 0; - here.tz_dsttime = 0; - gettimeofday(&then,&here); - while( REGIN(xl, VIA_REG_STATUS) & mask) { - gettimeofday(&now,&here); - if (timeDiff(&now,&then) > VIA_SYNCWAITTIMEOUT) { - if( REGIN(xl, VIA_REG_STATUS) & mask) { - xl->errors |= LL_ACCEL_TIMEDOUT; - break; - } - } - if (doSleep) nanosleep(&sleep, &rem); - } -} - - -static void -syncMpeg(XvMCLowLevel *xl, unsigned int mode, unsigned int doSleep) -{ - /* - * Ideally, we'd like to have an interrupt wait here, but from information from VIA - * at least the MPEG completion interrupt is broken on the CLE266, which was - * discovered during validation of the chip. - */ - - struct timeval now, then; - struct timezone here; - struct timespec sleep, rem; - CARD32 busyMask = 0; - CARD32 idleVal = 0; - CARD32 ret; - - sleep.tv_nsec = 1; - sleep.tv_sec = 0; - here.tz_minuteswest = 0; - here.tz_dsttime = 0; - gettimeofday(&then,&here); - if (mode & LL_MODE_DECODER_SLICE) { - busyMask = VIA_SLICEBUSYMASK; - idleVal = VIA_SLICEIDLEVAL; - } - if (mode & LL_MODE_DECODER_IDLE) { - busyMask |= VIA_BUSYMASK; - idleVal = VIA_IDLEVAL; - } - while(viaMpegIsBusy(xl, busyMask, idleVal)) { - gettimeofday(&now,&here); - if (timeDiff(&now,&then) > VIA_XVMC_DECODERTIMEOUT) { - if (viaMpegIsBusy(xl, busyMask, idleVal)) { - xl->errors |= LL_DECODER_TIMEDOUT; - } - break; - } - if (doSleep) nanosleep(&sleep, &rem); - } - - ret = viaMpegGetStatus(xl); - if (ret & 0x70) { - xl->errors |= ((ret & 0x70) >> 3); - } - return; -} - -static void -pciFlush(XvMCLowLevel *xl) -{ - int ret; - drm_via_cmdbuffer_t b; - unsigned mode=xl->curWaitFlags; - - b.buf = (char *)xl->pci_buffer; - b.size = xl->pci_pos * sizeof(CARD32); - if (xl->performLocking) hwlLock(xl,0); - if ((mode != LL_MODE_VIDEO) && (mode != 0)) - syncDMA(xl, 0); - if ((mode & LL_MODE_2D) || (mode & LL_MODE_3D)) - syncAccel(xl, mode, 0); - if (mode & LL_MODE_VIDEO) - syncVideo(xl, 0); - if (mode & (LL_MODE_DECODER_SLICE | LL_MODE_DECODER_IDLE)) - syncMpeg(xl, mode, 0); - ret = drmCommandWrite(xl->fd, DRM_VIA_PCICMD, &b, sizeof(b)); - if (xl->performLocking) hwlUnlock(xl,0); - if (ret) { - xl->errors |= LL_PCI_COMMAND_ERR; - } - xl->pci_pos = 0; - xl->curWaitFlags = 0; -} - -static void -agpFlush(XvMCLowLevel *xl) -{ - drm_via_cmdbuffer_t b; - int ret; - - if (xl->use_agp) { - b.buf = (char *)xl->agp_buffer; - b.size = xl->agp_pos * sizeof(CARD32); - if (xl->agpSync) { - syncXvMCLowLevel(xl, LL_MODE_DECODER_IDLE, 1, xl->agpSyncTimeStamp); - xl->agpSync = 0; - } - if (xl->performLocking) hwlLock(xl,0); - do { - ret = drmCommandWrite(xl->fd, DRM_VIA_CMDBUFFER, &b, sizeof(b)); - } while (-EAGAIN == ret); - if (xl->performLocking) hwlUnlock(xl,0); - - if (ret) { - xl->errors |= LL_AGP_COMMAND_ERR; - } else { - xl->agp_pos = 0; - } - xl->curWaitFlags &= LL_MODE_VIDEO; - } else { - unsigned mode=xl->curWaitFlags; - - b.buf = (char *)xl->agp_buffer; - b.size = xl->agp_pos * sizeof(CARD32); - if (xl->performLocking) hwlLock(xl,0); - if ((mode != LL_MODE_VIDEO) && (mode != 0)) - syncDMA(xl, 0); - if ((mode & LL_MODE_2D) || (mode & LL_MODE_3D)) - syncAccel(xl, mode, 0); - if (mode & LL_MODE_VIDEO) - syncVideo(xl, 0); - if (mode & (LL_MODE_DECODER_SLICE | LL_MODE_DECODER_IDLE)) - syncMpeg(xl, mode, 0); - ret = drmCommandWrite(xl->fd, DRM_VIA_PCICMD, &b, sizeof(b)); - if (xl->performLocking) hwlUnlock(xl,0); - if (ret) { - xl->errors |= LL_PCI_COMMAND_ERR; - } - xl->agp_pos = 0; - xl->curWaitFlags = 0; - } -} - -unsigned -flushXvMCLowLevel(void *xlp) -{ - unsigned - errors; - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - if(xl->pci_pos) pciFlush(xl); - if(xl->agp_pos) agpFlush(xl); - errors = xl->errors; - xl->errors = 0; - return errors; -} - -void -flushPCIXvMCLowLevel(void *xlp) -{ - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - if(xl->pci_pos) pciFlush(xl); - if (!xl->use_agp && xl->agp_pos) agpFlush(xl); -} - - -__inline static void pciCommand(XvMCLowLevel *xl, unsigned offset, unsigned value, unsigned flags) -{ - if (xl->pci_pos > (LL_PCI_CMDBUF_SIZE-2)) pciFlush(xl); - if (flags) xl->curWaitFlags |= flags; - xl->pci_buffer[xl->pci_pos++] = (offset >> 2) | 0xF0000000; - xl->pci_buffer[xl->pci_pos++] = value; -} - -void -viaMpegSetSurfaceStride(void *xlp, ViaXvMCContext *ctx) -{ - CARD32 y_stride = ctx->yStride; - CARD32 uv_stride = y_stride >> 1; - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - - BEGIN_RING_AGP(xl, 2); - OUT_RING_QW_AGP(xl, H1_ADDR(0xc50), (y_stride >> 3) | ((uv_stride >> 3) << 16)); - WAITFLAGS(xl, LL_MODE_DECODER_IDLE); -} - - -void -viaVideoSetSWFLipLocked(void *xlp, unsigned yOffs, unsigned uOffs, - unsigned vOffs, unsigned yStride, unsigned uvStride) -{ - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - pciCommand(xl,HQV_SRC_STARTADDR_Y | 0x200,yOffs,LL_MODE_VIDEO); - pciCommand(xl,HQV_SRC_STARTADDR_U | 0x200,uOffs,0); - pciCommand(xl,HQV_SRC_STARTADDR_V | 0x200,vOffs,0); -} - -void -viaVideoSWFlipLocked(void *xlp, unsigned flags, - int progressiveSequence) -{ - CARD32 andWd,orWd; - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - andWd = 0; - orWd = 0; - - if ((flags & XVMC_FRAME_PICTURE) == XVMC_BOTTOM_FIELD) { - andWd = 0xFFFFFFFFU; - orWd = HQV_FIELD_UV | - HQV_DEINTERLACE | - HQV_FIELD_2_FRAME | - HQV_FRAME_2_FIELD | - HQV_SW_FLIP | - HQV_FLIP_ODD | - HQV_FLIP_STATUS | - HQV_SUBPIC_FLIP; - } else if ((flags & XVMC_FRAME_PICTURE) == XVMC_TOP_FIELD) { - andWd = ~HQV_FLIP_ODD; - orWd = HQV_FIELD_UV | - HQV_DEINTERLACE | - HQV_FIELD_2_FRAME | - HQV_FRAME_2_FIELD | - HQV_SW_FLIP | - HQV_FLIP_STATUS | - HQV_SUBPIC_FLIP; - } else if ((flags & XVMC_FRAME_PICTURE) == XVMC_FRAME_PICTURE) { - andWd = ~(HQV_DEINTERLACE | - HQV_FRAME_2_FIELD | - HQV_FIELD_2_FRAME | - HQV_FIELD_UV); - orWd = HQV_SW_FLIP | - HQV_FLIP_STATUS | - HQV_SUBPIC_FLIP; - } - if (progressiveSequence) { - andWd &= ~HQV_FIELD_UV; - orWd &= ~HQV_FIELD_UV; - } - - pciCommand(xl,HQV_CONTROL | 0x200,(VIDIN(xl,HQV_CONTROL) & andWd) | orWd, 0); -} - -void -viaMpegSetFB(void *xlp,unsigned i, - unsigned yOffs, - unsigned uOffs, - unsigned vOffs) -{ - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - i *= 12; - BEGIN_RING_AGP(xl, 6); - OUT_RING_QW_AGP(xl, H1_ADDR(0xc20 + i), yOffs >> 3); - OUT_RING_QW_AGP(xl, H1_ADDR(0xc24 + i), uOffs >> 3); - OUT_RING_QW_AGP(xl, H1_ADDR(0xc28 + i), vOffs >> 3); - WAITFLAGS(xl, LL_MODE_DECODER_IDLE); -} - -void -viaMpegBeginPicture(void *xlp,ViaXvMCContext *ctx, - unsigned width, - unsigned height, - const XvMCMpegControl *control) { - - unsigned j, mb_width, mb_height; - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - mb_width = (width + 15) >> 4; - - mb_height = - ((control->mpeg_coding == XVMC_MPEG_2) && - (control->flags & XVMC_PROGRESSIVE_SEQUENCE)) ? - 2*((height+31) >> 5) : (((height+15) >> 4)); - - BEGIN_RING_AGP(xl, 144); - WAITFLAGS(xl, LL_MODE_DECODER_IDLE); - - OUT_RING_QW_AGP(xl, H1_ADDR(0xc00), - ((control->picture_structure & XVMC_FRAME_PICTURE) << 2) | - ((control->picture_coding_type & 3) << 4) | - ((control->flags & XVMC_ALTERNATE_SCAN) ? (1 << 6) : 0)); - - if (!(ctx->intraLoaded)) { - OUT_RING_QW_AGP(xl, H1_ADDR(0xc5c), 0); - for (j = 0; j < 64; j += 4) { - OUT_RING_QW_AGP(xl, H1_ADDR(0xc60), - ctx->intra_quantiser_matrix[j] | - (ctx->intra_quantiser_matrix[j+1] << 8) | - (ctx->intra_quantiser_matrix[j+2] << 16) | - (ctx->intra_quantiser_matrix[j+3] << 24)); - } - ctx->intraLoaded = 1; - } - - if (!(ctx->nonIntraLoaded)) { - OUT_RING_QW_AGP(xl, H1_ADDR(0xc5c), 1); - for (j = 0; j < 64; j += 4) { - OUT_RING_QW_AGP(xl, H1_ADDR(0xc60), - ctx->non_intra_quantiser_matrix[j] | - (ctx->non_intra_quantiser_matrix[j+1] << 8) | - (ctx->non_intra_quantiser_matrix[j+2] << 16) | - (ctx->non_intra_quantiser_matrix[j+3] << 24)); - } - ctx->nonIntraLoaded = 1; - } - - if (!(ctx->chromaIntraLoaded)) { - OUT_RING_QW_AGP(xl, H1_ADDR(0xc5c), 2); - for (j = 0; j < 64; j += 4) { - OUT_RING_QW_AGP(xl, H1_ADDR(0xc60), - ctx->chroma_intra_quantiser_matrix[j] | - (ctx->chroma_intra_quantiser_matrix[j+1] << 8) | - (ctx->chroma_intra_quantiser_matrix[j+2] << 16) | - (ctx->chroma_intra_quantiser_matrix[j+3] << 24)); - } - ctx->chromaIntraLoaded = 1; - } - - if (!(ctx->chromaNonIntraLoaded)) { - OUT_RING_QW_AGP(xl, H1_ADDR(0xc5c), 3); - for (j = 0; j < 64; j += 4) { - OUT_RING_QW_AGP(xl, H1_ADDR(0xc60), - ctx->chroma_non_intra_quantiser_matrix[j] | - (ctx->chroma_non_intra_quantiser_matrix[j+1] << 8) | - (ctx->chroma_non_intra_quantiser_matrix[j+2] << 16) | - (ctx->chroma_non_intra_quantiser_matrix[j+3] << 24)); - } - ctx->chromaNonIntraLoaded = 1; - } - - OUT_RING_QW_AGP(xl, H1_ADDR(0xc90), - ((mb_width * mb_height) & 0x3fff) | - ((control->flags & XVMC_PRED_DCT_FRAME) ? ( 1 << 14) : 0) | - ((control->flags & XVMC_TOP_FIELD_FIRST) ? (1 << 15) : 0 ) | - ((control->mpeg_coding == XVMC_MPEG_2) ? (1 << 16) : 0) | - ((mb_width & 0xff) << 18)); - - OUT_RING_QW_AGP(xl, H1_ADDR(0xc94), - ((control->flags & XVMC_CONCEALMENT_MOTION_VECTORS) ? 1 : 0) | - ((control->flags & XVMC_Q_SCALE_TYPE) ? 2 : 0) | - ((control->intra_dc_precision & 3) << 2) | - (((1 + 0x100000 / mb_width) & 0xfffff) << 4) | - ((control->flags & XVMC_INTRA_VLC_FORMAT) ? (1 << 24) : 0)); - - OUT_RING_QW_AGP(xl, H1_ADDR(0xc98), - (((control->FHMV_range) & 0xf) << 0) | - (((control->FVMV_range) & 0xf) << 4) | - (((control->BHMV_range) & 0xf) << 8) | - (((control->BVMV_range) & 0xf) << 12) | - ((control->flags & XVMC_SECOND_FIELD) ? (1 << 20) : 0) | - (0x0a6 << 16)); - -} - - - -void -viaMpegReset(void *xlp) -{ - int i,j; - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - BEGIN_RING_AGP(xl, 100); - WAITFLAGS(xl, LL_MODE_DECODER_IDLE); - - for (i = 0; i < 14; i++) - OUT_RING_QW_AGP(xl, H1_ADDR(0xc08) ,0); - - OUT_RING_QW_AGP(xl, H1_ADDR(0xc98), 0x400000); - - for (i = 0; i < 6; i++) { - OUT_RING_QW_AGP(xl, H1_ADDR(0xc0c), 0x43 | 0x20); - for (j = 0xc10; j < 0xc20; j += 4) - OUT_RING_QW_AGP(xl, H1_ADDR(j), 0); - } - - - OUT_RING_QW_AGP(xl,H1_ADDR(0xc0c), 0xc3 | 0x20); - for (j = 0xc10; j < 0xc20; j += 4) - OUT_RING_QW_AGP(xl,H1_ADDR(j),0); - -} - -void -viaMpegWriteSlice(void *xlp, CARD8* slice, int nBytes, CARD32 sCode) -{ - int i, n, r; - CARD32* buf; - int count; - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - - if (xl->errors & (LL_DECODER_TIMEDOUT | - LL_IDCT_FIFO_ERROR | - LL_SLICE_FIFO_ERROR | - LL_SLICE_FAULT)) return; - - n = nBytes >> 2; - if (sCode) nBytes += 4; - r = nBytes & 3; - buf = (CARD32*) slice; - - if (r) nBytes += 4 - r; - - nBytes += 8; - - BEGIN_RING_AGP(xl, 4); - WAITFLAGS(xl, LL_MODE_DECODER_IDLE); - - OUT_RING_QW_AGP(xl, H1_ADDR(0xc9c), nBytes); - - if (sCode) OUT_RING_QW_AGP(xl, H1_ADDR(0xca0), sCode); - - i = 0; - count = 0; - - do { - count += (LL_AGP_CMDBUF_SIZE -20) >> 1; - count = (count > n) ? n : count; - BEGIN_RING_AGP(xl, (count - i) << 1); - - for (; i < count; i++) { - OUT_RING_QW_AGP(xl, H1_ADDR(0xca0), *buf++); - } - } while (i < n); - - BEGIN_RING_AGP(xl, 6); - - if (r) { - OUT_RING_QW_AGP(xl, H1_ADDR(0xca0), *buf & ((1 << (r << 3)) - 1)); - } - OUT_RING_QW_AGP(xl, H1_ADDR(0xca0), 0); - OUT_RING_QW_AGP(xl, H1_ADDR(0xca0), 0); - -} - -void -viaVideoSubPictureOffLocked(void *xlp) { - - CARD32 stride; - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - - stride = VIDIN(xl,SUBP_CONTROL_STRIDE); - - pciCommand(xl, SUBP_CONTROL_STRIDE | 0x200, stride & ~SUBP_HQV_ENABLE,LL_MODE_VIDEO); -} - -void -viaVideoSubPictureLocked(void *xlp,ViaXvMCSubPicture *pViaSubPic) { - - unsigned i; - CARD32 cWord; - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - - for (i=0; ipalette[i],LL_MODE_VIDEO); - } - - pciCommand(xl, SUBP_STARTADDR | 0x200, pViaSubPic->offset, 0); - cWord = (pViaSubPic->stride & SUBP_STRIDE_MASK) | SUBP_HQV_ENABLE; - cWord |= (pViaSubPic->ia44) ? SUBP_IA44 : SUBP_AI44; - pciCommand(xl, SUBP_CONTROL_STRIDE | 0x200, cWord, 0); -} - -void -viaBlit(void *xlp,unsigned bpp,unsigned srcBase, - unsigned srcPitch,unsigned dstBase,unsigned dstPitch, - unsigned w,unsigned h,int xdir,int ydir, unsigned blitMode, - unsigned color) -{ - - CARD32 dwGEMode = 0, srcY=0, srcX, dstY=0, dstX; - CARD32 cmd; - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - - if (!w || !h) - return; - - switch (bpp) { - case 16: - dwGEMode |= VIA_GEM_16bpp; - break; - case 32: - dwGEMode |= VIA_GEM_32bpp; - break; - default: - dwGEMode |= VIA_GEM_8bpp; - break; - } - - srcX = srcBase & 31; - dstX = dstBase & 31; - switch (bpp) { - case 16: - dwGEMode |= VIA_GEM_16bpp; - srcX >>= 2; - dstX >>= 2; - break; - case 32: - dwGEMode |= VIA_GEM_32bpp; - srcX >>= 4; - dstX >>= 4; - break; - default: - dwGEMode |= VIA_GEM_8bpp; - break; - } - - BEGIN_RING_AGP(xl, 20); - WAITFLAGS(xl, LL_MODE_2D); - - - OUT_RING_QW_AGP(xl, H1_ADDR(VIA_REG_GEMODE), dwGEMode); - cmd = 0; - - if (xdir < 0) { - cmd |= VIA_GEC_DECX; - srcX += (w - 1); - dstX += (w - 1); - } - if (ydir < 0) { - cmd |= VIA_GEC_DECY; - srcY += (h - 1); - dstY += (h - 1); - } - - switch(blitMode) { - case VIABLIT_TRANSCOPY: - OUT_RING_QW_AGP(xl, H1_ADDR(VIA_REG_SRCCOLORKEY), color); - OUT_RING_QW_AGP(xl, H1_ADDR(VIA_REG_KEYCONTROL), 0x4000); - cmd |= VIA_GEC_BLT | (VIA_BLIT_COPY << 24); - break; - case VIABLIT_FILL: - OUT_RING_QW_AGP(xl, H1_ADDR(VIA_REG_FGCOLOR), color); - cmd |= VIA_GEC_BLT | VIA_GEC_FIXCOLOR_PAT | (VIA_BLIT_FILL << 24); - break; - default: - OUT_RING_QW_AGP(xl, H1_ADDR(VIA_REG_KEYCONTROL), 0x0); - cmd |= VIA_GEC_BLT | (VIA_BLIT_COPY << 24); - } - - OUT_RING_QW_AGP(xl, H1_ADDR(VIA_REG_SRCBASE), (srcBase & ~31) >> 3); - OUT_RING_QW_AGP(xl, H1_ADDR(VIA_REG_DSTBASE), (dstBase & ~31) >> 3); - OUT_RING_QW_AGP(xl, H1_ADDR(VIA_REG_PITCH), VIA_PITCH_ENABLE | - (srcPitch >> 3) | (((dstPitch) >> 3) << 16)); - OUT_RING_QW_AGP(xl, H1_ADDR(VIA_REG_SRCPOS), ((srcY << 16) | srcX)); - OUT_RING_QW_AGP(xl, H1_ADDR(VIA_REG_DSTPOS), ((dstY << 16) | dstX)); - OUT_RING_QW_AGP(xl, H1_ADDR(VIA_REG_DIMENSION), (((h - 1) << 16) | (w - 1))); - OUT_RING_QW_AGP(xl, H1_ADDR(VIA_REG_GECMD), cmd); -} - -unsigned -syncXvMCLowLevel(void *xlp, unsigned int mode, unsigned int doSleep, - CARD32 timeStamp) -{ - unsigned - errors; - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - if (mode == 0) { - errors = xl->errors; - xl->errors = 0; - return errors; - } - - if ((mode & (LL_MODE_VIDEO | LL_MODE_3D)) || !xl->use_agp) { - if (xl->performLocking) - hwlLock(xl,0); - if ((mode != LL_MODE_VIDEO)) - syncDMA(xl, doSleep); - if (mode & LL_MODE_3D) - syncAccel(xl, mode, doSleep); - if (mode & LL_MODE_VIDEO) - syncVideo(xl, doSleep); - if (xl->performLocking) - hwlUnlock(xl,0); - } else { - viaDMAWaitTimeStamp(xl, timeStamp, doSleep); - } - - if (mode & (LL_MODE_DECODER_SLICE | LL_MODE_DECODER_IDLE)) - syncMpeg(xl, mode, doSleep); - - errors = xl->errors; - xl->errors = 0; - - return errors; -} - - -extern void -*initXvMCLowLevel(int fd, drm_context_t *ctx, - drmLockPtr hwLock, drmAddress mmioAddress, - drmAddress fbAddress, unsigned fbStride, unsigned fbDepth, - unsigned width, unsigned height, int useAgp, unsigned chipId ) - -{ - int ret; - - XvMCLowLevel *xl = (XvMCLowLevel *)malloc(sizeof(XvMCLowLevel)); - if (!xl) return NULL; - - xl->agp_pos = 0; - xl->pci_pos = 0; - xl->use_agp = useAgp; - xl->fd = fd; - xl->drmcontext = ctx; - xl->hwLock = hwLock; - xl->mmioAddress = mmioAddress; - xl->fbAddress = fbAddress; - xl->curWaitFlags = 0; - xl->performLocking = 1; - xl->errors = 0; - xl->agpSync = 0; - ret = viaDMAInitTimeStamp(xl); - if (ret) { - free(xl); - return NULL; - } - return xl; -} - -void -setLowLevelLocking(void *xlp, int performLocking) -{ - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - xl->performLocking = performLocking; -} - -void -closeXvMCLowLevel(void *xlp) -{ - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - viaDMACleanupTimeStamp(xl); - free(xl); -} - diff --git a/nx-X11/lib/XvMC/hw/via/unichromeProA/Imakefile b/nx-X11/lib/XvMC/hw/via/unichromeProA/Imakefile deleted file mode 100644 index f87ae9b05..000000000 --- a/nx-X11/lib/XvMC/hw/via/unichromeProA/Imakefile +++ /dev/null @@ -1,50 +0,0 @@ -#define DoNormalLib NormalLibXvMC -#define DoSharedLib SharedLibXvMC -#define DoDebugLib DebugLibXvMC -#define DoProfileLib ProfileLibXvMC -#define LibName viaXvMCPro -#define SoRev SOXVMCREV -#define LibHeaders NO - -#include - -#ifdef SharedXvMCReqs -REQUIREDLIBS = SharedXvMCReqs -lXv -#endif - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - - DEFINES = $(ALLOC_DEFINES) -DTRUE=1 -DFALSE=0 - INCLUDES = -I$(XINCLUDESRC) -I$(INCLUDESRC) -I$(XLIBSRC) -I$(EXTINCSRC) \ - -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(DRMSRCDIR)/shared-core \ - -I$(XF86OSSRC)/linux/drm/kernel -I$(XF86DRIVERSRC)/via - SRCS = viaLowLevelPro.c - OBJS = viaXvMC.o viaLowLevelPro.o xf86drm.o xf86drmHash.o \ - xf86drmRandom.o xf86drmSL.o xf86dri.o driDrawable.o - LINTLIBS = $(LINTXLIB) - - -#include - - -#if defined(LinuxArchitecture) -LIBDRM_DIR = ../../../../../extras/drm/libdrm - -LinkSourceFile(xf86drm.c,$(LIBDRM_DIR)) -LinkSourceFile(xf86drmHash.c,$(LIBDRM_DIR)) -LinkSourceFile(xf86drmRandom.c,$(LIBDRM_DIR)) -LinkSourceFile(xf86drmSL.c,$(LIBDRM_DIR)) -LinkSourceFile(viaLowLevel.h,..) -LinkSourceFile(driDrawable.h,..) -LinkSourceFile(viaXvMCPriv.h,..) -LinkSourceFile(xf86dri.h,..) -LinkSourceFile(xf86dristr.h,..) -LinkSourceFile(xf86dri.c,..) -LinkSourceFile(driDrawable.c,..) -LinkSourceFile(viaXvMC.c,..) -#endif - -DependTarget() - diff --git a/nx-X11/lib/XvMC/hw/via/unichromeProA/viaLowLevelPro.c b/nx-X11/lib/XvMC/hw/via/unichromeProA/viaLowLevelPro.c deleted file mode 100644 index 666166c96..000000000 --- a/nx-X11/lib/XvMC/hw/via/unichromeProA/viaLowLevelPro.c +++ /dev/null @@ -1,1465 +0,0 @@ -/***************************************************************************** - * VIA Unichrome XvMC extension client lib. - * - * Copyright (c) 2004 Thomas Hellström. All rights reserved. - * Copyright (c) 2003 Andreas Robinson. 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 - * AUTHOR(S) OR 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. - */ - - -/* - * Low-level functions that deal directly with the hardware. In the future, - * these functions might be implemented in a kernel module. Also, some of them - * would benefit from DMA. - * - * Authors: - * Andreas Robinson 2003. (Initial decoder interface functions). - * Thomas Hellstrom 2004, 2005 (Blitting functions, AGP and locking, Unichrome Pro Video AGP). - * Ivor Hewitt 2005 (Unichrome Pro modifications and merging). - */ - -/* IH - * I've left the proReg or-ing in case we need/want to implement the V1/V3 - * register toggle too, which also moves the register locations. - * The CN400 has dual mpeg decoders, not sure at the moment whether these - * are also operated through independent registers also. - */ - -#undef VIDEO_DMA -#define HQV_USE_IRQ -#define UNICHROME_PRO - -#include "viaXvMCPriv.h" -#include "viaLowLevel.h" -#include "driDrawable.h" -#include -#include -#include - -typedef enum {ll_init, ll_agpBuf, ll_pciBuf, ll_timeStamp, ll_llBuf} - LLState; - - -typedef struct { - drm_via_mem_t mem; - unsigned offset; - unsigned stride; - unsigned height; -} LowLevelBuffer; - -struct _XvMCLowLevel; - -typedef struct _ViaCommandBuffer { - CARD32 *buf; - CARD32 waitFlags; - unsigned pos; - unsigned bufSize; - int mode; - int header_start; - int rindex; - void (*flushFunc)(struct _ViaCommandBuffer *cb, struct _XvMCLowLevel *xl); -} ViaCommandBuffer; - -typedef struct _XvMCLowLevel{ - ViaCommandBuffer agpBuf, pciBuf, *videoBuf; - int use_agp; - int fd; - drm_context_t *drmcontext; - drmLockPtr hwLock; - drmAddress mmioAddress; - drmAddress fbAddress; - unsigned fbStride; - unsigned fbDepth; - unsigned width; - unsigned height; - int performLocking; - unsigned errors; - drm_via_mem_t tsMem; - CARD32 tsOffset; - volatile CARD32 *tsP; - CARD32 curTimeStamp; - CARD32 lastReadTimeStamp; - int agpSync; - CARD32 agpSyncTimeStamp; - unsigned chipId; - - /* - * Data for video-engine less display - */ - - XvMCRegion sRegion; - XvMCRegion dRegion; - LowLevelBuffer scale; - LowLevelBuffer back; - Bool downScaling; - CARD32 downScaleW; - CARD32 downScaleH; - CARD32 upScaleW; - CARD32 upScaleH; - unsigned fetch; - unsigned line; - LLState state; -}XvMCLowLevel; - - -/* - * For Other architectures than i386 these might have to be modified for - * bigendian etc. - */ - - -#define MPEGIN(xl,reg) \ - *((volatile CARD32 *)(((CARD8 *)(xl)->mmioAddress) + 0xc00 + (reg))) - -#define VIDIN(ctx,reg) \ - *((volatile CARD32 *)(((CARD8 *)(ctx)->mmioAddress) + 0x200 + (reg))) - -#define REGIN(ctx,reg) \ - *((volatile CARD32 *)(((CARD8 *)(ctx)->mmioAddress) + 0x0000 + (reg))) - -#define HQV_CONTROL 0x1D0 -#define HQV_SRC_OFFSET 0x1CC -#define HQV_SRC_STARTADDR_Y 0x1D4 -#define HQV_SRC_STARTADDR_U 0x1D8 -#define HQV_SRC_STARTADDR_V 0x1DC -#define HQV_MINIFY_DEBLOCK 0x1E8 - -#define REG_HQV1_INDEX 0x00001000 - -#define HQV_SW_FLIP 0x00000010 -#define HQV_FLIP_STATUS 0x00000001 -#define HQV_SUBPIC_FLIP 0x00008000 -#define HQV_FLIP_ODD 0x00000020 -#define HQV_DEINTERLACE 0x00010000 -#define HQV_FIELD_2_FRAME 0x00020000 -#define HQV_FRAME_2_FIELD 0x00040000 -#define HQV_FIELD_UV 0x00100000 -#define HQV_DEBLOCK_HOR 0x00008000 -#define HQV_DEBLOCK_VER 0x80000000 -#define HQV_YUV420 0xC0000000 -#define HQV_YUV422 0x80000000 -#define HQV_ENABLE 0x08000000 -#define HQV_GEN_IRQ 0x00000080 - -#define HQV_SCALE_ENABLE 0x00000800 -#define HQV_SCALE_DOWN 0x00001000 - -#define V_COMPOSE_MODE 0x98 -#define V1_COMMAND_FIRE 0x80000000 -#define V3_COMMAND_FIRE 0x40000000 - -/* SUBPICTURE Registers */ -#define SUBP_CONTROL_STRIDE 0x1C0 -#define SUBP_STARTADDR 0x1C4 -#define RAM_TABLE_CONTROL 0x1C8 -#define RAM_TABLE_READ 0x1CC - -/* SUBP_CONTROL_STRIDE 0x3c0 */ -#define SUBP_HQV_ENABLE 0x00010000 -#define SUBP_IA44 0x00020000 -#define SUBP_AI44 0x00000000 -#define SUBP_STRIDE_MASK 0x00001fff -#define SUBP_CONTROL_MASK 0x00070000 - -/* RAM_TABLE_CONTROL 0x3c8 */ -#define RAM_TABLE_RGB_ENABLE 0x00000007 - - -#define VIA_REG_STATUS 0x400 -#define VIA_REG_GEMODE 0x004 -#define VIA_REG_SRCBASE 0x030 -#define VIA_REG_DSTBASE 0x034 -#define VIA_REG_PITCH 0x038 -#define VIA_REG_SRCCOLORKEY 0x01C -#define VIA_REG_KEYCONTROL 0x02C -#define VIA_REG_SRCPOS 0x008 -#define VIA_REG_DSTPOS 0x00C -#define VIA_REG_GECMD 0x000 -#define VIA_REG_DIMENSION 0x010 /* width and height */ -#define VIA_REG_FGCOLOR 0x018 - - -#define VIA_VR_QUEUE_BUSY 0x00020000 /* Virtual Queue is busy */ -#define VIA_CMD_RGTR_BUSY 0x00000080 /* Command Regulator is busy */ -#define VIA_2D_ENG_BUSY 0x00000001 /* 2D Engine is busy */ -#define VIA_3D_ENG_BUSY 0x00000002 /* 3D Engine is busy */ -#define VIA_GEM_8bpp 0x00000000 -#define VIA_GEM_16bpp 0x00000100 -#define VIA_GEM_32bpp 0x00000300 -#define VIA_GEC_BLT 0x00000001 -#define VIA_PITCH_ENABLE 0x80000000 -#define VIA_GEC_INCX 0x00000000 -#define VIA_GEC_DECY 0x00004000 -#define VIA_GEC_INCY 0x00000000 -#define VIA_GEC_DECX 0x00008000 -#define VIA_GEC_FIXCOLOR_PAT 0x00002000 - - -#define VIA_BLIT_CLEAR 0x00 -#define VIA_BLIT_COPY 0xCC -#define VIA_BLIT_FILL 0xF0 -#define VIA_BLIT_SET 0xFF - -#define VIA_SYNCWAITTIMEOUT 50000 /* Might be a bit conservative */ -#define VIA_DMAWAITTIMEOUT 150000 -#define VIA_VIDWAITTIMEOUT 50000 -#define VIA_XVMC_DECODERTIMEOUT 50000 /*(microseconds)*/ - -#define VIA_AGP_HEADER5 0xFE040000 -#define VIA_AGP_HEADER6 0xFE050000 - -typedef struct{ - CARD32 data; - Bool set; -} HQVRegister; - - -#define H1_ADDR(val) (((val) >> 2) | 0xF0000000) -#define WAITFLAGS(cb, flags) \ - (cb)->waitFlags |= (flags) -#define BEGIN_RING_AGP(cb, xl, size) \ - do { \ - if ((cb)->pos > ((cb)->bufSize-(size))) { \ - cb->flushFunc(cb, xl); \ - } \ - } while(0) -#define OUT_RING_AGP(cb, val) do{ \ - (cb)->buf[(cb)->pos++] = (val); \ - } while(0); - -#define OUT_RING_QW_AGP(cb, val1, val2) \ - do { \ - (cb)->buf[(cb)->pos++] = (val1); \ - (cb)->buf[(cb)->pos++] = (val2); \ - } while (0) - - -#define BEGIN_HEADER5_AGP(cb, xl, index) \ - do { \ - BEGIN_RING_AGP(cb, xl, 8); \ - (cb)->mode = VIA_AGP_HEADER5; \ - (cb)->rindex = (index); \ - (cb)->header_start = (cb)->pos; \ - (cb)->pos += 4; \ - } while (0) - -#define BEGIN_HEADER6_AGP(cb, xl) \ - do { \ - BEGIN_RING_AGP(cb, xl, 8); \ - (cb)->mode = VIA_AGP_HEADER6; \ - (cb)->header_start = (cb)->pos; \ - (cb)->pos += 4; \ - } while (0) - -#define BEGIN_HEADER5_DATA(cb, xl, size, index) \ - do { \ - if ((cb)->pos > ((cb)->bufSize - ((size) + 16))) { \ - cb->flushFunc(cb, xl); \ - BEGIN_HEADER5_AGP(cb, xl, index); \ - } else if ((cb)->mode && (((cb)->mode != VIA_AGP_HEADER5) || \ - ((cb)->rindex != index))) { \ - finish_header_agp(cb); \ - BEGIN_HEADER5_AGP((cb), xl, (index)); \ - } else if (cb->mode != VIA_AGP_HEADER5) { \ - BEGIN_HEADER5_AGP((cb), xl, (index)); \ - } \ - }while(0) - -#define BEGIN_HEADER6_DATA(cb, xl, size) \ - do{ \ - if ((cb)->pos > (cb->bufSize-(((size) << 1) + 16))) { \ - cb->flushFunc(cb, xl); \ - BEGIN_HEADER6_AGP(cb, xl); \ - } else if ((cb)->mode && ((cb)->mode != VIA_AGP_HEADER6)) { \ - finish_header_agp(cb); \ - BEGIN_HEADER6_AGP(cb, xl); \ - } \ - else if ((cb->mode != VIA_AGP_HEADER6)) { \ - BEGIN_HEADER6_AGP(cb, (xl)); \ - } \ - }while(0) - -#define HQV_SHADOW_BASE 0x3CC -#define HQV_SHADOW_SIZE 13 - -#define SETHQVSHADOW(shadow, offset, value) \ - do { \ - HQVRegister *r = (shadow) + (((offset) - HQV_SHADOW_BASE) >> 2); \ - r->data = (value); \ - r->set = TRUE; \ - } while(0) - -#define GETHQVSHADOW(shadow, offset) ((shadow)[(offset - HQV_SHADOW_BASE) >> 2].data) - -#define LL_HW_LOCK(xl) \ - do { \ - DRM_LOCK((xl)->fd,(xl)->hwLock,*(xl)->drmcontext,0); \ - } while(0); -#define LL_HW_UNLOCK(xl) \ - do { \ - DRM_UNLOCK((xl)->fd,(xl)->hwLock,*(xl)->drmcontext); \ - } while(0); - -static HQVRegister hqvShadow[HQV_SHADOW_SIZE]; - - -static void -initHQVShadow(HQVRegister *r) -{ - int i; - - for(i=0; idata = 0; - r++->set = FALSE; - } -} - -static void -setHQVDeblocking(HQVRegister *shadow, Bool on, Bool lowPass) -{ - CARD32 tmp = GETHQVSHADOW(shadow, 0x3DC); - - if (!on) { - tmp &= ~(1 << 27); - SETHQVSHADOW(shadow, 0x3DC , tmp); - return; - } - - tmp |= (8 << 16) | (1 << 27); - if (lowPass) - tmp |= (1 << 26); - SETHQVSHADOW(shadow, 0x3DC , tmp); - - tmp = GETHQVSHADOW(shadow, 0x3D4); - tmp |= (6 << 27); - SETHQVSHADOW(shadow, 0x3D4, tmp); - - tmp = GETHQVSHADOW(shadow, 0x3D8); - tmp |= (19 << 27); - SETHQVSHADOW(shadow, 0x3D8, tmp); -} - -static void -setHQVStartAddress(HQVRegister *shadow, unsigned yOffs, unsigned uOffs, - unsigned stride, unsigned format) -{ - CARD32 tmp = GETHQVSHADOW(shadow, 0x3D4); - - tmp |= yOffs & 0x03FFFFF0; - SETHQVSHADOW(shadow, 0x3D4, tmp); - tmp = GETHQVSHADOW(shadow, 0x3D8); - tmp |= uOffs & 0x03FFFFF0; - SETHQVSHADOW(shadow, 0x3D8, tmp); - tmp = GETHQVSHADOW(shadow, 0x3F8); - tmp |= (stride & 0x1FF8); - SETHQVSHADOW(shadow, 0x3F8, tmp); - tmp = GETHQVSHADOW(shadow, 0x3D0); - - if (format == 0) { - /* - * NV12 - */ - tmp |= (0x0C << 28); - } else if (format == 1) { - /* - * RGB16 - */ - tmp |= (0x02 << 28); - } else if (format == 2) { - /* - * RGB32 - */ - ; - } - SETHQVSHADOW(shadow, 0x3D0, tmp); -} - -static void -setHQVDeinterlacing(HQVRegister *shadow, CARD32 frameType) -{ - CARD32 tmp = GETHQVSHADOW(shadow, 0x3D0); - - - if ((frameType & XVMC_FRAME_PICTURE) == XVMC_TOP_FIELD) { - tmp |= HQV_FIELD_UV | - HQV_DEINTERLACE | - HQV_FIELD_2_FRAME | - HQV_FRAME_2_FIELD; - } else if ((frameType & XVMC_FRAME_PICTURE) == XVMC_BOTTOM_FIELD) { - tmp |= HQV_FIELD_UV | - HQV_DEINTERLACE | - HQV_FIELD_2_FRAME | - HQV_FRAME_2_FIELD | - HQV_FLIP_ODD; - } - SETHQVSHADOW(shadow, 0x3D0, tmp); -} - -static void -setHQVTripleBuffer(HQVRegister *shadow, Bool on) -{ - CARD32 tmp = GETHQVSHADOW(shadow, 0x3D0); - - if (on) - tmp |= ( 1 << 26 ); - else - tmp &= ~( 1 << 26 ); - SETHQVSHADOW(shadow, 0x3D0, tmp); -} - -static void -finish_header_agp(ViaCommandBuffer *cb) -{ - int - numDWords,i; - CARD32 - *hb; - - if (!cb->mode) return; - numDWords = cb->pos - cb->header_start - 4; - hb = cb->buf + cb->header_start; - switch (cb->mode) { - case VIA_AGP_HEADER5: - hb[0] = VIA_AGP_HEADER5 | cb->rindex; - hb[1] = numDWords ; - hb[2] = 0x00F50000; /* SW debug flag. (?) */ - break; - default: - hb[0] = VIA_AGP_HEADER6; - hb[1] = numDWords >> 1 ; - hb[2] = 0x00F60000; /* SW debug flag. (?) */ - break; - } - hb[3] = 0; - if (numDWords & 3) { - for (i=0; i<(4 - (numDWords & 3)); ++i) - OUT_RING_AGP(cb, 0x00000000); - } - cb->mode = 0; -} - -void -hwlLock(void *xlp, int videoLock) -{ - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - LL_HW_LOCK(xl); -} - -void -hwlUnlock(void *xlp, int videoLock) -{ - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - LL_HW_UNLOCK(xl); -} - -static unsigned -timeDiff(struct timeval *now,struct timeval *then) { - return (now->tv_usec >= then->tv_usec) ? - now->tv_usec - then->tv_usec : - 1000000 - (then->tv_usec - now->tv_usec); -} - -void -setAGPSyncLowLevel(void *xlp, int val, CARD32 timeStamp) -{ - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - xl->agpSync = val; - xl->agpSyncTimeStamp = timeStamp; -} - -CARD32 -viaDMATimeStampLowLevel(void *xlp) -{ - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - if (xl->use_agp) { - viaBlit(xl, 32, xl->tsOffset, 1, xl->tsOffset, 1, 1, 1, 0, 0, - VIABLIT_FILL, xl->curTimeStamp); - return xl->curTimeStamp++; - } - return 0; -} - -static void -viaDMAWaitTimeStamp(XvMCLowLevel *xl, CARD32 timeStamp, int doSleep) -{ - struct timeval now, then; - struct timezone here; - struct timespec sleep, rem; - - if (xl->use_agp && (xl->lastReadTimeStamp - timeStamp > (1 << 23))) { - sleep.tv_nsec = 1; - sleep.tv_sec = 0; - here.tz_minuteswest = 0; - here.tz_dsttime = 0; - gettimeofday(&then,&here); - - while(((xl->lastReadTimeStamp = *xl->tsP) - timeStamp) > (1 << 23)) { - gettimeofday(&now,&here); - if (timeDiff(&now,&then) > VIA_DMAWAITTIMEOUT) { - if(((xl->lastReadTimeStamp = *xl->tsP) - timeStamp) > (1 << 23)) { - xl->errors |= LL_DMA_TIMEDOUT; - break; - } - } - if (doSleep) nanosleep(&sleep, &rem); - } - } -} - -static int -viaDMAInitTimeStamp(XvMCLowLevel *xl) -{ - int ret = 0; - - if (xl->use_agp) { - xl->tsMem.context = *(xl->drmcontext); - xl->tsMem.size = 64; - xl->tsMem.type = VIA_MEM_VIDEO; - if ((ret = drmCommandWriteRead(xl->fd, DRM_VIA_ALLOCMEM, - &xl->tsMem, sizeof(xl->tsMem))) < 0) - return ret; - if (xl->tsMem.size != 64) - return -1; - xl->tsOffset = (xl->tsMem.offset + 31) & ~31; - xl->tsP = (CARD32 *)xl->fbAddress + (xl->tsOffset >> 2); - xl->curTimeStamp = 1; - *xl->tsP = 0; - } - return 0; -} - -static int -viaDMACleanupTimeStamp(XvMCLowLevel *xl) -{ - - if (!(xl->tsMem.size) || !xl->use_agp) return 0; - return drmCommandWrite(xl->fd, DRM_VIA_FREEMEM, &xl->tsMem, sizeof(xl->tsMem)); -} - - -static CARD32 -viaMpegGetStatus(XvMCLowLevel *xl) -{ - return MPEGIN(xl,0x54); -} - -static int -viaMpegIsBusy(XvMCLowLevel *xl, CARD32 mask, CARD32 idle) -{ - CARD32 tmp = viaMpegGetStatus(xl); - - /* - * Error detected. - * FIXME: Are errors really shown when error concealment is on? - */ - - if (tmp & 0x70) return 0; - - return (tmp & mask) != idle; -} - - -static void -syncDMA(XvMCLowLevel *xl, unsigned int doSleep) -{ - - /* - * Ideally, we'd like to have an interrupt wait here, but, according to second hand - * information, the hardware does not support this, although earlier S3 chips do that. - * It is therefore not implemented into the DRM, and we'll do a user space wait here. - */ - - struct timeval now, then; - struct timezone here; - struct timespec sleep, rem; - - sleep.tv_nsec = 1; - sleep.tv_sec = 0; - here.tz_minuteswest = 0; - here.tz_dsttime = 0; - gettimeofday(&then,&here); - while( !(REGIN(xl, VIA_REG_STATUS) & VIA_VR_QUEUE_BUSY)) { - gettimeofday(&now,&here); - if (timeDiff(&now,&then) > VIA_DMAWAITTIMEOUT) { - if( !(REGIN(xl, VIA_REG_STATUS) & VIA_VR_QUEUE_BUSY)) { - xl->errors |= LL_DMA_TIMEDOUT; - break; - } - } - if (doSleep) nanosleep(&sleep, &rem); - } - while( REGIN(xl, VIA_REG_STATUS) & VIA_CMD_RGTR_BUSY ) { - gettimeofday(&now,&here); - if (timeDiff(&now,&then) > VIA_DMAWAITTIMEOUT) { - if( REGIN(xl, VIA_REG_STATUS) & VIA_CMD_RGTR_BUSY ) { - xl->errors |= LL_DMA_TIMEDOUT; - break; - } - } - if (doSleep) nanosleep(&sleep, &rem); - } -} - -#ifdef HQV_USE_IRQ -static void -syncVideo(XvMCLowLevel *xl, unsigned int doSleep) -{ - int proReg = REG_HQV1_INDEX; - - /* - * Wait for HQV completion using completion interrupt. Nothing strange here. - * Note that the interrupt handler clears the HQV_FLIP_STATUS bit, so we - * can't wait on that one. - */ - - if ((VIDIN(xl, HQV_CONTROL|proReg) & (HQV_SW_FLIP | HQV_SUBPIC_FLIP))) { - drm_via_irqwait_t irqw; - irqw.request.irq = 1; - irqw.request.type = VIA_IRQ_ABSOLUTE; - if (drmCommandWriteRead(xl->fd, DRM_VIA_WAIT_IRQ, &irqw, sizeof(irqw)) < 0) - xl->errors |= LL_VIDEO_TIMEDOUT; - } -} -#else -static void -syncVideo(XvMCLowLevel *xl, unsigned int doSleep) -{ - /* - * Wait for HQV completion. Nothing strange here. We assume that the HQV - * Handles syncing to the V1 / V3 engines by itself. It should be safe to - * always wait for SUBPIC_FLIP completion although subpictures are not always - * used. - */ - - struct timeval now, then; - struct timezone here; - struct timespec sleep, rem; - - int proReg = REG_HQV1_INDEX; - - sleep.tv_nsec = 1; - sleep.tv_sec = 0; - here.tz_minuteswest = 0; - here.tz_dsttime = 0; - gettimeofday(&then,&here); - while((VIDIN(xl, HQV_CONTROL|proReg) & (HQV_SW_FLIP | HQV_SUBPIC_FLIP )) ) { - gettimeofday(&now,&here); - if (timeDiff(&now,&then) > VIA_SYNCWAITTIMEOUT) { - if((VIDIN(xl, HQV_CONTROL|proReg) & (HQV_SW_FLIP | HQV_SUBPIC_FLIP )) ) { - xl->errors |= LL_VIDEO_TIMEDOUT; - break; - } - } - if (doSleep) nanosleep(&sleep, &rem); - } -} -#endif - -static void -syncAccel(XvMCLowLevel *xl, unsigned int mode, unsigned int doSleep) -{ - struct timeval now, then; - struct timezone here; - struct timespec sleep, rem; - CARD32 mask = ((mode & LL_MODE_2D) ? VIA_2D_ENG_BUSY : 0) | - ((mode & LL_MODE_3D) ? VIA_3D_ENG_BUSY : 0); - - sleep.tv_nsec = 1; - sleep.tv_sec = 0; - here.tz_minuteswest = 0; - here.tz_dsttime = 0; - gettimeofday(&then,&here); - while( REGIN(xl, VIA_REG_STATUS) & mask) { - gettimeofday(&now,&here); - if (timeDiff(&now,&then) > VIA_SYNCWAITTIMEOUT) { - if( REGIN(xl, VIA_REG_STATUS) & mask) { - xl->errors |= LL_ACCEL_TIMEDOUT; - break; - } - } - if (doSleep) nanosleep(&sleep, &rem); - } -} - - -static void -syncMpeg(XvMCLowLevel *xl, unsigned int mode, unsigned int doSleep) -{ - /* - * Ideally, we'd like to have an interrupt wait here, but from information from VIA - * at least the MPEG completion interrupt is broken on the CLE266, which was - * discovered during validation of the chip. - */ - - struct timeval now, then; - struct timezone here; - struct timespec sleep, rem; - CARD32 busyMask = 0; - CARD32 idleVal = 0; - CARD32 ret; - - sleep.tv_nsec = 1; - sleep.tv_sec = 0; - here.tz_minuteswest = 0; - here.tz_dsttime = 0; - gettimeofday(&then,&here); - if (mode & LL_MODE_DECODER_SLICE) { - busyMask = VIA_SLICEBUSYMASK; - idleVal = VIA_SLICEIDLEVAL; - } - if (mode & LL_MODE_DECODER_IDLE) { - busyMask |= VIA_BUSYMASK; - idleVal = VIA_IDLEVAL; - } - while(viaMpegIsBusy(xl, busyMask, idleVal)) { - gettimeofday(&now,&here); - if (timeDiff(&now,&then) > VIA_XVMC_DECODERTIMEOUT) { - if (viaMpegIsBusy(xl, busyMask, idleVal)) { - xl->errors |= LL_DECODER_TIMEDOUT; - } - break; - } - if (doSleep) nanosleep(&sleep, &rem); - } - - ret = viaMpegGetStatus(xl); - if (ret & 0x70) { - xl->errors |= ((ret & 0x70) >> 3); - } - return; -} - -static void -pciFlush(ViaCommandBuffer *cb, XvMCLowLevel *xl) -{ - int ret; - drm_via_cmdbuffer_t b; - unsigned mode = cb->waitFlags; - - finish_header_agp(cb); - b.buf = (char *)cb->buf; - b.size = cb->pos * sizeof(CARD32); - if (xl->performLocking) hwlLock(xl,0); - if (((mode == LL_MODE_VIDEO) && (xl->videoBuf == &xl->agpBuf)) || - ((mode != LL_MODE_VIDEO) && (mode != 0))) - syncDMA(xl, 0); - if ((mode & LL_MODE_2D) || (mode & LL_MODE_3D)) { - syncAccel(xl, mode, 0); - } - if (mode & LL_MODE_VIDEO) { - syncVideo(xl, 1); - } - if (mode & (LL_MODE_DECODER_SLICE | LL_MODE_DECODER_IDLE)) { - syncMpeg(xl, mode, 0); - } - ret = drmCommandWrite(xl->fd, DRM_VIA_PCICMD, &b, sizeof(b)); - if (xl->performLocking) hwlUnlock(xl,0); - if (ret) { - xl->errors |= LL_PCI_COMMAND_ERR; - } - cb->pos = 0; - cb->waitFlags = 0; -} - -static void -agpFlush(ViaCommandBuffer *cb, XvMCLowLevel *xl) -{ - drm_via_cmdbuffer_t b; - int ret; - int i; - - finish_header_agp(cb); - if (xl->use_agp) { - b.buf = (char *)cb->buf; - b.size = cb->pos * sizeof(CARD32); - if (xl->agpSync) { - syncXvMCLowLevel(xl, LL_MODE_DECODER_IDLE, 1, xl->agpSyncTimeStamp); - xl->agpSync = 0; - } - if (xl->performLocking) hwlLock(xl,0); - do { - ret = drmCommandWrite(xl->fd, DRM_VIA_CMDBUFFER, &b, sizeof(b)); - } while (-EAGAIN == ret); - if (xl->performLocking) hwlUnlock(xl,0); - - if (ret) { - xl->errors |= LL_AGP_COMMAND_ERR; - for(i=0; ipos; i+=2) { - printf("0x%x, 0x%x\n", (unsigned) cb->buf[i], (unsigned) cb->buf[i+1]); - } - exit(-1); - } else { - cb->pos = 0; - } - cb->waitFlags &= LL_MODE_VIDEO; /* FIXME: Check this! */ - } else { - unsigned mode=cb->waitFlags; - - b.buf = (char *)cb->buf; - b.size = cb->pos * sizeof(CARD32); - if (xl->performLocking) hwlLock(xl,0); - if (((mode == LL_MODE_VIDEO) && (cb == &xl->agpBuf)) || - ((mode != LL_MODE_VIDEO) && (mode != 0))) - syncDMA(xl, 0); - if ((mode & LL_MODE_2D) || (mode & LL_MODE_3D)) - syncAccel(xl, mode, 0); - if (mode & LL_MODE_VIDEO) - syncVideo(xl, 1); - if (mode & (LL_MODE_DECODER_SLICE | LL_MODE_DECODER_IDLE)) - syncMpeg(xl, mode, 0); - ret = drmCommandWrite(xl->fd, DRM_VIA_PCICMD, &b, sizeof(b)); - if (xl->performLocking) hwlUnlock(xl,0); - if (ret) { - xl->errors |= LL_PCI_COMMAND_ERR; - } - cb->pos = 0; - cb->waitFlags = 0; - } -} - -static void -uploadHQVShadow(XvMCLowLevel *xl, unsigned offset, HQVRegister *shadow, - Bool flip) -{ - int i; - CARD32 tmp; - ViaCommandBuffer *cb = xl->videoBuf; - - BEGIN_HEADER6_DATA(cb, xl, HQV_SHADOW_SIZE); - WAITFLAGS(cb, LL_MODE_VIDEO); - - if (shadow[0].set) - OUT_RING_QW_AGP(cb, 0x3CC + offset, 0); - - for (i=2; i < HQV_SHADOW_SIZE; ++i) { - if (shadow[i].set) { - OUT_RING_QW_AGP(cb, offset + HQV_SHADOW_BASE + ( i << 2) , shadow[i].data); - shadow[i].set = FALSE; - } - } - - /* - * Finally the control register for flip. - */ - - if (flip) { - tmp = GETHQVSHADOW( shadow, 0x3D0); - OUT_RING_QW_AGP(cb, offset + HQV_CONTROL + 0x200 , - HQV_ENABLE | HQV_GEN_IRQ | HQV_SUBPIC_FLIP | HQV_SW_FLIP | tmp); - } - shadow[0].set = FALSE; - shadow[1].set = FALSE; -} - - - - -unsigned -flushXvMCLowLevel(void *xlp) -{ - unsigned - errors; - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - - if(xl->pciBuf.pos) pciFlush(&xl->pciBuf, xl); - if(xl->agpBuf.pos) agpFlush(&xl->agpBuf, xl); - errors = xl->errors; - if (errors) printf("Error 0x%x\n", errors); - xl->errors = 0; - return errors; -} - -void -flushPCIXvMCLowLevel(void *xlp) -{ - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - - if(xl->pciBuf.pos) pciFlush(&xl->pciBuf, xl); - if ((!xl->use_agp && xl->agpBuf.pos)) agpFlush(&xl->agpBuf, xl); -} - - -void -viaMpegSetSurfaceStride(void *xlp, ViaXvMCContext *ctx) -{ - CARD32 y_stride = ctx->yStride; - CARD32 uv_stride = y_stride >> 1; - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - ViaCommandBuffer *cb = &xl->agpBuf; - - BEGIN_HEADER6_DATA(cb, xl, 1); - OUT_RING_QW_AGP(cb, 0xc50, (y_stride >> 3) | ((uv_stride >> 3) << 16)); - WAITFLAGS(cb, LL_MODE_DECODER_IDLE); -} - - -void -viaVideoSetSWFLipLocked(void *xlp, unsigned yOffs, unsigned uOffs, - unsigned vOffs, unsigned yStride, unsigned uvStride) -{ - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - initHQVShadow(hqvShadow); - setHQVStartAddress(hqvShadow, yOffs, vOffs, yStride, 0); - if (xl->videoBuf == &xl->agpBuf) - syncDMA(xl, 1); - syncVideo(xl, 1); - uploadHQVShadow(xl, REG_HQV1_INDEX, hqvShadow, FALSE); - xl->videoBuf->flushFunc(xl->videoBuf, xl); -} - -void -viaVideoSWFlipLocked(void *xlp, unsigned flags, - Bool progressiveSequence) -{ - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - setHQVDeinterlacing(hqvShadow, flags); - setHQVDeblocking(hqvShadow,( (flags & XVMC_FRAME_PICTURE) == XVMC_FRAME_PICTURE), TRUE); - setHQVTripleBuffer(hqvShadow, TRUE); - if (xl->videoBuf == &xl->agpBuf) - syncDMA(xl, 1); - syncVideo(xl, 1); - uploadHQVShadow(xl, REG_HQV1_INDEX, hqvShadow, TRUE); - xl->videoBuf->flushFunc(xl->videoBuf, xl); -} - - -void -viaMpegSetFB(void *xlp,unsigned i, - unsigned yOffs, - unsigned uOffs, - unsigned vOffs) -{ - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - ViaCommandBuffer *cb = &xl->agpBuf; - - i *= (4*2); - BEGIN_HEADER6_DATA(cb,xl, 2); - OUT_RING_QW_AGP(cb, 0xc28 + i, yOffs >> 3); - OUT_RING_QW_AGP(cb, 0xc2c + i, vOffs >> 3); - - WAITFLAGS(cb, LL_MODE_DECODER_IDLE); -} - -void -viaMpegBeginPicture(void *xlp,ViaXvMCContext *ctx, - unsigned width, - unsigned height, - const XvMCMpegControl *control) { - - unsigned j, mb_width, mb_height; - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - ViaCommandBuffer *cb = &xl->agpBuf; - - mb_width = (width + 15) >> 4; - - mb_height = - ((control->mpeg_coding == XVMC_MPEG_2) && - (control->flags & XVMC_PROGRESSIVE_SEQUENCE)) ? - 2*((height+31) >> 5) : (((height+15) >> 4)); - - BEGIN_HEADER6_DATA(cb,xl, 72); - WAITFLAGS(cb, LL_MODE_DECODER_IDLE); - - OUT_RING_QW_AGP(cb, 0xc00, - ((control->picture_structure & XVMC_FRAME_PICTURE) << 2) | - ((control->picture_coding_type & 3) << 4) | - ((control->flags & XVMC_ALTERNATE_SCAN) ? (1 << 6) : 0)); - - if (!(ctx->intraLoaded)) { - OUT_RING_QW_AGP(cb, 0xc5c, 0); - for (j = 0; j < 64; j += 4) { - OUT_RING_QW_AGP(cb, 0xc60, - ctx->intra_quantiser_matrix[j] | - (ctx->intra_quantiser_matrix[j+1] << 8) | - (ctx->intra_quantiser_matrix[j+2] << 16) | - (ctx->intra_quantiser_matrix[j+3] << 24)); - } - ctx->intraLoaded = 1; - } - - if (!(ctx->nonIntraLoaded)) { - OUT_RING_QW_AGP(cb, 0xc5c, 1); - for (j = 0; j < 64; j += 4) { - OUT_RING_QW_AGP(cb, 0xc60, - ctx->non_intra_quantiser_matrix[j] | - (ctx->non_intra_quantiser_matrix[j+1] << 8) | - (ctx->non_intra_quantiser_matrix[j+2] << 16) | - (ctx->non_intra_quantiser_matrix[j+3] << 24)); - } - ctx->nonIntraLoaded = 1; - } - - if (!(ctx->chromaIntraLoaded)) { - OUT_RING_QW_AGP(cb, 0xc5c, 2); - for (j = 0; j < 64; j += 4) { - OUT_RING_QW_AGP(cb, 0xc60, - ctx->chroma_intra_quantiser_matrix[j] | - (ctx->chroma_intra_quantiser_matrix[j+1] << 8) | - (ctx->chroma_intra_quantiser_matrix[j+2] << 16) | - (ctx->chroma_intra_quantiser_matrix[j+3] << 24)); - } - ctx->chromaIntraLoaded = 1; - } - - if (!(ctx->chromaNonIntraLoaded)) { - OUT_RING_QW_AGP(cb, 0xc5c, 3); - for (j = 0; j < 64; j += 4) { - OUT_RING_QW_AGP(cb, 0xc60, - ctx->chroma_non_intra_quantiser_matrix[j] | - (ctx->chroma_non_intra_quantiser_matrix[j+1] << 8) | - (ctx->chroma_non_intra_quantiser_matrix[j+2] << 16) | - (ctx->chroma_non_intra_quantiser_matrix[j+3] << 24)); - } - ctx->chromaNonIntraLoaded = 1; - } - - OUT_RING_QW_AGP(cb, 0xc90, - ((mb_width * mb_height) & 0x3fff) | - ((control->flags & XVMC_PRED_DCT_FRAME) ? ( 1 << 14) : 0) | - ((control->flags & XVMC_TOP_FIELD_FIRST) ? (1 << 15) : 0 ) | - ((control->mpeg_coding == XVMC_MPEG_2) ? (1 << 16) : 0) | - ((mb_width & 0xff) << 18)); - - OUT_RING_QW_AGP(cb, 0xc94, - ((control->flags & XVMC_CONCEALMENT_MOTION_VECTORS) ? 1 : 0) | - ((control->flags & XVMC_Q_SCALE_TYPE) ? 2 : 0) | - ((control->intra_dc_precision & 3) << 2) | - (((1 + 0x100000 / mb_width) & 0xfffff) << 4) | - ((control->flags & XVMC_INTRA_VLC_FORMAT) ? (1 << 24) : 0)); - - OUT_RING_QW_AGP(cb, 0xc98, - (((control->FHMV_range) & 0xf) << 0) | - (((control->FVMV_range) & 0xf) << 4) | - (((control->BHMV_range) & 0xf) << 8) | - (((control->BVMV_range) & 0xf) << 12) | - ((control->flags & XVMC_SECOND_FIELD) ? (1 << 20) : 0) | - (0x0a6 << 16)); - -} - - - -void -viaMpegReset(void *xlp) -{ - int i,j; - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - ViaCommandBuffer *cb = &xl->agpBuf; - - BEGIN_HEADER6_DATA(cb,xl, 99); - WAITFLAGS(cb, LL_MODE_DECODER_IDLE); - - OUT_RING_QW_AGP(cb, 0xcf0 ,0); - - for (i = 0; i < 6; i++) { - OUT_RING_QW_AGP(cb, 0xcc0 ,0); - OUT_RING_QW_AGP(cb, 0xc0c, 0x43|0x20 ); - for (j = 0xc10; j < 0xc20; j += 4) - OUT_RING_QW_AGP(cb, j, 0); - } - - OUT_RING_QW_AGP(cb, 0xc0c, 0x1c3); - for (j = 0xc10; j < 0xc20; j += 4) - OUT_RING_QW_AGP(cb,j,0); - - for (i = 0; i < 19; i++) - OUT_RING_QW_AGP(cb, 0xc08 ,0); - - OUT_RING_QW_AGP(cb, 0xc98, 0x400000); - - for (i = 0; i < 6; i++) { - OUT_RING_QW_AGP(cb, 0xcc0 ,0); - OUT_RING_QW_AGP(cb, 0xc0c, 0x1c3|0x20); - for (j = 0xc10; j < 0xc20; j += 4) - OUT_RING_QW_AGP(cb,j,0); - } - OUT_RING_QW_AGP(cb, 0xcf0 ,0); - -} - -void -viaMpegWriteSlice(void *xlp, CARD8* slice, int nBytes, CARD32 sCode) -{ - int i, n, r; - CARD32* buf; - int count; - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - ViaCommandBuffer *cb = &xl->agpBuf; - - if (xl->errors & (LL_DECODER_TIMEDOUT | - LL_IDCT_FIFO_ERROR | - LL_SLICE_FIFO_ERROR | - LL_SLICE_FAULT)) return; - - n = nBytes >> 2; - if (sCode) nBytes += 4; - r = nBytes & 3; - buf = (CARD32*) slice; - - if (r) nBytes += 4 - r; - - nBytes += 8; - - BEGIN_HEADER6_DATA(cb,xl, 2); - WAITFLAGS(cb, LL_MODE_DECODER_IDLE); - OUT_RING_QW_AGP(cb, 0xc9c, nBytes); - - if (sCode) OUT_RING_QW_AGP(cb, 0xca0, sCode); - - i = 0; - count = 0; - - do { - count += (LL_AGP_CMDBUF_SIZE -20); - count = (count > n) ? n : count; - BEGIN_HEADER5_DATA(cb, xl, (count - i), 0xca0); - - for (; i < count; i++) { - OUT_RING_AGP(cb, *buf++); - } - finish_header_agp(cb); - } while (i < n); - - BEGIN_HEADER5_DATA(cb, xl, 3, 0xca0); - - if (r) { - OUT_RING_AGP(cb, *buf & ((1 << (r << 3)) - 1)); - } - OUT_RING_AGP(cb,0); - OUT_RING_AGP(cb,0); - finish_header_agp(cb); -} - -void -viaVideoSubPictureOffLocked(void *xlp) { - - CARD32 stride; - int proReg = REG_HQV1_INDEX; - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - ViaCommandBuffer *cb = xl->videoBuf; - - if (xl->videoBuf == &xl->agpBuf) - syncDMA(xl, 1); - stride = VIDIN(xl,proReg|SUBP_CONTROL_STRIDE); - WAITFLAGS(cb, LL_MODE_VIDEO); - BEGIN_HEADER6_DATA(cb, xl, 1); - OUT_RING_QW_AGP(cb, proReg|SUBP_CONTROL_STRIDE | 0x200, stride & ~SUBP_HQV_ENABLE); -} - -void -viaVideoSubPictureLocked(void *xlp, ViaXvMCSubPicture *pViaSubPic) { - - unsigned i; - CARD32 cWord; - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - int proReg = REG_HQV1_INDEX; - ViaCommandBuffer *cb = xl->videoBuf; - - if (xl->videoBuf == &xl->agpBuf) - syncDMA(xl, 1); - WAITFLAGS(cb, LL_MODE_VIDEO); - BEGIN_HEADER6_DATA(cb, xl, VIA_SUBPIC_PALETTE_SIZE + 2); - for (i=0; ipalette[i]); - } - - cWord = (pViaSubPic->stride & SUBP_STRIDE_MASK) | SUBP_HQV_ENABLE; - cWord |= (pViaSubPic->ia44) ? SUBP_IA44 : SUBP_AI44; - OUT_RING_QW_AGP(cb, proReg|SUBP_STARTADDR | 0x200, pViaSubPic->offset); - OUT_RING_QW_AGP(cb, proReg|SUBP_CONTROL_STRIDE | 0x200, cWord); -} - -void -viaBlit(void *xlp,unsigned bpp,unsigned srcBase, - unsigned srcPitch,unsigned dstBase,unsigned dstPitch, - unsigned w,unsigned h,int xdir,int ydir, unsigned blitMode, - unsigned color) -{ - - CARD32 dwGEMode = 0, srcY=0, srcX, dstY=0, dstX; - CARD32 cmd; - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - ViaCommandBuffer *cb = &xl->agpBuf; - - if (!w || !h) - return; - - finish_header_agp(cb); - - switch (bpp) { - case 16: - dwGEMode |= VIA_GEM_16bpp; - break; - case 32: - dwGEMode |= VIA_GEM_32bpp; - break; - default: - dwGEMode |= VIA_GEM_8bpp; - break; - } - - srcX = srcBase & 31; - dstX = dstBase & 31; - switch (bpp) { - case 16: - dwGEMode |= VIA_GEM_16bpp; - srcX >>= 2; - dstX >>= 2; - break; - case 32: - dwGEMode |= VIA_GEM_32bpp; - srcX >>= 4; - dstX >>= 4; - break; - default: - dwGEMode |= VIA_GEM_8bpp; - break; - } - - BEGIN_RING_AGP(cb, xl, 20); - WAITFLAGS(cb, LL_MODE_2D); - - - OUT_RING_QW_AGP(cb, H1_ADDR(VIA_REG_GEMODE), dwGEMode); - cmd = 0; - - if (xdir < 0) { - cmd |= VIA_GEC_DECX; - srcX += (w - 1); - dstX += (w - 1); - } - if (ydir < 0) { - cmd |= VIA_GEC_DECY; - srcY += (h - 1); - dstY += (h - 1); - } - - switch(blitMode) { - case VIABLIT_TRANSCOPY: - OUT_RING_QW_AGP(cb, H1_ADDR(VIA_REG_SRCCOLORKEY), color); - OUT_RING_QW_AGP(cb, H1_ADDR(VIA_REG_KEYCONTROL), 0x4000); - cmd |= VIA_GEC_BLT | (VIA_BLIT_COPY << 24); - break; - case VIABLIT_FILL: - OUT_RING_QW_AGP(cb, H1_ADDR(VIA_REG_FGCOLOR), color); - cmd |= VIA_GEC_BLT | VIA_GEC_FIXCOLOR_PAT | (VIA_BLIT_FILL << 24); - break; - default: - OUT_RING_QW_AGP(cb, H1_ADDR(VIA_REG_KEYCONTROL), 0x0); - cmd |= VIA_GEC_BLT | (VIA_BLIT_COPY << 24); - } - - OUT_RING_QW_AGP(cb, H1_ADDR(VIA_REG_SRCBASE), (srcBase & ~31) >> 3); - OUT_RING_QW_AGP(cb, H1_ADDR(VIA_REG_DSTBASE), (dstBase & ~31) >> 3); - OUT_RING_QW_AGP(cb, H1_ADDR(VIA_REG_PITCH), VIA_PITCH_ENABLE | - (srcPitch >> 3) | (((dstPitch) >> 3) << 16)); - OUT_RING_QW_AGP(cb, H1_ADDR(VIA_REG_SRCPOS), ((srcY << 16) | srcX)); - OUT_RING_QW_AGP(cb, H1_ADDR(VIA_REG_DSTPOS), ((dstY << 16) | dstX)); - OUT_RING_QW_AGP(cb, H1_ADDR(VIA_REG_DIMENSION), (((h - 1) << 16) | (w - 1))); - OUT_RING_QW_AGP(cb, H1_ADDR(VIA_REG_GECMD), cmd); -} - -unsigned -syncXvMCLowLevel(void *xlp, unsigned int mode, unsigned int doSleep, - CARD32 timeStamp) -{ - unsigned - errors; - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - - if (mode == 0) { - errors = xl->errors; - xl->errors = 0; - return errors; - } - - if ((mode & (LL_MODE_VIDEO | LL_MODE_3D)) || !xl->use_agp) { - if (xl->performLocking) - hwlLock(xl,0); - if ((xl->videoBuf == &xl->agpBuf) || (mode != LL_MODE_VIDEO)) - syncDMA(xl, doSleep); - if (mode & LL_MODE_3D) - syncAccel(xl, mode, doSleep); - if (mode & LL_MODE_VIDEO) - syncVideo(xl, doSleep); - if (xl->performLocking) - hwlUnlock(xl,0); - } else { - viaDMAWaitTimeStamp(xl, timeStamp, doSleep); - } - - if (mode & (LL_MODE_DECODER_SLICE | LL_MODE_DECODER_IDLE)) - syncMpeg(xl, mode, doSleep); - - errors = xl->errors; - xl->errors = 0; - - return errors; -} - -static int -updateLowLevelBuf(XvMCLowLevel *xl, LowLevelBuffer *buf, - unsigned width, unsigned height) -{ - unsigned - stride, size; - drm_via_mem_t *mem = &buf->mem; - int ret; - - stride = (width + 31) & ~31; - size = stride * height + (xl->fbDepth >> 3); - - if (size != mem->size) { - if (mem->size) - drmCommandWrite(xl->fd, DRM_VIA_FREEMEM, mem, sizeof(*mem)); - mem->context = *(xl->drmcontext); - mem->size = size; - mem->type = VIA_MEM_VIDEO; - - if (((ret = drmCommandWriteRead(xl->fd, DRM_VIA_ALLOCMEM, mem, sizeof(mem))) < 0) || - mem->size != size) { - mem->size = 0; - return -1; - } - } - - buf->offset = (mem->offset + 31) & ~31; - buf->stride = stride; - buf->height = height; - return 0; -} - -static void -cleanupLowLevelBuf(XvMCLowLevel *xl, LowLevelBuffer *buf) -{ - drm_via_mem_t *mem = &buf->mem; - - if (mem->size) - drmCommandWrite(xl->fd, DRM_VIA_FREEMEM, mem, sizeof(mem)); - mem->size = 0; -} - - -static void -*releaseXvMCLowLevel(XvMCLowLevel *xl) -{ - switch(xl->state) { - case ll_llBuf: - cleanupLowLevelBuf(xl, &xl->scale); - case ll_timeStamp: - viaDMACleanupTimeStamp(xl); - case ll_pciBuf: - free(xl->pciBuf.buf); - case ll_agpBuf: - free(xl->agpBuf.buf); - case ll_init: - free(xl); - default: - ; - } - return NULL; -} - - -void -*initXvMCLowLevel(int fd, drm_context_t *ctx, - drmLockPtr hwLock, drmAddress mmioAddress, - drmAddress fbAddress, unsigned fbStride, unsigned fbDepth, - unsigned width, unsigned height, int useAgp, unsigned chipId ) -{ - XvMCLowLevel *xl = (XvMCLowLevel *)malloc(sizeof(XvMCLowLevel)); - - if (!xl) return NULL; - xl->state = ll_init; - - xl->agpBuf.buf = (CARD32 *)malloc(LL_AGP_CMDBUF_SIZE * sizeof(CARD32)); - if (!xl->agpBuf.buf) return releaseXvMCLowLevel(xl); - xl->state = ll_agpBuf; - xl->agpBuf.bufSize = LL_AGP_CMDBUF_SIZE; - xl->agpBuf.flushFunc = &agpFlush; - xl->agpBuf.pos = 0; - xl->agpBuf.mode = 0; - xl->agpBuf.waitFlags = 0; - - xl->pciBuf.buf = (CARD32 *)malloc(LL_PCI_CMDBUF_SIZE * sizeof(CARD32)); - if (!xl->pciBuf.buf) return releaseXvMCLowLevel(xl); - xl->state = ll_pciBuf; - xl->pciBuf.bufSize = LL_PCI_CMDBUF_SIZE; - xl->pciBuf.flushFunc = &pciFlush; - xl->pciBuf.pos = 0; - xl->pciBuf.mode = 0; - xl->pciBuf.waitFlags = 0; - - xl->use_agp = useAgp; - xl->fd = fd; - xl->drmcontext = ctx; - xl->hwLock = hwLock; - xl->mmioAddress = mmioAddress; - xl->fbAddress = fbAddress; - xl->fbDepth = fbDepth; - xl->fbStride = fbStride; - xl->width = width; - xl->height = height; - xl->performLocking = 1; - xl->errors = 0; - xl->agpSync = 0; - xl->chipId = chipId; - - if (viaDMAInitTimeStamp(xl)) - return releaseXvMCLowLevel(xl); - xl->state = ll_timeStamp; - - xl->scale.mem.size = 0; - xl->back.mem.size = 0; - - if (updateLowLevelBuf(xl, &xl->scale, width, height)) - return releaseXvMCLowLevel(xl); - xl->state = ll_llBuf; - -#ifdef VIDEO_DMA - xl->videoBuf = &xl->agpBuf; -#else - xl->videoBuf = &xl->pciBuf; -#endif - - return xl; -} - -void -setLowLevelLocking(void *xlp, int performLocking) -{ - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - xl->performLocking = performLocking; -} - -void -closeXvMCLowLevel(void *xlp) -{ - XvMCLowLevel *xl = (XvMCLowLevel *) xlp; - releaseXvMCLowLevel(xl); -} diff --git a/nx-X11/lib/XvMC/hw/via/viaLowLevel.h b/nx-X11/lib/XvMC/hw/via/viaLowLevel.h deleted file mode 100644 index 12e5fe373..000000000 --- a/nx-X11/lib/XvMC/hw/via/viaLowLevel.h +++ /dev/null @@ -1,148 +0,0 @@ -/***************************************************************************** - * VIA Unichrome XvMC extension client lib. - * - * Copyright (c) 2004 The Unichrome Project. 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 - * AUTHOR(S) OR 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. - */ - - -/* - * Authors: Thomas Hellström 2004 - 2005. - */ - - -#ifndef VIA_LOWLEVEL_H -#define VIA_LOWLEVEL_H - - -/* - * The below define is cache size sensitive. Increasing the AGP buffer size - * will enable the library to do deeper pipelining, but will degrade the - * performance in the drm dma command verifier. - */ - -#define LL_AGP_CMDBUF_SIZE (4096*2) -#define LL_PCI_CMDBUF_SIZE (4096) - -#define LL_MODE_DECODER_SLICE 0x01 -#define LL_MODE_DECODER_IDLE 0x02 -#define LL_MODE_VIDEO 0x04 -#define LL_MODE_2D 0x08 -#define LL_MODE_3D 0x10 - -/* - * Errors - */ - -#define LL_DECODER_TIMEDOUT 0x00000001 -#define LL_IDCT_FIFO_ERROR 0x00000002 -#define LL_SLICE_FIFO_ERROR 0x00000004 -#define LL_SLICE_FAULT 0x00000008 -#define LL_DMA_TIMEDOUT 0x00000010 -#define LL_VIDEO_TIMEDOUT 0x00000020 -#define LL_ACCEL_TIMEDOUT 0x00000040 -#define LL_PCI_COMMAND_ERR 0x00000080 -#define LL_AGP_COMMAND_ERR 0x00000100 - -#define VIA_SLICEBUSYMASK 0x00000200 -#define VIA_BUSYMASK 0x00000207 -#define VIA_SLICEIDLEVAL 0x00000200 -#define VIA_IDLEVAL 0x00000204 - -#include "via_drm.h" -#include "viaXvMCPriv.h" - -#define setRegion(xx,yy,ww,hh,region) \ - do { \ - (region).x = (xx); \ - (region).y = (yy); \ - (region).w = (ww); \ - (region).h = (hh); \ - } while(0) - -#define regionEqual(r1, r2) \ - ((r1).x == (r2).x && \ - (r1).y == (r2).y && \ - (r1).w == (r2).w && \ - (r1).h == (r2).h) - - - -extern void -*initXvMCLowLevel(int fd, drm_context_t *ctx, - drmLockPtr hwLock, drmAddress mmioAddress, - drmAddress fbAddress, unsigned fbStride, unsigned fbDepth, - unsigned width, unsigned height, int useAgp, unsigned chipId ); - -extern void setLowLevelLocking(void *xlp, int perFormLocking); -extern void closeXvMCLowLevel(void *xlp); -extern void flushPCIXvMCLowLevel(void *xlp); -extern CARD32 viaDMATimeStampLowLevel(void *xlp); -extern void setAGPSyncLowLevel(void *xlp, int val, CARD32 timeStamp); - - -/* - * These two functions also return and clear the current error status. - */ - -extern unsigned flushXvMCLowLevel(void *xlp); -extern unsigned syncXvMCLowLevel(void *xlp, unsigned int mode, - unsigned int doSleep, CARD32 timeStamp); - -extern void hwlUnlock(void *xlp, int videoLock); -extern void hwlLock(void *xlp, int videoLock); - -extern void viaVideoSetSWFLipLocked(void *xlp, unsigned yOffs, unsigned uOffs, - unsigned vOffs, unsigned yStride, unsigned uvStride); - -extern void viaMpegReset(void *xlp); -extern void viaMpegWriteSlice(void *xlp, CARD8* slice, - int nBytes, CARD32 sCode); -extern void viaMpegSetSurfaceStride(void *xlp, ViaXvMCContext *ctx); -extern void viaMpegSetFB(void *xlp,unsigned i, unsigned yOffs, - unsigned uOffs, unsigned vOffs); -extern void viaMpegBeginPicture(void *xlp, ViaXvMCContext *ctx,unsigned width, - unsigned height,const XvMCMpegControl *control); - -/* - * Low-level Video functions in viaLowLevel.c - */ - - -extern void viaBlit(void *xlp,unsigned bpp,unsigned srcBase, - unsigned srcPitch,unsigned dstBase,unsigned dstPitch, - unsigned w,unsigned h,int xdir,int ydir, - unsigned blitMode, unsigned color); - -extern void viaVideoSWFlipLocked(void *xlp, unsigned flags, - int progressiveSequence); - -extern void viaVideoSubPictureLocked(void *xlp,ViaXvMCSubPicture *pViaSubPic); -extern void viaVideoSubPictureOffLocked(void *xlp); - - - - -#define PCI_CHIP_VT3204 0x3108 /* K8M800 */ -#define PCI_CHIP_VT3259 0x3118 /* PM800/PM880/CN400 */ -#define PCI_CHIP_CLE3122 0x3122 /* CLE266 */ -#define PCI_CHIP_VT3205 0x7205 /* KM400 */ - -#endif diff --git a/nx-X11/lib/XvMC/hw/via/viaXvMC.c b/nx-X11/lib/XvMC/hw/via/viaXvMC.c deleted file mode 100644 index eebc87ea8..000000000 --- a/nx-X11/lib/XvMC/hw/via/viaXvMC.c +++ /dev/null @@ -1,1964 +0,0 @@ -/***************************************************************************** - * VIA Unichrome XvMC extension client lib. - * - * Copyright (c) 2004-2005 Thomas Hellström. 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 - * AUTHOR(S) OR 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. - */ - - -/* - *Author: Thomas Hellström, 2004. - *Bugfixes by among others Pascal Brisset and Terry Barnaby. - *DRI protocol support by Thomas Hellström, 2005. - */ - -#undef WAITPAUSE - -#include "viaXvMCPriv.h" -#include "viaLowLevel.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "xf86dri.h" -#include "driDrawable.h" - -#define SAREAPTR(ctx) ((ViaXvMCSAreaPriv *) \ - (((CARD8 *)(ctx)->sAreaAddress) + \ - (ctx)->sAreaPrivOffset)) - - - -static int error_base; -static int event_base; -static unsigned numContexts = 0; -static int globalFD; -static drmAddress sAreaAddress; -static drmAddress fbAddress; -static drmAddress mmioAddress; - - -#define FOURCC_XVMC (('C' << 24) + ('M' << 16) + ('V' << 8) + 'X') - -#define ppthread_mutex_lock(arg) \ - { \ - pthread_mutex_lock(arg); \ - } \ - -#define ppthread_mutex_unlock(arg) \ - { \ - pthread_mutex_unlock(arg); \ - } \ - -static unsigned yOffs (ViaXvMCSurface *srf) -{ - return srf->offsets[0]; -} - -static unsigned vOffs (ViaXvMCSurface *srf) -{ - return srf->offsets[0] + srf->yStride * srf->height; -} - -static unsigned uOffs (ViaXvMCSurface *srf) -{ - return srf->offsets[0] + ( srf->yStride * srf->height) + - (srf->yStride >> 1) * (srf->height >> 1); -} - - -static void defaultQMatrices(ViaXvMCContext *ctx) -{ - int i; - - static const char intra[64] = { - 8, 16, 19, 22, 26, 27, 29, 34, 16, 16, 22, 24, 27, 29, 34, 37, - 19, 22, 26, 27, 29, 34, 34, 38, 22, 22, 26, 27, 29, 34, 37, 40, - 22, 26, 27, 29, 32, 35, 40, 48, 26, 27, 29, 32, 35, 40, 48, 58, - 26, 27, 29, 34, 38, 46, 56, 69, 27, 29, 35, 38, 46, 56, 69, 83 - }; - - for( i=0; i<64; ++i) { - ctx->intra_quantiser_matrix[i] = intra[i]; - ctx->non_intra_quantiser_matrix[i] = 16; - } - ctx->intraLoaded = 0; - ctx->nonIntraLoaded = 0; -} - - -static void releaseDecoder(ViaXvMCContext *ctx,int clearCtx) -{ - volatile ViaXvMCSAreaPriv *sAPriv; - - sAPriv = SAREAPTR(ctx); - UNICHROME_UNLOCK(ctx->fd, UNICHROME_LOCK_DECODER1, sAPriv, ctx->drmcontext); -} - - -static int grabDecoder( ViaXvMCContext *ctx, int *hadLastLock) -{ - volatile ViaXvMCSAreaPriv *sAPriv = SAREAPTR(ctx); - int retFtx, lc; - - /* - * Try to grab the decoder. If it is not available we will sleep until - * it becomes available or for a maximum of 20 ms. - * Then try to grab it again, unless a timeout occured. If the decoder is - * available, the lock should be reasonably fast. - */ - - if (ctx->haveDecoder) { - flushXvMCLowLevel(ctx->xl); /* Ignore errors here. */ - - /*fprintf(stderr,"ViaXvMC: ERROR: Trying to re-lock decoder.\n"); */ - *hadLastLock = 1; - return 0; - } - UNICHROME_LOCK(ctx->fd, UNICHROME_LOCK_DECODER1, sAPriv, ctx->drmcontext, lc, - retFtx); - *hadLastLock = (ctx->drmcontext == lc); - - return retFtx; -} - -static void setupAttribDesc(Display *display, XvPortID port, - const ViaXvMCAttrHolder *attrib, - XvAttribute attribDesc[]) -{ - XvAttribute *XvAttribs,*curAD; - int num; - unsigned i,j; - - XLockDisplay(display); - XvAttribs = XvQueryPortAttributes(display, port, &num); - for(i=0; inumAttr; ++i) { - curAD = attribDesc + i; - curAD->flags = 0; - curAD->min_value = 0; - curAD->max_value = 0; - curAD->name = NULL; - for(j=0; jattributes[i].attribute == - XInternAtom(display,XvAttribs[j].name,TRUE)) { - *curAD = XvAttribs[j]; - curAD->name = strdup(XvAttribs[j].name); - break; - } - } - } - if (XvAttribs) XFree(XvAttribs); - XUnlockDisplay(display); - -} - -static void releaseAttribDesc(int numAttr, XvAttribute attribDesc[]) -{ - int i; - - for (i=0; iprivData; - - switch(pViaXvMC->resources) { - case context_drawHash: - driDestroyHashContents( pViaXvMC->drawHash ); - drmHashDestroy( pViaXvMC->drawHash ); - case context_lowLevel: - closeXvMCLowLevel(pViaXvMC->xl); - case context_mutex: - pthread_mutex_destroy(&pViaXvMC->ctxMutex); - case context_drmContext: - XLockDisplay(display); - uniDRIDestroyContext(display, pViaXvMC->screen, pViaXvMC->id); - XUnlockDisplay(display); - case context_sAreaMap: - numContexts--; - if (numContexts == 0) - drmUnmap(pViaXvMC->sAreaAddress,pViaXvMC->sAreaSize); - case context_fbMap: - if (numContexts == 0) - drmUnmap(pViaXvMC->fbAddress,pViaXvMC->fbSize); - case context_mmioMap: - if (numContexts == 0) - drmUnmap(pViaXvMC->mmioAddress,pViaXvMC->mmioSize); - case context_fd: - if (numContexts == 0) { - if (pViaXvMC->fd >= 0) - drmClose(pViaXvMC->fd); - } - pViaXvMC->fd = -1; - case context_driConnection: - if (numContexts == 0) { - XLockDisplay(display); - uniDRICloseConnection(display, pViaXvMC->screen); - XUnlockDisplay(display); - } - case context_context: - XLockDisplay(display); - _xvmc_destroy_context(display, context); - XUnlockDisplay(display); - if (!freePrivate) break; - default: - free(pViaXvMC); - } - return errType; -} - -Status XvMCCreateContext(Display *display, XvPortID port, - int surface_type_id, int width, int height, int flags, - XvMCContext *context) -{ - ViaXvMCContext *pViaXvMC; - int priv_count; - uint *priv_data; - uint magic; - unsigned i; - Status ret; - int major, minor; - ViaXvMCCreateContextRec *tmpComm; - drmVersionPtr drmVer; - char *curBusID; - int isCapable; - - /* - * Verify Obvious things first - */ - - if(context == NULL) { - return XvMCBadContext; - } - - if(!(flags & XVMC_DIRECT)) { - fprintf(stderr,"Indirect Rendering not supported! Using Direct.\n"); - } - - /* - *FIXME: Check $DISPLAY for legal values here - */ - - context->surface_type_id = surface_type_id; - context->width = (unsigned short)((width + 15) & ~15); - context->height = (unsigned short)((height + 15) & ~15); - context->flags = flags; - context->port = port; - - /* - * Width, Height, and flags are checked against surface_type_id - * and port for validity inside the X server, no need to check - * here. - */ - - /* Allocate private Context data */ - context->privData = (void *)malloc(sizeof(ViaXvMCContext)); - if(!context->privData) { - fprintf(stderr,"Unable to allocate resources for XvMC context.\n"); - return BadAlloc; - } - - pViaXvMC = (ViaXvMCContext *)context->privData; - pViaXvMC->resources = context_none; - - /* Verify the XvMC extension exists */ - - XLockDisplay(display); - if(! XvMCQueryExtension(display, &event_base, - &error_base)) { - fprintf(stderr,"XvMC Extension is not available!\n"); - free(pViaXvMC); - XUnlockDisplay(display); - return BadAlloc; - } - - /* Verify XvMC version */ - ret = XvMCQueryVersion(display, &major, &minor); - if(ret) { - fprintf(stderr,"XvMCQuery Version Failed, unable to determine " - "protocol version!\n"); - } - XUnlockDisplay(display); - - /* FIXME: Check Major and Minor here */ - - XLockDisplay(display); - if((ret = _xvmc_create_context(display, context, &priv_count, - &priv_data))) { - XUnlockDisplay(display); - fprintf(stderr,"Unable to create XvMC Context.\n"); - return releaseContextResources(display, context, 1, BadAlloc); - } - XUnlockDisplay(display); - - /* - * Check size and version of returned data. - */ - - tmpComm = ( ViaXvMCCreateContextRec *) priv_data; - if(priv_count != (sizeof(ViaXvMCCreateContextRec) >> 2)) { - fprintf(stderr,"_xvmc_create_context() returned incorrect " - "data size!\n"); - fprintf(stderr,"\tExpected %d, got %d\n", - (int) (sizeof(ViaXvMCCreateContextRec) >> 2), - (int) priv_count); - XFree(priv_data); - return releaseContextResources(display, context, 1, BadAlloc); - } - pViaXvMC->resources = context_context; - - if ((tmpComm->major != VIAXVMC_MAJOR) || - (tmpComm->minor != VIAXVMC_MINOR)) { - fprintf(stderr,"Version mismatch between the X via driver\n" - "and the XvMC library. Cannot continue!\n"); - XFree(priv_data); - return releaseContextResources(display, context, 1, BadAlloc); - } - - pViaXvMC->ctxNo = tmpComm->ctxNo; - pViaXvMC->fbOffset = tmpComm->fbOffset; - pViaXvMC->fbSize = tmpComm->fbSize; - pViaXvMC->mmioOffset = tmpComm->mmioOffset; - pViaXvMC->mmioSize = tmpComm->mmioSize; - pViaXvMC->sAreaSize = tmpComm->sAreaSize; - pViaXvMC->sAreaPrivOffset = tmpComm->sAreaPrivOffset; - pViaXvMC->decoderOn = 0; - pViaXvMC->xvMCPort = tmpComm->xvmc_port; - pViaXvMC->useAGP = tmpComm->useAGP; - pViaXvMC->attrib = tmpComm->initAttrs; - pViaXvMC->screen = tmpComm->screen; - pViaXvMC->depth = tmpComm->depth; - pViaXvMC->stride = tmpComm->stride; - pViaXvMC->chipId = tmpComm->chipId; - - /* - * Must free the private data we were passed from X - */ - - XFree(priv_data); - - /* - * Check for direct rendering capable, establish DRI and DRM connections, - * map framebuffer, DRI shared area and read-only register areas. - * Initial checking for drm has already been done by the server. - * Only do this for the first context we create. - */ - - if (numContexts == 0) { - XLockDisplay(display); - ret = uniDRIQueryDirectRenderingCapable(display, pViaXvMC->screen, &isCapable); - if (!ret || !isCapable) { - XUnlockDisplay(display); - fprintf(stderr,"Direct Rendering is not available on this system!\n"); - return releaseContextResources(display, context, 1, BadAlloc); - } - - if (!uniDRIOpenConnection(display, pViaXvMC->screen, &pViaXvMC->sAreaOffset, - &curBusID)) { - XUnlockDisplay(display); - fprintf(stderr,"Could not open DRI connection to X server!\n"); - return releaseContextResources(display, context, 1, BadAlloc); - } - XUnlockDisplay(display); - - strncpy(pViaXvMC->busIdString,curBusID,20); - pViaXvMC->busIdString[20] = '\0'; - XFree(curBusID); - - pViaXvMC->resources = context_driConnection; - - if((pViaXvMC->fd = drmOpen("via",pViaXvMC->busIdString)) < 0) { - fprintf(stderr,"DRM Device for via could not be opened.\n"); - return releaseContextResources(display, context, 1, BadAlloc); - } - globalFD = pViaXvMC->fd; - pViaXvMC->resources = context_fd; - - if (NULL == (drmVer = drmGetVersion(pViaXvMC->fd))) { - fprintf(stderr, - "viaXvMC: Could not get drm version."); - return releaseContextResources(display, context, 1, BadAlloc); - } - if (((drmVer->version_major != 2 ) || (drmVer->version_minor < 0))) { - fprintf(stderr, - "viaXvMC: Kernel drm is not compatible with XvMC.\n"); - fprintf(stderr, - "viaXvMC: Kernel drm version: %d.%d.%d " - "and I need at least version 2.0.0.\n" - "Please update.\n", - drmVer->version_major,drmVer->version_minor, - drmVer->version_patchlevel); - drmFreeVersion(drmVer); - return releaseContextResources(display, context, 1, BadAlloc); - } - drmFreeVersion(drmVer); - drmGetMagic(pViaXvMC->fd,&magic); - - XLockDisplay(display); - if (!uniDRIAuthConnection(display, pViaXvMC->screen, magic)) { - XUnlockDisplay(display); - fprintf(stderr, "viaXvMC: X server did not allow DRI. Check permissions.\n"); - XFree(priv_data); - return releaseContextResources(display, context, 1, BadAlloc); - } - XUnlockDisplay(display); - - /* - * Map the register memory - */ - - if(drmMap(pViaXvMC->fd,pViaXvMC->mmioOffset, - pViaXvMC->mmioSize,&mmioAddress) < 0) { - fprintf(stderr,"Unable to map the display chip mmio registers.\n"); - return releaseContextResources(display, context, 1, BadAlloc); - } - pViaXvMC->mmioAddress = mmioAddress; - pViaXvMC->resources = context_mmioMap; - - /* - * Map Framebuffer memory - */ - - if(drmMap(pViaXvMC->fd,pViaXvMC->fbOffset, - pViaXvMC->fbSize,&fbAddress) < 0) { - fprintf(stderr,"Unable to map XvMC Framebuffer.\n"); - return releaseContextResources(display, context, 1, BadAlloc); - } - pViaXvMC->fbAddress = fbAddress; - pViaXvMC->resources = context_fbMap; - - - /* - * Map DRI Sarea. - */ - - if(drmMap(pViaXvMC->fd,pViaXvMC->sAreaOffset, - pViaXvMC->sAreaSize,&sAreaAddress) < 0) { - fprintf(stderr,"Unable to map DRI SAREA.\n"); - return releaseContextResources(display, context, 1, BadAlloc); - } - } else { - pViaXvMC->fd = globalFD; - pViaXvMC->mmioAddress = mmioAddress; - pViaXvMC->fbAddress = fbAddress; - } - - pViaXvMC->sAreaAddress = sAreaAddress; - pViaXvMC->resources = context_sAreaMap; - numContexts++; - - /* - * Find a matching visual. Important only for direct drawing to the visible - * frame-buffer. - */ - - XLockDisplay(display); - ret = XMatchVisualInfo(display, pViaXvMC->screen, - (pViaXvMC->depth == 32) ? 24 : pViaXvMC->depth, TrueColor, - &pViaXvMC->visualInfo); - XUnlockDisplay(display); - if (!ret) { - fprintf(stderr, "viaXvMC: Could not find a matching TrueColor visual.\n"); - return releaseContextResources(display, context, 1, BadAlloc); - } - - if (!uniDRICreateContext(display, pViaXvMC->screen, pViaXvMC->visualInfo.visual, - &pViaXvMC->id, &pViaXvMC->drmcontext)) { - - fprintf(stderr, "viaXvMC: Could not create DRI context.\n"); - return releaseContextResources(display, context, 1, BadAlloc); - } - - pViaXvMC->resources = context_drmContext; - - for (i=0; irendSurf[i] = 0; - } - pViaXvMC->lastSrfDisplaying = ~0; - setupAttribDesc(display, port, &pViaXvMC->attrib, pViaXvMC->attribDesc); - - pViaXvMC->hwLock = (drmLockPtr) pViaXvMC->sAreaAddress; - defaultQMatrices(pViaXvMC); - pViaXvMC->chromaIntraLoaded = 1; - pViaXvMC->chromaNonIntraLoaded = 1; - pViaXvMC->yStride = (width + 31) & ~31; - pViaXvMC->haveDecoder = 0; - pViaXvMC->attribChanged = 1; - pViaXvMC->haveXv = 0; - pViaXvMC->port = context->port; - pthread_mutex_init(&pViaXvMC->ctxMutex,NULL); - pViaXvMC->resources = context_mutex; - pViaXvMC->timeStamp = 0; - setRegion(0,0,-1,-1,pViaXvMC->sRegion); - setRegion(0,0,-1,-1,pViaXvMC->dRegion); - - if (NULL == (pViaXvMC->xl = - initXvMCLowLevel(pViaXvMC->fd, &pViaXvMC->drmcontext, - pViaXvMC->hwLock, pViaXvMC->mmioAddress, - pViaXvMC->fbAddress, pViaXvMC->stride, pViaXvMC->depth, - context->width, context->height, - pViaXvMC->useAGP, pViaXvMC->chipId))) { - - fprintf(stderr,"ViaXvMC: Could not allocate timestamp blit area.\n"); - return releaseContextResources(display, context, 1, BadAlloc); - } - pViaXvMC->resources = context_lowLevel; - setAGPSyncLowLevel(pViaXvMC->xl, 1, 0); - - if (NULL == (pViaXvMC->drawHash = drmHashCreate())) { - fprintf(stderr,"ViaXvMC: Could not allocate drawable hash table.\n"); - return releaseContextResources(display, context, 1, BadAlloc); - } - pViaXvMC->resources = context_drawHash; - - - if (numContexts == 1) { - hwlLock(pViaXvMC->xl,1); - setLowLevelLocking(pViaXvMC->xl,0); - viaVideoSubPictureOffLocked(pViaXvMC->xl); - flushXvMCLowLevel(pViaXvMC->xl); - setLowLevelLocking(pViaXvMC->xl,1); - hwlUnlock(pViaXvMC->xl,1); - } - - return Success; -} - - -Status XvMCDestroyContext(Display *display, XvMCContext *context) -{ - ViaXvMCContext *pViaXvMC; - - - if(context == NULL) { - return (error_base + XvMCBadContext); - } - if(NULL == (pViaXvMC = context->privData)) { - return (error_base + XvMCBadContext); - } - - /* - * Release decoder if we have it. In case of crash or termination - * before XvMCDestroyContext, the X server will take care of this. - */ - - releaseAttribDesc(pViaXvMC->attrib.numAttr,pViaXvMC->attribDesc); - releaseDecoder(pViaXvMC,1); - return releaseContextResources(display, context, 1, Success); -} - -Status XvMCCreateSurface( Display *display, XvMCContext *context, - XvMCSurface *surface) -{ - ViaXvMCContext *pViaXvMC; - ViaXvMCSurface *pViaSurface; - int priv_count; - unsigned *priv_data; - unsigned i; - Status ret; - - if((surface == NULL) || (context == NULL) || (display == NULL)){ - return BadValue; - } - - pViaXvMC = (ViaXvMCContext *)context->privData; - ppthread_mutex_lock( &pViaXvMC->ctxMutex ); - - if(pViaXvMC == NULL) { - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return (error_base + XvMCBadContext); - } - - pViaSurface = surface->privData = (ViaXvMCSurface *)malloc(sizeof(ViaXvMCSurface)); - if(!surface->privData) { - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return BadAlloc; - } - XLockDisplay(display); - if((ret = _xvmc_create_surface(display, context, surface, - &priv_count, &priv_data))) { - XUnlockDisplay(display); - free(pViaSurface); - fprintf(stderr,"Unable to create XvMC Surface.\n"); - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return ret; - } - XUnlockDisplay(display); - - pViaSurface->srfNo = priv_data[0]; - - /* - * Store framebuffer offsets to the buffers allocated for this surface. - * For some chipset revisions, surfaces may be double-buffered. - */ - - pViaSurface->numBuffers = priv_data[1]; - for (i=0; i < pViaSurface->numBuffers; ++i) { - pViaSurface->offsets[i] = priv_data[i+2]; - } - pViaSurface->curBuf = 0; - - - /* Free data returned from xvmc_create_surface */ - - XFree(priv_data); - - pViaSurface->width = context->width; - pViaSurface->height = context->height; - pViaSurface->yStride = pViaXvMC->yStride; - pViaSurface->privContext = pViaXvMC; - pViaSurface->privSubPic = NULL; - pViaSurface->needsSync = 0; - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return Success; -} - -Status XvMCDestroySurface(Display *display, XvMCSurface *surface) -{ - ViaXvMCSurface *pViaSurface; - - if((display == NULL) || (surface == NULL)) { - return BadValue; - } - if(surface->privData == NULL) { - return (error_base + XvMCBadSurface); - } - - pViaSurface = (ViaXvMCSurface *)surface->privData; - - XLockDisplay(display); - _xvmc_destroy_surface(display,surface); - XUnlockDisplay(display); - - free(pViaSurface); - surface->privData = NULL; - return Success; -} - -Status XvMCPutSlice2(Display *display,XvMCContext *context, char *slice, - int nBytes, int sliceCode) -{ - ViaXvMCContext *pViaXvMC; - CARD32 sCode = 0x00010000 | (sliceCode & 0xFF) << 24; - - if((display == NULL) || (context == NULL)) { - return BadValue; - } - if(NULL == (pViaXvMC = context->privData)) { - return (error_base + XvMCBadContext); - } - ppthread_mutex_lock( &pViaXvMC->ctxMutex ); - if (!pViaXvMC->haveDecoder) { - fprintf(stderr,"XvMCPutSlice: This context does not own decoder!\n"); - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return BadAlloc; - } - - viaMpegWriteSlice(pViaXvMC->xl, (CARD8 *)slice, nBytes, sCode); - - flushPCIXvMCLowLevel(pViaXvMC->xl); - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return Success; -} - -Status XvMCPutSlice(Display *display,XvMCContext *context, char *slice, - int nBytes) -{ - ViaXvMCContext *pViaXvMC; - - if((display == NULL) || (context == NULL)) { - return BadValue; - } - if(NULL == (pViaXvMC = context->privData)) { - return (error_base + XvMCBadContext); - } - ppthread_mutex_lock( &pViaXvMC->ctxMutex ); - - if (!pViaXvMC->haveDecoder) { - fprintf(stderr,"XvMCPutSlice: This context does not own decoder!\n"); - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return BadAlloc; - } - - viaMpegWriteSlice(pViaXvMC->xl, (CARD8 *)slice, nBytes, 0); - flushPCIXvMCLowLevel(pViaXvMC->xl); - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return Success; -} - - -static Status updateXVOverlay(Display *display,ViaXvMCContext *pViaXvMC, - ViaXvMCSurface *pViaSurface, Drawable draw, - short srcx, short srcy, unsigned short srcw, - unsigned short srch,short destx,short desty, - unsigned short destw,unsigned short desth) -{ - ViaXvMCCommandBuffer buf; - ViaXvMCSubPicture *pViaSubPic; - Status ret; - - if (!pViaXvMC->haveXv) { - pViaXvMC->xvImage = - XvCreateImage(display,pViaXvMC->port,FOURCC_XVMC, - (char *)&buf,pViaSurface->width, - pViaSurface->height); - pViaXvMC->gc = XCreateGC(display,draw,0,0); - pViaXvMC->haveXv = 1; - } - pViaXvMC->draw = draw; - pViaXvMC->xvImage->data = (char *)&buf; - - buf.command = (pViaXvMC->attribChanged) ? - VIA_XVMC_COMMAND_FDISPLAY : VIA_XVMC_COMMAND_DISPLAY; - buf.ctxNo = pViaXvMC->ctxNo | VIA_XVMC_VALID; - buf.srfNo = pViaSurface->srfNo | VIA_XVMC_VALID; - pViaSubPic = pViaSurface->privSubPic; - buf.subPicNo = ((NULL == pViaSubPic) ? 0 : pViaSubPic->srfNo ) - | VIA_XVMC_VALID; - buf.attrib = pViaXvMC->attrib; - - XLockDisplay(display); - - if ((ret = XvPutImage(display,pViaXvMC->port,draw,pViaXvMC->gc, - pViaXvMC->xvImage,srcx,srcy,srcw,srch, - destx,desty,destw,desth))) { - XUnlockDisplay(display); - return ret; - } - XSync(display, 0); - XUnlockDisplay(display); - pViaXvMC->attribChanged = 0; - return Success; -} - - -Status XvMCPutSurface(Display *display,XvMCSurface *surface,Drawable draw, - short srcx, short srcy, unsigned short srcw, - unsigned short srch,short destx,short desty, - unsigned short destw,unsigned short desth, int flags) -{ - /* - * This function contains some hairy locking logic. What we really want to - * do is to flip the picture ASAP, to get a low latency and smooth playback. - * However, if somebody else used the overlay since we used it last or if it is - * our first time, we'll have to call X to update the overlay first. Otherwise - * we'll do the overlay update once we've flipped. Since we release the hardware - * lock when we call X, X needs to verify using the SAREA that nobody else flipped - * in a picture between the lock release and the X server control. Similarly - * when the overlay update returns, we have to make sure that we still own the - * overlay. - */ - - ViaXvMCSurface *pViaSurface; - ViaXvMCContext *pViaXvMC; - ViaXvMCSubPicture *pViaSubPic; - volatile ViaXvMCSAreaPriv *sAPriv; - Status ret; - unsigned dispSurface, lastSurface; - int overlayUpdated; - drawableInfo *drawInfo; - XvMCRegion sReg, dReg; - Bool forceUpdate = FALSE; - - if((display == NULL) || (surface == NULL)) { - return BadValue; - } - if(NULL == (pViaSurface = surface->privData )) { - return (error_base + XvMCBadSurface); - } - if (NULL == (pViaXvMC = pViaSurface->privContext)) { - return (error_base + XvMCBadContext); - } - - ppthread_mutex_lock( &pViaXvMC->ctxMutex ); - pViaSubPic = pViaSurface->privSubPic; - sAPriv = SAREAPTR( pViaXvMC ); - - setRegion(srcx, srcy, srcw, srch, sReg); - setRegion(destx, desty, destw, desth, dReg); - - - if ((!regionEqual(sReg, pViaXvMC->sRegion)) || - (!regionEqual(dReg, pViaXvMC->dRegion))) { - - /* - * Force update of the video overlay to match the new format. - */ - - pViaXvMC->sRegion = sReg; - pViaXvMC->dRegion = dReg; - forceUpdate = TRUE; - } - - - hwlLock(pViaXvMC->xl,1); - - if (getDRIDrawableInfoLocked(pViaXvMC->drawHash, display, pViaXvMC->screen, draw, 0, - pViaXvMC->fd, pViaXvMC->drmcontext, pViaXvMC->sAreaAddress, - FALSE, &drawInfo, sizeof(*drawInfo))) { - - hwlUnlock(pViaXvMC->xl,1); - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return BadAccess; - } - - setLowLevelLocking(pViaXvMC->xl,0); - - - /* - * Put a surface ID in the SAREA to "authenticate" to the - * X server. - */ - - dispSurface = sAPriv->XvMCDisplaying[pViaXvMC->xvMCPort]; - lastSurface = pViaXvMC->lastSrfDisplaying; - sAPriv->XvMCDisplaying[pViaXvMC->xvMCPort] = - pViaXvMC->lastSrfDisplaying = pViaSurface->srfNo | VIA_XVMC_VALID; - overlayUpdated = 0; - - viaVideoSetSWFLipLocked(pViaXvMC->xl, yOffs(pViaSurface), uOffs(pViaSurface), - vOffs(pViaSurface), pViaSurface->yStride, pViaSurface->yStride >> 1); - - while ((lastSurface != dispSurface) || forceUpdate) { - - forceUpdate = FALSE; - flushPCIXvMCLowLevel(pViaXvMC->xl); - setLowLevelLocking(pViaXvMC->xl,1); - hwlUnlock(pViaXvMC->xl,1); - - /* - * We weren't the last to display. Update the overlay before flipping. - */ - - ret = updateXVOverlay(display,pViaXvMC,pViaSurface,draw,srcx,srcy,srcw, - srch,destx,desty,destw,desth); - if (ret) { - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return ret; - } - - hwlLock(pViaXvMC->xl,1); - - if (getDRIDrawableInfoLocked(pViaXvMC->drawHash, display, pViaXvMC->screen, draw, 0, - pViaXvMC->fd, pViaXvMC->drmcontext, pViaXvMC->sAreaAddress, - FALSE, &drawInfo, sizeof(*drawInfo))) { - - hwlUnlock(pViaXvMC->xl,1); - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return BadAccess; - } - - setLowLevelLocking(pViaXvMC->xl,0); - lastSurface = pViaSurface->srfNo | VIA_XVMC_VALID; - dispSurface = sAPriv->XvMCDisplaying[pViaXvMC->xvMCPort]; - overlayUpdated = 1; - } - - - /* - * Subpictures - */ - - if (NULL != pViaSubPic) { - if (sAPriv->XvMCSubPicOn[pViaXvMC->xvMCPort] - != (pViaSubPic->srfNo | VIA_XVMC_VALID)) { - sAPriv->XvMCSubPicOn[pViaXvMC->xvMCPort] = - pViaSubPic->srfNo | VIA_XVMC_VALID; - viaVideoSubPictureLocked(pViaXvMC->xl, pViaSubPic); - } - } else { - if (sAPriv->XvMCSubPicOn[pViaXvMC->xvMCPort] & VIA_XVMC_VALID) { - viaVideoSubPictureOffLocked(pViaXvMC->xl); - sAPriv->XvMCSubPicOn[pViaXvMC->xvMCPort] &= ~VIA_XVMC_VALID; - } - } - - /* - * Flip - */ - - viaVideoSWFlipLocked(pViaXvMC->xl, flags, pViaSurface->progressiveSequence); - flushXvMCLowLevel(pViaXvMC->xl); - - setLowLevelLocking(pViaXvMC->xl,1); - hwlUnlock(pViaXvMC->xl,1); - - if (overlayUpdated || !drawInfo->touched ) { - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return Success; - } - - /* - * Update overlay - */ - - ret = updateXVOverlay(display,pViaXvMC,pViaSurface,draw,srcx,srcy,srcw, - srch,destx,desty,destw,desth); - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return ret; - -} - -Status XvMCBeginSurface(Display *display, - XvMCContext *context, - XvMCSurface *target_surface, - XvMCSurface *past_surface, - XvMCSurface *future_surface, - const XvMCMpegControl *control) -{ - ViaXvMCSurface *targS,*futS,*pastS; - ViaXvMCContext *pViaXvMC; - int hadDecoderLast; - CARD32 timeStamp; - - if((display == NULL) || (context == NULL) || (target_surface == NULL)) { - return BadValue; - } - - pViaXvMC = context->privData; - - ppthread_mutex_lock( &pViaXvMC->ctxMutex ); - if (grabDecoder(pViaXvMC, &hadDecoderLast)) { - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return BadAlloc; - } - pViaXvMC->haveDecoder = 1; - - /* - * We need to wait for decoder idle at next flush, since hardware doesn't queue - * beginsurface requests until the decoder is idle. This is - * done by waiting on the last previous timestamp, or if there was another context - * having the decoder before us, by emitting a new one. - */ - - if (pViaXvMC->useAGP) { - if (!hadDecoderLast || pViaXvMC->timeStamp == 0) { - timeStamp = viaDMATimeStampLowLevel(pViaXvMC->xl); - if (flushXvMCLowLevel(pViaXvMC->xl)) { - releaseDecoder(pViaXvMC, 0); - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return BadAlloc; - } - pViaXvMC->timeStamp = timeStamp; - } else { - timeStamp = pViaXvMC->timeStamp; - } - setAGPSyncLowLevel(pViaXvMC->xl, 1, timeStamp); - } - - if (!hadDecoderLast || !pViaXvMC->decoderOn) { - pViaXvMC->intraLoaded = 0; - pViaXvMC->nonIntraLoaded = 0; - } - - viaMpegReset(pViaXvMC->xl); - - targS = (ViaXvMCSurface *)target_surface->privData; - futS = NULL; - pastS = NULL; - - - pViaXvMC->rendSurf[0] = targS->srfNo | VIA_XVMC_VALID; - if (future_surface) { - futS = (ViaXvMCSurface *)future_surface->privData; - futS->needsSync = 0; - } - if (past_surface) { - pastS = (ViaXvMCSurface *)past_surface->privData; - pastS->needsSync = 0; - } - - - targS->progressiveSequence = (control->flags & XVMC_PROGRESSIVE_SEQUENCE); - targS->topFieldFirst = (control->flags & XVMC_TOP_FIELD_FIRST); - targS->privSubPic = NULL; - - viaMpegSetSurfaceStride(pViaXvMC->xl,pViaXvMC); - - viaMpegSetFB(pViaXvMC->xl,0,yOffs(targS),uOffs(targS),vOffs(targS)); - if (past_surface) { - viaMpegSetFB(pViaXvMC->xl,1,yOffs(pastS),uOffs(pastS),vOffs(pastS)); - } else { - viaMpegSetFB(pViaXvMC->xl,1,0,0,0); - } - - if (future_surface) { - viaMpegSetFB(pViaXvMC->xl,2,yOffs(futS),uOffs(futS),vOffs(futS)); - } else { - viaMpegSetFB(pViaXvMC->xl,2,0,0,0); - } - - viaMpegBeginPicture(pViaXvMC->xl,pViaXvMC,context->width,context->height,control); - flushPCIXvMCLowLevel(pViaXvMC->xl); - targS->needsSync = 1; - targS->syncMode = LL_MODE_DECODER_IDLE; - pViaXvMC->decoderOn = 1; - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return Success; -} - - -Status XvMCSyncSurface(Display *display,XvMCSurface *surface) -{ - ViaXvMCSurface *pViaSurface; - ViaXvMCContext *pViaXvMC; - unsigned i; - - if((display == NULL) || (surface == NULL)) { - return BadValue; - } - if(surface->privData == NULL) { - return (error_base + XvMCBadSurface); - } - - pViaSurface = (ViaXvMCSurface *)surface->privData; - pViaXvMC = pViaSurface->privContext; - - if(pViaXvMC == NULL) { - return (error_base + XvMCBadSurface); - } - - ppthread_mutex_lock( &pViaXvMC->ctxMutex ); - - if (pViaSurface->needsSync) { - CARD32 timeStamp = pViaSurface->timeStamp; - int syncMode = pViaSurface->syncMode; - - if (pViaXvMC->useAGP) { - - syncMode = (pViaSurface->syncMode == LL_MODE_2D || - pViaSurface->timeStamp < pViaXvMC->timeStamp) ? - LL_MODE_2D : LL_MODE_DECODER_IDLE; - if (pViaSurface->syncMode != LL_MODE_2D) - timeStamp = pViaXvMC->timeStamp; - - } else if (syncMode != LL_MODE_2D && - pViaXvMC->rendSurf[0] != (pViaSurface->srfNo | VIA_XVMC_VALID)) { - - pViaSurface->needsSync = 0; - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return Success; - } - - if (syncXvMCLowLevel(pViaXvMC->xl, syncMode, 1, - pViaSurface->timeStamp)) { - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return BadValue; - } - pViaSurface->needsSync = 0; - } - - if (pViaXvMC->rendSurf[0] == (pViaSurface->srfNo | VIA_XVMC_VALID)) { - pViaSurface->needsSync = 0; - for (i=0; irendSurf[i] = 0; - } - } - - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return Success; -} - -Status XvMCLoadQMatrix(Display *display, XvMCContext *context, - const XvMCQMatrix *qmx) -{ - ViaXvMCContext - *pViaXvMC; - - if((display == NULL) || (context == NULL)) { - return BadValue; - } - if(NULL == (pViaXvMC = context->privData)) { - return (error_base + XvMCBadContext); - } - - ppthread_mutex_lock( &pViaXvMC->ctxMutex ); - if (qmx->load_intra_quantiser_matrix) { - memcpy(pViaXvMC->intra_quantiser_matrix, - qmx->intra_quantiser_matrix, - sizeof(qmx->intra_quantiser_matrix)); - pViaXvMC->intraLoaded = 0; - } - - if (qmx->load_non_intra_quantiser_matrix) { - memcpy(pViaXvMC->non_intra_quantiser_matrix, - qmx->non_intra_quantiser_matrix, - sizeof(qmx->non_intra_quantiser_matrix)); - pViaXvMC->nonIntraLoaded = 0; - } - - if (qmx->load_chroma_intra_quantiser_matrix) { - memcpy(pViaXvMC->chroma_intra_quantiser_matrix, - qmx->chroma_intra_quantiser_matrix, - sizeof(qmx->chroma_intra_quantiser_matrix)); - pViaXvMC->chromaIntraLoaded = 0; - } - - if (qmx->load_chroma_non_intra_quantiser_matrix) { - memcpy(pViaXvMC->chroma_non_intra_quantiser_matrix, - qmx->chroma_non_intra_quantiser_matrix, - sizeof(qmx->chroma_non_intra_quantiser_matrix)); - pViaXvMC->chromaNonIntraLoaded = 0; - } - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - - return Success; -} - -/* - * Below, we provide functions unusable for this implementation, but for - * standard completeness. - */ - - -Status XvMCRenderSurface -( - Display *display, - XvMCContext *context, - unsigned int picture_structure, - XvMCSurface *target_surface, - XvMCSurface *past_surface, - XvMCSurface *future_surface, - unsigned int flags, - unsigned int num_macroblocks, - unsigned int first_macroblock, - XvMCMacroBlockArray *macroblock_array, - XvMCBlockArray *blocks - ) -{ - return (error_base + XvMCBadContext); -} - -Status XvMCCreateBlocks -( - Display *display, - XvMCContext *context, - unsigned int num_blocks, - XvMCBlockArray * block - ) -{ - return (error_base + XvMCBadContext); -} - -Status XvMCDestroyBlocks (Display *display, XvMCBlockArray * block) -{ - return Success; -} - -Status XvMCCreateMacroBlocks -( - Display *display, - XvMCContext *context, - unsigned int num_blocks, - XvMCMacroBlockArray * blocks - ) -{ - return (error_base + XvMCBadContext); -} - -Status XvMCDestroyMacroBlocks(Display *display, XvMCMacroBlockArray * block) -{ - return (error_base + XvMCBadContext); -} - -Status XvMCCreateSubpicture( Display *display, - XvMCContext *context, - XvMCSubpicture *subpicture, - unsigned short width, - unsigned short height, - int xvimage_id) -{ - ViaXvMCContext *pViaXvMC; - ViaXvMCSubPicture *pViaSubPic; - int priv_count; - unsigned *priv_data; - Status ret; - - if((subpicture == NULL) || (context == NULL) || (display == NULL)){ - return BadValue; - } - - pViaXvMC = (ViaXvMCContext *)context->privData; - if(pViaXvMC == NULL) { - return (error_base + XvMCBadContext); - } - - subpicture->privData = (ViaXvMCSubPicture *) - malloc(sizeof(ViaXvMCSubPicture)); - if(!subpicture->privData) { - return BadAlloc; - } - - ppthread_mutex_lock( &pViaXvMC->ctxMutex ); - subpicture->width = context->width; - subpicture->height = context->height; - subpicture->xvimage_id = xvimage_id; - pViaSubPic = (ViaXvMCSubPicture *)subpicture->privData; - - XLockDisplay(display); - if((ret = _xvmc_create_subpicture(display, context, subpicture, - &priv_count, &priv_data))) { - XUnlockDisplay(display); - free(pViaSubPic); - fprintf(stderr,"Unable to create XvMC Subpicture.\n"); - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return ret; - } - XUnlockDisplay(display); - - - subpicture->num_palette_entries = VIA_SUBPIC_PALETTE_SIZE; - subpicture->entry_bytes = 3; - strncpy(subpicture->component_order,"YUV",4); - pViaSubPic->srfNo = priv_data[0]; - pViaSubPic->offset = priv_data[1]; - pViaSubPic->stride = (subpicture->width + 31) & ~31; - pViaSubPic->privContext = pViaXvMC; - pViaSubPic->ia44 = (xvimage_id == FOURCC_IA44); - pViaSubPic->needsSync = 0; - - /* Free data returned from _xvmc_create_subpicture */ - - XFree(priv_data); - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return Success; -} - -Status -XvMCSetSubpicturePalette (Display *display, XvMCSubpicture *subpicture, - unsigned char *palette) -{ - ViaXvMCSubPicture *pViaSubPic; - ViaXvMCContext *pViaXvMC; - volatile ViaXvMCSAreaPriv *sAPriv; - unsigned i; - CARD32 tmp; - - if((subpicture == NULL) || (display == NULL)){ - return BadValue; - } - if(subpicture->privData == NULL) { - return (error_base + XvMCBadSubpicture); - } - pViaSubPic = (ViaXvMCSubPicture *) subpicture->privData; - for (i=0; i < VIA_SUBPIC_PALETTE_SIZE; ++i) { - tmp = *palette++ << 8; - tmp |= *palette++ << 16; - tmp |= *palette++ << 24; - tmp |= ((i & 0x0f) << 4) | 0x07; - pViaSubPic->palette[i] = tmp; - } - - pViaXvMC = pViaSubPic->privContext; - ppthread_mutex_lock( &pViaXvMC->ctxMutex ); - sAPriv = SAREAPTR( pViaXvMC ); - hwlLock(pViaXvMC->xl,1); - setLowLevelLocking(pViaXvMC->xl,0); - - /* - * If the subpicture is displaying, Immeadiately update it with the - * new palette. - */ - - if (sAPriv->XvMCSubPicOn[pViaXvMC->xvMCPort] == - (pViaSubPic->srfNo | VIA_XVMC_VALID)) { - viaVideoSubPictureLocked(pViaXvMC->xl,pViaSubPic); - } - flushPCIXvMCLowLevel(pViaXvMC->xl); - setLowLevelLocking(pViaXvMC->xl,1); - hwlUnlock(pViaXvMC->xl,1); - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return Success; -} - - -static int findOverlap(unsigned width,unsigned height, - short *dstX, short *dstY, - short *srcX, short *srcY, - unsigned short *areaW, unsigned short *areaH) -{ - int - w,h; - unsigned - mWidth,mHeight; - - w = *areaW; - h = *areaH; - - if ((*dstX >= width) || (*dstY >= height)) - return 1; - if (*dstX < 0) { - w += *dstX; - *srcX -= *dstX; - *dstX = 0; - } - if (*dstY < 0) { - h += *dstY; - *srcY -= *dstY; - *dstY = 0; - } - if ((w <= 0) || ((h <= 0))) - return 1; - mWidth = width - *dstX; - mHeight = height - *dstY; - *areaW = (w <= mWidth) ? w : mWidth; - *areaH = (h <= mHeight) ? h : mHeight; - return 0; -} - - - -Status XvMCClearSubpicture ( - Display *display, - XvMCSubpicture *subpicture, - short x, - short y, - unsigned short width, - unsigned short height, - unsigned int color - ) -{ - - ViaXvMCContext *pViaXvMC; - ViaXvMCSubPicture *pViaSubPic; - short dummyX,dummyY; - unsigned long bOffs; - - if((subpicture == NULL) || (display == NULL)) { - return BadValue; - } - if(subpicture->privData == NULL) { - return (error_base + XvMCBadSubpicture); - } - pViaSubPic = (ViaXvMCSubPicture *) subpicture->privData; - pViaXvMC = pViaSubPic->privContext; - ppthread_mutex_lock( &pViaXvMC->ctxMutex ); - - /* Clip clearing area so that it fits inside subpicture. */ - - if (findOverlap(subpicture->width, subpicture->height, &x, &y, - &dummyX, &dummyY, &width, &height)) { - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return Success; - } - - bOffs = pViaSubPic->offset + y*pViaSubPic->stride + x; - viaBlit(pViaXvMC->xl, 8, 0, pViaSubPic->stride, bOffs, pViaSubPic->stride, - width, height, 1, 1, VIABLIT_FILL, color); - pViaSubPic->needsSync = 1; - pViaSubPic->timeStamp = viaDMATimeStampLowLevel(pViaXvMC->xl); - if (flushXvMCLowLevel(pViaXvMC->xl)) { - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return BadValue; - } - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return Success; -} - -Status -XvMCCompositeSubpicture ( - Display *display, - XvMCSubpicture *subpicture, - XvImage *image, - short srcx, - short srcy, - unsigned short width, - unsigned short height, - short dstx, - short dsty - ) -{ - - unsigned i; - ViaXvMCContext *pViaXvMC; - ViaXvMCSubPicture *pViaSubPic; - CARD8 *dAddr, *sAddr; - - if((subpicture == NULL) || (display == NULL) || (image == NULL)){ - return BadValue; - } - if(NULL == (pViaSubPic = (ViaXvMCSubPicture *)subpicture->privData)) { - return (error_base + XvMCBadSubpicture); - } - - pViaXvMC = pViaSubPic->privContext; - - - if (image->id != subpicture->xvimage_id) - return BadMatch; - - ppthread_mutex_lock( &pViaXvMC->ctxMutex ); - - - /* - * Clip copy area so that it fits inside subpicture and image. - */ - - if (findOverlap(subpicture->width, subpicture->height, - &dstx, &dsty, &srcx, &srcy, &width, &height)) { - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return Success; - } - if (findOverlap(image->width, image->height, - &srcx, &srcy, &dstx, &dsty, &width, &height)) { - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return Success; - } - - if (pViaSubPic->needsSync) { - if (syncXvMCLowLevel(pViaXvMC->xl, LL_MODE_2D, 0, pViaSubPic->timeStamp)) { - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return BadValue; - } - pViaSubPic->needsSync = 0; - } - - for(i=0; ifbAddress) + - (pViaSubPic->offset + (dsty+i)*pViaSubPic->stride + dstx)); - sAddr = (((CARD8 *)image->data) + - (image->offsets[0] + (srcy+i)*image->pitches[0] + srcx)); - memcpy(dAddr,sAddr,width); - } - - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return Success; -} - - - -Status -XvMCBlendSubpicture ( - Display *display, - XvMCSurface *target_surface, - XvMCSubpicture *subpicture, - short subx, - short suby, - unsigned short subw, - unsigned short subh, - short surfx, - short surfy, - unsigned short surfw, - unsigned short surfh - ) -{ - ViaXvMCSurface *pViaSurface; - ViaXvMCSubPicture *pViaSubPic; - - if((display == NULL) || target_surface == NULL){ - return BadValue; - } - - if (subx || suby || surfx || surfy || - (subw != surfw) || (subh != surfh)) { - fprintf(stderr,"ViaXvMC: Only completely overlapping subpicture " - "supported.\n"); - return BadValue; - } - - if(NULL == (pViaSurface = target_surface->privData)) { - return (error_base + XvMCBadSurface); - } - - if (subpicture) { - - if(NULL == (pViaSubPic = subpicture->privData)) { - return (error_base + XvMCBadSubpicture); - } - - pViaSurface->privSubPic = pViaSubPic; - } else { - pViaSurface->privSubPic = NULL; - } - return Success; -} - -Status -XvMCBlendSubpicture2 ( - Display *display, - XvMCSurface *source_surface, - XvMCSurface *target_surface, - XvMCSubpicture *subpicture, - short subx, - short suby, - unsigned short subw, - unsigned short subh, - short surfx, - short surfy, - unsigned short surfw, - unsigned short surfh - ) -{ - ViaXvMCSurface *pViaSurface,*pViaSSurface; - ViaXvMCSubPicture *pViaSubPic; - ViaXvMCContext *pViaXvMC; - - unsigned width,height; - - if((display == NULL) || target_surface == NULL || source_surface == NULL){ - return BadValue; - } - - if (subx || suby || surfx || surfy || - (subw != surfw) || (subh != surfh)) { - fprintf(stderr,"ViaXvMC: Only completely overlapping subpicture " - "supported.\n"); - return BadMatch; - } - - if(NULL == (pViaSurface = target_surface->privData)) { - return (error_base + XvMCBadSurface); - } - - if(NULL == (pViaSSurface = source_surface->privData)) { - return (error_base + XvMCBadSurface); - } - pViaXvMC = pViaSurface->privContext; - width = pViaSSurface->width; - height = pViaSSurface->height; - if (width != pViaSurface->width || height != pViaSSurface->height) { - return BadMatch; - } - - if (XvMCSyncSurface(display,source_surface)) { - return BadValue; - } - - ppthread_mutex_lock( &pViaXvMC->ctxMutex ); - viaBlit(pViaXvMC->xl, 8, yOffs(pViaSSurface), pViaSSurface->yStride, - yOffs(pViaSurface), pViaSurface->yStride, - width, height, 1, 1, VIABLIT_COPY, 0); - flushPCIXvMCLowLevel(pViaXvMC->xl); - if (pViaXvMC->chipId != PCI_CHIP_VT3259) { - - /* - * YV12 Chroma blit. - */ - - viaBlit(pViaXvMC->xl, 8, uOffs(pViaSSurface), pViaSSurface->yStride >> 1, - uOffs(pViaSurface), pViaSurface->yStride >> 1, - width >> 1, height >> 1, 1, 1, VIABLIT_COPY, 0); - flushPCIXvMCLowLevel(pViaXvMC->xl); - viaBlit(pViaXvMC->xl, 8, vOffs(pViaSSurface), pViaSSurface->yStride >> 1, - vOffs(pViaSurface), pViaSurface->yStride >> 1, - width >> 1, height >> 1, 1, 1, VIABLIT_COPY, 0); - } else { - - /* - * NV12 Chroma blit. - */ - - viaBlit(pViaXvMC->xl, 8, vOffs(pViaSSurface), pViaSSurface->yStride, - vOffs(pViaSurface), pViaSurface->yStride, - width, height >> 1, 1, 1, VIABLIT_COPY, 0); - } - pViaSurface->needsSync = 1; - pViaSurface->syncMode = LL_MODE_2D; - pViaSurface->timeStamp = viaDMATimeStampLowLevel(pViaXvMC->xl); - if (flushXvMCLowLevel(pViaXvMC->xl)) { - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return BadValue; - } - if (subpicture) { - - if(NULL == (pViaSubPic = subpicture->privData)) { - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return (error_base + XvMCBadSubpicture); - } - - pViaSurface->privSubPic = pViaSubPic; - } else { - pViaSurface->privSubPic = NULL; - } - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return Success; -} - - -Status -XvMCSyncSubpicture (Display *display, XvMCSubpicture *subpicture) -{ - ViaXvMCSubPicture *pViaSubPic; - ViaXvMCContext *pViaXvMC; - Status retVal=0; - - if((display == NULL) || subpicture == NULL){ - return BadValue; - } - if(NULL == (pViaSubPic = subpicture->privData)) { - return (error_base + XvMCBadSubpicture); - } - - pViaXvMC = pViaSubPic->privContext; - ppthread_mutex_lock( &pViaXvMC->ctxMutex ); - if (pViaSubPic->needsSync) { - if (syncXvMCLowLevel(pViaXvMC->xl, LL_MODE_2D, - 0, pViaSubPic->timeStamp)) { - retVal = BadValue; - } - pViaSubPic->needsSync = 0; - } - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return retVal; -} - -Status -XvMCFlushSubpicture (Display *display, XvMCSubpicture *subpicture) -{ - ViaXvMCSubPicture *pViaSubPic; - - if((display == NULL) || subpicture == NULL){ - return BadValue; - } - if(NULL == (pViaSubPic = subpicture->privData)) { - return (error_base + XvMCBadSubpicture); - } - - return Success; -} - -Status -XvMCDestroySubpicture (Display *display, XvMCSubpicture *subpicture) -{ - ViaXvMCSubPicture *pViaSubPic; - ViaXvMCContext *pViaXvMC; - volatile ViaXvMCSAreaPriv *sAPriv; - - if((display == NULL) || subpicture == NULL){ - return BadValue; - } - if(NULL == (pViaSubPic = subpicture->privData)) { - return (error_base + XvMCBadSubpicture); - } - pViaXvMC = pViaSubPic->privContext; - ppthread_mutex_lock( &pViaXvMC->ctxMutex ); - - - sAPriv = SAREAPTR(pViaXvMC); - hwlLock(pViaXvMC->xl,1); - setLowLevelLocking(pViaXvMC->xl,0); - if (sAPriv->XvMCSubPicOn[pViaXvMC->xvMCPort] == - ( pViaSubPic->srfNo | VIA_XVMC_VALID )) { - viaVideoSubPictureOffLocked(pViaXvMC->xl); - sAPriv->XvMCSubPicOn[pViaXvMC->xvMCPort] = 0; - } - flushPCIXvMCLowLevel(pViaXvMC->xl); - setLowLevelLocking(pViaXvMC->xl,1); - hwlUnlock(pViaXvMC->xl,1); - - XLockDisplay(display); - _xvmc_destroy_subpicture(display,subpicture); - XUnlockDisplay(display); - - free(pViaSubPic); - subpicture->privData = NULL; - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - - return Success; -} - -Status -XvMCGetSubpictureStatus (Display *display, XvMCSubpicture *subpic, int *stat) -{ - ViaXvMCSubPicture *pViaSubPic; - ViaXvMCContext *pViaXvMC; - volatile ViaXvMCSAreaPriv *sAPriv; - - - if((display == NULL) || subpic == NULL){ - return BadValue; - } - if(NULL == (pViaSubPic = subpic->privData)) { - return (error_base + XvMCBadSubpicture); - } - if (stat) { - *stat = 0; - pViaXvMC = pViaSubPic->privContext; - sAPriv = SAREAPTR( pViaXvMC ); - if (sAPriv->XvMCSubPicOn[pViaXvMC->xvMCPort] == - (pViaSubPic->srfNo | VIA_XVMC_VALID)) - *stat |= XVMC_DISPLAYING; - } - return Success; -} - -Status -XvMCFlushSurface (Display *display, XvMCSurface *surface) -{ - ViaXvMCSurface *pViaSurface; - ViaXvMCContext *pViaXvMC; - Status ret; - - if((display == NULL) || surface == NULL){ - return BadValue; - } - if(NULL == (pViaSurface = surface->privData)) { - return (error_base + XvMCBadSurface); - } - - pViaXvMC = pViaSurface->privContext; - ppthread_mutex_lock( &pViaXvMC->ctxMutex ); - if (pViaSurface->needsSync) - pViaSurface->timeStamp = pViaXvMC->timeStamp = - viaDMATimeStampLowLevel(pViaXvMC->xl); - ret = (flushXvMCLowLevel(pViaXvMC->xl)) ? BadValue : Success; - if (pViaXvMC->rendSurf[0] == (pViaSurface->srfNo | VIA_XVMC_VALID)) { - hwlLock(pViaXvMC->xl,0); - pViaXvMC->haveDecoder = 0; - releaseDecoder(pViaXvMC, 0); - hwlUnlock(pViaXvMC->xl,0); - } - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return ret; -} - -Status -XvMCGetSurfaceStatus (Display *display, XvMCSurface *surface, int *stat) -{ - ViaXvMCSurface *pViaSurface; - ViaXvMCContext *pViaXvMC; - volatile ViaXvMCSAreaPriv *sAPriv; - unsigned i; - int ret = 0; - - if((display == NULL) || surface == NULL){ - return BadValue; - } - if(NULL == (pViaSurface = surface->privData)) { - return (error_base + XvMCBadSurface); - } - if (stat) { - *stat = 0; - pViaXvMC = pViaSurface->privContext; - ppthread_mutex_lock( &pViaXvMC->ctxMutex ); - sAPriv = SAREAPTR( pViaXvMC ); - if (sAPriv->XvMCDisplaying[pViaXvMC->xvMCPort] - == (pViaSurface->srfNo | VIA_XVMC_VALID)) - *stat |= XVMC_DISPLAYING; - for (i=0; irendSurf[i] == - (pViaSurface->srfNo | VIA_XVMC_VALID)) { - *stat |= XVMC_RENDERING; - break; - } - } - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - } - return ret; -} - -XvAttribute * -XvMCQueryAttributes ( - Display *display, - XvMCContext *context, - int *number - ) -{ - ViaXvMCContext *pViaXvMC; - XvAttribute *ret; - unsigned long siz; - - *number = 0; - if ((display == NULL) || (context == NULL)) { - return NULL; - } - - if (NULL == (pViaXvMC = context->privData)) { - return NULL; - } - - ppthread_mutex_lock( &pViaXvMC->ctxMutex ); - if (NULL != (ret = (XvAttribute *) - malloc(siz = VIA_NUM_XVMC_ATTRIBUTES*sizeof(XvAttribute)))) { - memcpy(ret,pViaXvMC->attribDesc,siz); - *number = VIA_NUM_XVMC_ATTRIBUTES; - } - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - - return ret; -} - -Status -XvMCSetAttribute ( - Display *display, - XvMCContext *context, - Atom attribute, - int value - ) -{ - int found; - unsigned i; - ViaXvMCContext *pViaXvMC; - ViaXvMCCommandBuffer buf; - - if ((display == NULL) || (context == NULL)) { - return (error_base + XvMCBadContext); - } - - if (NULL == (pViaXvMC = context->privData)) { - return (error_base + XvMCBadContext); - } - - ppthread_mutex_lock( &pViaXvMC->ctxMutex ); - - found = 0; - for (i=0; i < pViaXvMC->attrib.numAttr; ++i) { - if (attribute == pViaXvMC->attrib.attributes[i].attribute) { - if ((!(pViaXvMC->attribDesc[i].flags & XvSettable)) || - value < pViaXvMC->attribDesc[i].min_value || - value > pViaXvMC->attribDesc[i].max_value) - return BadValue; - pViaXvMC->attrib.attributes[i].value = value; - found = 1; - pViaXvMC->attribChanged = 1; - break; - } - } - if (!found) { - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return BadMatch; - } - if (pViaXvMC->haveXv) { - buf.command = VIA_XVMC_COMMAND_ATTRIBUTES; - pViaXvMC->xvImage->data = (char *)&buf; - buf.ctxNo = pViaXvMC->ctxNo | VIA_XVMC_VALID; - buf.attrib = pViaXvMC->attrib; - XLockDisplay(display); - pViaXvMC->attribChanged = - XvPutImage(display,pViaXvMC->port,pViaXvMC->draw, - pViaXvMC->gc, - pViaXvMC->xvImage,0,0,1,1,0,0,1,1); - XUnlockDisplay(display); - } - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return Success; -} - - -Status -XvMCGetAttribute ( - Display *display, - XvMCContext *context, - Atom attribute, - int *value - ) -{ - int found; - unsigned i; - ViaXvMCContext *pViaXvMC; - - if ((display == NULL) || (context == NULL)) { - return (error_base + XvMCBadContext); - } - - if (NULL == (pViaXvMC = context->privData)) { - return (error_base + XvMCBadContext); - } - - ppthread_mutex_lock( &pViaXvMC->ctxMutex ); - found = 0; - for (i=0; i < pViaXvMC->attrib.numAttr; ++i) { - if (attribute == pViaXvMC->attrib.attributes[i].attribute) { - if (pViaXvMC->attribDesc[i].flags & XvGettable) { - *value = pViaXvMC->attrib.attributes[i].value; - found = 1; - break; - } - } - } - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - - if (!found) - return BadMatch; - return Success; -} - - -Status XvMCHideSurface(Display *display,XvMCSurface *surface) -{ - - ViaXvMCSurface *pViaSurface; - ViaXvMCContext *pViaXvMC; - ViaXvMCSubPicture *pViaSubPic; - volatile ViaXvMCSAreaPriv *sAPriv; - ViaXvMCCommandBuffer buf; - Status ret; - - if ((display == NULL) || (surface == NULL)) { - return BadValue; - } - if (NULL == (pViaSurface = surface->privData )) { - return (error_base + XvMCBadSurface); - } - if (NULL == (pViaXvMC = pViaSurface->privContext)) { - return (error_base + XvMCBadContext); - } - - ppthread_mutex_lock( &pViaXvMC->ctxMutex ); - if (!pViaXvMC->haveXv) { - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return Success; - } - - sAPriv = SAREAPTR( pViaXvMC ); - hwlLock(pViaXvMC->xl,1); - - if (sAPriv->XvMCDisplaying[pViaXvMC->xvMCPort] != - (pViaSurface->srfNo | VIA_XVMC_VALID)) { - hwlUnlock(pViaXvMC->xl,1); - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return Success; - } - setLowLevelLocking(pViaXvMC->xl,0); - if (NULL != (pViaSubPic = pViaSurface->privSubPic)) { - if (sAPriv->XvMCSubPicOn[pViaXvMC->xvMCPort] == - (pViaSubPic->srfNo | VIA_XVMC_VALID)) { - sAPriv->XvMCSubPicOn[pViaXvMC->xvMCPort] &= ~VIA_XVMC_VALID; - viaVideoSubPictureOffLocked(pViaXvMC->xl); - } - } - flushPCIXvMCLowLevel(pViaXvMC->xl); - setLowLevelLocking(pViaXvMC->xl,1); - hwlUnlock(pViaXvMC->xl,1); - - buf.command = VIA_XVMC_COMMAND_UNDISPLAY; - buf.ctxNo = pViaXvMC->ctxNo | VIA_XVMC_VALID; - buf.srfNo = pViaSurface->srfNo | VIA_XVMC_VALID; - pViaXvMC->xvImage->data = (char *)&buf; - if ((ret = XvPutImage(display,pViaXvMC->port,pViaXvMC->draw, - pViaXvMC->gc, - pViaXvMC->xvImage,0,0,1,1,0,0,1,1))) { - fprintf(stderr,"XvMCPutSurface: Hiding overlay failed.\n"); - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return ret; - } - ppthread_mutex_unlock( &pViaXvMC->ctxMutex ); - return Success; -} diff --git a/nx-X11/lib/XvMC/hw/via/viaXvMCPriv.h b/nx-X11/lib/XvMC/hw/via/viaXvMCPriv.h deleted file mode 100644 index de4976a25..000000000 --- a/nx-X11/lib/XvMC/hw/via/viaXvMCPriv.h +++ /dev/null @@ -1,198 +0,0 @@ -/***************************************************************************** - * VIA Unichrome XvMC extension client lib. - * - * Copyright (c) 2004 Thomas Hellström. 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 - * AUTHOR(S) OR 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. - */ - -#ifndef _VIAXVMCPRIV_H -#define _VIAXVMCPRIV_H 1 - -#include -#include -#include -#include -#include -#include -#include "via_xvmc.h" - -typedef struct{ - int x; - int y; - int w; - int h; -} XvMCRegion; - - -extern Status _xvmc_create_context(Display *dpy, XvMCContext *context, - int *priv_count, uint **priv_data); -extern Status _xvmc_destroy_context(Display *dpy, XvMCContext *context); -extern Status _xvmc_create_surface(Display *dpy, XvMCContext *context, - XvMCSurface *surface, int *priv_count, - uint **priv_data); -extern Status _xvmc_destroy_surface(Display *dpy, XvMCSurface *surface); -extern Status _xvmc_create_subpicture(Display *dpy, XvMCContext *context, - XvMCSubpicture *subpicture, - int *priv_count, uint **priv_data); -extern Status _xvmc_destroy_subpicture(Display *dpy, - XvMCSubpicture *subpicture); - -#define VIA_SUBPIC_PALETTE_SIZE 16 /*Number of colors in subpicture palette*/ -#define VIA_CBUFFERSIZE 4096 /*Hardware command buffer size*/ -#define VIA_MAX_BUFS 2 /*Number of YUV buffers per surface*/ -#define VIA_MAX_RENDSURF 3 /*Maximum numbers of surfaces per context - that can answer RENDERING to a rendering - query*/ - -typedef enum{ - context_drawHash, - context_lowLevel, - context_mutex, - context_sAreaMap, - context_fbMap, - context_mmioMap, - context_drmContext, - context_fd, - context_driConnection, - context_context, - context_none -} ContextRes; - - -typedef struct{ - unsigned ctxNo; /* XvMC private context reference number */ - pthread_mutex_t ctxMutex; /* Mutex for multi-threading. Not used */ - drm_context_t drmcontext; /* The drm context */ - drm_handle_t fbOffset; /* Handle to drm frame-buffer area */ - drm_handle_t mmioOffset; /* Handle to drm mmio area */ - drm_handle_t sAreaOffset; /* Handle to drm shared memory area */ - unsigned fbSize; /* Size of drm frame-buffer area */ - unsigned mmioSize; /* Size of drm mmio area */ - unsigned sAreaSize; /* Size of drm shared memory area */ - unsigned sAreaPrivOffset; /* Offset in sarea to private part */ - drmAddress fbAddress; /* Virtual address of frame buffer area */ - drmAddress mmioAddress; /* Virtual address of mmio area */ - drmAddress sAreaAddress; /* Virtual address of shared memory area */ - char busIdString[21]; /* Busid of video card */ - unsigned yStride; /* Y stride of surfaces in this context */ - int fd; /* FD for connection to drm module */ - unsigned char intra_quantiser_matrix[64]; - unsigned char non_intra_quantiser_matrix[64]; - unsigned char chroma_intra_quantiser_matrix[64]; - unsigned char chroma_non_intra_quantiser_matrix[64]; - unsigned rendSurf[VIA_MAX_RENDSURF]; /* Which surfaces answer rendering to - a rendering query */ - int decoderOn; /* Decoder switched on ? */ - int intraLoaded; /* Intra quantiser matrix loaded in - decoder? */ - int nonIntraLoaded; /* Non-Intra quantiser matrix loaded - in decoder */ - int chromaIntraLoaded; - int chromaNonIntraLoaded; - int haveDecoder; /* Does this context own decoder? */ - int attribChanged; /* Attributes have changed and need to - be uploaded to Xv at next frame - display */ - drmLockPtr hwLock; /* Virtual address Pointer to the - heavyweight drm hardware lock */ - unsigned xvMCPort; /* XvMC private port. Corresponds to - an Xv port, but not by number */ - ViaXvMCAttrHolder attrib; /* This contexts attributes and their - values */ - XvAttribute attribDesc[VIA_NUM_XVMC_ATTRIBUTES]; /* Attribute decriptions */ - int useAGP; /* Use the AGP ringbuffer to upload data to the chip */ - void *xl; /* Lowlevel context. Opaque to us. */ - int haveXv; /* Have I initialized the Xv - connection for this surface? */ - XvImage *xvImage; /* Fake Xv Image used for command - buffer transport to the X server */ - GC gc; /* X GC needed for displaying */ - Drawable draw; /* Drawable to undisplay from */ - XvPortID port; /* Xv Port ID when displaying */ - int lastSrfDisplaying; - ContextRes resources; - CARD32 timeStamp; - CARD32 videoTimeStamp; - XID id; - unsigned screen; - unsigned depth; - unsigned stride; - XVisualInfo visualInfo; - void *drawHash; - CARD32 chipId; - XvMCRegion sRegion; - XvMCRegion dRegion; -}ViaXvMCContext; - -typedef struct{ - pthread_mutex_t subMutex; /* Currently not used. */ - unsigned srfNo; /* XvMC private surface number */ - unsigned offset; /* Offset into frame-buffer area */ - unsigned stride; /* Storage stride */ - unsigned width; /* Width */ - unsigned height; /* Height */ - CARD32 palette[VIA_SUBPIC_PALETTE_SIZE]; /* YUV Palette */ - ViaXvMCContext *privContext; /* Pointer to context private data */ - int ia44; /* IA44 or AI44 format */ - int needsSync; - CARD32 timeStamp; -}ViaXvMCSubPicture; - - -typedef struct{ - pthread_mutex_t srfMutex; /* For multithreading. Not used. */ - pthread_cond_t bufferAvailable; /* For multithreading. Not used. */ - unsigned srfNo; /* XvMC private surface numbers */ - unsigned numBuffers; /* Number of picture buffers */ - unsigned curBuf; /* Which is the current buffer? */ - unsigned offsets[VIA_MAX_BUFS]; /* Offsets of picture buffers - into the frame-buffer area */ - unsigned yStride; /* Stride of YUV420 Y component. */ - unsigned width; /* Dimensions */ - unsigned height; - int progressiveSequence; /* Mpeg progressive picture? Hmm? */ - ViaXvMCContext *privContext; /* XvMC context private part. */ - ViaXvMCSubPicture *privSubPic; /* Subpicture to be blended when - displaying. NULL if none. */ - int needsSync; - int syncMode; - CARD32 timeStamp; - int topFieldFirst; -}ViaXvMCSurface; - -/* - * Take and release the global drm hardware lock. - */ - -#define HW_LOCK(ctx) \ - DRM_LOCK((ctx)->fd,(ctx)->hwLock,(ctx)->drmcontext,0) -#define HW_UNLOCK(ctx) \ - DRM_UNLOCK((ctx)->fd,(ctx->hwLock),(ctx)->drmcontext) - -/* - * Low-level Mpeg functions in viaLowLevel.c - */ - -#define VIABLIT_TRANSCOPY 0 -#define VIABLIT_COPY 1 -#define VIABLIT_FILL 2 - - -#endif diff --git a/nx-X11/lib/XvMC/hw/via/xf86dri.c b/nx-X11/lib/XvMC/hw/via/xf86dri.c deleted file mode 100644 index dd1d1e072..000000000 --- a/nx-X11/lib/XvMC/hw/via/xf86dri.c +++ /dev/null @@ -1,592 +0,0 @@ -/* $XFree86: xc/lib/GL/dri/XF86dri.c,v 1.13 2002/10/30 12:51:25 alanh Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -Copyright 2000 VA Linux Systems, 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, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Kevin E. Martin - * Jens Owen - * Rickard E. (Rik) Faith - * - */ - -/* THIS IS NOT AN X CONSORTIUM STANDARD */ - -#define NEED_REPLIES -#include -#include -#include -/* #include "glheader.h" */ -#include "xf86dristr.h" - -static XExtensionInfo _xf86dri_info_data; -static XExtensionInfo *xf86dri_info = &_xf86dri_info_data; -static char xf86dri_extension_name[] = XF86DRINAME; - -#define uniDRICheckExtension(dpy,i,val) \ - XextCheckExtension (dpy, i, xf86dri_extension_name, val) - -/***************************************************************************** - * * - * private utility routines * - * * - *****************************************************************************/ - -static int close_display(Display *dpy, XExtCodes *extCodes); -static /* const */ XExtensionHooks xf86dri_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, xf86dri_info, - xf86dri_extension_name, - &xf86dri_extension_hooks, - 0, NULL) - -static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xf86dri_info) - - -/***************************************************************************** - * * - * public XFree86-DRI Extension routines * - * * - *****************************************************************************/ - -#if 0 -#include -#define TRACE(msg) fprintf(stderr,"uniDRI%s\n", msg); -#else -#define TRACE(msg) -#endif - - - Bool uniDRIQueryExtension (dpy, event_basep, error_basep) - Display *dpy; - int *event_basep, *error_basep; -{ - XExtDisplayInfo *info = find_display (dpy); - - TRACE("QueryExtension..."); - if (XextHasExtension(info)) { - *event_basep = info->codes->first_event; - *error_basep = info->codes->first_error; - TRACE("QueryExtension... return True"); - return True; - } else { - TRACE("QueryExtension... return False"); - return False; - } -} - - Bool uniDRIQueryVersion(dpy, majorVersion, minorVersion, patchVersion) - Display* dpy; - int* majorVersion; - int* minorVersion; - int* patchVersion; -{ - XExtDisplayInfo *info = find_display (dpy); - xXF86DRIQueryVersionReply rep; - xXF86DRIQueryVersionReq *req; - - TRACE("QueryVersion..."); - uniDRICheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(XF86DRIQueryVersion, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_XF86DRIQueryVersion; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("QueryVersion... return False"); - return False; - } - *majorVersion = rep.majorVersion; - *minorVersion = rep.minorVersion; - *patchVersion = rep.patchVersion; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("QueryVersion... return True"); - return True; -} - - Bool uniDRIQueryDirectRenderingCapable(dpy, screen, isCapable) - Display* dpy; - int screen; - Bool* isCapable; -{ - XExtDisplayInfo *info = find_display (dpy); - xXF86DRIQueryDirectRenderingCapableReply rep; - xXF86DRIQueryDirectRenderingCapableReq *req; - - TRACE("QueryDirectRenderingCapable..."); - uniDRICheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(XF86DRIQueryDirectRenderingCapable, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_XF86DRIQueryDirectRenderingCapable; - req->screen = screen; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("QueryDirectRenderingCapable... return False"); - return False; - } - *isCapable = rep.isCapable; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("QueryDirectRenderingCapable... return True"); - return True; -} - - Bool uniDRIOpenConnection(dpy, screen, hSAREA, busIdString) - Display* dpy; - int screen; - drm_handle_t * hSAREA; - char **busIdString; -{ - XExtDisplayInfo *info = find_display (dpy); - xXF86DRIOpenConnectionReply rep; - xXF86DRIOpenConnectionReq *req; - - TRACE("OpenConnection..."); - uniDRICheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(XF86DRIOpenConnection, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_XF86DRIOpenConnection; - req->screen = screen; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("OpenConnection... return False"); - return False; - } - - *hSAREA = rep.hSAREALow; -#ifdef LONG64 - *hSAREA |= ((drm_handle_t)rep.hSAREAHigh) << 32; -#endif - - if (rep.length) { - if (!(*busIdString = (char *)Xcalloc(rep.busIdStringLength + 1, 1))) { - _XEatData(dpy, ((rep.busIdStringLength+3) & ~3)); - UnlockDisplay(dpy); - SyncHandle(); - TRACE("OpenConnection... return False"); - return False; - } - _XReadPad(dpy, *busIdString, rep.busIdStringLength); - } else { - *busIdString = NULL; - } - UnlockDisplay(dpy); - SyncHandle(); - TRACE("OpenConnection... return True"); - return True; -} - - Bool uniDRIAuthConnection(dpy, screen, magic) - Display* dpy; - int screen; - drm_magic_t magic; -{ - XExtDisplayInfo *info = find_display (dpy); - xXF86DRIAuthConnectionReq *req; - xXF86DRIAuthConnectionReply rep; - - TRACE("AuthConnection..."); - uniDRICheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(XF86DRIAuthConnection, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_XF86DRIAuthConnection; - req->screen = screen; - req->magic = magic; - rep.authenticated = 0; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse) || !rep.authenticated) { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("AuthConnection... return False"); - return False; - } - UnlockDisplay(dpy); - SyncHandle(); - TRACE("AuthConnection... return True"); - return True; -} - - Bool uniDRICloseConnection(dpy, screen) - Display* dpy; - int screen; -{ - XExtDisplayInfo *info = find_display (dpy); - xXF86DRICloseConnectionReq *req; - - TRACE("CloseConnection..."); - - uniDRICheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(XF86DRICloseConnection, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_XF86DRICloseConnection; - req->screen = screen; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("CloseConnection... return True"); - return True; -} - - Bool uniDRIGetClientDriverName(dpy, screen, ddxDriverMajorVersion, - ddxDriverMinorVersion, ddxDriverPatchVersion, clientDriverName) - Display* dpy; - int screen; - int* ddxDriverMajorVersion; - int* ddxDriverMinorVersion; - int* ddxDriverPatchVersion; - char** clientDriverName; -{ - XExtDisplayInfo *info = find_display (dpy); - xXF86DRIGetClientDriverNameReply rep; - xXF86DRIGetClientDriverNameReq *req; - - TRACE("GetClientDriverName..."); - uniDRICheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(XF86DRIGetClientDriverName, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_XF86DRIGetClientDriverName; - req->screen = screen; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("GetClientDriverName... return False"); - return False; - } - - *ddxDriverMajorVersion = rep.ddxDriverMajorVersion; - *ddxDriverMinorVersion = rep.ddxDriverMinorVersion; - *ddxDriverPatchVersion = rep.ddxDriverPatchVersion; - - if (rep.length) { - if (!(*clientDriverName = (char *)Xcalloc(rep.clientDriverNameLength + 1, 1))) { - _XEatData(dpy, ((rep.clientDriverNameLength+3) & ~3)); - UnlockDisplay(dpy); - SyncHandle(); - TRACE("GetClientDriverName... return False"); - return False; - } - _XReadPad(dpy, *clientDriverName, rep.clientDriverNameLength); - } else { - *clientDriverName = NULL; - } - UnlockDisplay(dpy); - SyncHandle(); - TRACE("GetClientDriverName... return True"); - return True; -} - - Bool uniDRICreateContextWithConfig(dpy, screen, configID, context, - hHWContext) - Display* dpy; - int screen; - int configID; - XID* context; - drm_context_t * hHWContext; -{ - XExtDisplayInfo *info = find_display (dpy); - xXF86DRICreateContextReply rep; - xXF86DRICreateContextReq *req; - - TRACE("CreateContext..."); - uniDRICheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(XF86DRICreateContext, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_XF86DRICreateContext; - req->visual = configID; - req->screen = screen; - *context = XAllocID(dpy); - req->context = *context; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("CreateContext... return False"); - return False; - } - *hHWContext = rep.hHWContext; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("CreateContext... return True"); - return True; -} - - Bool uniDRICreateContext(dpy, screen, visual, context, hHWContext) - Display* dpy; - int screen; - Visual* visual; - XID* context; - drm_context_t * hHWContext; -{ - return uniDRICreateContextWithConfig( dpy, screen, visual->visualid, - context, hHWContext ); -} - - Bool uniDRIDestroyContext( Display * ndpy, int screen, - XID context ) -{ - Display * const dpy = (Display *) ndpy; - XExtDisplayInfo *info = find_display (dpy); - xXF86DRIDestroyContextReq *req; - - TRACE("DestroyContext..."); - uniDRICheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(XF86DRIDestroyContext, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_XF86DRIDestroyContext; - req->screen = screen; - req->context = context; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("DestroyContext... return True"); - return True; -} - -Bool uniDRICreateDrawable( Display * ndpy, int screen, - Drawable drawable, drm_drawable_t * hHWDrawable ) -{ - Display * const dpy = (Display *) ndpy; - XExtDisplayInfo *info = find_display (dpy); - xXF86DRICreateDrawableReply rep; - xXF86DRICreateDrawableReq *req; - - TRACE("CreateDrawable..."); - uniDRICheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(XF86DRICreateDrawable, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_XF86DRICreateDrawable; - req->screen = screen; - req->drawable = drawable; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("CreateDrawable... return False"); - return False; - } - *hHWDrawable = rep.hHWDrawable; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("CreateDrawable... return True"); - return True; -} - -Bool uniDRIDestroyDrawable( Display * ndpy, int screen, - Drawable drawable ) -{ - Display * const dpy = (Display *) ndpy; - XExtDisplayInfo *info = find_display (dpy); - xXF86DRIDestroyDrawableReq *req; - - TRACE("DestroyDrawable..."); - uniDRICheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(XF86DRIDestroyDrawable, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_XF86DRIDestroyDrawable; - req->screen = screen; - req->drawable = drawable; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("DestroyDrawable... return True"); - return True; -} - - Bool uniDRIGetDrawableInfo(Display* dpy, int screen, Drawable drawable, - unsigned int* index, unsigned int* stamp, - int* X, int* Y, int* W, int* H, - int* numClipRects, drm_clip_rect_t ** pClipRects, - int* backX, int* backY, - int* numBackClipRects, drm_clip_rect_t ** pBackClipRects ) -{ - XExtDisplayInfo *info = find_display (dpy); - xXF86DRIGetDrawableInfoReply rep; - xXF86DRIGetDrawableInfoReq *req; - int total_rects; - - TRACE("GetDrawableInfo..."); - uniDRICheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(XF86DRIGetDrawableInfo, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_XF86DRIGetDrawableInfo; - req->screen = screen; - req->drawable = drawable; - - if (!_XReply(dpy, (xReply *)&rep, 1, xFalse)) - { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("GetDrawableInfo... return False"); - return False; - } - *index = rep.drawableTableIndex; - *stamp = rep.drawableTableStamp; - *X = (int)rep.drawableX; - *Y = (int)rep.drawableY; - *W = (int)rep.drawableWidth; - *H = (int)rep.drawableHeight; - *numClipRects = rep.numClipRects; - total_rects = *numClipRects; - - *backX = rep.backX; - *backY = rep.backY; - *numBackClipRects = rep.numBackClipRects; - total_rects += *numBackClipRects; - -#if 0 - /* Because of the fix in Xserver/GL/dri/xf86dri.c, this check breaks - * backwards compatibility (Because of the >> 2 shift) but the fix - * enables multi-threaded apps to work. - */ - if (rep.length != ((((SIZEOF(xXF86DRIGetDrawableInfoReply) - - SIZEOF(xGenericReply) + - total_rects * sizeof(drm_clip_rect_t)) + 3) & ~3) >> 2)) { - _XEatData(dpy, rep.length); - UnlockDisplay(dpy); - SyncHandle(); - TRACE("GetDrawableInfo... return False"); - return False; - } -#endif - - if (*numClipRects) { - int len = sizeof(drm_clip_rect_t) * (*numClipRects); - - *pClipRects = (drm_clip_rect_t *)Xcalloc(len, 1); - if (*pClipRects) - _XRead(dpy, (char*)*pClipRects, len); - } else { - *pClipRects = NULL; - } - - if (*numBackClipRects) { - int len = sizeof(drm_clip_rect_t) * (*numBackClipRects); - - *pBackClipRects = (drm_clip_rect_t *)Xcalloc(len, 1); - if (*pBackClipRects) - _XRead(dpy, (char*)*pBackClipRects, len); - } else { - *pBackClipRects = NULL; - } - - UnlockDisplay(dpy); - SyncHandle(); - TRACE("GetDrawableInfo... return True"); - return True; -} - - Bool uniDRIGetDeviceInfo(dpy, screen, hFrameBuffer, - fbOrigin, fbSize, fbStride, devPrivateSize, pDevPrivate) - Display* dpy; - int screen; - drm_handle_t * hFrameBuffer; - int* fbOrigin; - int* fbSize; - int* fbStride; - int* devPrivateSize; - void** pDevPrivate; -{ - XExtDisplayInfo *info = find_display (dpy); - xXF86DRIGetDeviceInfoReply rep; - xXF86DRIGetDeviceInfoReq *req; - - TRACE("GetDeviceInfo..."); - uniDRICheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(XF86DRIGetDeviceInfo, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_XF86DRIGetDeviceInfo; - req->screen = screen; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("GetDeviceInfo... return False"); - return False; - } - - *hFrameBuffer = rep.hFrameBufferLow; -#ifdef LONG64 - *hFrameBuffer |= ((drm_handle_t)rep.hFrameBufferHigh) << 32; -#endif - - *fbOrigin = rep.framebufferOrigin; - *fbSize = rep.framebufferSize; - *fbStride = rep.framebufferStride; - *devPrivateSize = rep.devPrivateSize; - - if (rep.length) { - if (!(*pDevPrivate = (void *)Xcalloc(rep.devPrivateSize, 1))) { - _XEatData(dpy, ((rep.devPrivateSize+3) & ~3)); - UnlockDisplay(dpy); - SyncHandle(); - TRACE("GetDeviceInfo... return False"); - return False; - } - _XRead(dpy, (char*)*pDevPrivate, rep.devPrivateSize); - } else { - *pDevPrivate = NULL; - } - - UnlockDisplay(dpy); - SyncHandle(); - TRACE("GetDeviceInfo... return True"); - return True; -} - diff --git a/nx-X11/lib/XvMC/hw/via/xf86dri.h b/nx-X11/lib/XvMC/hw/via/xf86dri.h deleted file mode 100644 index f82b573fe..000000000 --- a/nx-X11/lib/XvMC/hw/via/xf86dri.h +++ /dev/null @@ -1,121 +0,0 @@ -/* $XFree86: xc/lib/GL/dri/xf86dri.h,v 1.8 2002/10/30 12:51:25 alanh Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -Copyright 2000 VA Linux Systems, 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, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/** - * \file xf86dri.h - * Protocol numbers and function prototypes for DRI X protocol. - * - * \author Kevin E. Martin - * \author Jens Owen - * \author Rickard E. (Rik) Faith - */ - -#ifndef _XF86DRI_H_ -#define _XF86DRI_H_ - -#include -#include - -#define X_XF86DRIQueryVersion 0 -#define X_XF86DRIQueryDirectRenderingCapable 1 -#define X_XF86DRIOpenConnection 2 -#define X_XF86DRICloseConnection 3 -#define X_XF86DRIGetClientDriverName 4 -#define X_XF86DRICreateContext 5 -#define X_XF86DRIDestroyContext 6 -#define X_XF86DRICreateDrawable 7 -#define X_XF86DRIDestroyDrawable 8 -#define X_XF86DRIGetDrawableInfo 9 -#define X_XF86DRIGetDeviceInfo 10 -#define X_XF86DRIAuthConnection 11 -#define X_XF86DRIOpenFullScreen 12 /* Deprecated */ -#define X_XF86DRICloseFullScreen 13 /* Deprecated */ - -#define XF86DRINumberEvents 0 - -#define XF86DRIClientNotLocal 0 -#define XF86DRIOperationNotSupported 1 -#define XF86DRINumberErrors (XF86DRIOperationNotSupported + 1) - -#ifndef _XF86DRI_SERVER_ - - -_XFUNCPROTOBEGIN - -Bool uniDRIQueryExtension( Display *dpy, int *event_base, int *error_base ); - -Bool uniDRIQueryVersion( Display *dpy, int *majorVersion, int *minorVersion, - int *patchVersion ); - -Bool uniDRIQueryDirectRenderingCapable( Display *dpy, int screen, - Bool *isCapable ); - -Bool uniDRIOpenConnection( Display *dpy, int screen, drm_handle_t *hSAREA, - char **busIDString ); - -Bool uniDRIAuthConnection( Display *dpy, int screen, drm_magic_t magic ); - -Bool uniDRICloseConnection( Display *dpy, int screen ); - -Bool uniDRIGetClientDriverName( Display *dpy, int screen, - int *ddxDriverMajorVersion, int *ddxDriverMinorVersion, - int *ddxDriverPatchVersion, char **clientDriverName ); - -Bool uniDRICreateContext( Display *dpy, int screen, Visual *visual, - XID *ptr_to_returned_context_id, drm_context_t *hHWContext ); - -Bool uniDRICreateContextWithConfig( Display *dpy, int screen, int configID, - XID *ptr_to_returned_context_id, drm_context_t *hHWContext ); - -extern Bool uniDRIDestroyContext( Display *dpy, int screen, - XID context_id ); - -extern Bool uniDRICreateDrawable( Display *dpy, int screen, - Drawable drawable, drm_drawable_t *hHWDrawable ); - -extern Bool uniDRIDestroyDrawable( Display *dpy, int screen, - Drawable drawable); - -Bool uniDRIGetDrawableInfo( Display *dpy, int screen, Drawable drawable, - unsigned int *index, unsigned int *stamp, - int *X, int *Y, int *W, int *H, - int *numClipRects, drm_clip_rect_t ** pClipRects, - int *backX, int *backY, - int *numBackClipRects, drm_clip_rect_t **pBackClipRects ); - -Bool uniDRIGetDeviceInfo( Display *dpy, int screen, - drm_handle_t *hFrameBuffer, int *fbOrigin, int *fbSize, - int *fbStride, int *devPrivateSize, void **pDevPrivate ); - -_XFUNCPROTOEND - -#endif /* _XF86DRI_SERVER_ */ - -#endif /* _XF86DRI_H_ */ - diff --git a/nx-X11/lib/XvMC/hw/via/xf86dristr.h b/nx-X11/lib/XvMC/hw/via/xf86dristr.h deleted file mode 100644 index ac05b183b..000000000 --- a/nx-X11/lib/XvMC/hw/via/xf86dristr.h +++ /dev/null @@ -1,343 +0,0 @@ -/* $XFree86: xc/lib/GL/dri/xf86dristr.h,v 1.10 2002/10/30 12:51:25 alanh Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -Copyright 2000 VA Linux Systems, 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, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Kevin E. Martin - * Jens Owen - * Rickard E. (Rik) Fiath - * - */ - -#ifndef _XF86DRISTR_H_ -#define _XF86DRISTR_H_ - -#include "xf86dri.h" - -#define XF86DRINAME "XFree86-DRI" - -/* The DRI version number. This was originally set to be the same of the - * XFree86 version number. However, this version is really indepedent of - * the XFree86 version. - * - * Version History: - * 4.0.0: Original - * 4.0.1: Patch to bump clipstamp when windows are destroyed, 28 May 02 - * 4.1.0: Add transition from single to multi in DRMInfo rec, 24 Jun 02 - */ -#define XF86DRI_MAJOR_VERSION 4 -#define XF86DRI_MINOR_VERSION 1 -#define XF86DRI_PATCH_VERSION 0 - -typedef struct _XF86DRIQueryVersion { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRIQueryVersion */ - CARD16 length B16; -} xXF86DRIQueryVersionReq; -#define sz_xXF86DRIQueryVersionReq 4 - -typedef struct { - BYTE type; /* X_Reply */ - BOOL pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD16 majorVersion B16; /* major version of DRI protocol */ - CARD16 minorVersion B16; /* minor version of DRI protocol */ - CARD32 patchVersion B32; /* patch version of DRI protocol */ - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; -} xXF86DRIQueryVersionReply; -#define sz_xXF86DRIQueryVersionReply 32 - -typedef struct _XF86DRIQueryDirectRenderingCapable { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */ - CARD16 length B16; - CARD32 screen B32; -} xXF86DRIQueryDirectRenderingCapableReq; -#define sz_xXF86DRIQueryDirectRenderingCapableReq 8 - -typedef struct { - BYTE type; /* X_Reply */ - BOOL pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - BOOL isCapable; - BOOL pad2; - BOOL pad3; - BOOL pad4; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; - CARD32 pad8 B32; - CARD32 pad9 B32; -} xXF86DRIQueryDirectRenderingCapableReply; -#define sz_xXF86DRIQueryDirectRenderingCapableReply 32 - -typedef struct _XF86DRIOpenConnection { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRIOpenConnection */ - CARD16 length B16; - CARD32 screen B32; -} xXF86DRIOpenConnectionReq; -#define sz_xXF86DRIOpenConnectionReq 8 - -typedef struct { - BYTE type; /* X_Reply */ - BOOL pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 hSAREALow B32; - CARD32 hSAREAHigh B32; - CARD32 busIdStringLength B32; - CARD32 pad6 B32; - CARD32 pad7 B32; - CARD32 pad8 B32; -} xXF86DRIOpenConnectionReply; -#define sz_xXF86DRIOpenConnectionReply 32 - -typedef struct _XF86DRIAuthConnection { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRICloseConnection */ - CARD16 length B16; - CARD32 screen B32; - CARD32 magic B32; -} xXF86DRIAuthConnectionReq; -#define sz_xXF86DRIAuthConnectionReq 12 - -typedef struct { - BYTE type; - BOOL pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 authenticated B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; -} xXF86DRIAuthConnectionReply; -#define zx_xXF86DRIAuthConnectionReply 32 - -typedef struct _XF86DRICloseConnection { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRICloseConnection */ - CARD16 length B16; - CARD32 screen B32; -} xXF86DRICloseConnectionReq; -#define sz_xXF86DRICloseConnectionReq 8 - -typedef struct _XF86DRIGetClientDriverName { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRIGetClientDriverName */ - CARD16 length B16; - CARD32 screen B32; -} xXF86DRIGetClientDriverNameReq; -#define sz_xXF86DRIGetClientDriverNameReq 8 - -typedef struct { - BYTE type; /* X_Reply */ - BOOL pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 ddxDriverMajorVersion B32; - CARD32 ddxDriverMinorVersion B32; - CARD32 ddxDriverPatchVersion B32; - CARD32 clientDriverNameLength B32; - CARD32 pad5 B32; - CARD32 pad6 B32; -} xXF86DRIGetClientDriverNameReply; -#define sz_xXF86DRIGetClientDriverNameReply 32 - -typedef struct _XF86DRICreateContext { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRICreateContext */ - CARD16 length B16; - CARD32 screen B32; - CARD32 visual B32; - CARD32 context B32; -} xXF86DRICreateContextReq; -#define sz_xXF86DRICreateContextReq 16 - -typedef struct { - BYTE type; /* X_Reply */ - BOOL pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 hHWContext B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; -} xXF86DRICreateContextReply; -#define sz_xXF86DRICreateContextReply 32 - -typedef struct _XF86DRIDestroyContext { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRIDestroyContext */ - CARD16 length B16; - CARD32 screen B32; - CARD32 context B32; -} xXF86DRIDestroyContextReq; -#define sz_xXF86DRIDestroyContextReq 12 - -typedef struct _XF86DRICreateDrawable { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRICreateDrawable */ - CARD16 length B16; - CARD32 screen B32; - CARD32 drawable B32; -} xXF86DRICreateDrawableReq; -#define sz_xXF86DRICreateDrawableReq 12 - -typedef struct { - BYTE type; /* X_Reply */ - BOOL pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 hHWDrawable B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; -} xXF86DRICreateDrawableReply; -#define sz_xXF86DRICreateDrawableReply 32 - -typedef struct _XF86DRIDestroyDrawable { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRIDestroyDrawable */ - CARD16 length B16; - CARD32 screen B32; - CARD32 drawable B32; -} xXF86DRIDestroyDrawableReq; -#define sz_xXF86DRIDestroyDrawableReq 12 - -typedef struct _XF86DRIGetDrawableInfo { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRIGetDrawableInfo */ - CARD16 length B16; - CARD32 screen B32; - CARD32 drawable B32; -} xXF86DRIGetDrawableInfoReq; -#define sz_xXF86DRIGetDrawableInfoReq 12 - -typedef struct { - BYTE type; /* X_Reply */ - BOOL pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 drawableTableIndex B32; - CARD32 drawableTableStamp B32; - INT16 drawableX B16; - INT16 drawableY B16; - INT16 drawableWidth B16; - INT16 drawableHeight B16; - CARD32 numClipRects B32; - INT16 backX B16; - INT16 backY B16; - CARD32 numBackClipRects B32; -} xXF86DRIGetDrawableInfoReply; - -#define sz_xXF86DRIGetDrawableInfoReply 36 - - -typedef struct _XF86DRIGetDeviceInfo { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRIGetDeviceInfo */ - CARD16 length B16; - CARD32 screen B32; -} xXF86DRIGetDeviceInfoReq; -#define sz_xXF86DRIGetDeviceInfoReq 8 - -typedef struct { - BYTE type; /* X_Reply */ - BOOL pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 hFrameBufferLow B32; - CARD32 hFrameBufferHigh B32; - CARD32 framebufferOrigin B32; - CARD32 framebufferSize B32; - CARD32 framebufferStride B32; - CARD32 devPrivateSize B32; -} xXF86DRIGetDeviceInfoReply; -#define sz_xXF86DRIGetDeviceInfoReply 32 - -typedef struct _XF86DRIOpenFullScreen { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRIOpenFullScreen */ - CARD16 length B16; - CARD32 screen B32; - CARD32 drawable B32; -} xXF86DRIOpenFullScreenReq; -#define sz_xXF86DRIOpenFullScreenReq 12 - -typedef struct { - BYTE type; - BOOL pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 isFullScreen B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; -} xXF86DRIOpenFullScreenReply; -#define sz_xXF86DRIOpenFullScreenReply 32 - -typedef struct _XF86DRICloseFullScreen { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRICloseFullScreen */ - CARD16 length B16; - CARD32 screen B32; - CARD32 drawable B32; -} xXF86DRICloseFullScreenReq; -#define sz_xXF86DRICloseFullScreenReq 12 - -typedef struct { - BYTE type; - BOOL pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; -} xXF86DRICloseFullScreenReply; -#define sz_xXF86DRICloseFullScreenReply 32 - - -#endif /* _XF86DRISTR_H_ */ diff --git a/nx-X11/lib/XvMC/wrapper/Imakefile b/nx-X11/lib/XvMC/wrapper/Imakefile deleted file mode 100644 index 4438437c9..000000000 --- a/nx-X11/lib/XvMC/wrapper/Imakefile +++ /dev/null @@ -1,34 +0,0 @@ -XCOMM $XFree86: xc/lib/XvMC/wrapper/Imakefile,v 1.2 2002/10/30 12:52:02 alanh Exp $ -#define DoNormalLib NormalLibXvMC -#define DoSharedLib SharedLibXvMC -#define DoDebugLib DebugLibXvMC -#define DoProfileLib ProfileLibXvMC -#define LibName XvMCW -#define SoRev SOXVMCREV -#define LibHeaders NO - -#include - -#ifdef SharedXvMCReqs -REQUIREDLIBS = -ldl -#endif - -#ifdef XConfigDir -XVMC_DEFINES = -DXVMC_CONFIGDIR=XConfigDir -DXVMC_SOVERSION=\".$(SOXVMCREV)\" \ - -DXV_SOVERSION=\".$(SOXVREV)\" -#endif - - - DEFINES = $(XVMC_DEFINES) - INCLUDES = -I$(XINCLUDESRC) -I$(INCLUDESRC) -I$(XLIBSRC) -I$(EXTINCSRC) - SRCS = XvMCWrapper.c - OBJS = XvMCWrapper.o - LINTLIBS = $(LINTXLIB) - - -#if ((SharedLibXvMC == 1) && (SharedLibXv == 1)) -#include -#endif - -DependTarget() - diff --git a/nx-X11/lib/XvMC/wrapper/XvMCWrapper.c b/nx-X11/lib/XvMC/wrapper/XvMCWrapper.c deleted file mode 100644 index 9fa0c99ab..000000000 --- a/nx-X11/lib/XvMC/wrapper/XvMCWrapper.c +++ /dev/null @@ -1,779 +0,0 @@ -/***************************************************************************** - * XvMC Wrapper including the Nonstandard VLD extension. - * - * Copyright (c) 2004 The Unichrome project. 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 - * AUTHOR(S) OR 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. - * - * Author: Thomas Hellström (2004) - */ - -/* - * BUGS: The wrapper really should maintain one symbol table per port. This - * could possibly be impemented, To do that, the port-independent symbols need to be lifted out, - * and one would have to create a number of mapping tables: - * - * port -> symbol table - * context -> port - * surface -> port - * subpicture -> port - * - * and reference the right table when needed. - * This needs to be done only if there is a player that wants to access two displays with different - * hardware simultaneously. Not likely as of today. - */ - -#ifdef HAVE_CONFIG_H - #include "config.h" -#endif - -#include -#include -#include -#include -#include -#include -#include - - -typedef Bool (*XvMCQueryExtensionP) (Display *, int *, int *); -typedef Status (*XvMCQueryVersionP) (Display *, int *,int *); -typedef XvMCSurfaceInfo * (*XvMCListSurfaceTypesP)(Display *, XvPortID, int *); -typedef Status (* XvMCCreateContextP) (Display *,XvPortID,int ,int ,int ,int ,XvMCContext * ); -typedef Status (*XvMCDestroyContextP) (Display *, XvMCContext * ); -typedef Status (*XvMCCreateSurfaceP)(Display *,XvMCContext *,XvMCSurface *); -typedef Status (*XvMCDestroySurfaceP)(Display *, XvMCSurface *); -typedef XvImageFormatValues * (*XvMCListSubpictureTypesP) (Display *,XvPortID ,int ,int *); -typedef Status (*XvMCPutSurfaceP)(Display *,XvMCSurface *,Drawable ,short , short , unsigned short , - unsigned short ,short ,short ,unsigned short ,unsigned short ,int ); -typedef Status (*XvMCHideSurfaceP)(Display *, XvMCSurface *); -typedef Status (*XvMCCreateSubpictureP) (Display *, XvMCContext *, XvMCSubpicture *, - unsigned short, unsigned short,int); -typedef Status (*XvMCClearSubpictureP) (Display *,XvMCSubpicture *,short,short,unsigned short,unsigned short, - unsigned int); -typedef Status (*XvMCCompositeSubpictureP) (Display *, XvMCSubpicture *,XvImage *,short,short, - unsigned short, unsigned short,short,short); -typedef Status (*XvMCDestroySubpictureP) (Display *, XvMCSubpicture *); -typedef Status (*XvMCSetSubpicturePaletteP) (Display *, XvMCSubpicture *, unsigned char *); -typedef Status (*XvMCBlendSubpictureP) (Display *d,XvMCSurface *,XvMCSubpicture *,short, - short,unsigned short,unsigned short,short,short, - unsigned short,unsigned short); -typedef Status (*XvMCBlendSubpicture2P) (Display *,XvMCSurface *,XvMCSurface *, - XvMCSubpicture *,short,short,unsigned short, - unsigned short,short,short,unsigned short, - unsigned short); -typedef Status (*XvMCSyncSurfaceP) (Display *, XvMCSurface *); -typedef Status (*XvMCFlushSurfaceP) (Display *, XvMCSurface *); -typedef Status (*XvMCGetSurfaceStatusP) (Display *, XvMCSurface *, int *); -typedef Status (*XvMCRenderSurfaceP) (Display *,XvMCContext *,unsigned int,XvMCSurface *, - XvMCSurface *,XvMCSurface *,unsigned int,unsigned int, - unsigned int,XvMCMacroBlockArray *,XvMCBlockArray *); -typedef Status (*XvMCSyncSubpictureP) (Display *, XvMCSubpicture *); -typedef Status (*XvMCFlushSubpictureP) (Display *, XvMCSubpicture *); -typedef Status (*XvMCGetSubpictureStatusP) (Display *, XvMCSubpicture *, int *); -typedef Status (*XvMCCreateBlocksP) (Display *, XvMCContext *,unsigned int,XvMCBlockArray *); -typedef Status (*XvMCDestroyBlocksP) (Display *,XvMCBlockArray *); -typedef Status (*XvMCCreateMacroBlocksP) (Display *,XvMCContext *,unsigned int, - XvMCMacroBlockArray *); -typedef Status (*XvMCDestroyMacroBlocksP) (Display *,XvMCMacroBlockArray *); -typedef XvAttribute *(*XvMCQueryAttributesP) (Display *,XvMCContext *,int *); -typedef Status (*XvMCSetAttributeP) (Display *,XvMCContext *, Atom, int); -typedef Status (*XvMCGetAttributeP) (Display *,XvMCContext *, Atom, int *); - -/* - * Nonstandard VLD acceleration level: - */ - -typedef Status (*XvMCBeginSurfaceP) (Display *,XvMCContext *,XvMCSurface *, - XvMCSurface *,XvMCSurface *f,const XvMCMpegControl *); -typedef Status (*XvMCLoadQMatrixP) (Display *, XvMCContext *,const XvMCQMatrix *); -typedef Status (*XvMCPutSliceP)(Display *,XvMCContext *, char *,int); -typedef Status (*XvMCPutSlice2P)(Display *,XvMCContext *, char *,int, unsigned); -typedef Status (*XvMCGetDRInfoP)(Display *, XvPortID, char **, char **, int *, int *, - int *, int *); - - -typedef struct { - XvMCQueryExtensionP XvMCQueryExtension; - XvMCQueryVersionP XvMCQueryVersion; - XvMCListSurfaceTypesP XvMCListSurfaceTypes; - XvMCCreateContextP XvMCCreateContext; - XvMCDestroyContextP XvMCDestroyContext; - XvMCCreateSurfaceP XvMCCreateSurface; - XvMCDestroySurfaceP XvMCDestroySurface; - XvMCListSubpictureTypesP XvMCListSubpictureTypes; - XvMCPutSurfaceP XvMCPutSurface; - XvMCHideSurfaceP XvMCHideSurface; - XvMCCreateSubpictureP XvMCCreateSubpicture; - XvMCClearSubpictureP XvMCClearSubpicture; - XvMCCompositeSubpictureP XvMCCompositeSubpicture; - XvMCDestroySubpictureP XvMCDestroySubpicture; - XvMCSetSubpicturePaletteP XvMCSetSubpicturePalette; - XvMCBlendSubpictureP XvMCBlendSubpicture; - XvMCBlendSubpicture2P XvMCBlendSubpicture2; - XvMCSyncSurfaceP XvMCSyncSurface; - XvMCFlushSurfaceP XvMCFlushSurface; - XvMCGetSurfaceStatusP XvMCGetSurfaceStatus; - XvMCRenderSurfaceP XvMCRenderSurface; - XvMCSyncSubpictureP XvMCSyncSubpicture; - XvMCFlushSubpictureP XvMCFlushSubpicture; - XvMCGetSubpictureStatusP XvMCGetSubpictureStatus; - XvMCCreateBlocksP XvMCCreateBlocks; - XvMCDestroyBlocksP XvMCDestroyBlocks; - XvMCCreateMacroBlocksP XvMCCreateMacroBlocks; - XvMCDestroyMacroBlocksP XvMCDestroyMacroBlocks; - XvMCQueryAttributesP XvMCQueryAttributes; - XvMCSetAttributeP XvMCSetAttribute; - XvMCGetAttributeP XvMCGetAttribute; - - /* - * Nonstandard VLD acceleration level: - */ - - XvMCBeginSurfaceP XvMCBeginSurface; - XvMCLoadQMatrixP XvMCLoadQMatrix; - XvMCPutSliceP XvMCPutSlice; - XvMCPutSlice2P XvMCPutSlice2; - - /* - * Driver name function. - */ - - XvMCGetDRInfoP XvMCGetDRInfo; - - int preInitialised; - int initialised; - int vldextension; -} XvMCWrapper; - -static XvMCWrapper xW; -static int wrapperInit = 0; -static int wrapperPreInit = 0; -static void *xvhandle; -static void *handle2; - -#define BUFLEN 200 - -#define STRS(ARG) STR(ARG) -#define STR(ARG) #ARG - -#define XW_RSYM(base,handle,handle2,pointer, retval) \ - do { \ - register char *err; \ - base.pointer = (pointer##P) dlsym((handle),#pointer); \ - if ((err = dlerror()) != NULL) { \ - if (!handle2) { \ - fprintf(stderr,"%s\n",err); return retval; \ - } \ - base.pointer = (pointer##P) dlsym((handle2),#pointer); \ - if ((err = dlerror()) != NULL) { \ - fprintf(stderr,"%s\n",err); return retval; \ - } \ - } \ - } while (0); - -#define XW_RSYM2(base,handle,handle2,pointer) \ - base.pointer = (pointer##P) dlsym((handle),#pointer); \ - if (dlerror() != NULL) { \ - base.pointer = (pointer##P) dlsym((handle2),#pointer); \ - if (dlerror() != NULL) return; \ - } - - -/* - * Try to dlopen a shared library, versionless first. - */ - - -static void *dlopenversion(const char *lib, const char *version, int flag) -{ - void *ret; - int curLen,verLen; - char *curName; - const char *tail; - - - curLen = strlen(lib) + (verLen = strlen(version)) + 1; - curName = (char *) malloc(curLen * sizeof(char)); - strncpy( curName, lib, curLen); - if (verLen > 1) { - if (NULL != (tail = strstr(version+1,"."))) { - strncat( curName, version, tail - version); - } else { - strncat( curName, version, verLen); - } - } - ret = dlopen(curName, flag); - free(curName); - return ret; -} - -static int preInitW(Display *dpy) -{ - - /* - * Resolve functions that are not hw driver specific. - */ - - void *handleZ = 0; - - wrapperPreInit = 1; - xW.preInitialised = 0; - xW.initialised = 0; - xvhandle = dlopenversion("libXv.so", XV_SOVERSION, RTLD_LAZY | RTLD_GLOBAL); - if (!xvhandle) { - fprintf(stderr,"XvMCWrapper: Warning! Could not open shared " - "library \"libXv.so" XV_SOVERSION "\"\nThis may cause relocation " - "errors later.\nError was: \"%s\".\n",dlerror()); - } - handle2 = dlopenversion("libXvMC.so", XVMC_SOVERSION, RTLD_LAZY | RTLD_GLOBAL); - if (!handle2) { - fprintf(stderr,"XvMCWrapper: Could not load XvMC " - "library \"libXvMC.so" XVMC_SOVERSION "\". Failing\n"); - fprintf(stderr,"%s\n",dlerror()); - return 1; - } - XW_RSYM(xW, handle2, handleZ, XvMCQueryExtension, 1); - XW_RSYM(xW, handle2, handleZ, XvMCQueryVersion, 1); - xW.preInitialised = 1; - return 0; -} - -static void initW(Display *dpy, XvPortID port) -{ - char nameBuffer[BUFLEN]; - void *handle; - int tmp; - char *clientName = NULL; - char *err; - FILE *configFile; - int nameLen = 0; - int major,minor,patchLevel,isLocal; - char *busID = NULL; - - wrapperInit = 1; - xW.initialised = 0; - - if (!wrapperPreInit) - if (preInitW( dpy )) return; - - /* - * Will the DDX tell us the client driver name? - */ - - xW.XvMCGetDRInfo = (XvMCGetDRInfoP) - dlsym(handle2,"XvMCGetDRInfo"); - - if ((err = dlerror()) == NULL) { - if (0 == xW.XvMCGetDRInfo( dpy, port, &clientName, &busID, &major, - &minor,&patchLevel, &isLocal)) { - nameLen = strlen(clientName); - XFree(busID); - if (!isLocal) { - fprintf(stderr,"XvMCWrapper: X server is not local. Cannot run XvMC.\n"); - XFree(clientName); - return; - } - } else { - clientName = NULL; - } - } - - if (clientName && (nameLen < BUFLEN-7) && (nameLen > 0)) { - nameLen += 3; - strncpy(nameBuffer,"lib",BUFLEN-1); - strncpy(nameBuffer+3, clientName, BUFLEN-4); - strncpy(nameBuffer + nameLen, ".so", BUFLEN-nameLen-1); - nameBuffer[BUFLEN-1] = 0; - XFree(clientName); - handle = dlopenversion(nameBuffer, XVMC_SOVERSION,RTLD_LAZY); - } else { - /* - * No. Try to obtain it from the config file. - */ - - if (clientName) XFree(clientName); - - configFile = fopen(STRS(XVMC_CONFIGDIR) "/XvMCConfig","r"); - - xW.initialised = 0; - xW.vldextension = 0; - - if (0 == configFile) { - fprintf(stderr,"XvMCWrapper: Could not open config file \"%s\".\n", - STRS(XVMC_CONFIGDIR) "/XvMCConfig"); - perror("XvMCWrapper"); - return; - } - - if (0 == fgets(nameBuffer, BUFLEN, configFile)) { - fclose(configFile); - fprintf(stderr,"XvMCWrapper: Could not read XvMC library name.\n"); - perror("XvMCWrapper"); - return; - } - - fclose(configFile); - if ((tmp = strlen(nameBuffer)) == 0) { - fprintf(stderr,"XvMCWrapper: Zero length XvMC library name.\n"); - fprintf(stderr,"%s\n",dlerror()); - return; - } - - /* - * Skip trailing newlines and garbage. - */ - - while (iscntrl(nameBuffer[tmp-1])) { - nameBuffer[tmp-1] = 0; - if (--tmp == 0) { - fprintf(stderr,"XvMCWrapper: Zero length XvMC library name.\n"); - return; - } - } - handle = dlopen(nameBuffer,RTLD_LAZY); - } - if (!handle) { - fprintf(stderr,"XvMCWrapper: Could not load hardware specific XvMC " - "library \"%s\".\n",nameBuffer); - fprintf(stderr,"%s\n",dlerror()); - return; - } - - XW_RSYM(xW, handle, handle2, XvMCListSurfaceTypes,); - XW_RSYM(xW, handle, handle2, XvMCCreateContext,); - XW_RSYM(xW, handle, handle2, XvMCDestroyContext,); - XW_RSYM(xW, handle, handle2, XvMCCreateSurface,); - XW_RSYM(xW, handle, handle2, XvMCDestroySurface,); - XW_RSYM(xW, handle, handle2, XvMCListSubpictureTypes,); - XW_RSYM(xW, handle, handle2, XvMCHideSurface,); - XW_RSYM(xW, handle, handle2, XvMCCreateSubpicture,); - XW_RSYM(xW, handle, handle2, XvMCClearSubpicture,); - XW_RSYM(xW, handle, handle2, XvMCCompositeSubpicture,); - XW_RSYM(xW, handle, handle2, XvMCDestroySubpicture,); - XW_RSYM(xW, handle, handle2, XvMCSetSubpicturePalette,); - XW_RSYM(xW, handle, handle2, XvMCBlendSubpicture,); - XW_RSYM(xW, handle, handle2, XvMCBlendSubpicture2,); - XW_RSYM(xW, handle, handle2, XvMCPutSurface,); - XW_RSYM(xW, handle, handle2, XvMCSyncSurface,); - XW_RSYM(xW, handle, handle2, XvMCFlushSurface,); - XW_RSYM(xW, handle, handle2, XvMCGetSurfaceStatus,); - XW_RSYM(xW, handle, handle2, XvMCRenderSurface,); - XW_RSYM(xW, handle, handle2, XvMCSyncSubpicture,); - XW_RSYM(xW, handle, handle2, XvMCFlushSubpicture,); - XW_RSYM(xW, handle, handle2, XvMCGetSubpictureStatus,); - XW_RSYM(xW, handle, handle2, XvMCCreateBlocks,); - XW_RSYM(xW, handle, handle2, XvMCDestroyBlocks,); - XW_RSYM(xW, handle, handle2, XvMCCreateMacroBlocks,); - XW_RSYM(xW, handle, handle2, XvMCDestroyMacroBlocks,); - XW_RSYM(xW, handle, handle2, XvMCQueryAttributes,); - XW_RSYM(xW, handle, handle2, XvMCSetAttribute,); - XW_RSYM(xW, handle, handle2, XvMCGetAttribute,); - xW.initialised = 1; - XW_RSYM2(xW, handle, handle2, XvMCBeginSurface); - XW_RSYM(xW, handle, handle2, XvMCLoadQMatrix,); - XW_RSYM(xW, handle, handle2, XvMCPutSlice,); - XW_RSYM(xW, handle, handle2, XvMCPutSlice2,); - xW.vldextension = 1; -} - - -Bool XvMCQueryExtension (Display *display, int *eventBase, int *errBase) -{ - if (!wrapperPreInit) preInitW( display ); - if (!xW.preInitialised) return 0; - return (*xW.XvMCQueryExtension)(display, eventBase, errBase); -} - -Status XvMCQueryVersion (Display *display, int *major_versionp, - int *minor_versionp) -{ - if (!wrapperPreInit) preInitW( display ); - if (!xW.preInitialised) return 0; - return (*xW.XvMCQueryVersion)(display, major_versionp, minor_versionp); -} - - -XvMCSurfaceInfo * XvMCListSurfaceTypes(Display *dpy, XvPortID port, int *num) -{ - if (!wrapperInit) initW( dpy, port); - if (!xW.initialised) return NULL; - return (*xW.XvMCListSurfaceTypes)(dpy, port, num); -} - -Status XvMCCreateContext ( - Display *display, - XvPortID port, - int surface_type_id, - int width, - int height, - int flags, - XvMCContext * context - ) -{ - if (!wrapperInit) initW(display, port); - if (!xW.initialised) return BadValue; - return (*xW.XvMCCreateContext)(display, port, surface_type_id, - width, height, flags, context); -} - -Status XvMCDestroyContext (Display *display, XvMCContext * context) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCDestroyContext)(display, context); -} - -Status -XvMCCreateSurface( - Display *display, - XvMCContext * context, - XvMCSurface * surface - ) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCCreateSurface)(display, context, surface); -} - -Status XvMCDestroySurface(Display *display, XvMCSurface *surface) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCDestroySurface)(display, surface); -} - - -XvImageFormatValues * XvMCListSubpictureTypes ( - Display * display, - XvPortID port, - int surface_type_id, - int *count_return - ) -{ - if (!xW.initialised) return NULL; - return (*xW.XvMCListSubpictureTypes)(display, port, surface_type_id, - count_return); -} - - -Status -XvMCPutSurface( - Display *display, - XvMCSurface *surface, - Drawable draw, - short srcx, - short srcy, - unsigned short srcw, - unsigned short srch, - short destx, - short desty, - unsigned short destw, - unsigned short desth, - int flags - ) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCPutSurface)(display, surface, draw, srcx, srcy, srcw, srch, - destx, desty, destw, desth, flags); -} - -Status XvMCHideSurface(Display *display, XvMCSurface *surface) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCHideSurface)(display, surface); -} - - -Status -XvMCCreateSubpicture ( - Display *display, - XvMCContext *context, - XvMCSubpicture *subpicture, - unsigned short width, - unsigned short height, - int xvimage_id - ) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCCreateSubpicture)(display, context, subpicture, width, height, - xvimage_id); -} - - -Status -XvMCClearSubpicture ( - Display *display, - XvMCSubpicture *subpicture, - short x, - short y, - unsigned short width, - unsigned short height, - unsigned int color - ) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCClearSubpicture)(display, subpicture, x, y, width, height, color); -} - - -Status -XvMCCompositeSubpicture ( - Display *display, - XvMCSubpicture *subpicture, - XvImage *image, - short srcx, - short srcy, - unsigned short width, - unsigned short height, - short dstx, - short dsty - ) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCCompositeSubpicture)(display, subpicture, image, srcx, srcy, - width, height, dstx, dsty); -} - -Status -XvMCDestroySubpicture (Display *display, XvMCSubpicture *subpicture) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCDestroySubpicture)(display, subpicture); -} - -Status -XvMCSetSubpicturePalette ( - Display *display, - XvMCSubpicture *subpicture, - unsigned char *palette - ) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCSetSubpicturePalette)(display, subpicture, palette); -} - - -Status -XvMCBlendSubpicture ( - Display *display, - XvMCSurface *target_surface, - XvMCSubpicture *subpicture, - short subx, - short suby, - unsigned short subw, - unsigned short subh, - short surfx, - short surfy, - unsigned short surfw, - unsigned short surfh - ) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCBlendSubpicture)(display, target_surface, subpicture, - subx, suby, subw, subh, surfx, surfy, - surfw, surfh); -} - -Status -XvMCBlendSubpicture2 ( - Display *display, - XvMCSurface *source_surface, - XvMCSurface *target_surface, - XvMCSubpicture *subpicture, - short subx, - short suby, - unsigned short subw, - unsigned short subh, - short surfx, - short surfy, - unsigned short surfw, - unsigned short surfh - ) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCBlendSubpicture2)(display, source_surface, target_surface, subpicture, - subx, suby, subw, subh, surfx, surfy, surfw, surfh); -} - - -Status XvMCSyncSurface (Display *display, XvMCSurface *surface) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCSyncSurface)(display, surface); -} - -Status XvMCFlushSurface (Display *display, XvMCSurface *surface) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCFlushSurface)(display, surface); -} - -Status XvMCGetSurfaceStatus (Display *display, XvMCSurface *surface, int *stat) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCGetSurfaceStatus)(display, surface, stat); -} - -Status XvMCRenderSurface ( - Display *display, - XvMCContext *context, - unsigned int picture_structure, - XvMCSurface *target_surface, - XvMCSurface *past_surface, - XvMCSurface *future_surface, - unsigned int flags, - unsigned int num_macroblocks, - unsigned int first_macroblock, - XvMCMacroBlockArray *macroblock_array, - XvMCBlockArray *blocks - ) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCRenderSurface)(display, context, picture_structure, target_surface, - past_surface, future_surface, flags, num_macroblocks, - first_macroblock, macroblock_array, blocks); -} - -Status XvMCSyncSubpicture (Display *display, XvMCSubpicture *subpicture) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCSyncSubpicture)(display, subpicture); -} - -Status XvMCFlushSubpicture (Display *display, XvMCSubpicture *subpicture) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCFlushSubpicture)(display, subpicture); -} -Status -XvMCGetSubpictureStatus (Display *display, XvMCSubpicture *subpic, int *stat) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCGetSubpictureStatus)(display, subpic, stat); -} - -Status XvMCCreateBlocks ( - Display *display, - XvMCContext *context, - unsigned int num_blocks, - XvMCBlockArray *block - ) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCCreateBlocks)(display, context, num_blocks, block); -} - - -Status XvMCDestroyBlocks (Display *display,XvMCBlockArray *block) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCDestroyBlocks)(display, block); -} - -Status XvMCCreateMacroBlocks ( - Display *display, - XvMCContext *context, - unsigned int num_blocks, - XvMCMacroBlockArray *blocks - ) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCCreateMacroBlocks)(display, context, num_blocks, blocks); -} - - -Status XvMCDestroyMacroBlocks ( - Display *display, - XvMCMacroBlockArray *block - ) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCDestroyMacroBlocks)(display, block); -} - - -XvAttribute * -XvMCQueryAttributes ( - Display *display, - XvMCContext *context, - int *number - ) -{ - if (!xW.initialised) return NULL; - return (*xW.XvMCQueryAttributes)(display, context, number); -} - - -Status -XvMCSetAttribute ( - Display *display, - XvMCContext *context, - Atom attribute, - int value - ) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCSetAttribute)(display, context, attribute, value); -} - - -Status -XvMCGetAttribute ( - Display *display, - XvMCContext *context, - Atom attribute, - int *value - ) -{ - if (!xW.initialised) return BadValue; - return (*xW.XvMCGetAttribute)(display, context, attribute, value); -} - - -Status XvMCBeginSurface(Display *display, - XvMCContext *context, - XvMCSurface *target_surface, - XvMCSurface *past_surface, - XvMCSurface *future_surface, - const XvMCMpegControl *control) -{ - if (!xW.vldextension) return BadValue; - return (*xW.XvMCBeginSurface)(display, context, target_surface, past_surface, future_surface, - control); -} - -Status XvMCLoadQMatrix(Display *display, XvMCContext *context, - const XvMCQMatrix *qmx) -{ - if (!xW.vldextension) return BadValue; - return (*xW.XvMCLoadQMatrix)(display, context, qmx); -} - -Status XvMCPutSlice(Display *display,XvMCContext *context, - char *slice, int nBytes) -{ - if (!xW.vldextension) return BadValue; - return (*xW.XvMCPutSlice)(display, context, slice, nBytes); -} - -Status XvMCPutSlice2(Display *display,XvMCContext *context, - char *slice, int nBytes, int sliceCode) -{ - if (!xW.vldextension) return BadValue; - return (*xW.XvMCPutSlice2)(display, context, slice, nBytes, sliceCode); -} diff --git a/nx-X11/lib/apple/AppleWM.man b/nx-X11/lib/apple/AppleWM.man deleted file mode 100644 index bb81470c9..000000000 --- a/nx-X11/lib/apple/AppleWM.man +++ /dev/null @@ -1,340 +0,0 @@ -.\" -.\" $XFree86: xc/lib/apple/AppleWM.man,v 1.1 2003/08/12 23:47:10 torrey Exp $ -.\" -.\" Copyright (c) 2002 Apple Computer, Inc. All Rights Reserved. -.\" Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved. -.\" -.\" Permission is hereby granted, free of charge, to any person obtaining a -.\" copy of this software and associated documentation files (the -.\" "Software"), to deal in the Software without restriction, including -.\" without limitation the rights to use, copy, modify, merge, publish, -.\" distribute, sub license, and/or sell copies of the Software, and to -.\" permit persons to whom the Software is furnished to do so, subject to -.\" the following conditions: -.\" -.\" The above copyright notice and this permission notice (including the -.\" next paragraph) shall be included in all copies or substantial portions -.\" of the Software. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -.\" IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -.\" ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -.\" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -.\" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -.\" -.de TQ -.br -.ns -.TP \\$1 -.. -.TH APPLEWM __libmansuffix__ __vendorversion__ - -.SH NAME - AppleWM \- Apple rootless window management extension. -.SH SYNTAX -\&#include -.nf -.sp -Bool XAppleWMQueryExtension \^(\^Display *\fIdpy\fP, - int *\fIevent_basep\fP, int *\fIerror_basep\fP\^); -.sp -Status XAppleWMQueryVersion \^(\^Display *\fIdpy\fP, - int *\fImajor_versionp\fP, int *\fIminor_versionp\fP\^); -.sp -Bool XAppleWMDisableUpdate \^(\^Display *\fIdpy\fP, int \fIscreen\fP\^); -.sp -Bool XAppleWMReenableUpdate \^(\^Display *\fIdpy\fP, int \fIscreen\fP\^); -.sp -Bool XAppleWMSelectInput \^(\^Display *\fIdpy\fP, unsigned long \fImask\fP\^); -.sp -Bool XAppleWMSetWindowMenu \^(\^Display *\fIdpy\fP, int \fInitems\fP, - const char **\fIitems\fP\^); -.sp -Bool XAppleWMSetWindowMenuWithShortcuts \^(\^Display *\fIdpy\fP, - int \fInitems\fP, const char **\fIitems\fP, - const char *\fIshortcuts\fP\^); -.sp -Bool XAppleWMSetWindowMenuCheck \^(\^Display *\fIdpy\fP, int \fIindex\fP\^); -.sp -Bool XAppleWMSetFrontProcess \^(\^Display *\fIdpy\fP\^); -.sp -Bool XAppleWMSetWindowLevel \^(\^Display *\fIdpy\fP, Window \fIwindow\fP, - int \fIlevel\fP\^); -.sp -Bool XAppleWMSetCanQuit \^(\^Display *\fIdpy\fP, Bool \fIstate\fP\^); -.sp -Bool XAppleWMFrameGetRect \^(\^Display *\fIdpy\fP, - unsigned int \fIframe_class\fP, - unsigned int \fIframe_rect\fP, - short \fIinner_x\fP, short \fIinner_y\fP, - short \fIinner_w\fP, short \fIinner_h\fP, - short \fIouter_x\fP, short \fIouter_y\fP, - short \fIouter_w\fP, short \fIouter_h\fP, - short *\fIret_x\fP, short *\fIret_y\fP, - short *\fIret_w\fP, short *\fIret_h\fP\^); -.sp -unsigned int XAppleWMFrameHitTest \^(\^Display *\fIdpy\fP, - unsigned int \fIframe_class\fP, - short \fIpoint_x\fP, short \fIpoint_y\fP, - short \fIinner_x\fP, short \fIinner_y\fP, - short \fIinner_w\fP, short \fIinner_h\fP, - short \fIouter_x\fP, short \fIouter_y\fP, - short \fIouter_w\fP, short \fIouter_h\fP\^); -.sp -Bool XAppleWMFrameDraw \^(\^Display *\fIdpy\fP, int \fIscreen\fP, - Window \fIwindow\fP, - unsigned int \fIframe_class\fP, - unsigned int \fIframe_attr\fP, - short \fIinner_x\fP, short \fIinner_y\fP, - short \fIinner_w\fP, short \fIinner_h\fP, - short \fIouter_x\fP, short \fIouter_y\fP, - short \fIouter_w\fP, short \fIouter_h\fP, - unsigned int \fItitle_length\fP, - const unsigned char *\fItitle_bytes\fP); -.fi -.SH ARGUMENTS -.IP \fIdpy\fP 1i -Specifies the connection to the X server. -.IP \fIscreen\fP 1i -Specifies which screen. -.IP \fImask\fP 1i -Mask of event types the client is interested in. -.IP \fIwindow\fP 1i -Specifies which window. -.IP \fIlevel\fP 1i -Specifies the window level. -.IP \fIframe_class\fP 1i -Specifies the class of window frame decoration. -.IP \fIframe_rect\fP 1i -Specifies which rectangle to return from the window frame decoration. -.IP \fIframe_attr\fP 1i -A mask specifying the attributes of the window frame decoration. -.IP \fIinner_x\fP,\fIinner_y\fP,\fIinner_w\fP,\fIinner_h\fP 1i -Rectangle of the window content inside the window frame decoration. -.IP \fIouter_x\fP,\fIouter_y\fP,\fIouter_w\fP,\fIouter_h\fP 1i -Rectangle of the outer border of the window frame decoration. -.IP \fIpoint_x\fP,\fIpoint_y\fP 1i -Specifies the coordinates of the mouse up event. - -.SH DATATYPES - -.PP -.B Events -.nf -typedef struct { - int type; \/* of event *\/ - unsigned long serial; \/* # of last request processed by server *\/ - Bool send_event; \/* true if came from a SendEvent request *\/ - Display *display; \/* Display the event was read from *\/ - Window window; \/* window of event *\/ - Time time; \/* server timestamp when event happened *\/ - int kind; \/* subtype of event *\/ - int arg; -} XAppleWMNotifyEvent; -.fi -.B XAppleWMNotifyEvent -is sent to a client who has requested notification of AppleWM events with -\fBXAppleWMSelectInput\fP. - -.PP -Event types: -.nf -\&#define AppleWMControllerNotify 0 -\&#define AppleWMActivationNotify 1 -\&#define AppleWMPasteboardNotify 2 -.fi -.PP -Event masks: -.nf -\&#define AppleWMControllerNotifyMask (1L << 0) -\&#define AppleWMActivationNotifyMask (1L << 1) -\&#define AppleWMPasteboardNotifyMask (1L << 2) -.fi -.PP -Kinds of ControllerNotify events: -.nf -\&#define AppleWMMinimizeWindow 0 -\&#define AppleWMZoomWindow 1 -\&#define AppleWMCloseWindow 2 -\&#define AppleWMBringAllToFront 3 -\&#define AppleWMHideWindow 4 -\&#define AppleWMHideAll 5 -\&#define AppleWMShowAll 6 -\&#define AppleWMWindowMenuItem 9 -\&#define AppleWMWindowMenuNotify 10 -\&#define AppleWMNextWindow 11 -\&#define AppleWMPreviousWindow 12 -.fi -.PP -Kinds of ActivationNotify events: -.nf -\&#define AppleWMIsActive 0 -\&#define AppleWMIsInactive 1 -.fi -.PP -Kinds of PasteboardNotify events: -.nf -\&#define AppleWMCopyToPasteboard 0 -.sp -.fi -.PP -.B Window Parameters -.PP -Window level ids for \fBXAppleWMSetWindowLevel\fP: -.nf -\&#define AppleWMWindowLevelNormal 0 -\&#define AppleWMWindowLevelFloating 1 -\&#define AppleWMWindowLevelTornOff 2 -\&#define AppleWMWindowLevelDock 3 -\&#define AppleWMWindowLevelDesktop 4 -\&#define AppleWMNumWindowLevels 5 -.fi -.PP -Values for \fIframe_rect\fP argument to \fBXAppleWMFrameGetRect\fP: -.nf -\&#define AppleWMFrameRectTitleBar 1 -\&#define AppleWMFrameRectTracking 2 -\&#define AppleWMFrameRectGrowBox 3 -.fi -.PP -Window frame classes: -.nf -\&#define AppleWMFrameClassDocument 1 << 0 -\&#define AppleWMFrameClassDialog 1 << 1 -\&#define AppleWMFrameClassModalDialog 1 << 2 -\&#define AppleWMFrameClassSystemModalDialog 1 << 3 -\&#define AppleWMFrameClassUtility 1 << 4 -\&#define AppleWMFrameClassToolbar 1 << 5 -\&#define AppleWMFrameClassMenu 1 << 6 -\&#define AppleWMFrameClassSplash 1 << 7 -\&#define AppleWMFrameClassBorderless 1 << 8 -.fi -.PP -Window frame attributes: -.nf -\&#define AppleWMFrameActive 0x0001 -\&#define AppleWMFrameUrgent 0x0002 -\&#define AppleWMFrameTitle 0x0004 -\&#define AppleWMFramePrelight 0x0008 -\&#define AppleWMFrameShaded 0x0010 -\&#define AppleWMFrameCloseBox 0x0100 -\&#define AppleWMFrameCollapseBox 0x0200 -\&#define AppleWMFrameZoomBox 0x0400 -\&#define AppleWMFrameAnyBox 0x0700 -\&#define AppleWMFrameCloseBoxClicked 0x0800 -\&#define AppleWMFrameCollapseBoxClicked 0x1000 -\&#define AppleWMFrameZoomBoxClicked 0x2000 -\&#define AppleWMFrameAnyBoxClicked 0x3800 -\&#define AppleWMFrameGrowBox 0x4000 -.fi - -.SH DESCRIPTION -.B AppleWM -is a simple library designed to interface with the Apple-WM extension. -This extension allows X window managers to better interact with -the Mac OS X Aqua user interface when running X11 in a rootless mode. -.PP -A more complete description will be forthcoming eventually. - -.SH FUNCTIONS -.B XAppleWMDisableUpdate -causes any updates to the windows on the screen to be queued until updates -are reenabled with \fBXAppleWMReenableUpdate\fP. This is useful to avoid -intermediate redraws to the screen if a number of changes are going to be -made at once. Updates should only be disabled temporarily while drawing -to a window. These calls may be nested and each call to -\fBXAppleWMDisableUpdate\fP must be paired with a subsequent call to -\fBXAppleWMReenableUpdate\fP. Updating is not reenabled until the last -unnested call to \fBXAppleWMReenableUpdate\fP. Disabling updates applies -to window content; however, it is implementation dependent whether window -size and position changes are disabled as well. -.PP -.B XAppleWMSelectInput -is used to request that a client receive notification of the -.B AppleWM -events listed above. The event mask specifies the event types the client is -interested in receiving. Passing an event mask of 0 stops notification of -events. -.PP -.B XAppleWMSetWindowMenu -and -.B XAppleWMSetWindowMenuWithShortcuts -set the list of windows displayed in the X server's "Window" menu in the -Aqua menu bar. Other items may be listed in this menu by the X server, but -a part of this menu is set aside for use by the Apple-WM extension. This -is intended to be used to set a list of important top-level X11 windows. -.PP -One item of the X server's "Window" menu can have a checkmark beside it to -indicate it is the active or front most window. -.B XAppleWMSetWindowMenuCheck -can be used to set the item number to put a checkmark beside. -.PP -.B XAppleWMSetFrontProcess -directs the X server to make itself the front most application among all -the other Mac OS X applications. This causes X11 windows to move above -other applications' windows and for the X server to start receiving -keyboard and mouse events. -.PP -Windows can be placed into different Aqua window levels with -\fBXAppleWMSetWindowLevel\fP. The stacking of window levels takes precedence -over the stacking of windows within a level. Thus the bottom window in a level -will obscure even the top most window of a lower window level. By default all -windows are placed in the lowest window level, AppleWMWindowLevelNormal. When -a window is moved to a new level, it is ordered in front of all of its peers -at the new level. \fINote, X11 does not have the concept of window levels and -this function does not change the X11 window order. The result of trying to -reorder an X11 window above another window of higher level is undefined. -This should probably be changed.\fP -.PP -By default, the X server will ask for confirmation whenever the user requests -that it quit from the Aqua UI. -.B XAppleWMSetCanQuit -can be used to change this behavior. If a \fIstate\fP of TRUE is passed, the -X server will quit without confirmation when requested. If FALSE is passed, -the default behavior is used. -.PP -.B XAppleWMFrameDraw -can be used to decorate a top-level window with the standard Aqua window -frame and widgets. The \fIframe_class\fP controls the overall look of the -window frame and \fIframe_attr\fP specifies the details of how the various -UI elements should be drawn. The dimensions of the X11 window content are -passed as the \fIinner_*\fP rectangle and the dimensions of the Aqua window -frame are passed as the \fIouter_*\fP rectangle. -.B XAppleWMFrameGetRect -is used to calculate the size of the outer rectangle from the size of the -window content, which is being reparented. -.PP -.B XAppleWMFrameGetRect -returns a rectangle that encloses an element of the window frame decoration. -The \fIframe_rect\fP argument specifies the element of interest. The -\fIinner_*\fP and \fIouter_*\fP rectangles (as described above) specify the -window geometry. If AppleWMFrameRectTitleBar is passed for \fIframe_rect\fP, -the \fIinner_*\fP parameters are ignored. The returned rectangle has the -dimensions of the \fIouter_*\fP rectangle except that its height is equal -to the constant title bar height for the specified \fIframe_class\fP. The -proper outer rectangle for a given window content size is the union of inner -rectangle and the title bar rectangle. The AppleWMFrameRectTracking and -AppleWMFrameRectGrowBox rectangles are primarily intended to be used by the -window manager to determine the correct placement for child windows to -receive events. The tracking rectangle is the area of the window containing -the close, collapse and zoom boxes. Typically when the cursor is over this -area, the window manager will highlight the close, collapse, and zoom -buttons to conform to the standard Aqua interface. -.PP -If a mouse up or down event is received in the tracking rectangle, -.B XAppleWMFrameHitTest -is used to determine which button was clicked. -.B XAppleWMFrameHitTest -returns AppleWMFrameCloseBox, AppleWMFrameCollapseBox, or AppleWMFrameZoomBox -to indicate which button was clicked. If no button was clicked, 0 will be -returned. -.PP -Other functions include: \fBXAppleWMQueryExtension\fP, which returns the event -and error base codes and \fBXAppleWMQueryVersion\fP, which returns the current -version of the extension. (This information is cached by the library.) - -.SH RESTRICTIONS -.B AppleWM -is only intended to be used on Mac OS X when running a rootless X server. diff --git a/nx-X11/lib/apple/Imakefile b/nx-X11/lib/apple/Imakefile deleted file mode 100644 index a3dabf455..000000000 --- a/nx-X11/lib/apple/Imakefile +++ /dev/null @@ -1,37 +0,0 @@ -XCOMM $XFree86: xc/lib/Xrandr/Imakefile,v 1.2 2002/10/02 16:55:41 keithp Exp $ - - -#define DoNormalLib NormalLibAppleWM -#define DoSharedLib SharedLibAppleWM -#define DoDebugLib DebugLibAppleWM -#define DoProfileLib ProfileLibAppleWM -#define LibName AppleWM -#define SoRev SOAPPLEWMREV -#define IncSubdir X11 -#define IncSubSubdir extensions - -#include - -#ifdef SharedAppleWMReqs -REQUIREDLIBS = SharedAppleWMReqs -#endif - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - - DEFINES = $(ALLOC_DEFINES) - INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) - SRCS = applewm.c - OBJS = applewm.o - LINTLIBS = $(LINTXLIB) - -HEADERS = applewm.h applewmstr.h - -#include - -MANSUFFIX = $(LIBMANSUFFIX) - -InstallManPage(AppleWM,$(LIBMANDIR)) - -DependTarget() diff --git a/nx-X11/lib/apple/applewm.c b/nx-X11/lib/apple/applewm.c deleted file mode 100644 index c627762fb..000000000 --- a/nx-X11/lib/apple/applewm.c +++ /dev/null @@ -1,530 +0,0 @@ -/* $XFree86: xc/lib/GL/dri/XF86dri.c,v 1.12 2001/08/27 17:40:57 dawes Exp $ */ -/************************************************************************** - -Copyright (c) 2002 Apple Computer, 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, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* THIS IS NOT AN X CONSORTIUM STANDARD */ - -#define NEED_EVENTS -#define NEED_REPLIES -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include - -static XExtensionInfo _applewm_info_data; -static XExtensionInfo *applewm_info = &_applewm_info_data; -static char *applewm_extension_name = APPLEWMNAME; - -#define AppleWMCheckExtension(dpy,i,val) \ - XextCheckExtension (dpy, i, applewm_extension_name, val) - -/***************************************************************************** - * * - * private utility routines * - * * - *****************************************************************************/ - -static int close_display(Display *dpy, XExtCodes *extCodes); -static Bool wire_to_event(); -static Status event_to_wire(); - -static /* const */ XExtensionHooks applewm_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, applewm_info, - applewm_extension_name, - &applewm_extension_hooks, - AppleWMNumberEvents, NULL) - -static XEXT_GENERATE_CLOSE_DISPLAY (close_display, applewm_info) - -static Bool wire_to_event (dpy, re, event) - Display *dpy; - XEvent *re; - xEvent *event; -{ - XExtDisplayInfo *info = find_display (dpy); - XAppleWMNotifyEvent *se; - xAppleWMNotifyEvent *sevent; - - AppleWMCheckExtension (dpy, info, False); - - switch ((event->u.u.type & 0x7f) - info->codes->first_event) { - case AppleWMControllerNotify: - case AppleWMActivationNotify: - case AppleWMPasteboardNotify: - se = (XAppleWMNotifyEvent *) re; - sevent = (xAppleWMNotifyEvent *) event; - se->type = sevent->type & 0x7f; - se->serial = _XSetLastRequestRead(dpy,(xGenericReply *) event); - se->send_event = (sevent->type & 0x80) != 0; - se->display = dpy; - se->window = 0; - se->time = sevent->time; - se->kind = sevent->kind; - se->arg = sevent->arg; - return True; - } - return False; -} - -static Status event_to_wire (dpy, re, event) - Display *dpy; - XEvent *re; - xEvent *event; -{ - XExtDisplayInfo *info = find_display (dpy); - XAppleWMNotifyEvent *se; - xAppleWMNotifyEvent *sevent; - - AppleWMCheckExtension (dpy, info, False); - - switch ((re->type & 0x7f) - info->codes->first_event) { - case AppleWMControllerNotify: - case AppleWMActivationNotify: - case AppleWMPasteboardNotify: - se = (XAppleWMNotifyEvent *) re; - sevent = (xAppleWMNotifyEvent *) event; - sevent->type = se->type | (se->send_event ? 0x80 : 0); - sevent->sequenceNumber = se->serial & 0xffff; - sevent->kind = se->kind; - sevent->arg = se->arg; - sevent->time = se->time; - return 1; - } - return 0; -} - -/***************************************************************************** - * * - * public Apple-WM Extension routines * - * * - *****************************************************************************/ - -#if 0 -#include -#define TRACE(msg) fprintf(stderr, "AppleWM%s\n", msg); -#else -#define TRACE(msg) -#endif - - -Bool XAppleWMQueryExtension (dpy, event_basep, error_basep) - Display *dpy; - int *event_basep, *error_basep; -{ - XExtDisplayInfo *info = find_display (dpy); - - TRACE("QueryExtension..."); - if (XextHasExtension(info)) { - *event_basep = info->codes->first_event; - *error_basep = info->codes->first_error; - TRACE("QueryExtension... return True"); - return True; - } else { - TRACE("QueryExtension... return False"); - return False; - } -} - -Bool XAppleWMQueryVersion(dpy, majorVersion, minorVersion, patchVersion) - Display* dpy; - int* majorVersion; - int* minorVersion; - int* patchVersion; -{ - XExtDisplayInfo *info = find_display (dpy); - xAppleWMQueryVersionReply rep; - xAppleWMQueryVersionReq *req; - - TRACE("QueryVersion..."); - AppleWMCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(AppleWMQueryVersion, req); - req->reqType = info->codes->major_opcode; - req->wmReqType = X_AppleWMQueryVersion; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("QueryVersion... return False"); - return False; - } - *majorVersion = rep.majorVersion; - *minorVersion = rep.minorVersion; - *patchVersion = rep.patchVersion; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("QueryVersion... return True"); - return True; -} - -Bool XAppleWMDisableUpdate(dpy, screen) - Display* dpy; - int screen; -{ - XExtDisplayInfo *info = find_display (dpy); - xAppleWMDisableUpdateReq *req; - - TRACE("DisableUpdate..."); - AppleWMCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(AppleWMDisableUpdate, req); - req->reqType = info->codes->major_opcode; - req->wmReqType = X_AppleWMDisableUpdate; - req->screen = screen; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("DisableUpdate... return True"); - return True; -} - -Bool XAppleWMReenableUpdate(dpy, screen) - Display* dpy; - int screen; -{ - XExtDisplayInfo *info = find_display (dpy); - xAppleWMReenableUpdateReq *req; - - TRACE("ReenableUpdate..."); - AppleWMCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(AppleWMReenableUpdate, req); - req->reqType = info->codes->major_opcode; - req->wmReqType = X_AppleWMReenableUpdate; - req->screen = screen; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("ReenableUpdate... return True"); - return True; -} - -Bool XAppleWMSelectInput(dpy, mask) - Display* dpy; - unsigned long mask; -{ - XExtDisplayInfo *info = find_display (dpy); - xAppleWMSelectInputReq *req; - - TRACE("SelectInput..."); - AppleWMCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(AppleWMSelectInput, req); - req->reqType = info->codes->major_opcode; - req->wmReqType = X_AppleWMSelectInput; - req->mask = mask; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("SetlectInput... return True"); - return True; -} - -Bool XAppleWMSetWindowMenuWithShortcuts(dpy, nitems, items, shortcuts) - Display* dpy; - int nitems; - const char **items; - const char *shortcuts; -{ - XExtDisplayInfo *info = find_display (dpy); - xAppleWMSetWindowMenuReq *req; - int i, total_length, len; - char *buf, *ptr; - - TRACE("SetWindowMenu..."); - AppleWMCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(AppleWMSetWindowMenu, req); - req->reqType = info->codes->major_opcode; - req->wmReqType = X_AppleWMSetWindowMenu; - req->nitems = nitems; - - total_length = 0; - for (i = 0; i < nitems; i++) - total_length += strlen (items[i]) + 2; - - ptr = buf = alloca (total_length); - for (i = 0; i < nitems; i++) - { - len = strlen (items[i]); - *ptr++ = shortcuts ? shortcuts[i] : 0; - memcpy (ptr, items[i], len); - ptr[len] = 0; - ptr += len + 1; - } - - req->length += (total_length + 3) >> 2; - Data (dpy, buf, total_length); - - UnlockDisplay(dpy); - SyncHandle(); - TRACE("SetlectInput... return True"); - return True; -} - -Bool XAppleWMSetWindowMenu(dpy, nitems, items) - Display* dpy; - int nitems; - const char **items; -{ - return XAppleWMSetWindowMenuWithShortcuts (dpy, nitems, items, NULL); -} - -Bool XAppleWMSetWindowMenuCheck(dpy, idx) - Display* dpy; - int idx; -{ - XExtDisplayInfo *info = find_display (dpy); - xAppleWMSetWindowMenuCheckReq *req; - - TRACE("SetWindowMenuCheck..."); - AppleWMCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(AppleWMSetWindowMenuCheck, req); - req->reqType = info->codes->major_opcode; - req->wmReqType = X_AppleWMSetWindowMenuCheck; - req->index = idx; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("SetWindowMenuCheck... return True"); - return True; -} - -Bool XAppleWMSetFrontProcess(dpy) - Display* dpy; -{ - XExtDisplayInfo *info = find_display (dpy); - xAppleWMSetFrontProcessReq *req; - - TRACE("SetFrontProcess..."); - AppleWMCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(AppleWMSetFrontProcess, req); - req->reqType = info->codes->major_opcode; - req->wmReqType = X_AppleWMSetFrontProcess; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("SetFrontProcess... return True"); - return True; -} - -Bool XAppleWMSetWindowLevel(dpy, id, level) - Display* dpy; - Window id; - int level; -{ - XExtDisplayInfo *info = find_display (dpy); - xAppleWMSetWindowLevelReq *req; - - TRACE("SetWindowLevel..."); - AppleWMCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(AppleWMSetWindowLevel, req); - req->reqType = info->codes->major_opcode; - req->wmReqType = X_AppleWMSetWindowLevel; - req->window = id; - req->level = level; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("SetWindowLevel... return True"); - return True; -} - -Bool XAppleWMSetCanQuit(dpy, state) - Display* dpy; - Bool state; -{ - XExtDisplayInfo *info = find_display (dpy); - xAppleWMSetCanQuitReq *req; - - TRACE("SetCanQuit..."); - AppleWMCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(AppleWMSetCanQuit, req); - req->reqType = info->codes->major_opcode; - req->wmReqType = X_AppleWMSetCanQuit; - req->state = state; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("SetCanQuit... return True"); - return True; -} - -Bool XAppleWMFrameGetRect(dpy, frame_class, frame_rect, - ix, iy, iw, ih, ox, oy, ow, oh, rx, ry, rw, rh) - Display* dpy; - unsigned int frame_class, frame_rect; - short ix, iy, iw, ih; - short ox, oy, ow, oh; - short *rx, *ry, *rw, *rh; -{ - XExtDisplayInfo *info = find_display (dpy); - xAppleWMFrameGetRectReply rep; - xAppleWMFrameGetRectReq *req; - - TRACE("FrameGetRect..."); - AppleWMCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(AppleWMFrameGetRect, req); - req->reqType = info->codes->major_opcode; - req->wmReqType = X_AppleWMFrameGetRect; - req->frame_class = frame_class; - req->frame_rect = frame_rect; - req->ix = ix; - req->iy = iy; - req->iw = iw; - req->ih = ih; - req->ox = ox; - req->oy = oy; - req->ow = ow; - req->oh = oh; - rep.x = rep.y = rep.w = rep.h = 0; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("FrameGetRect... return False"); - return False; - } - *rx = rep.x; *ry = rep.y; - *rw = rep.w; *rh = rep.h; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("FrameGetRect... return True"); - return True; -} - -unsigned int XAppleWMFrameHitTest(dpy, frame_class, px, py, - ix, iy, iw, ih, ox, oy, ow, oh) - Display* dpy; - unsigned int frame_class; - short px, py; - short ix, iy, iw, ih; - short ox, oy, ow, oh; -{ - XExtDisplayInfo *info = find_display (dpy); - xAppleWMFrameHitTestReply rep; - xAppleWMFrameHitTestReq *req; - - TRACE("FrameHitTest..."); - AppleWMCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(AppleWMFrameHitTest, req); - req->reqType = info->codes->major_opcode; - req->wmReqType = X_AppleWMFrameHitTest; - req->frame_class = frame_class; - req->px = px; - req->py = py; - req->ix = ix; - req->iy = iy; - req->iw = iw; - req->ih = ih; - req->ox = ox; - req->oy = oy; - req->ow = ow; - req->oh = oh; - rep.ret = 0; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("FrameHitTest... return False"); - return False; - } - UnlockDisplay(dpy); - SyncHandle(); - TRACE("FrameHiTest... return True"); - return rep.ret; -} - -Bool XAppleWMFrameDraw(dpy, screen, window, - frame_class, frame_attr, - ix, iy, iw, ih, ox, oy, ow, oh, - title_length, title_bytes) - Display* dpy; - int screen; - Window window; - unsigned int frame_class, frame_attr; - short ix, iy, iw, ih; - short ox, oy, ow, oh; - unsigned int title_length; - const unsigned char *title_bytes; -{ - XExtDisplayInfo *info = find_display (dpy); - xAppleWMFrameDrawReq *req; - - TRACE("FrameDraw..."); - AppleWMCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(AppleWMFrameDraw, req); - req->reqType = info->codes->major_opcode; - req->wmReqType = X_AppleWMFrameDraw; - req->screen = screen; - req->window = window; - req->frame_class = frame_class; - req->frame_attr = frame_attr; - req->ix = ix; - req->iy = iy; - req->iw = iw; - req->ih = ih; - req->ox = ox; - req->oy = oy; - req->ow = ow; - req->oh = oh; - req->title_length = title_length; - - req->length += (title_length + 3)>>2; - Data (dpy, title_bytes, title_length); - - UnlockDisplay(dpy); - SyncHandle(); - TRACE("FrameDraw... return True"); - return True; -} diff --git a/nx-X11/lib/apple/applewm.h b/nx-X11/lib/apple/applewm.h deleted file mode 100644 index 884d5cb91..000000000 --- a/nx-X11/lib/apple/applewm.h +++ /dev/null @@ -1,190 +0,0 @@ -/* $XFree86: xc/lib/apple/applewm.h,v 1.1 2003/08/12 23:47:10 torrey Exp $ */ -/************************************************************************** - -Copyright (c) 2002 Apple Computer, 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, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -#ifndef _APPLEWM_H_ -#define _APPLEWM_H_ - -#include - -#define X_AppleWMQueryVersion 0 -#define X_AppleWMFrameGetRect 1 -#define X_AppleWMFrameHitTest 2 -#define X_AppleWMFrameDraw 3 -#define X_AppleWMDisableUpdate 4 -#define X_AppleWMReenableUpdate 5 -#define X_AppleWMSelectInput 6 -#define X_AppleWMSetWindowMenuCheck 7 -#define X_AppleWMSetFrontProcess 8 -#define X_AppleWMSetWindowLevel 9 -#define X_AppleWMSetCanQuit 10 -#define X_AppleWMSetWindowMenu 11 - -/* Events */ -#define AppleWMControllerNotify 0 -#define AppleWMActivationNotify 1 -#define AppleWMPasteboardNotify 2 -#define AppleWMNumberEvents 3 - -#define AppleWMControllerNotifyMask (1L << 0) -#define AppleWMActivationNotifyMask (1L << 1) -#define AppleWMPasteboardNotifyMask (1L << 2) - -/* "Kinds" of ControllerNotify events */ -#define AppleWMMinimizeWindow 0 -#define AppleWMZoomWindow 1 -#define AppleWMCloseWindow 2 -#define AppleWMBringAllToFront 3 -#define AppleWMHideWindow 4 -#define AppleWMHideAll 5 -#define AppleWMShowAll 6 -#define AppleWMWindowMenuItem 9 -#define AppleWMWindowMenuNotify 10 -#define AppleWMNextWindow 11 -#define AppleWMPreviousWindow 12 - -/* "Kinds" of ActivationNotify events */ -#define AppleWMIsActive 0 -#define AppleWMIsInactive 1 - -/* "Kinds" of PasteboardNotify events */ -#define AppleWMCopyToPasteboard 0 - -/* Errors */ -#define AppleWMClientNotLocal 0 -#define AppleWMOperationNotSupported 1 -#define AppleWMNumberErrors (AppleWMOperationNotSupported + 1) - -/* Window level ids */ -#define AppleWMWindowLevelNormal 0 -#define AppleWMWindowLevelFloating 1 -#define AppleWMWindowLevelTornOff 2 -#define AppleWMWindowLevelDock 3 -#define AppleWMWindowLevelDesktop 4 -#define AppleWMNumWindowLevels 5 - -/* Possible value for frame_rect argument to XAppleWMFrameGetRect() */ -#define AppleWMFrameRectTitleBar 1 -#define AppleWMFrameRectTracking 2 -#define AppleWMFrameRectGrowBox 3 - -/* Window frame classes */ -#define AppleWMFrameClassDocument 1 << 0 -#define AppleWMFrameClassDialog 1 << 1 -#define AppleWMFrameClassModalDialog 1 << 2 -#define AppleWMFrameClassSystemModalDialog 1 << 3 -#define AppleWMFrameClassUtility 1 << 4 -#define AppleWMFrameClassToolbar 1 << 5 -#define AppleWMFrameClassMenu 1 << 6 -#define AppleWMFrameClassSplash 1 << 7 -#define AppleWMFrameClassBorderless 1 << 8 - -/* Window frame attributes */ -#define AppleWMFrameActive 0x0001 -#define AppleWMFrameUrgent 0x0002 -#define AppleWMFrameTitle 0x0004 -#define AppleWMFramePrelight 0x0008 -#define AppleWMFrameShaded 0x0010 -#define AppleWMFrameCloseBox 0x0100 -#define AppleWMFrameCollapseBox 0x0200 -#define AppleWMFrameZoomBox 0x0400 -#define AppleWMFrameAnyBox 0x0700 -#define AppleWMFrameCloseBoxClicked 0x0800 -#define AppleWMFrameCollapseBoxClicked 0x1000 -#define AppleWMFrameZoomBoxClicked 0x2000 -#define AppleWMFrameAnyBoxClicked 0x3800 -#define AppleWMFrameGrowBox 0x4000 - -#ifndef _APPLEWM_SERVER_ - -typedef struct { - int type; /* of event */ - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came frome a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; /* window of event */ - Time time; /* server timestamp when event happened */ - int kind; /* subtype of event */ - int arg; -} XAppleWMNotifyEvent; - -_XFUNCPROTOBEGIN - -Bool XAppleWMQueryExtension (Display *dpy, int *event_base, int *error_base); - -Bool XAppleWMQueryVersion (Display *dpy, int *majorVersion, - int *minorVersion, int *patchVersion); - -Bool XAppleWMDisableUpdate (Display *dpy, int screen); - -Bool XAppleWMReenableUpdate (Display *dpy, int screen); - -Bool XAppleWMSelectInput (Display *dpy, unsigned long mask); - -Bool XAppleWMSetWindowMenu (Display *dpy, int nitems, const char **items); -Bool XAppleWMSetWindowMenuWithShortcuts (Display *dpy, int nitems, - const char **items, - const char *shortcuts); - -Bool XAppleWMSetWindowMenuCheck (Display *dpy, int index); - -Bool XAppleWMSetFrontProcess (Display *dpy); - -Bool XAppleWMSetWindowLevel (Display *dpy, Window id, int level); - -Bool XAppleWMSetCanQuit (Display *dpy, Bool state); - -Bool XAppleWMFrameGetRect (Display *dpy, - unsigned int frame_class, unsigned int frame_rect, - short inner_x, short inner_y, - short inner_w, short inner_h, - short outer_x, short outer_y, - short outer_w, short outer_h, - short *ret_x, short *ret_y, - short *ret_w, short *ret_h); - -unsigned int XAppleWMFrameHitTest (Display *dpy, - unsigned int frame_class, - short point_x, short point_y, - short inner_x, short inner_y, - short inner_w, short inner_h, - short outer_x, short outer_y, - short outer_w, short outer_h); - -Bool XAppleWMFrameDraw (Display *dpy, int screen, Window window, - unsigned int frame_class, unsigned int frame_attr, - short inner_x, short inner_y, - short inner_w, short inner_h, - short outer_x, short outer_y, - short outer_w, short outer_h, - unsigned int title_length, - const unsigned char * title_bytes); - -_XFUNCPROTOEND - -#endif /* _APPLEWM_SERVER_ */ -#endif /* _APPLEWM_H_ */ diff --git a/nx-X11/lib/apple/applewmstr.h b/nx-X11/lib/apple/applewmstr.h deleted file mode 100644 index 392eaa885..000000000 --- a/nx-X11/lib/apple/applewmstr.h +++ /dev/null @@ -1,226 +0,0 @@ -/* $XFree86: xc/lib/apple/applewmstr.h,v 1.1 2003/08/12 23:47:10 torrey Exp $ */ -/************************************************************************** - -Copyright (c) 2002 Apple Computer, 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, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -#ifndef _APPLEWMSTR_H_ -#define _APPLEWMSTR_H_ - -#include -#include -#include - -#define APPLEWMNAME "Apple-WM" - -#define APPLE_WM_MAJOR_VERSION 1 /* current version numbers */ -#define APPLE_WM_MINOR_VERSION 0 -#define APPLE_WM_PATCH_VERSION 0 - -typedef struct _AppleWMQueryVersion { - CARD8 reqType; /* always WMReqCode */ - CARD8 wmReqType; /* always X_WMQueryVersion */ - CARD16 length B16; -} xAppleWMQueryVersionReq; -#define sz_xAppleWMQueryVersionReq 4 - -typedef struct { - BYTE type; /* X_Reply */ - BOOL pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD16 majorVersion B16; /* major version of WM protocol */ - CARD16 minorVersion B16; /* minor version of WM protocol */ - CARD32 patchVersion B32; /* patch version of WM protocol */ - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; -} xAppleWMQueryVersionReply; -#define sz_xAppleWMQueryVersionReply 32 - -typedef struct _AppleWMDisableUpdate { - CARD8 reqType; /* always WMReqCode */ - CARD8 wmReqType; /* always X_WMDisableUpdate */ - CARD16 length B16; - CARD32 screen B32; -} xAppleWMDisableUpdateReq; -#define sz_xAppleWMDisableUpdateReq 8 - -typedef struct _AppleWMReenableUpdate { - CARD8 reqType; /* always WMReqCode */ - CARD8 wmReqType; /* always X_WMReenableUpdate */ - CARD16 length B16; - CARD32 screen B32; -} xAppleWMReenableUpdateReq; -#define sz_xAppleWMReenableUpdateReq 8 - -typedef struct _AppleWMSelectInput { - CARD8 reqType; /* always WMReqCode */ - CARD8 wmReqType; /* always X_WMSelectInput */ - CARD16 length B16; - CARD32 mask B32; -} xAppleWMSelectInputReq; -#define sz_xAppleWMSelectInputReq 8 - -typedef struct _AppleWMNotify { - BYTE type; /* always eventBase + event type */ - BYTE kind; - CARD16 sequenceNumber B16; - Time time B32; /* time of change */ - CARD16 pad1 B16; - CARD32 arg B32; - CARD32 pad3 B32; -} xAppleWMNotifyEvent; -#define sz_xAppleWMNotifyEvent 20 - -typedef struct _AppleWMSetWindowMenu { - CARD8 reqType; /* always WMReqCode */ - CARD8 wmReqType; /* always X_WMSetWindowMenu */ - CARD16 length B16; - CARD16 nitems B16; - CARD16 pad1 B16; -} xAppleWMSetWindowMenuReq; -#define sz_xAppleWMSetWindowMenuReq 8 - -typedef struct _AppleWMSetWindowMenuCheck { - CARD8 reqType; /* always WMReqCode */ - CARD8 wmReqType; /* always X_WMSetWindowMenuCheck */ - CARD16 length B16; - CARD32 index; -} xAppleWMSetWindowMenuCheckReq; -#define sz_xAppleWMSetWindowMenuCheckReq 8 - -typedef struct _AppleWMSetFrontProcess { - CARD8 reqType; /* always WMReqCode */ - CARD8 wmReqType; /* always X_WMSetFrontProcess */ - CARD16 length B16; -} xAppleWMSetFrontProcessReq; -#define sz_xAppleWMSetFrontProcessReq 4 - -typedef struct _AppleWMSetWindowLevel { - CARD8 reqType; /* always WMReqCode */ - CARD8 wmReqType; /* always X_WMSetWindowLevel */ - CARD16 length B16; - CARD32 window; - CARD32 level; -} xAppleWMSetWindowLevelReq; -#define sz_xAppleWMSetWindowLevelReq 12 - -typedef struct _AppleWMSetCanQuit { - CARD8 reqType; /* always WMReqCode */ - CARD8 wmReqType; /* always X_WMSetCanQuit */ - CARD16 length B16; - CARD32 state; -} xAppleWMSetCanQuitReq; -#define sz_xAppleWMSetCanQuitReq 8 - -typedef struct _AppleWMFrameGetRect { - CARD8 reqType; /* always WMReqCode */ - CARD8 wmReqType; /* always X_WMFrameGetRect */ - CARD16 length B16; - CARD16 frame_class B16; - CARD16 frame_rect B16; - CARD16 ix B16; - CARD16 iy B16; - CARD16 iw B16; - CARD16 ih B16; - CARD16 ox B16; - CARD16 oy B16; - CARD16 ow B16; - CARD16 oh B16; -} xAppleWMFrameGetRectReq; -#define sz_xAppleWMFrameGetRectReq 24 - -typedef struct { - BYTE type; /* X_Reply */ - BOOL pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD16 x B16; - CARD16 y B16; - CARD16 w B16; - CARD16 h B16; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; -} xAppleWMFrameGetRectReply; -#define sz_xAppleWMFrameGetRectReply 32 - -typedef struct _AppleWMFrameHitTest { - CARD8 reqType; /* always WMReqCode */ - CARD8 wmReqType; /* always X_WMFrameHitTest */ - CARD16 length B16; - CARD16 frame_class B16; - CARD16 pad1 B16; - CARD16 px B16; - CARD16 py B16; - CARD16 ix B16; - CARD16 iy B16; - CARD16 iw B16; - CARD16 ih B16; - CARD16 ox B16; - CARD16 oy B16; - CARD16 ow B16; - CARD16 oh B16; -} xAppleWMFrameHitTestReq; -#define sz_xAppleWMFrameHitTestReq 28 - -typedef struct { - BYTE type; /* X_Reply */ - BOOL pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 ret B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; -} xAppleWMFrameHitTestReply; -#define sz_xAppleWMFrameHitTestReply 32 - -typedef struct _AppleWMFrameDraw { - CARD8 reqType; /* always WMReqCode */ - CARD8 wmReqType; /* always X_WMFrameDraw */ - CARD16 length B16; - CARD32 screen B32; - CARD32 window B32; - CARD16 frame_class B16; - CARD16 frame_attr B16; - CARD16 ix B16; - CARD16 iy B16; - CARD16 iw B16; - CARD16 ih B16; - CARD16 ox B16; - CARD16 oy B16; - CARD16 ow B16; - CARD16 oh B16; - CARD32 title_length B32; -} xAppleWMFrameDrawReq; -#define sz_xAppleWMFrameDrawReq 36 - -#endif /* _APPLEWMSTR_H_ */ diff --git a/nx-X11/lib/dmx/Imakefile b/nx-X11/lib/dmx/Imakefile deleted file mode 100644 index c4296de6f..000000000 --- a/nx-X11/lib/dmx/Imakefile +++ /dev/null @@ -1,26 +0,0 @@ -XCOMM $XFree86$ - -#define DoNormalLib NormalLibDmx -#define DoSharedLib SharedLibDmx -#define DoDebugLib DebugLibDmx -#define DoProfileLib ProfileLibDmx - -#define LibName dmx -#define SoRev SODMXREV -#define LibHeaders NO - -#include - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - - DEFINES = $(ALLOC_DEFINES) - INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) - SRCS = dmx.c - OBJS = dmx.o - LINTLIBS = $(LINTXLIB) - -#include - -DependTarget() diff --git a/nx-X11/lib/dmx/dmx.c b/nx-X11/lib/dmx/dmx.c deleted file mode 100644 index 1df28e690..000000000 --- a/nx-X11/lib/dmx/dmx.c +++ /dev/null @@ -1,802 +0,0 @@ -/* $XFree86$ */ -/* - * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina. - * - * 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 on 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 (including the - * next paragraph) shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith - * - */ - -/* THIS IS NOT AN X CONSORTIUM STANDARD */ - -/** \file - * This file implements the client-side part of the DMX protocol. It - * can be included in client applications by linking with the libdmx.a - * library. */ - -#define NEED_REPLIES -#include -#include -#define EXTENSION_PROC_ARGS void * -#include -#include -#include - -static XExtensionInfo dmx_extension_info_data; -static XExtensionInfo *dmx_extension_info = &dmx_extension_info_data; -static const char *dmx_extension_name = DMX_EXTENSION_NAME; - -#define DMXCheckExtension(dpy,i,val) \ - XextCheckExtension(dpy, i, dmx_extension_name, val) -#define DMXSimpleCheckExtension(dpy,i) \ - XextSimpleCheckExtension(dpy, i, dmx_extension_name) - -/***************************************************************************** - * * - * private utility routines * - * * - *****************************************************************************/ - -static int close_display(Display *dpy, XExtCodes *extCodes); -static /* const */ XExtensionHooks dmx_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, dmx_extension_info, - (char *)dmx_extension_name, - &dmx_extension_hooks, - 0, NULL) - -static XEXT_GENERATE_CLOSE_DISPLAY(close_display, dmx_extension_info) - - -/***************************************************************************** - * * - * public DMX Extension routines * - * * - *****************************************************************************/ - -/** If the server has the DMX extension, the event and error bases will - * be placed in \a event_basep and \a error_basep, and True will be - * returned. Otherwise, False will be returned. - * - * Available in DMX Protocol Version 1.0 */ -Bool DMXQueryExtension(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; - } -} - -/** If the DMXQueryVersion protocol request returns version information - * from the server, \a majorVersion, \a minorVersion, and \a - * patchVersion are filled in with the appropriate information and True - * is returned. Otherwise, False will be returned. - * - * Available in DMX Protocol Version 1.0 */ -Bool DMXQueryVersion(Display *dpy, - int *majorVersion, int *minorVersion, int *patchVersion) -{ - XExtDisplayInfo *info = find_display(dpy); - xDMXQueryVersionReply rep; - xDMXQueryVersionReq *req; - - DMXCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(DMXQueryVersion, req); - req->reqType = info->codes->major_opcode; - req->dmxReqType = X_DMXQueryVersion; - if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - *majorVersion = rep.majorVersion; - *minorVersion = rep.minorVersion; - *patchVersion = rep.patchVersion; - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -/** Flush all pending dmxSync requests in DMX server. - * - * Available in DMX Protocol Version 1.5 */ -Bool DMXSync(Display *dpy) -{ - XExtDisplayInfo *info = find_display(dpy); - xDMXSyncReply rep; - xDMXSyncReq *req; - - DMXCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(DMXSync, req); - req->reqType = info->codes->major_opcode; - req->dmxReqType = X_DMXSync; - if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - - UnlockDisplay(dpy); - SyncHandle(); - return rep.status == Success ? True : False; -} - -/** The creation of the specified \a window will be forced. - * - * Available in DMX Protocol Version 1.2 - * Reply added in DMX Protocol Version 2.0 */ -Bool DMXForceWindowCreation(Display *dpy, Window window) -{ - XExtDisplayInfo *info = find_display(dpy); - xDMXForceWindowCreationReq *req; - xDMXForceWindowCreationReply rep; - - DMXCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(DMXForceWindowCreation, req); - req->reqType = info->codes->major_opcode; - req->dmxReqType = X_DMXForceWindowCreation; - req->window = window; - if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - - UnlockDisplay(dpy); - SyncHandle(); - return rep.status == Success ? True : False; -} - -/** If the DMXGetScreenCount protocol request returns the screen count, - * the value will be placed in \a screen_count, and True will be - * returned. Otherwise, False will be returned. - * - * Available in DMX Protocol Version 1.0 */ -Bool DMXGetScreenCount(Display *dpy, int *screen_count) -{ - XExtDisplayInfo *info = find_display(dpy); - xDMXGetScreenCountReply rep; - xDMXGetScreenCountReq *req; - - DMXCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(DMXGetScreenCount, req); - req->reqType = info->codes->major_opcode; - req->dmxReqType = X_DMXGetScreenCount; - if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - *screen_count = rep.screenCount; - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -/** If the DMXGetScreenAttributes protocol request returns information - * for the specified \a physical_screen, information about the screen - * will be placed in \a attr, and True will be returned. Otherwise, - * False will be returned. - * - * Available in DMX Protocol Version 1.0; Modified in Version 2.0 */ -Bool DMXGetScreenAttributes(Display *dpy, int physical_screen, - DMXScreenAttributes *attr) -{ - XExtDisplayInfo *info = find_display(dpy); - xDMXGetScreenAttributesReply rep; - xDMXGetScreenAttributesReq *req; - - DMXCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(DMXGetScreenAttributes, req); - req->reqType = info->codes->major_opcode; - req->dmxReqType = X_DMXGetScreenAttributes; - req->physicalScreen = physical_screen; - if (!_XReply(dpy, (xReply *)&rep, - (SIZEOF(xDMXGetScreenAttributesReply) - 32) >> 2, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - attr->displayName = Xmalloc(rep.displayNameLength + 1 + 4 /* for pad */); - _XReadPad(dpy, attr->displayName, rep.displayNameLength); - attr->displayName[rep.displayNameLength] = '\0'; - attr->logicalScreen = rep.logicalScreen; - - attr->screenWindowWidth = rep.screenWindowWidth; - attr->screenWindowHeight = rep.screenWindowHeight; - attr->screenWindowXoffset = rep.screenWindowXoffset; - attr->screenWindowYoffset = rep.screenWindowYoffset; - - attr->rootWindowWidth = rep.rootWindowWidth; - attr->rootWindowHeight = rep.rootWindowHeight; - attr->rootWindowXoffset = rep.rootWindowXoffset; - attr->rootWindowYoffset = rep.rootWindowYoffset; - attr->rootWindowXorigin = rep.rootWindowXorigin; - attr->rootWindowYorigin = rep.rootWindowYorigin; - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -static CARD32 _DMXGetScreenAttribute(int bit, DMXScreenAttributes *attr) -{ - switch (1 << bit) { - case DMXScreenWindowWidth: return attr->screenWindowWidth; - case DMXScreenWindowHeight: return attr->screenWindowHeight; - case DMXScreenWindowXoffset: return attr->screenWindowXoffset; - case DMXScreenWindowYoffset: return attr->screenWindowYoffset; - case DMXRootWindowWidth: return attr->rootWindowWidth; - case DMXRootWindowHeight: return attr->rootWindowHeight; - case DMXRootWindowXoffset: return attr->rootWindowXoffset; - case DMXRootWindowYoffset: return attr->rootWindowYoffset; - case DMXRootWindowXorigin: return attr->rootWindowXorigin; - case DMXRootWindowYorigin: return attr->rootWindowYorigin; - default: return 0; - } -} - -static int _DMXDumpScreenAttributes(Display *dpy, - unsigned long mask, - DMXScreenAttributes *attr) -{ - int i; - unsigned long value_list[32]; - unsigned long *value = value_list; - int count = 0; - - for (i = 0; i < 32; i++) { - if (mask & (1 << i)) { - *value++ = _DMXGetScreenAttribute(i, attr); - ++count; - } - } - Data32(dpy, value_list, count * sizeof(CARD32)); - return count; -} - -static CARD32 _DMXGetInputAttribute(int bit, DMXInputAttributes *attr) -{ - switch (1 << bit) { - case DMXInputType: - switch (attr->inputType) { - case DMXLocalInputType: return 0; - case DMXConsoleInputType: return 1; - case DMXBackendInputType: return 2; - } - return attr->inputType; - case DMXInputPhysicalScreen: return attr->physicalScreen; - case DMXInputSendsCore: return attr->sendsCore; - default: return 0; - } -} - -static int _DMXDumpInputAttributes(Display *dpy, - unsigned long mask, - DMXInputAttributes *attr) -{ - int i; - unsigned long value_list[32]; - unsigned long *value = value_list; - int count = 0; - - for (i = 0; i < 32; i++) { - if (mask & (1 << i)) { - *value++ = _DMXGetInputAttribute(i, attr); - ++count; - } - } - Data32(dpy, value_list, count * sizeof(CARD32)); - return count; -} - -/** Change geometries and positions of the DMX screen and root windows - * on the back-end X server. */ -int DMXChangeScreensAttributes(Display *dpy, - int screen_count, - int *screens, - int mask_count, - unsigned int *masks, - DMXScreenAttributes *attrs, /* vector */ - int *error_screen) -{ - XExtDisplayInfo *info = find_display(dpy); - xDMXChangeScreensAttributesReply rep; - xDMXChangeScreensAttributesReq *req; - int i; - unsigned int mask = 0; - CARD32 *screen_list; - CARD32 *mask_list; - - DMXCheckExtension(dpy, info, False); - - if (screen_count < 1 || mask_count < 1) return DmxBadValue; - - LockDisplay(dpy); - GetReq(DMXChangeScreensAttributes, req); - req->reqType = info->codes->major_opcode; - req->dmxReqType = X_DMXChangeScreensAttributes; - req->screenCount = screen_count; - req->maskCount = mask_count; - req->length += screen_count + mask_count; - - screen_list = (CARD32 *)Xmalloc(sizeof(*screen_list) * screen_count); - for (i = 0; i < screen_count; i++) screen_list[i] = screens[i]; - Data32(dpy, screen_list, screen_count * sizeof(CARD32)); - Xfree(screen_list); - - mask_list = (CARD32 *)Xmalloc(sizeof(*mask_list) * mask_count); - for (i = 0; i < mask_count; i++) mask_list[i] = masks[i]; - Data32(dpy, mask_list, mask_count * sizeof(CARD32)); - Xfree(mask_list); - - for (i = 0; i < screen_count; i++) { - if (i < mask_count) mask = masks[i]; - req->length += _DMXDumpScreenAttributes(dpy, mask, attrs + i); - } - - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return DmxBadReply; - } - if (error_screen) *error_screen = rep.errorScreen; - UnlockDisplay(dpy); - SyncHandle(); - return rep.status; -} - -/** Add a screen. */ -Bool DMXAddScreen(Display *dpy, const char *displayName, unsigned int mask, - DMXScreenAttributes *attr, int *screen) -{ - XExtDisplayInfo *info = find_display(dpy); - xDMXAddScreenReply rep; - xDMXAddScreenReq *req; - int length; - int paddedLength; - - DMXCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(DMXAddScreen, req); - length = displayName ? strlen(displayName) : 0; - paddedLength = (length + 3) & ~3; - req->reqType = info->codes->major_opcode; - req->dmxReqType = X_DMXAddScreen; - req->displayNameLength = length; - req->physicalScreen = *screen; - req->valueMask = mask; - req->length += paddedLength/4; - req->length += _DMXDumpScreenAttributes(dpy, mask, attr); - - if (length) { - char *buffer = Xmalloc(paddedLength); - memset(buffer, 0, paddedLength); - memcpy(buffer, displayName, length); - Data32(dpy, buffer, paddedLength); - Xfree(buffer); - } - - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - if (screen) *screen = rep.physicalScreen; - UnlockDisplay(dpy); - SyncHandle(); - return rep.status == Success ? True : False; -} - -/** Remove a screen. */ -Bool DMXRemoveScreen(Display *dpy, int screen) -{ - XExtDisplayInfo *info = find_display(dpy); - xDMXRemoveScreenReply rep; - xDMXRemoveScreenReq *req; - - DMXCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(DMXRemoveScreen, req); - req->reqType = info->codes->major_opcode; - req->dmxReqType = X_DMXRemoveScreen; - req->physicalScreen = screen; - - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - UnlockDisplay(dpy); - SyncHandle(); - return rep.status == Success ? True : False; -} - -/** If the DMXGetWindowAttributes protocol request returns information - * about the specified \a window, the number of screens for which - * information is available will be returned in \a screen_count and - * information about the first \a available_count of those screens will - * be placed in \a inf. Because this call transports a great deal of - * information over the wire, please call #DMXGetScreenCount first, and - * make sure \a inf is that large. - * - * Note that if the specified \a window has not yet been mapped when - * #DMXGetWindowAttributes is called, then a subsequent XMapWindow call - * might be buffered in xlib while requests directly to the back-end X - * servers are processed. This race condition can be solved by calling - * #DMXSync before talking directly to the back-end X servers. - * - * Available in DMX Protocol Version 1.0, but not working correctly - * until DMX Protocol Version 1.4 */ -Bool DMXGetWindowAttributes(Display *dpy, Window window, - int *screen_count, int available_count, - DMXWindowAttributes *inf) -{ - XExtDisplayInfo *info = find_display(dpy); - xDMXGetWindowAttributesReply rep; - xDMXGetWindowAttributesReq *req; - unsigned long current; - CARD32 *screens; /* Must match protocol size */ - CARD32 *windows; /* Must match protocol size */ - XRectangle *pos; /* Must match protocol size */ - XRectangle *vis; /* Must match protocol size */ - - DMXCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(DMXGetWindowAttributes, req); - req->reqType = info->codes->major_opcode; - req->dmxReqType = X_DMXGetWindowAttributes; - req->window = window; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - - /* FIXME: check for NULL? */ - screens = Xmalloc(rep.screenCount * sizeof(*screens)); - windows = Xmalloc(rep.screenCount * sizeof(*windows)); - pos = Xmalloc(rep.screenCount * sizeof(*pos)); - vis = Xmalloc(rep.screenCount * sizeof(*vis)); - - _XRead(dpy, (char *)screens, rep.screenCount * sizeof(*screens)); - _XRead(dpy, (char *)windows, rep.screenCount * sizeof(*windows)); - _XRead(dpy, (char *)pos, rep.screenCount * sizeof(*pos)); - _XRead(dpy, (char *)vis, rep.screenCount * sizeof(*vis)); - - *screen_count = rep.screenCount; - for (current = 0; - current < rep.screenCount && current < (unsigned)available_count; - current++, inf++) { - inf->screen = screens[current]; - inf->window = windows[current]; - inf->pos = pos[current]; - inf->vis = vis[current]; - } - - Xfree(vis); - Xfree(pos); - Xfree(windows); - Xfree(screens); - - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -/** If the DMXGetDesktopAttributes protocol request returns information - * correctly, the information will be placed in \a attr, and True will - * be returned. Otherwise, False will be returned. - * - * Available in DMX Protocol Version 2.0 */ -Bool DMXGetDesktopAttributes(Display *dpy, DMXDesktopAttributes *attr) -{ - XExtDisplayInfo *info = find_display(dpy); - xDMXGetDesktopAttributesReply rep; - xDMXGetDesktopAttributesReq *req; - - DMXCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(DMXGetDesktopAttributes, req); - req->reqType = info->codes->major_opcode; - req->dmxReqType = X_DMXGetDesktopAttributes; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - attr->width = rep.width; - attr->height = rep.height; - attr->shiftX = rep.shiftX; - attr->shiftY = rep.shiftY; - - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -static CARD32 _DMXGetDesktopAttribute(int bit, DMXDesktopAttributes *attr) -{ - switch (1 << bit) { - case DMXDesktopWidth: return attr->width; - case DMXDesktopHeight: return attr->height; - case DMXDesktopShiftX: return attr->shiftX; - case DMXDesktopShiftY: return attr->shiftY; - default: return 0; - } -} - -static int _DMXDumpDesktopAttributes(Display *dpy, - unsigned long mask, - DMXDesktopAttributes *attr) -{ - int i; - unsigned long value_list[32]; - unsigned long *value = value_list; - int count = 0; - - for (i = 0; i < 32; i++) { - if (mask & (1 << i)) { - *value++ = _DMXGetDesktopAttribute(i, attr); - ++count; - } - } - Data32(dpy, value_list, count * sizeof(CARD32)); - return count; -} - -/** Change the global bounding box and origin offset. - * - * Available in DMX Protocol Version 2.0 */ -int DMXChangeDesktopAttributes(Display *dpy, - unsigned int mask, - DMXDesktopAttributes *attr) -{ - XExtDisplayInfo *info = find_display(dpy); - xDMXChangeDesktopAttributesReply rep; - xDMXChangeDesktopAttributesReq *req; - - DMXCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(DMXChangeDesktopAttributes, req); - req->reqType = info->codes->major_opcode; - req->dmxReqType = X_DMXChangeDesktopAttributes; - req->valueMask = mask; - req->length +=_DMXDumpDesktopAttributes(dpy, mask, attr); - - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return DmxBadReply; - } - UnlockDisplay(dpy); - SyncHandle(); - return rep.status; -} - -/** If the DMXGetInputCount protocol request returns the input count, - * the value will be placed in \a input_count, and True will be - * returned. Otherwise, False will be returned. - * - * Available in DMX Protocol Version 1.1 */ -Bool DMXGetInputCount(Display *dpy, int *input_count) -{ - XExtDisplayInfo *info = find_display(dpy); - xDMXGetInputCountReply rep; - xDMXGetInputCountReq *req; - - DMXCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(DMXGetInputCount, req); - req->reqType = info->codes->major_opcode; - req->dmxReqType = X_DMXGetInputCount; - if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - *input_count = rep.inputCount; - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -/** If the DMXGetInputAttributes protocol request returns information - * about the input device with the specified \a id, information about - * the input device will be placed in \a inf, and True will be returned. - * Otherwise, False will be returned. - * - * Available in DMX Protocol Version 1.1 */ -Bool DMXGetInputAttributes(Display *dpy, int id, DMXInputAttributes *inf) -{ - XExtDisplayInfo *info = find_display(dpy); - xDMXGetInputAttributesReply rep; - xDMXGetInputAttributesReq *req; - char *buffer; - - DMXCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(DMXGetInputAttributes, req); - req->reqType = info->codes->major_opcode; - req->dmxReqType = X_DMXGetInputAttributes; - req->deviceId = id; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - - switch (rep.inputType) { - case 0: inf->inputType = DMXLocalInputType; break; - case 1: inf->inputType = DMXConsoleInputType; break; - case 2: inf->inputType = DMXBackendInputType; break; - } - - inf->physicalScreen = rep.physicalScreen; - inf->physicalId = rep.physicalId; - inf->isCore = rep.isCore; - inf->sendsCore = rep.sendsCore; - inf->detached = rep.detached; - buffer = Xmalloc(rep.nameLength + 1 + 4 /* for pad */); - _XReadPad(dpy, buffer, rep.nameLength); - buffer[rep.nameLength] = '\0'; - inf->name = buffer; - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -/** Add input. */ -Bool DMXAddInput(Display *dpy, unsigned int mask, DMXInputAttributes *attr, - int *id) -{ - XExtDisplayInfo *info = find_display(dpy); - xDMXAddInputReply rep; - xDMXAddInputReq *req; - int length; - int paddedLength; - - DMXCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(DMXAddInput, req); - length = attr->name ? strlen(attr->name) : 0; - paddedLength = (length + 3) & ~3; - req->reqType = info->codes->major_opcode; - req->dmxReqType = X_DMXAddInput; - req->displayNameLength = length; - req->valueMask = mask; - req->length += paddedLength/4; - req->length += _DMXDumpInputAttributes(dpy, mask, attr); - - if (length) { - char *buffer = Xmalloc(paddedLength); - memset(buffer, 0, paddedLength); - memcpy(buffer, attr->name, paddedLength); - Data32(dpy, buffer, paddedLength); - Xfree(buffer); - } - - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - if (id) *id = rep.physicalId; - UnlockDisplay(dpy); - SyncHandle(); - return rep.status == Success ? True : False; -} - -/** Add backend input (a helper function that calls #DMXAddInput). */ -Bool DMXAddBackendInput(Display *dpy, int screen, int sendsCore, int *newId) -{ - DMXInputAttributes attr; - unsigned int mask = (DMXInputType - | DMXInputPhysicalScreen - | DMXInputSendsCore); - - attr.inputType = DMXBackendInputType; - attr.physicalScreen = screen; - attr.sendsCore = sendsCore; - attr.name = NULL; - return DMXAddInput(dpy, mask, &attr, newId); -} - -/** Add console input (a helper function that calls #DMXAddInput). */ -Bool DMXAddConsoleInput(Display *dpy, const char *name, int sendsCore, - int *newId) -{ - DMXInputAttributes attr; - unsigned int mask = (DMXInputType - | DMXInputSendsCore); - - attr.inputType = DMXConsoleInputType; - attr.physicalScreen = 0; - attr.sendsCore = sendsCore; - attr.name = name; - return DMXAddInput(dpy, mask, &attr, newId); -} - -/** Remove an input. */ -Bool DMXRemoveInput(Display *dpy, int id) -{ - XExtDisplayInfo *info = find_display(dpy); - xDMXRemoveInputReply rep; - xDMXRemoveInputReq *req; - - DMXCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(DMXRemoveInput, req); - req->reqType = info->codes->major_opcode; - req->dmxReqType = X_DMXRemoveInput; - req->physicalId = id; - - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - UnlockDisplay(dpy); - SyncHandle(); - return rep.status == Success ? True : False; -} diff --git a/nx-X11/lib/dps/DPSCAP.h b/nx-X11/lib/dps/DPSCAP.h deleted file mode 100644 index cb36016c2..000000000 --- a/nx-X11/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/nx-X11/lib/dps/DPSCAPClient.h b/nx-X11/lib/dps/DPSCAPClient.h deleted file mode 100644 index 803acf3ed..000000000 --- a/nx-X11/lib/dps/DPSCAPClient.h +++ /dev/null @@ -1,139 +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 -#ifndef Xmalloc -#endif -#include - -/* === 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 */, Display * /* agent */); - -extern int DPSCAPDestroy(XExtData * /* extData */); - -extern XExtData * DPSCAPOpenAgent(Display * /* dpy */, char * /* trueDisplayName */); - -extern void DPSCAPRead(DPSCAPData /* my */, char * /* buf */, unsigned /* len */, DPSCAPIOFlags /* includePad */); - -extern void DPSCAPStartUp(void); - -extern void DPSCAPWrite(Display * /* my */, char * /* buf */, unsigned /* len */, DPSCAPIOFlags /* writePad */, DPSCAPIOFlags /* 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 */); - -extern int DPSCAPCopyGCProc(Display * /* dpy */, GC /* gc */, XExtCodes * /* codes */); - -extern int DPSCAPFreeGCProc(Display * /* pdpy */, GC /* gc */, XExtCodes * /* codes */); - -extern int DPSCAPFlushGCProc(Display * /* dpy */, GC /* gc */, XExtCodes * /* codes */); - -#endif /* DPSCAPCLIENT_H */ diff --git a/nx-X11/lib/dps/DPSCAPproto.h b/nx-X11/lib/dps/DPSCAPproto.h deleted file mode 100644 index e35487b2b..000000000 --- a/nx-X11/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/nx-X11/lib/dps/Imakefile b/nx-X11/lib/dps/Imakefile deleted file mode 100644 index 119b3429e..000000000 --- a/nx-X11/lib/dps/Imakefile +++ /dev/null @@ -1,265 +0,0 @@ -XCOMM $XFree86: xc/lib/dps/Imakefile,v 1.16tsi 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 - -#ifdef SharedDPSReqs -REQUIREDLIBS = SharedDPSReqs -#endif - -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 - PSWRAP = 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 - -/* - * hv: HEADERS must be here, otherwise IncSubdir-triggered BuildIncludes - * will fail on systems without ln cmd - */ -HEADERS = psops.h dpsops.h - -all:: $(HEADERS) - -includes:: $(DPSOPSCFILES) $(PSOPSCFILES) $(HEADERS) - -$(DPSOPSCFILES) $(PSOPSCFILES): HostProgramTargetName($(PSWRAP)) - -SRCS = \ - ${COMMONSOURCEFILES} \ - ${XSOURCEFILES} \ - ${XCSDPSSOURCEFILES} \ - ${DPSOPSCFILES} \ - ${PSOPSCFILES} - -OBJS = \ - ${COMMONOBJECTFILES} \ - ${XOBJECTFILES} \ - ${XCSDPSOBJECTFILES} \ - ${DPSOPSOBJECTS} \ - ${PSOPSOBJECTS} - -DERIVED_FILES = $(DPSOPSHEADERFILES) $(PSOPSHEADERFILES) \ - $(DPSOPSCFILES) $(PSOPSCFILES) - -#include - -.SUFFIXES: .psw .h - -.psw.c : HostProgramTargetName($(PSWRAP)) - RunProgram(PSWRAP,-a -o $*.c -h $*.h $<) - -.psw.h : HostProgramTargetName($(PSWRAP)) - RunProgram(PSWRAP,-a -h $*.h $< > /dev/null) - -HostProgramTargetName($(PSWRAP)): - @echo "checking $@ over in $(PSWRAPSRC) first..."; \ - test -d $(PSWRAPSRC) && cd $(PSWRAPSRC) && $(MAKE) pswraponly; \ - echo "okay, continuing in $(CURRENT_DIR)" - -includes :: $(HEADERS) -depend :: $(DPSOPSCFILES) $(PSOPSCFILES) - -psops.h : $(PSOPSHEADERFILES) - RemoveFile($@) - ${CAT} $(PSOPSHEADERFILES) |\ - ${SED} -e '/^$$/D' -e '/#/D' -e '/^\//D'\ - -e '/^ gener/D' -e '/^.\//D' |\ - ${SORT} > .sort - ${AWK} '/;/ {print; printf("\n");}' .sort > .ttt - ${CAT} psname.txt header.txt psifdef.txt .ttt psendif.txt > psops.h - RemoveFiles(.sort .ttt .attt) - -dpsops.h : psops.h $(DPSOPSHEADERFILES) - RemoveFile($@) - ${CAT} $(DPSOPSHEADERFILES) |\ - ${SED} -e '/^$$/D' -e '/#/D' -e '/^\//D'\ - -e '/^ gener/D' -e '/^.\//D' |\ - ${SORT} > .sort - ${AWK} '/;/ {print; printf("\n");}' .sort > .ttt - ${CAT} dpsname.txt header.txt dpsifdef.txt .ttt dpsendif.txt > dpsops.h - RemoveFiles(.sort .ttt .attt) - -clean :: - ${RM} $(DERIVED_FILES) .sort .ttt .att psops.h dpsops.h *% - -DependTarget() - diff --git a/nx-X11/lib/dps/XDPS.c b/nx-X11/lib/dps/XDPS.c deleted file mode 100644 index 5b1614e4c..000000000 --- a/nx-X11/lib/dps/XDPS.c +++ /dev/null @@ -1,2235 +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 - */ -/* $XFree86: xc/lib/dps/XDPS.c,v 1.4tsi Exp $ */ - -#define NEED_EVENTS -#define NEED_REPLIES - -#include -/* Include this first so that Xasync.h, included from Xlibint.h, can find - the definition of NOFILE */ -#include -#include -#include -#include -#include - -#include "DPS/XDPS.h" -#include "DPS/XDPSproto.h" -#include "DPS/XDPSlib.h" -#include "DPS/dpsNXargs.h" - -#include "cslibint.h" -#include "dpsassert.h" -#include "DPSCAPClient.h" - -#include "publictypes.h" -#include "dpsXpriv.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)(Display *, XEvent *, xEvent *); - -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)(Display *); - -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 { - void (*Flush)(Display *); - int (*Read)(Display*, char*, long); - void (*ReadPad)(Display*, char*, long); - Status (*Reply)(Display*, xReply*, int, Bool); - void (*Send)(Display*, _Xconst char*, long); -} 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(Display *dpy, Display *agent, GC gc); -static Status DPSCAPClientMessageProc(Display *dpy, XEvent *re, xEvent *event); -static int DPSCAPAfterProc(Display *xdpy); -static unsigned int DPSCAPSetPause(Display *xdpy, ContextXID cxid); -static Bool DPSCAPResumeContext(Display *xdpy, ContextXID cxid); -static Bool WaitForSyncProc(Display *xdpy, XEvent *event, char *arg); - -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(void) -{ - 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(Display *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(Display *dpy, XDPSLEventHandler proc) -{ - TextProc = proc; -} - -/* ARGSUSED */ -void -XDPSLCallOutputEventHandler(Display *dpy, XEvent *event) -{ - (*TextProc)(event); -} - -void -XDPSLSetStatusEventHandler(Display *dpy, XDPSLEventHandler proc) -{ - StatusProc[DPY_NUMBER(dpy)] = proc; -} - -void -XDPSLCallStatusEventHandler(Display *dpy, XEvent *event) -{ - (*(StatusProc[DPY_NUMBER(dpy)]))(event); -} - -/* Added for L2-DPS/PROTO 9 */ -void -XDPSLSetReadyEventHandler(Display *dpy, XDPSLEventHandler proc) -{ - ReadyProc[DPY_NUMBER(dpy)] = proc; -} - -/* Added for L2-DPS/PROTO 9 */ -void -XDPSLCallReadyEventHandler(Display *dpy, XEvent *event) -{ - (*(ReadyProc[DPY_NUMBER(dpy)]))(event); -} - -/* Added for L2-DPS/PROTO 9 */ -int -XDPSLGetVersion(Display *dpy) -{ - return(version[DPY_NUMBER(dpy)]); -} -/* See CSDPS additions for XDPSLSetVersion */ - -void -XDPSLInitDisplayFlags(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(Display *dpy) -{ - return Codes[DPY_NUMBER(dpy)]; -} - -/* ARGSUSED */ -static int -CloseDisplayProc(Display *dpy, XExtCodes *codes) -{ - /* 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 */ - return 0; /* return-value is ignored */ -} - -Bool -XDPSLGetPassEventsFlag(Display *dpy) -{ - return displayFlags[DPY_NUMBER(dpy)].passEvents; -} - -void -XDPSLSetPassEventsFlag(Display *dpy, Bool flag) -{ - displayFlags[DPY_NUMBER(dpy)].passEvents = flag; -} - -Bool -XDPSLGetWrapWaitingFlag(Display *dpy) -{ - return displayFlags[DPY_NUMBER(dpy)].wrapWaiting; -} - -void -XDPSLSetWrapWaitingFlag(Display *dpy, Bool flag) -{ - displayFlags[DPY_NUMBER(dpy)].wrapWaiting = flag; -} - -static Status -ConvertOutputEvent(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(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(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(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( - 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; - - 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)(Display*, xError*, XExtCodes*, int*); - 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( - xPSCreateContextReq *req, - XStandardColormap *colorcube, - XStandardColormap *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( - register Display *xdpy, - Drawable draw, - GC gc, - int x, int y, - unsigned int eventMask, - XStandardColormap *grayRamp, - XStandardColormap *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) - { - default: - 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( - register Display *xdpy, - SpaceXID sxid, - Drawable draw, - GC gc, - int x, int y, - unsigned int eventMask, - XStandardColormap *grayRamp, - XStandardColormap *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) - { - default: - 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(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(Display *xdpy, ContextXID cxid, char *data, int length) -{ - int dpyix; - register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)]; - register xPSGiveInputReq *req; - 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(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(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(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( - 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( - 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( - 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(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( - Display *xdpy, - ContextXID cxid, - unsigned int enableMask, - unsigned int disableMask, - unsigned int 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. - -*/ -void -_XReadPad (Display *dpy, char *data, 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( - 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(Display *dpy, int ecode) -{ - XExtCodes *c = XDPSLGetCodes(dpy); - - if (c == NULL) - return not_pserror; - - 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(Display *dpy, unsigned ver) -{ - version[DPY_NUMBER(dpy)] = ver; -} - -void -XDPSLSetCodes(Display *dpy, XExtCodes *codes) -{ - Codes[DPY_NUMBER(dpy)] = codes; -} - -Display * -XDPSLGetShunt(Display *dpy_in) -{ - return(ShuntMap[DPY_NUMBER(dpy_in)]); -} - -void -XDPSLSetShunt(Display *dpy_in, Display *dpy_out) -{ - ShuntMap[DPY_NUMBER(dpy_in)] = dpy_out; -} - -int -XDPSLGetSyncMask(Display *dpy) -{ - return (int)displayFlags[DPY_NUMBER(dpy)].syncMask; -} - -void -XDPSLSetSyncMask(Display *dpy, int mask) -{ - displayFlags[DPY_NUMBER(dpy)].syncMask = (char)mask; - gForceFlush = (mask & DPSCAP_SYNCMASK_RECONCILE); -} - -void -XDPSLFlush(Display *xdpy) -{ - register Display *dpy = ShuntMap[DPY_NUMBER(xdpy)]; - - _XFlush(xdpy); - if (dpy != xdpy) - N_XFlush(dpy); -} - -void -XDPSLSyncGCClip(Display *xdpy, GC gc) -{ - register unsigned long oldDirty; - register int dpyix; - register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)]; - - /* 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(Display *dpy) -{ - dpys[DPY_NUMBER(dpy)] = dpy; -} -#endif /* VMS */ - -char * -XDPSLSetAgentName(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(Display *dpy) -{ - if (dpy == NULL) return; - ClientMsgProc[DPY_NUMBER(dpy)] = XESetWireToEvent( - dpy, - ClientMessage, - DPSCAPClientMessageProc); -} - -void -XDPSLSetAfterProc(Display *xdpy) -{ - if (xdpy == NULL) return; - AfterProcs[DPY_NUMBER(xdpy)] = (GenericProcPtrReturnsInt) - XSetAfterFunction(xdpy, DPSCAPAfterProc); - /* +++ Consider using agent->synchandler to store old proc */ -} - - -CSDPSFakeEventTypes -XDPSLGetCSDPSFakeEventType(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( - 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); -} - -void -XDPSLGetCSDPSStatus( - 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( - 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( - 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(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; - 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(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(Display *xdpy, int arg, int 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( - Display *dpy, - XEvent *re, - 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(Display *dpy, Display *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(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] == (long) my->saveseq) { - return(True); - } else { - return(False); - } -} - - -static int -DPSCAPAfterProc(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(Display *xdpy, 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(Display *xdpy, ContextXID cxid) -{ - register DPSCAPPausedContextData *slot; - 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/nx-X11/lib/dps/Xlibnet.h b/nx-X11/lib/dps/Xlibnet.h deleted file mode 100644 index f86c3542b..000000000 --- a/nx-X11/lib/dps/Xlibnet.h +++ /dev/null @@ -1,284 +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.6 2001/06/30 22:41:44 tsi 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 - -#endif /* SYSV */ -#ifdef SVR4 -/* - * TLI (Streams-based) networking - */ -#define BytesReadable(fd,ptr) (_XBytesReadable ((fd), (ptr))) -#include /* define struct iovec */ - -#endif /* SVR4 */ -#else /* not STREAMSCONN */ -/* - * socket-based systems - */ -#include -#include -#include -#include /* needed for XlibInt.c */ -#ifdef SVR4 -#include -#endif - -#if defined(i386) && defined(SYSV) -#if !defined(__SCO__) -#include -#endif -#include -#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 -#else -#define _POSIX_SOURCE -#include -#undef _POSIX_SOURCE -#endif -#endif -#ifndef OPEN_MAX -#ifdef SVR4 -#define OPEN_MAX 256 -#else -#include -#ifndef OPEN_MAX -#ifdef NOFILE -#define OPEN_MAX NOFILE -#else -#if !defined(__UNIXOS2__) && !defined(__QNX__) -#define OPEN_MAX NOFILES_MAX -#else -#define OPEN_MAX 256 -#endif -#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] ...) - */ -extern int N_XANYSET(unsigned long *); -#endif - -/* - * ReadvFromServer and WritevToSever use struct iovec, normally found - * in Berkeley systems in . 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) || \ - defined(__SCO__) || (!(defined(SYSV) && defined(i386))) || \ - defined(__UNIXWARE__) -#define _XReadV readv -#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/nx-X11/lib/dps/Xstreams.h b/nx-X11/lib/dps/Xstreams.h deleted file mode 100644 index a7419131b..000000000 --- a/nx-X11/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$ */ - - -#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/nx-X11/lib/dps/csconndi.c b/nx-X11/lib/dps/csconndi.c deleted file mode 100644 index 64205f8dc..000000000 --- a/nx-X11/lib/dps/csconndi.c +++ /dev/null @@ -1,839 +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.11tsi Exp $ */ - -#if defined(sun) && !defined(SVR4) -#define memmove(t,f,c) bcopy(f,t,c) -#endif - -#define NEED_EVENTS - -#include -#include -#include -/* Include this first so that Xasync.h, included from Xlibint.h, can find - the definition of NOFILE */ -#include -#include -#include "Xlibnet.h" /* New for R5, delete for R4 */ -#include - -#ifndef hpux /* HP doesn't include Xauth.h :-( */ -#include -#else -#define FamilyLocal (256) -#endif - -#include -#ifdef DNETCONN -#include -#include -#endif - -#include - -#include "DPSCAPproto.h" -#include "cslibint.h" -#include "dpsassert.h" - -#if defined(hpux) || defined(AIXV3) -#define SELECT_TYPE int * -#else -#define SELECT_TYPE fd_set * -#endif - -#ifndef _XANYSET -#define _XANYSET N_XANYSET -#endif /* _XANYSET */ - -#ifndef X_CONNECTION_RETRIES /* number retries on ECONNREFUSED */ -#define X_CONNECTION_RETRIES 5 -#endif - -#define CONN_PARAMS char *, int , int , int *, int *, char ** - -#ifdef DNETCONN -static int MakeDECnetConnection(CONN_PARAMS); -#endif -#ifdef UNIXCONN -static int MakeUNIXSocketConnection(CONN_PARAMS); -#endif -#ifdef TCPCONN -static int MakeTCPConnection(CONN_PARAMS); -#endif -#ifdef STREAMSCONN -extern int _XMakeStreamsConnection(CONN_PARAMS); -#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 (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( - 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 (*connfunc)(CONN_PARAMS); /* 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(O_NONBLOCK) - (void) fcntl (fd, F_SETFL, O_NONBLOCK); -#elif defined(FNDELAY) - (void) fcntl (fd, F_SETFL, FNDELAY); -#else - (void) fcntl (fd, F_SETFL, O_NDELAY); -#endif /* O_NONBLOCK/FNDELAY */ -#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 - -#ifndef hpux -#ifdef apollo /* nest if(n)defs because makedepend is broken */ -#ifndef NO_TCP_H -#include -#endif /* NO_TCP_H */ -#else /* apollo */ -#include -#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 - -#ifndef X_NO_SYS_UN -#include -#endif - -#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 ( - 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; - - 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) - 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 ( - 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 (int server) -{ - (void) close(server); - return 0; -} - - -#include -/* - * 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(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((DPSContext)0, "N_XWaitForWritable read bogus X event"); - } - ENDITERATE - } - if (_XANYSET(w_mask)) - return; - } -} - - -void N_XWaitForReadable(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 ( - Display *dpy, - xConnClientPrefix *client, /* contains count for auth_* */ - char *auth_proto, /* NOT null-terminated */ - char char *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/nx-X11/lib/dps/csfindNX.c b/nx-X11/lib/dps/csfindNX.c deleted file mode 100644 index 63b40acbc..000000000 --- a/nx-X11/lib/dps/csfindNX.c +++ /dev/null @@ -1,657 +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.7tsi Exp $ */ - -#include /* for MAXHOSTNAMELEN */ -#include -#include -#include /* getuid() */ -#include -#include - -#include -#include -#include -#include -#include - -#include "csfindNX.h" -#include "dpsNXprops.h" -#include "Xlibnet.h" -#include "DPS/dpsXclient.h" -#include "DPS/dpsNXargs.h" -#include - -#include "dpsassert.h" -#include "cslibint.h" - -/* ---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(char *); - -/* ---Private Functions--- */ - -static int -TmpErrorHandler( - Display *dpy, - XErrorEvent *err) -{ - gXDPSNXErrorCode = err->error_code; - return 0; -} - - -static int -GetProperty( - Display *dpy, - Window w, - Atom prop, - Atom type, - unsigned long *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( - 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)(Display *, XErrorEvent *) = 0; /* the current error handler */ - unsigned long 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; - unsigned long 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 { - unsigned long 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( - Display *dpy, - char *licenseMethod, - char **host, - int *transport, - int *port) -{ - unsigned long nAgents = 0; - AgentIdList agentList = NULL; - Bool match = False; - unsigned long 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 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( - char *string, - char **hostname, /* RETURN */ - int *transport, /* RETURN */ - int *port) /* RETURN */ -{ - int dnet = 0; - Bool transportSpecified = False; - char namebuf[255]; - char *p; - - (void) strncpy(namebuf, string, strlen(string)+1); - p = &namebuf[0]; - /* - * Step 1, find the hostname. This is delimited by a required colon. - */ - for (; *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( - Display *dpy, - char **host, - int *transport, - int *port) -{ - XrmDatabase rDB = NULL; /* for merged database */ - XrmDatabase serverDB; - 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(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( - 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(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)(long) value; - } else if (arg == XDPSNX_LAUNCHED_AGENT_TRANS) { - gXDPSNXLaunchedAgentTrans = (long) value; - } else if (arg == XDPSNX_LAUNCHED_AGENT_PORT) { - gXDPSNXLaunchedAgentPort = (long) 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 = (long)value; - if (i >= 4096 && i <= 65536) gNXSndBufSize = i; - } - return(Success); -} - - -void -XDPSGetNXArg(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 *) (long)gXDPSNXAutoLaunch; - } else if (arg == XDPSNX_LAUNCHED_AGENT_TRANS) { - *value = (void *) (long)gXDPSNXLaunchedAgentTrans; - } else if (arg == XDPSNX_LAUNCHED_AGENT_PORT) { - *value = (void *) (long)gXDPSNXLaunchedAgentPort; - } -} diff --git a/nx-X11/lib/dps/csfindNX.h b/nx-X11/lib/dps/csfindNX.h deleted file mode 100644 index f5bf3bdc9..000000000 --- a/nx-X11/lib/dps/csfindNX.h +++ /dev/null @@ -1,93 +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" - -/* ---TYPES--- */ - -typedef enum { - findnx_found, - findnx_not_found, - findnx_error -} XDPSNXFindNXResult; - - -/* ---Functions--- */ - -extern XDPSNXFindNXResult -XDPSNXFindNX ( - 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 ( - 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/nx-X11/lib/dps/cslibext.c b/nx-X11/lib/dps/cslibext.c deleted file mode 100644 index 831f0ad65..000000000 --- a/nx-X11/lib/dps/cslibext.c +++ /dev/null @@ -1,762 +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 - */ -/* $XFree86: xc/lib/dps/cslibext.c,v 1.4tsi Exp $ */ - -#include -#include - -#include /* for MAXHOSTNAMELEN */ -#include -#include -#include -#include "cslibint.h" -#include -#include -#include -#include -#include "DPSCAPClient.h" -#include "dpsassert.h" -#include - -#include "publictypes.h" -#include "dpsXpriv.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 === */ - -#ifdef MAHALO -static int -DPSCAPFlushAfterProc(Display *agent) -{ - LockDisplay(agent); - N_XFlush(agent); - UnlockDisplay(agent); -} -#endif - -int -CSDPSInit( - 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]; - - if (gCSDPS == NULL) - DPSCAPStartUp(); - - /* To fix dps-nx #68, Motif too slow on HP */ - if ((c = getenv("DPSNXGCMODE")) != 0) - { - 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)); -#ifdef DPSLNKL -skip_read: -#endif - 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 %ld older than expected %d, client will downgrade", (long)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 */ - (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( - Display *dpy) -{ - XEDataObject object; - - object.display = dpy; - return(XEHeadOfExtensionList(object)); -} - -void -XDPSSyncGCClip( - 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( - 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( - Display *dpy, - int arg, int val) -{ - if (!dpy || arg >= 0 || arg < AGENTLASTARG) - return(!Success); - else - return(XDPSLSetAgentArg(dpy, arg, val)); -} - -/* New for DPS NX 2.0 */ -void -XDPSFlushGC( - Display *dpy, - GC gc) -{ - if (dpy && gc) - XDPSLFlushGC(dpy, gc); -} - -/* === SUPPORT PROCS === */ - -void -DPSCAPChangeGC( - register Display *agent, - GC gc, - unsigned long valuemask, - XGCValues *values) -{ - register xChangeGCReq *req; - 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( - Display *dpy, Display *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( - 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(void) -{ - gCSDPS = (DPSCAPGlobals)Xcalloc(1, sizeof(DPSCAPGlobalsRec)); -} - - -static unsigned char padAdd[] = {0, 3, 2, 1}; - -void -DPSCAPWrite( - Display *agent, - char *buf, - unsigned len, - 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( - 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( - 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( - 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( - Display *dpy, - GC gc, - XExtCodes *codes) -{ - XGCValues values; - DPSCAPData my; - XExtData *extData; -#ifdef CSDPSDEBUG - unsigned long int dirty; -#endif /* CSDPSDEBUG */ - - /* 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) */ -#ifdef CSDPSDEBUG - dirty = gc->dirty; -#endif /* CSDPSDEBUG */ - 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); -} diff --git a/nx-X11/lib/dps/cslibint.c b/nx-X11/lib/dps/cslibint.c deleted file mode 100644 index 84d7b753e..000000000 --- a/nx-X11/lib/dps/cslibint.c +++ /dev/null @@ -1,1910 +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.4tsi 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 -#include -#include "Xlibnet.h" -#include - -#include "dpsassert.h" -#include "cslibint.h" - -static void _EatData32 (Display *dpy, unsigned long n); - -/* 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. - */ -void N_XFlush (Display *dpy) -{ - register long size, todo; - register int write_stat; - register char *bufindex; - - if (!dpy) return; - - if (dpy->flags & XlibDisplayIOError) return; - - 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; -} - -#ifdef NEEDFORNX - -int -_XEventsQueued (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 - */ -void _XReadEvents(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. - */ -int N_XRead (Display *dpy, char *data, 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 void _doXRead32 (Display *dpy, long *data, long size, 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> bits; - bits = bits ^32; - if(bits){ - lpack++; - } - } -} - -void _XRead32 (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 void _doXRead16 (Display *dpy, short *data, 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> bits; - bits -= 16; - if(bits < 0){ - lpack++; - bits = 48; - } - } -} - -void _XRead16 (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); -} - -void _XRead16Pad (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. - */ -void N_XReadPad (Display *dpy, char *data, long size) -{ - register long bytes_read; - struct iovec iov[2]; - char pad[3]; - - if (!dpy) return; - if ((dpy->flags & XlibDisplayIOError) || 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; - 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) { - iov[1].iov_len += iov[0].iov_len - bytes_read; - iov[1].iov_base = - (char *)iov[1].iov_base + bytes_read - iov[0].iov_len; - iov[0].iov_len = 0; - } - else { - iov[0].iov_len -= bytes_read; - 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); - } - } -} - -/* - * 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; - */ -void N_XSend (Display *dpy, _Xconst char *data, 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; - - /* - * 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 ((char *)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; -} - -#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(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(Display *dpy, 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 ( - Display *dpy, - 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 ((unsigned) 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 ((unsigned) 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 (Display *dpy, 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 (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.... - */ -void _XEnq (Display *dpy, 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( - Display *dpy, /* pointer to display structure */ - XEvent *re, /* pointer to where event should be reformatted */ - xEvent *event) /* wire protocol event */ -{ - char mbuf[256]; - - sprintf(mbuf, "NX: unhandled wire event %d, agent = %lx", re->type, (long)dpy); - DPSWarnProc(NULL, mbuf); - return(False); -} - -/*ARGSUSED*/ -Status -N_XUnknownNativeEvent( - Display *dpy, /* pointer to display structure */ - XEvent *re, /* pointer to where event should be reformatted */ - xEvent *event) /* wire protocol event */ -{ - char mbuf[256]; - - sprintf(mbuf, "NX: unhandled native event %d, agent = %lx", re->type, (long)dpy); - DPSWarnProc(NULL, mbuf); - return(0); -} - -#ifdef NEEDFORNX -/* - * reformat a wire event into an XEvent structure of the right type. - */ -Bool -_XWireToEvent( - Display *dpy, /* pointer to display structure */ - XEvent *re, /* pointer to where event should be reformatted */ - 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 (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 (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 (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(Display *dpy, XErrorEvent *event) -{ - if (_XPrintDefaultError (dpy, event, stderr) == 0) return 0; - exit(1); - /*NOTREACHED*/ -} - -/*ARGSUSED*/ -Bool _XDefaultWireError(Display *display, XErrorEvent *he, xError *we) -{ - return True; -} - -/* - * _XError - prepare to upcall user protocol error handler - */ -int _XError (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 (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 (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 (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); -} - -void XFree (void *data) -{ - Xfree (data); -} - -#ifdef _XNEEDBCOPYFUNC -void _Xbcopy(char *b1, char *b2, length) -{ - if (b1 < b2) { - b2 += length; - b1 += length; - while (length--) - *--b2 = *--b1; - } else { - while (length--) - *b2++ = *b1++; - } -} -#endif - -#endif /* NEEDFORNX */ - -void NXProcData (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 void -doData16(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> 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 (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> 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 (void) -{ - 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 -#endif - -/* - * N_XGetHostname - similar to gethostname but allows special processing. - */ -int N_XGetHostname (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 (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 - */ -int -N_XANYSET(unsigned long *src) -{ - int i; - - for (i=0; i - -int _XReadV (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 (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 - -int _XReadV (int fd, struct iovec *iov, int iovcnt) -{ - int i, len, total; - char *base; - - errno = 0; - for (i=0, total=0; iiov_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 (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 (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/nx-X11/lib/dps/cslibint.h b/nx-X11/lib/dps/cslibint.h deleted file mode 100644 index b16770504..000000000 --- a/nx-X11/lib/dps/cslibint.h +++ /dev/null @@ -1,302 +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 - */ -/* $XFree86: xc/lib/dps/cslibint.h,v 1.3 2001/06/30 22:41:44 tsi Exp $ */ - -/* - * 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 - -#include -#include - -/* For SYSV, no gethostname, so fake it */ -#include -#if defined(__SCO__) -/* SCO systems define MAXHOSTNAMELEN here */ -#include -#endif - -#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(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(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 !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 !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 */ - -extern int gNXSyncGCMode; - -/* extension hooks */ - -extern Bool N_XUnknownWireEvent(Display *, XEvent *, xEvent *); -extern Status N_XReply(Display *, xReply *, int, Bool); -extern Status N_XUnknownNativeEvent(Display *, XEvent *, xEvent *); -extern int DPSCAPConnect( char *, char **, int *, int *, int *, char **); -extern int N_XDisconnectDisplay(int); -extern int N_XGetHostname (char *, int); -extern int N_XRead(Display*, char *, long); -extern void NXProcData (Display *, char *, long); -extern void N_XFlush(Display *); -extern void N_XReadPad(Display*, char *, long); -extern void N_XSend(Display *, _Xconst char *, long); -extern void N_XWaitForReadable(Display *); -extern void N_XWaitForWritable(Display *); - -extern void XDPSGetDefaultColorMaps( - Display *dpy, - Screen *screen, - Drawable drawable, - XStandardColormap *colorCube, - XStandardColormap *grayRamp); - -#endif /* _CSLIBINT_H */ - diff --git a/nx-X11/lib/dps/csopendi.c b/nx-X11/lib/dps/csopendi.c deleted file mode 100644 index c0eb1d373..000000000 --- a/nx-X11/lib/dps/csopendi.c +++ /dev/null @@ -1,567 +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 - */ -/* $XFree86$ */ - -#include -#include -#include /* for MAXHOSTNAMELEN */ -#define NEED_EVENTS -#include -#include -#include "cslibint.h" -#ifdef XXX -#include -#include - -extern int _Xdebug; -extern Display *_XHeadOfDisplayList; - -#ifndef lint -static int lock; /* get rid of ifdefs when locking implemented */ -#endif - -#endif /* XXX */ - -#include -#include - -#include "DPSCAPClient.h" -#include -#include -#include "dpsassert.h" -#include "dpsNXprops.h" -#include "csfindNX.h" -#include "csstartNX.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 -}; - -static void OutOfMemory (Display *); - -#ifdef XXX -/* - * 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 */ - -void XSetAuthorization (char *name, int namelen, char *data, int datalen) -{ - 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(Display *dpy, char *trueDisplayName) -{ - register Display *agent; - char *agentHost = (char *)NULL; - register int i; - char display_name[256]; /* pointer to display name */ - char licMethBuf[256]; - char *licMeth = licMethBuf; - char *fullname = NULL; - int idisplay; - char *server_addr = NULL; - int server_addrlen = 0; - int conn_family; - int transport, port; - XExtData *ext; - DPSCAPData my; - 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 void OutOfMemory (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(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(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/nx-X11/lib/dps/csstartNX.c b/nx-X11/lib/dps/csstartNX.c deleted file mode 100644 index 0db2cbe5b..000000000 --- a/nx-X11/lib/dps/csstartNX.c +++ /dev/null @@ -1,237 +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 - */ -/* $XFree86: xc/lib/dps/csstartNX.c,v 1.6 2001/10/28 03:32:43 tsi Exp $ */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "DPSCAPproto.h" -#include "Xlibnet.h" /* New for R5, delete for R4 */ -#include "dpsassert.h" -#include "csfindNX.h" -#include "csstartNX.h" - -/* ---Defines--- */ - -#include - -#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(void) -{ - struct sockaddr_in insock; - int request; - 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 *) 0)) != 0) - 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(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(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 == 0) return (!Success); - - /* Create the argv list for the execl() call */ - (void) XDPSGetNXArg(XDPSNX_EXEC_ARGS, (void **) &execArgs); - if (execArgs != 0) - for(cpp = execArgs; *cpp != 0; cpp++, argc++); /* count args. */ - if (additionalArgs != 0) /* add on the add-on args. */ - for(cpp = additionalArgs; *cpp != 0; cpp++, argc++); - - args = (char **) Xmalloc(sizeof(char *) * (argc+1)); - if (args == 0) - return(!Success); - args[argc] = 0; /* cap end of args */ - args[i++] = execObj; - if (additionalArgs != 0) - for(cpp = additionalArgs; *cpp != 0; cpp++, i++) args[i] = *cpp; - if (execArgs != 0) - for(cpp = execArgs; *cpp != 0; cpp++, i++) args[i] = *cpp; - - /* now try to start up the agent... */ - if ((childPid = fork()) != -1) { - if (childPid == 0) { /* Child process */ -#ifndef __UNIXOS2__ - if (setsid() < 0) - DPSWarnProc(NULL, "Agent unable to create session. Continuing...\n"); -#endif - - /* 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 != 0) (void) XFree(args); - return(status); -} diff --git a/nx-X11/lib/dps/csstartNX.h b/nx-X11/lib/dps/csstartNX.h deleted file mode 100644 index 5e80e60aa..000000000 --- a/nx-X11/lib/dps/csstartNX.h +++ /dev/null @@ -1,67 +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 - -/* ---Globals--- */ - -extern Bool gStartXDPSNXIsPresent; - /* - * Indicates whether the function "StartXDPSNX" is live or just - * a stubbed out version. - */ - -/* ---Functions--- */ - -extern int StartXDPSNX (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 - */ - -extern int XDPSNXRecommendPort(int transport); - -#endif /* CSSTARTNX_H */ diff --git a/nx-X11/lib/dps/dps-def.cpp b/nx-X11/lib/dps/dps-def.cpp deleted file mode 100644 index d88841d66..000000000 --- a/nx-X11/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$ */ diff --git a/nx-X11/lib/dps/dpsNXprops.h b/nx-X11/lib/dps/dpsNXprops.h deleted file mode 100644 index c3a8e8d39..000000000 --- a/nx-X11/lib/dps/dpsNXprops.h +++ /dev/null @@ -1,90 +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 - */ -/* $XFree86$ */ - -#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 - -#include - - -/* ---Types--- */ - -typedef struct { - int transport; - int port; -} TransportInfo; - - -#endif /* DPSNXPROPS_H */ diff --git a/nx-X11/lib/dps/dpsXclient.c b/nx-X11/lib/dps/dpsXclient.c deleted file mode 100644 index 212030ecc..000000000 --- a/nx-X11/lib/dps/dpsXclient.c +++ /dev/null @@ -1,1134 +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 - */ -/* $XFree86$ */ - -#include -#include /* sleep() */ -#include -#include -#include - -#ifdef VMS -/* Xlib does not like UNIX defined to any value under VMS. */ -#undef UNIX -#include -#include - -#else /* VMS */ -#include -#include -#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" - -#include "dpsdict.h" -#include "DPS/dpsexcept.h" - -#include "dpsXint.h" - -static DPSPrivContext FindPrivContext ( - 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 ( - Display * dpy, - int cid) -{ - return ((DPSContext) FindPrivContext (dpy, cid)); -} - -DPSContext DPSContextFromContextID( - 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( - 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, - (unsigned long) ctxt, 0); - } - return true; - } - return false; -} - -static void procFlushContext( - DPSContext ctxt) -{ - DPSPrivContext c = (DPSPrivContext) ctxt; - XDPSLFlush (((XDPSPrivContext) c->wh)->dpy); - if (ctxt->chainChild != NIL) DPSFlushContext(ctxt->chainChild); -} - -/* ARGSUSED */ -static Bool FindDPSEvent( - Display *dpy, - XEvent *event, - char *arg) -{ - return XDPSIsDPSEvent(event); -} - -static void procAwaitReturnValues(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, (unsigned long) 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( - 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(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(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(DPSSpace space) -{ - DPSPrivSpace ss = (DPSPrivSpace) space; - - if (ss->creator) DPSSendDestroySpace((XDPSPrivContext) ss->wh, ss->sid, - DPSclientPrintProc); - - free (ss->wh); -} - -boolean DPSCheckShared(DPSPrivContext ctxt) -{ - return ctxt->creator == false && ctxt->resultTable != NIL; - /* let procAwaitReturnValues generate error */ -} - -/* ARGSUSED */ -void DPSServicePostScript(boolean (*returnControl)(void)) -{ -} /* DPSServicePostScript */ - -void DPSHandleBogusError(DPSContext ctxt, char *prefix, char *suffix) -{ - char *buf = "bogus error output from context"; - DPSDefaultPrivateHandler(ctxt, dps_err_warning, - (long unsigned int)buf, 0, prefix, suffix); -} - -void DPSDefaultPrivateHandler( - DPSContext ctxt, - DPSErrorCode errorCode, - long unsigned int arg1, - long unsigned int arg2, - char *prefix, - char *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(DPSPrivSpace s) -{ - s->creator = true; -} - -void DPSInitPrivateContextFields(DPSPrivContext c, DPSPrivSpace s) -{ - c->creator = true; - c->zombie = false; - if (!s->creator) { - c->procs = XDPSconvProcs; - c->nameEncoding = dps_strings; - } -} - -void DPSInitPrivateTextContextFields(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 (void) -{ - return (DPSLastUserObjectIndex++); -} - -void XDPSSetProcs (void) -{ - 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(DPSProcs p) -{ - p->FlushContext = procFlushContext; - p->ResetContext = procResetContext; - p->AwaitReturnValues = procAwaitReturnValues; -} - -DPSContext XDPSCreateSimpleContext ( - 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 ( - 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 ( - 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 ((SpaceXID)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, - (unsigned long) newNameEncoding, - (unsigned long) 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 ((SpaceXID)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 ((SpaceXID)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( - 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( - 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(void) -{ - static int 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( - 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; - default: - break; - } - - if (old) return dps_event_pass_through; - else return dps_event_internal_dispatch; -} - -Bool XDPSIsStatusEvent( - 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( - 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( - 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( - 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( - 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( - Display *dpy) -{ - return XDPSLGetVersion(dpy); -} diff --git a/nx-X11/lib/dps/dpsXcmu.c b/nx-X11/lib/dps/dpsXcmu.c deleted file mode 100644 index 502649d51..000000000 --- a/nx-X11/lib/dps/dpsXcmu.c +++ /dev/null @@ -1,1602 +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 - */ -/* $XFree86: xc/lib/dps/dpsXcmu.c,v 1.4 2000/09/26 15:56:59 tsi Exp $ */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "dpsassert.h" -#include "cslibint.h" - -/* Defines for standard colormap routines */ - -#define PrivSort qsort -#include - -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(Display *); - -typedef struct { - unsigned long *pixels; - int npixels; -} PixelRec; - -static Bool AllocateColor(Display *, Colormap, XColor *); -static Bool AllocateColormap(Display *, XStandardColormap *, XVisualInfo *, int *, PixelRec *, int *, int *, unsigned long); -static Bool CheckCube(XColor *, XColor *, XStandardColormap *); -static Bool CubicCube(XStandardColormap *); -static Bool GetColorCubeFromProperty(Display *, XVisualInfo *, XStandardColormap *, XStandardColormap **, int *); -static Bool GetGrayRampFromProperty(Display *, XVisualInfo *, XStandardColormap *, XStandardColormap **, int *); -Status XDPSCreateStandardColormaps(Display *, Drawable, Visual *, int, int, int, int, XStandardColormap *, XStandardColormap *, Bool); -static Status contiguous(unsigned long *, int, int *, unsigned long, int *, int *); -static XVisualInfo *PickCorrectVisual(Display *, XVisualInfo *, int, Colormap); -static int FindRampSize(XColor *, XColor *); -static long NumColors(char *, char *, char *); -static void AllocateColorCube(Display *, XVisualInfo *, XStandardColormap *, PixelRec *); -static void AllocateGrayRamp(Display *, XVisualInfo *, XStandardColormap *, XStandardColormap *, PixelRec *); -static void ColorValuesFromMask(unsigned long, unsigned long *, unsigned long *); -static void CreateDefaultsDb(Display *); -static void DefineProperty(Display *, XStandardColormap *, XVisualInfo *, XStandardColormap *, int, Atom); -static void FindStaticColorCube(Display *, XVisualInfo *, XStandardColormap *); -static void FindStaticGrayRamp(Display *, XVisualInfo *, XStandardColormap *, XStandardColormap *); -static void GetDatabaseValues(Display *, XVisualInfo *, XStandardColormap *, XStandardColormap *); -static void GetHomeDir(char *); -static void SetRamp(XColor *, XColor *, int, int *, unsigned long *); -static void ShrinkMapToFit(XStandardColormap *, int *, XVisualInfo *); -static void UseGrayCorners(XStandardColormap *, XStandardColormap *); -static void UseGrayDiagonal(XStandardColormap *, XStandardColormap *); - -#define SCALE 65535 -#undef ABS -#define ABS(x) ((x) < 0 ? -(x) : (x)) - -void XDPSGetDefaultColorMaps( - Display *dpy, - Screen *screen, - Drawable drawable, - XStandardColormap *colorCube, - XStandardColormap *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( - Display *dpy, - Drawable drawable, - Visual *visual, - int reds, int greens, int blues, int grays, - XStandardColormap *colorCube, - XStandardColormap *grayRamp, - Bool retain) -{ - XVisualInfo vtemp, *vinfo; - int nvis; - XStandardColormap *propCube = NULL, *propRamp = NULL; - int nPropCube = 0, nPropRamp = 0; - Bool gotCube = False, 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(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( - 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 { - int maxdepth = 0; - XVisualInfo *v = 0; - - 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( - XStandardColormap *c, - XVisualInfo *vinfo) -{ - unsigned long max = 1 << vinfo->depth; - unsigned long pixel; - - if (c->red_max < 1 || c->green_max < 1 || c->blue_max < 1) return False; - if (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 > max) return False; - - return True; -} - -static Bool ValidRamp( - XStandardColormap *c, - XVisualInfo *vinfo) -{ - unsigned long max = 1 << vinfo->depth; - unsigned long pixel; - - if (c->red_max < 1) return False; - if (c->base_pixel > max) return False; - pixel = (c->red_max * c->red_mult + c->base_pixel) & 0xFFFFFFFF; - if (pixel > max) return False; - - return True; -} - -static Bool GetColorCubeFromProperty( - 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( - 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( - Display *dpy, - XVisualInfo *vinfo, - XStandardColormap *colorCube, - XStandardColormap *grayRamp) -{ - char *class, *depth; - char namePrefix[40], classPrefix[40]; - unsigned long max; - XStandardColormap fakeCube; - - switch (vinfo->class) { - default: - 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(XStandardColormap *cube) -{ - return cube->red_max == cube->green_max && cube->red_max == - cube->blue_max; -} - -static void UseGrayDiagonal(XStandardColormap *cube, XStandardColormap *ramp) -{ - ramp->red_max = cube->red_max; - ramp->red_mult = cube->red_mult + cube->green_mult + cube->blue_mult; - ramp->base_pixel = cube->base_pixel; -} - -static void UseGrayCorners(XStandardColormap *cube, XStandardColormap *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( - unsigned long mask, - unsigned long *maxColor, - unsigned long *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(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(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(char *namePrefix, char *classPrefix, char *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( - 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( - XColor *black, - XColor *white, - XStandardColormap *cube) -{ - int r = 0, g = 0, b = 0, c = 0, m = 0, y = 0, 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( - Display *dpy, - XVisualInfo *vinfo, - XStandardColormap *grayRamp, - XStandardColormap *colorCube) -{ - XColor *ramp, *black, *white, *altBlack, *altWhite; - int i, r0, r1, r2, r3, size, entries, redMult; - unsigned long 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(XColor *black, XColor *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( - XColor *black, - XColor *white, - int size, - int *mult, - unsigned long *base) -{ - *base = black->pixel; - *mult = (white - black) / size; -} - -#define lowbit(x) ((x) & (~(x) + 1)) - -static unsigned long shiftdown(unsigned long x) -{ - while ((x & 1) == 00) { - x = x >> 1; - } - return x; -} - -static void AllocateColorCube( - Display *dpy, - XVisualInfo *vinfo, - XStandardColormap *colorCube, - PixelRec *pixels) -{ - int count, first, remain, n, j; - unsigned long 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, j = 0; j < count; ++j, 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 = - (j * 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 (j = 0; j < remain; j++) { - pixels->pixels[first+j] = pixels->pixels[first+count+j]; - } - pixels->npixels -= count; -} - -static void AllocateGrayRamp( - Display *dpy, - XVisualInfo *vinfo, - XStandardColormap *grayRamp, - XStandardColormap *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; -} - -static int compare(const void *a1, const void *a2) -{ - register unsigned long *e1 = (unsigned long *) a1, - *e2 = (unsigned long *) a2; - - if (*e1 < *e2) return -1; - if (*e1 > *e2) return 1; - return 0; -} - -static Bool AllocateColormap( - Display *dpy, - XStandardColormap *map, - XVisualInfo *vinfo, - int *count, - PixelRec *pixels, - int *first, int *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 = 0; - - /* 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( - 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( - 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( - 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( - 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/nx-X11/lib/dps/dpsXint.h b/nx-X11/lib/dps/dpsXint.h deleted file mode 100644 index 08c4d233a..000000000 --- a/nx-X11/lib/dps/dpsXint.h +++ /dev/null @@ -1,104 +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 - -#include -#include - -/* 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; - DPSTextProc textProc; - DPSErrorProc 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 occurred 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. */ - XDPSStatusProc statusProc; - boolean zombie; /* To avoid DPSAwaitReturnValues */ - XDPSReadyProc 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/nx-X11/lib/dps/dpsXops.psw b/nx-X11/lib/dps/dpsXops.psw deleted file mode 100644 index a14335739..000000000 --- a/nx-X11/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/nx-X11/lib/dps/dpsXpriv.c b/nx-X11/lib/dps/dpsXpriv.c deleted file mode 100644 index c0f12545c..000000000 --- a/nx-X11/lib/dps/dpsXpriv.c +++ /dev/null @@ -1,534 +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.7 2002/03/05 21:50:14 herrb Exp $ */ - -#include -#include -#include -#include -#include -#include - -#ifdef GC -#undef GC -#endif /* GC */ - -#ifdef VMS -/* Xlib does not like UNIX defined to any value under VMS. */ -#undef UNIX -#include -#include -#include -#include -#else /* VMS */ -#include -#include -#include -#include -#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 -#endif - -#ifdef __QNX__ -#include -#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 ( - register Display *dpy) -{ - register PRegstDPY rdpy; - - for (rdpy = firstDPY; rdpy != NIL; rdpy = rdpy->next) - if (rdpy->dpy == dpy) - return (rdpy); - return (NIL); -} - - -void XDPSPrivZapDpy( - 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 ( - Display *dpy, - XEvent *event, - char *arg) -{ - return((event->type & 0x7F) == X_Error); -} - -void XDPSForceEvents ( - Display *dpy) -{ - XEvent event; - - while (XCheckIfEvent (dpy, &event, UsuallyFalse, (char *) NULL)) { - int (*proc)(Display *, XErrorEvent *) = XSetErrorHandler(NULL); - (void) XSetErrorHandler(proc); - if (proc != 0 && event.type < 256) - (void)(*proc)(dpy, &event.xerror); - } -} - - -static void OutputEventHandler ( - 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 ( - Display *dpy) -{ - fd_set 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) { - FD_SET(ConnectionNumber(dpy), &readfds); - 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 ( - 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, - nameEncoding, 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( - DPSTextProc textProc, - void (*releaseProc) (char *, char *)) -{ - DPSAssert (releaseProc != NIL); - XDPSSetProcs (); - DPSSetTextBackstop (DPSDefaultTextBackstop); - DPSSetErrorBackstop (DPSDefaultErrorProc); -} - - -DPSNumFormat XDPSNumFormat ( - 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 ( - 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, (XDPSLEventHandler) XDPSStatusEventHandler); - XDPSLSetReadyEventHandler (dpy, (XDPSLEventHandler) 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 ( - 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 ( - 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 ( - register XDPSPrivContext wh, - DPSClientPrintProc printProc, - ContextPSID cid, - char *buffer, - long int count, - boolean (*returnControl)(void)) -{ - 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, - ConnectionNumber(wh->dpy), - 0); - } - } - DPSCheckRaiseError(wh->ctxt); - } -} - - -/* ARGSUSED */ -void DPSSendInterrupt ( - XDPSPrivContext wh, - ContextPSID cid, - DPSClientPrintProc printProc) -{ - XDPSLNotifyContext (wh->dpy, wh->cxid, PSINTERRUPT); -} - - -/* ARGSUSED */ -void DPSSendEOF ( - XDPSPrivContext wh, - ContextPSID cid, - DPSClientPrintProc printProc) -{ - XDPSLReset (wh->dpy, wh->cxid); -} - - -/* ARGSUSED */ -void DPSSendTerminate ( - XDPSPrivContext wh, - ContextPSID cid, - DPSClientPrintProc printProc) -{ - XDPSLNotifyContext (wh->dpy, wh->cxid, PSKILL); -} - - -void XDPSSendUnfreeze ( - Display *dpy, - ContextXID cxid) -{ - XDPSLNotifyContext (dpy, cxid, PSUNFREEZE); -} - - -/* ARGSUSED */ -void DPSSendDestroySpace( - XDPSPrivContext wh, - SpaceXID sxid, - DPSClientPrintProc printProc) -{ - XDPSLDestroySpace (wh->dpy, sxid); -} - - -void DPSOutOfMemory (void) -{ - DPSFatalProc(NULL, "DPS Client Library Error: Out of memory.\n"); - exit (1); -} diff --git a/nx-X11/lib/dps/dpsXpriv.h b/nx-X11/lib/dps/dpsXpriv.h deleted file mode 100644 index 56b25b757..000000000 --- a/nx-X11/lib/dps/dpsXpriv.h +++ /dev/null @@ -1,187 +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 -#include -#include -#else /* VMS */ -#include -#include -#include -#endif /* VMS */ - -#include -#include "DPS/dpsclient.h" -#include "dpsprivate.h" -#include "DPS/dpsXclient.h" -#include "publictypes.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 */); - - /* 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 DPSCreatePrivContext( - XDPSPrivContext /* wh */, - DPSContext /* ctxt */, - ContextPSID * /* cidP */, - SpaceXID * /* sxidP */, - boolean /* newSpace */, - DPSClientPrintProc /* printProc */); - /* returns -1 if server can't create the context */ - -extern void DPSIncludePrivContext( - XDPSPrivContext /* wh */, - DPSContext /* ctxt */, - ContextPSID /* cid */, - SpaceXID /* sxid */, - DPSClientPrintProc /* printProc */); - -extern void DPSSendPostScript( - XDPSPrivContext /* wh */, - DPSClientPrintProc /* printProc */, - ContextPSID /* cid */, - char * /* buffer */, - long int /* count */, - boolean (* /* returnControl */)(void)); - -extern void DPSSendInterrupt( - XDPSPrivContext /* wh */, - ContextPSID /* cid */, - DPSClientPrintProc /* printProc */); - -extern void DPSSendEOF( - XDPSPrivContext /* wh */, - ContextPSID /* cid */, - DPSClientPrintProc /* printProc */); - -extern void DPSSendTerminate( - XDPSPrivContext /* wh */, - ContextPSID /* cid */, - DPSClientPrintProc /* printProc */); - -extern void XDPSPrivZapDpy( - Display * /* dpy */); - -extern DPSNumFormat XDPSNumFormat (Display * /* dpy */); - - /* Determine the number format for server over the "dpy" connection. */ - -extern void XDPSSetProcs (void); - - /* 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 */); - -extern void DPSSendDestroySpace( - XDPSPrivContext /* wh */, - SpaceXID /* sxid */, - DPSClientPrintProc /* printProc */); - -#endif /* DPSXPRIVATE_H */ diff --git a/nx-X11/lib/dps/dpsXtdisp.c b/nx-X11/lib/dps/dpsXtdisp.c deleted file mode 100644 index d778a3245..000000000 --- a/nx-X11/lib/dps/dpsXtdisp.c +++ /dev/null @@ -1,109 +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 - -#if XtSpecificationRelease < 6 - -#include "dpsassert.h" - -void XDPSSetXtEventDispatching(Display *dpy) -{ - DPSFatalProc(NULL, "Attempt to use XDPSSetXtEventDispatching with pre-R6 Intrinsics\n"); - exit(1); -} - -#else - -#include -#include - -typedef struct _DpyProcRec { - Display *dpy; - XtEventDispatchProc oldproc; - struct _DpyProcRec *next; -} DpyProcRec; - -static DpyProcRec *dpyProcList = NULL; - -static Boolean NXDispatcher(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(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/nx-X11/lib/dps/dpsabbrev.c b/nx-X11/lib/dps/dpsabbrev.c deleted file mode 100644 index 20b3ef713..000000000 --- a/nx-X11/lib/dps/dpsabbrev.c +++ /dev/null @@ -1,360 +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 - */ -/* $XFree86$ */ - -#include -#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(DPSAbbrevRec **list, int *count) -{ - *list = abbrev; - *count = sizeof(abbrev) / sizeof(abbrev[0]); -} - -char *DPSGetSysnameAbbrev(int n) -{ - if ((unsigned) n > sizeof(abbrevPtr) / sizeof(abbrevPtr[0])) return NULL; - if (abbrevPtr[n] == -1) return NULL; - return abbrev[abbrevPtr[n]].abbrev; -} - -char *DPSGetOperatorAbbrev(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/nx-X11/lib/dps/dpsassert.h b/nx-X11/lib/dps/dpsassert.h deleted file mode 100644 index 00632a111..000000000 --- a/nx-X11/lib/dps/dpsassert.h +++ /dev/null @@ -1,57 +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 - -#include "DPS/dpsclient.h" - -#define DPSAssertWarn(cndtn, cntxt, mssg)\ - if (!(cndtn)) DPSWarnProc((DPSContext)(cntxt),(mssg)) - -extern void DPSWarnProc(DPSContext ctxt, char *msg); -extern void DPSFatalProc(DPSContext ctxt, char *msg); -extern void DPSCantHappen(void); - -#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/nx-X11/lib/dps/dpsclient.c b/nx-X11/lib/dps/dpsclient.c deleted file mode 100644 index c75d76ce8..000000000 --- a/nx-X11/lib/dps/dpsclient.c +++ /dev/null @@ -1,2969 +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 - */ -/* $XFree86$ */ - -#include -#include -#include -#include - -#include "dpsXpriv.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(integer e, integer n) -{ - char *p; - while (!(p = (char *)calloc(e, n))) { - DPSOutOfMemory(); - } - return p; -} - - - -void DPSSafeSetLastNameIndex(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(void) -{ - if (!DPSglobals) { - DPSglobals = (Globals)DPScalloc(sizeof(GlobalsRec), 1); - globLastNameIndex = -1; - } -} - -/**************************************************************/ -/* Procedures that support the DPSCreateContext context procs */ -/**************************************************************/ - -/* ARGSUSED */ -static void ReleaseInput( - char *unused, char *buffer) -{ - ContextBuffer cb = (ContextBuffer)buffer; - if (cb == NIL) return; - cb->next = contextBuffers; - contextBuffers = cb; - queuedBuffers--; -} - -/* ARGSUSED */ -static void StuffResultVal( - 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, (long unsigned)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, (long unsigned)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, (long unsigned)obj, 0); - } /* switch (result->type) */ - - if (bump == 0) { - DPSSafeSetLastNameIndex(ctxt); - if (ctxt->errorProc != NIL) - (*ctxt->errorProc)(ctxt, dps_err_resultTypeCheck, (long unsigned)obj, 0); - return; - } - if (result->count != -1) { - result->count--; - result->value += bump; - } - obj += 1; - nObjs--; - } while (nObjs > 0); /* do */ - -} /* StuffResultVal */ - - -static void NumFormatFromTokenType( - 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(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(DPSSpace space) -{ - DPSPrivSpace ss, s = (DPSPrivSpace) space; - for (ss = spaces; ss != NIL; ss = ss->next) - if (ss == s) return true; - return false; -} - -void DPSclientPrintProc ( - DPSContext ctxt, - char *buf, - unsigned 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; - unsigned oldNch = 0; - unsigned 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 < (unsigned) 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 + cc->nObjBufChars < m) { - 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; - unsigned t; - unsigned long int m; - unsigned 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||nchobjBuf = (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&&nchobjBuf = (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, (unsigned long)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, (unsigned long)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(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(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( - 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( - 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( - DPSContext ctxt, - char *buf, - unsigned int count) -{ - DPSinnerProcWriteData(ctxt, buf, count); - if (ctxt->chainChild != NIL) DPSWriteStringChars(ctxt->chainChild, buf, count); -} - -static void procWritePostScript( - DPSContext ctxt, - char *buf, - unsigned int count) -{ - DPSinnerProcWriteData(ctxt, buf, count); - if (ctxt->chainChild != NIL) DPSWritePostScript(ctxt->chainChild, buf, count); -} - -static void innerProcWriteNumstring( - DPSContext ctxt, - DPSDefinedType type, - char *data, - unsigned int size, - int scale, - void (*writeProc)(DPSContext, char *, unsigned)) -{ - 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; - - default: - 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 && (unsigned) 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)); - - default: - break; - } -} /* innerProcWriteNumstring */ - -static void procWriteNumstring( - 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( - 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(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(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(DPSContext ctxt) -{ - DPSPrivContext c = (DPSPrivContext)ctxt; - DPSSendInterrupt((XDPSPrivContext)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(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 unsigned GetHdrNBytes(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( - 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(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( - 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 = 0; - 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( - 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 = ((unsigned) 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 = ((unsigned) 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( - 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( - 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 = 0; - 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( - 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 = 0.0; - 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 */ - DPSPrintf(ctxt, "/%s ", DPSNameFromIndex(*buf)); - break; - case 148: /* executable user name index */ - 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( - 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, (char *) buf, 0); - ConvertAndWriteSeqAsData(ctxt, (char *) buf, 1); - ConvertAndWriteSeqAsData(ctxt, (char *) buf, 2); - } - else if (bos->tokenType != DPS_DEF_TOKENTYPE - || cc->numFormat != DPSDefaultNumFormat) { - /* first pass just writes modified seqHead */ - ConvertAndWriteSeqAsData(ctxt, (char *) buf, 0); - /* second pass converts numbers and writes the sequence */ - ConvertAndWriteSeqAsData(ctxt, (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(DPSContext ctxt, char *buf, unsigned int nch) -{ - (*ctxt->textProc)(ctxt, buf, nch); - if (ctxt->chainChild != NIL) DPSWriteData(ctxt->chainChild, buf, nch); -} - -static void textFlushContext(DPSContext ctxt) -{ - if (ctxt->chainChild != NIL) DPSFlushContext(ctxt->chainChild); -} - -static void textInterruptContext(DPSContext ctxt) -{ - if (ctxt->chainChild != NIL) DPSInterruptContext(ctxt->chainChild); -} - -static void textDestroyContext(DPSContext ctxt) -{ - DPSPrivContext c = (DPSPrivContext)ctxt; - - DPSUnchainContext(ctxt); - - free(c); -} - -static void textInnerWritePostScript( - DPSContext ctxt, char *buf, unsigned int nch) -{ - DPSPrivContext cc = (DPSPrivContext)ctxt; - while (nch > 0) { - char *oldBuf = NIL; - integer oldNch = 0; - unsigned n; - if (cc->outBuf) { /* we're buffering */ - unsigned 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 < (unsigned) 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 + cc->nOutBufChars < m) { - 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 */ - unsigned m = 0; - 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 < (unsigned)bst || nch < (m = GetNBytes((unsigned char *) buf))) { - /* gotta buffer it */ - DPSAssertWarn(!oldBuf, cc, "problem converting binary token/sequence (oldBuf)"); - if (nch < (unsigned) 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( - 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( - DPSContext ctxt, char *buf, unsigned int nch) -{ - DPSContext children = ctxt->chainChild; - - if (DPSCheckShared((DPSPrivContext)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( - DPSContext ctxt, char *buf, unsigned int nch) -{ - DPSContext children = ctxt->chainChild; - DPSPrivContext c = (DPSPrivContext) ctxt; - - if (DPSCheckShared(c)) 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( - 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(long int index) -{ - if (DPSglobals == NIL || index < 0 || index > globLastNameIndex - || userNameDict == NIL) - return NIL; - return (char *) userNames[index]; -} - -void DPSMapNames( - DPSContext ctxt, - unsigned int nNames, - char **names, - int **indices) -{ - unsigned i; - char *last = names[0]; - - 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 (n == NIL) - n = last; - else - last = n; - DPSAssert(n != NIL); - if (strlen(n) > 128) { - DPSSafeSetLastNameIndex(ctxt); - (*ctxt->errorProc)(ctxt, dps_err_nameTooLong, (unsigned long) 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( - DPSContext ctxt, - DPSErrorCode errorCode, - long unsigned int arg1, long unsigned int 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%ld%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(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(DPSContext ctxt) -{ - (*ctxt->errorProc)(ctxt, dps_err_invalidAccess, 0, 0); -} - -static void Noop(void) -{ -} - -DPSContext DPSCreateTextContext( - 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 = (DPSSpaceProc) Noop; - textSpace->lastNameIndex = -1; - DPSInitPrivateSpaceFields(textSpace); - } - c->space = (DPSSpace) textSpace; - - DPSInitPrivateTextContextFields(c, textSpace); - return (DPSContext)c; -} /* DPSCreateTextContext */ - - -static DPSContext CreateDummyContext(void) -{ - DPSPrivContext c; - - DPSCheckInitClientGlobals(); - if (!dummyCtxProcs) { - dummyCtxProcs = (DPSProcs)DPScalloc(sizeof(DPSProcsRec), 1); - dummyCtxProcs->BinObjSeqWrite = (DPSContextBufProc) Noop; - dummyCtxProcs->WriteTypedObjectArray = (DPSContextTypedArrayProc) Noop; - dummyCtxProcs->WriteStringChars = (DPSContextBufProc) Noop; - dummyCtxProcs->WritePostScript = (DPSContextBufProc) Noop; - dummyCtxProcs->WriteData = (DPSContextBufProc) Noop; - dummyCtxProcs->FlushContext = (DPSContextProc) Noop; - dummyCtxProcs->ResetContext = (DPSContextProc) Noop; - dummyCtxProcs->WaitContext = (DPSContextProc) Noop; - dummyCtxProcs->UpdateNameMap = (DPSContextProc) Noop; - dummyCtxProcs->AwaitReturnValues = (DPSContextProc) Noop; - dummyCtxProcs->Interrupt = (DPSContextProc) Noop; - dummyCtxProcs->DestroyContext = (DPSContextProc) Noop; - dummyCtxProcs->WriteNumString = (DPSWriteNumStringProc) 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(DPSTextProc textProc) -{ - DPSCheckInitClientGlobals(); - if (!dummyCtx) dummyCtx = CreateDummyContext(); - dummyCtx->textProc = textProc; -} - -DPSTextProc DPSGetCurrentTextBackstop(void) -{ - DPSCheckInitClientGlobals(); - if (dummyCtx == NIL) return NIL; - else return dummyCtx->textProc; -} - -void DPSSetErrorBackstop(DPSErrorProc errorProc) -{ - DPSCheckInitClientGlobals(); - if (!dummyCtx) dummyCtx = CreateDummyContext(); - dummyCtx->errorProc = errorProc; -} - -DPSErrorProc DPSGetCurrentErrorBackstop(void) -{ - DPSCheckInitClientGlobals(); - if (dummyCtx == NIL) return NIL; - else return dummyCtx->errorProc; -} - -static void NoteInitFailure(DPSContext ctxt, char *buf, long unsigned length) -{ - initFailed = -1; -} - -int DPSInitialize(void) -{ - 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( - 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 = (DPSWriteNumStringProc) 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( - (XDPSPrivContext)wh, - (DPSContext)c, - (ContextPSID *)&c->cid, - (SpaceXID *)&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( - 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(DPSContext parent, DPSContext 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(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(DPSContext ctxt) -{ - (*(ctxt)->procs->AwaitReturnValues)((ctxt)); -} - -void DPSDestroyContext(DPSContext ctxt) -{ - (*(ctxt)->procs->DestroyContext)((ctxt)); -} - -void DPSDestroySpace(DPSSpace spc) -{ - (*(spc)->procs->DestroySpace)((spc)); -} - -void DPSFlushContext(DPSContext ctxt) -{ - (*(ctxt)->procs->FlushContext)((ctxt)); -} - -DPSContext DPSGetCurrentContext(void) { return DPSGlobalContext; } - -void DPSInterruptContext(DPSContext ctxt) -{ - (*(ctxt)->procs->Interrupt)((ctxt)); -} - -DPSContext DPSPrivCurrentContext(void) { return DPSGlobalContext; } - -void DPSResetContext(DPSContext ctxt) -{ - (*(ctxt)->procs->ResetContext)((ctxt)); -} - -void DPSSetResultTable( - register DPSContext ctxt, - DPSResults tbl, - unsigned int len) -{ - (ctxt)->resultTable = (tbl); - (ctxt)->resultTableLength = (len); -} - -void DPSSetContext( - DPSContext ctxt) -{ - DPSGlobalContext = ctxt; -} - -void DPSUpdateNameMap( - DPSContext ctxt) -{ - (*(ctxt)->procs->UpdateNameMap)((ctxt)); -} - -void DPSWaitContext( - DPSContext ctxt) -{ - (*(ctxt)->procs->WaitContext)(ctxt); -} - -void DPSBinObjSeqWrite( - DPSContext ctxt, - char *buf, - unsigned int count) -{ - (*(ctxt)->procs->BinObjSeqWrite)((ctxt), (buf), (count)); -} - -void DPSWriteData( - DPSContext ctxt, - char *buf, - unsigned int count) -{ - (*(ctxt)->procs->WriteData)((ctxt), (buf), (count)); -} - -void DPSWritePostScript( - DPSContext ctxt, - char *buf, - unsigned int count) -{ - (*(ctxt)->procs->WritePostScript)((ctxt), (buf), (count)); -} - -void DPSWriteStringChars( - 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(DPSProcs p) -{ - p->BinObjSeqWrite = textBinObjSeqWrite; - p->WriteTypedObjectArray = writeTypedObjectArray; - p->WriteStringChars = textWriteStringChars; - p->WritePostScript = textWritePostScript; - p->WriteData = textWriteData; - p->FlushContext = textFlushContext; - p->ResetContext = (DPSContextProc) Noop; - p->WaitContext = (DPSContextProc) Noop; - p->UpdateNameMap = procUpdateNameMap; - p->AwaitReturnValues = textAwaitReturnValues; - p->Interrupt = textInterruptContext; - p->DestroyContext = textDestroyContext; - p->WriteNumString = (DPSWriteNumStringProc) textWriteNumstring; -} - -void DPSInitCommonContextProcs(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 = (DPSWriteNumStringProc) procWriteNumstring; -} - -void DPSInitCommonSpaceProcs(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(void) -{ - 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/nx-X11/lib/dps/dpsclrops.psw b/nx-X11/lib/dps/dpsclrops.psw deleted file mode 100644 index f8ec18269..000000000 --- a/nx-X11/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/nx-X11/lib/dps/dpsctrlops.psw b/nx-X11/lib/dps/dpsctrlops.psw deleted file mode 100644 index d00707d4c..000000000 --- a/nx-X11/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/nx-X11/lib/dps/dpsctxtops.psw b/nx-X11/lib/dps/dpsctxtops.psw deleted file mode 100644 index 00f6f8f18..000000000 --- a/nx-X11/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/nx-X11/lib/dps/dpsdataops.psw b/nx-X11/lib/dps/dpsdataops.psw deleted file mode 100644 index c38893678..000000000 --- a/nx-X11/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/nx-X11/lib/dps/dpsdict.c b/nx-X11/lib/dps/dpsdict.c deleted file mode 100644 index b2e8a04b2..000000000 --- a/nx-X11/lib/dps/dpsdict.c +++ /dev/null @@ -1,189 +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 - */ -/* $XFree86$ */ - -/***********/ -/* Imports */ -/***********/ - -#include -#include - -#include "dpsint.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 */ -/**************************/ - -/* Creates and returns a new dictionary. nEntries is a hint. */ -PSWDict DPSCreatePSWDict(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(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(char *name, integer nEntries) -{ - register integer val = 0; - while (*name) val += *name++; - if (val < 0) val = -val; - return (val % nEntries); -} - -static Entry Probe(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(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(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(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(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(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 (Atom) e->name; -} diff --git a/nx-X11/lib/dps/dpsdict.h b/nx-X11/lib/dps/dpsdict.h deleted file mode 100644 index 18b40d42b..000000000 --- a/nx-X11/lib/dps/dpsdict.h +++ /dev/null @@ -1,78 +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 - -#include "publictypes.h" - -typedef struct _PSWDictRec *PSWDict; -/* Opaque designator for a dictionary */ - -typedef int PSWDictValue; /* non-negative */ - -/* 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/nx-X11/lib/dps/dpsendif.txt b/nx-X11/lib/dps/dpsendif.txt deleted file mode 100644 index 80dd08085..000000000 --- a/nx-X11/lib/dps/dpsendif.txt +++ /dev/null @@ -1,5 +0,0 @@ -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - -#endif /* DPSOPS_H */ diff --git a/nx-X11/lib/dps/dpsexcept.c b/nx-X11/lib/dps/dpsexcept.c deleted file mode 100644 index cd404dd86..000000000 --- a/nx-X11/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: $ */ - -/* -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/nx-X11/lib/dps/dpsfontops.psw b/nx-X11/lib/dps/dpsfontops.psw deleted file mode 100644 index 9958e776a..000000000 --- a/nx-X11/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/nx-X11/lib/dps/dpsgsttops.psw b/nx-X11/lib/dps/dpsgsttops.psw deleted file mode 100644 index d9b2728e7..000000000 --- a/nx-X11/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/nx-X11/lib/dps/dpsifdef.txt b/nx-X11/lib/dps/dpsifdef.txt deleted file mode 100644 index d44b7c85f..000000000 --- a/nx-X11/lib/dps/dpsifdef.txt +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef DPSOPS_H -#define DPSOPS_H - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - diff --git a/nx-X11/lib/dps/dpsint.h b/nx-X11/lib/dps/dpsint.h deleted file mode 100644 index 8d5ede870..000000000 --- a/nx-X11/lib/dps/dpsint.h +++ /dev/null @@ -1,125 +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 - -#include "publictypes.h" -#include "dpsassert.h" - -#include "dpsprivate.h" -#include "dpsXint.h" -#include "dpsdict.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 boolean DPSCheckShared(DPSPrivContext ctxt); -extern boolean DPSKnownContext(DPSContext ctxt); -extern boolean DPSKnownSpace(DPSSpace space); -extern boolean DPSPrivateCheckWait(DPSContext ctxt); -extern void DPSCheckInitClientGlobals(void); -extern void DPSPrivateDestroyContext(DPSContext ctxt); -extern void DPSPrivateDestroySpace(DPSSpace space); -extern void DPSSafeSetLastNameIndex(DPSContext ctxt); -extern void DPSclientPrintProc(DPSContext ctxt, char *buf, unsigned nch); -extern void DPSinnerProcWriteData(DPSContext ctxt, char *buf, unsigned int count); - -extern void DPSDefaultPrivateHandler( - DPSContext ctxt, - DPSErrorCode errorCode, - long unsigned int arg1, - long unsigned int arg2, - char *prefix, - char *suffix); - -extern char *DPScalloc(integer e, integer n); - -extern DPSContext DPSCreateContext( - char *wh, - DPSTextProc textProc, - DPSErrorProc errorProc, - DPSSpace space); - -extern void DPSHandleBogusError(DPSContext ctxt, char *prefix, char *suffix); -extern void DPSInitCommonContextProcs(DPSProcs p); -extern void DPSInitCommonSpaceProcs(DPSSpaceProcs p); -extern void DPSInitCommonTextContextProcs(DPSProcs p); -extern void DPSInitPrivateContextFields(DPSPrivContext c, DPSPrivSpace s); -extern void DPSInitPrivateContextProcs(DPSProcs p); -extern void DPSInitPrivateSpaceFields(DPSPrivSpace s); -extern void DPSInitPrivateTextContextFields(DPSPrivContext c, DPSPrivSpace s); -extern void DPSServicePostScript(boolean (*returnControl)(void)); - -#endif /* DPSINT_H */ diff --git a/nx-X11/lib/dps/dpsioops.psw b/nx-X11/lib/dps/dpsioops.psw deleted file mode 100644 index dec3bb7c3..000000000 --- a/nx-X11/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/nx-X11/lib/dps/dpsl2ops.psw b/nx-X11/lib/dps/dpsl2ops.psw deleted file mode 100644 index 67c1aee22..000000000 --- a/nx-X11/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/nx-X11/lib/dps/dpsmathops.psw b/nx-X11/lib/dps/dpsmathops.psw deleted file mode 100644 index e7ada11af..000000000 --- a/nx-X11/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/nx-X11/lib/dps/dpsmiscops.psw b/nx-X11/lib/dps/dpsmiscops.psw deleted file mode 100644 index 6b5bb8078..000000000 --- a/nx-X11/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/nx-X11/lib/dps/dpsmtrxops.psw b/nx-X11/lib/dps/dpsmtrxops.psw deleted file mode 100644 index 6b5303ba0..000000000 --- a/nx-X11/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/nx-X11/lib/dps/dpsname.txt b/nx-X11/lib/dps/dpsname.txt deleted file mode 100644 index ab32b7f7d..000000000 --- a/nx-X11/lib/dps/dpsname.txt +++ /dev/null @@ -1,4 +0,0 @@ -/* - * dpsops.h - */ - diff --git a/nx-X11/lib/dps/dpsopstack.psw b/nx-X11/lib/dps/dpsopstack.psw deleted file mode 100644 index ac10d77c5..000000000 --- a/nx-X11/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/nx-X11/lib/dps/dpspathops.psw b/nx-X11/lib/dps/dpspathops.psw deleted file mode 100644 index 7c0ed7600..000000000 --- a/nx-X11/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/nx-X11/lib/dps/dpspntops.psw b/nx-X11/lib/dps/dpspntops.psw deleted file mode 100644 index e57de4997..000000000 --- a/nx-X11/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/nx-X11/lib/dps/dpsprintf.c b/nx-X11/lib/dps/dpsprintf.c deleted file mode 100644 index 79d8172b6..000000000 --- a/nx-X11/lib/dps/dpsprintf.c +++ /dev/null @@ -1,68 +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 - */ -/* $XFree86: xc/lib/dps/dpsprintf.c,v 1.3 2000/09/26 15:57:00 tsi Exp $ */ - -#include -#include - -#include "publictypes.h" -#include "DPS/dpsclient.h" - -#ifdef USE_DOPRINT -extern void DPSdoprint(); -#endif /* USE_DOPRINT */ - -#include - -void DPSPrintf(DPSContext ctxt, char *fmt, ...) -{ - va_list args; - - va_start(args, fmt); - -#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); -} diff --git a/nx-X11/lib/dps/dpsprivate.h b/nx-X11/lib/dps/dpsprivate.h deleted file mode 100644 index 0392eedd6..000000000 --- a/nx-X11/lib/dps/dpsprivate.h +++ /dev/null @@ -1,127 +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" -#include "DPS/dpsclient.h" - -typedef enum { - dps_hiFirst, dps_loFirst - } DPSByteOrder; - -typedef enum { - dps_ieee, dps_native - } DPSNumFormat; - -typedef void (*DPSClientPrintProc)( - DPSContext /* cid */, - 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, - void (* /* releaseProc */) (char *, char *)); -/* 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 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 int DPSInitialize(void); -extern void DPSInitSysNames(void); - -extern char *DPSSetWh(DPSContext /* ctxt */, char * /* newWh */); - /* set new window handle, returns old window handle */ - -extern void DPSOutOfMemory(void); - /* - 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/nx-X11/lib/dps/dpssimpint.h b/nx-X11/lib/dps/dpssimpint.h deleted file mode 100644 index 8485bc389..000000000 --- a/nx-X11/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/nx-X11/lib/dps/dpssysnames.c b/nx-X11/lib/dps/dpssysnames.c deleted file mode 100644 index 54bf07431..000000000 --- a/nx-X11/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/nx-X11/lib/dps/dpssysops.psw b/nx-X11/lib/dps/dpssysops.psw deleted file mode 100644 index 731287930..000000000 --- a/nx-X11/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/nx-X11/lib/dps/dpswinops.psw b/nx-X11/lib/dps/dpswinops.psw deleted file mode 100644 index 6ccf77b4c..000000000 --- a/nx-X11/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/nx-X11/lib/dps/else.txt b/nx-X11/lib/dps/else.txt deleted file mode 100644 index b74df412a..000000000 --- a/nx-X11/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/nx-X11/lib/dps/genheader.cmd b/nx-X11/lib/dps/genheader.cmd deleted file mode 100644 index b1784e232..000000000 --- a/nx-X11/lib/dps/genheader.cmd +++ /dev/null @@ -1,14 +0,0 @@ -REM -/* OS/2 generate header files */ -/* $XFree86: xc/lib/dps/genheader.cmd,v 1.1 2000/04/05 18:13:22 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/nx-X11/lib/dps/header.txt b/nx-X11/lib/dps/header.txt deleted file mode 100644 index 8b37ebe67..000000000 --- a/nx-X11/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/nx-X11/lib/dps/psXops.psw b/nx-X11/lib/dps/psXops.psw deleted file mode 100644 index 5d350418f..000000000 --- a/nx-X11/lib/dps/psXops.psw +++ /dev/null @@ -1,81 +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 - */ -/* $XFree86$ */ - -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(int 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/nx-X11/lib/dps/psclrops.psw b/nx-X11/lib/dps/psclrops.psw deleted file mode 100644 index 986f85176..000000000 --- a/nx-X11/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/nx-X11/lib/dps/psctrlops.psw b/nx-X11/lib/dps/psctrlops.psw deleted file mode 100644 index 882020d63..000000000 --- a/nx-X11/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/nx-X11/lib/dps/psctxtops.psw b/nx-X11/lib/dps/psctxtops.psw deleted file mode 100644 index 43ca803fc..000000000 --- a/nx-X11/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/nx-X11/lib/dps/psdataops.psw b/nx-X11/lib/dps/psdataops.psw deleted file mode 100644 index ee89313f6..000000000 --- a/nx-X11/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/nx-X11/lib/dps/psendif.txt b/nx-X11/lib/dps/psendif.txt deleted file mode 100644 index cd3eae5f3..000000000 --- a/nx-X11/lib/dps/psendif.txt +++ /dev/null @@ -1,6 +0,0 @@ - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - -#endif /* PSOPS_H */ diff --git a/nx-X11/lib/dps/psfontops.psw b/nx-X11/lib/dps/psfontops.psw deleted file mode 100644 index 9d9b99914..000000000 --- a/nx-X11/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/nx-X11/lib/dps/psgsttops.psw b/nx-X11/lib/dps/psgsttops.psw deleted file mode 100644 index a6eb87b62..000000000 --- a/nx-X11/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/nx-X11/lib/dps/psifdef.txt b/nx-X11/lib/dps/psifdef.txt deleted file mode 100644 index 0de071a23..000000000 --- a/nx-X11/lib/dps/psifdef.txt +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef PSOPS_H -#define PSOPS_H - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - diff --git a/nx-X11/lib/dps/psioops.psw b/nx-X11/lib/dps/psioops.psw deleted file mode 100644 index c4d4b4bb9..000000000 --- a/nx-X11/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/nx-X11/lib/dps/psl2ops.psw b/nx-X11/lib/dps/psl2ops.psw deleted file mode 100644 index 684b5b2e0..000000000 --- a/nx-X11/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/nx-X11/lib/dps/psmathops.psw b/nx-X11/lib/dps/psmathops.psw deleted file mode 100644 index 268535348..000000000 --- a/nx-X11/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/nx-X11/lib/dps/psmiscops.psw b/nx-X11/lib/dps/psmiscops.psw deleted file mode 100644 index 35bc092d0..000000000 --- a/nx-X11/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/nx-X11/lib/dps/psmtrxops.psw b/nx-X11/lib/dps/psmtrxops.psw deleted file mode 100644 index cd9ae1b79..000000000 --- a/nx-X11/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/nx-X11/lib/dps/psname.txt b/nx-X11/lib/dps/psname.txt deleted file mode 100644 index 508b7a86d..000000000 --- a/nx-X11/lib/dps/psname.txt +++ /dev/null @@ -1,3 +0,0 @@ -/* - * psops.h - */ diff --git a/nx-X11/lib/dps/psopstack.psw b/nx-X11/lib/dps/psopstack.psw deleted file mode 100644 index d78ad6b7c..000000000 --- a/nx-X11/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/nx-X11/lib/dps/pspathops.psw b/nx-X11/lib/dps/pspathops.psw deleted file mode 100644 index e4c378282..000000000 --- a/nx-X11/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/nx-X11/lib/dps/pspntops.psw b/nx-X11/lib/dps/pspntops.psw deleted file mode 100644 index 2f7beef00..000000000 --- a/nx-X11/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/nx-X11/lib/dps/pssysops.psw b/nx-X11/lib/dps/pssysops.psw deleted file mode 100644 index 024d4fd52..000000000 --- a/nx-X11/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/nx-X11/lib/dps/pswinops.psw b/nx-X11/lib/dps/pswinops.psw deleted file mode 100644 index 4a6a2db5a..000000000 --- a/nx-X11/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/nx-X11/lib/dps/publictypes.h b/nx-X11/lib/dps/publictypes.h deleted file mode 100644 index 871766e69..000000000 --- a/nx-X11/lib/dps/publictypes.h +++ /dev/null @@ -1,71 +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 - */ -/* $XFree86: xc/lib/dps/publictypes.h,v 1.2 2000/06/07 22:02:58 tsi Exp $ */ - -#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 */ - -#undef MIN -#define MIN(a,b) ((a)<(b)?(a):(b)) -#undef MAX -#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 */ - -#include - -#define NIL NULL - -#endif /* PUBLICTYPES_H */ diff --git a/nx-X11/lib/dpstk/CSBwraps.psw b/nx-X11/lib/dpstk/CSBwraps.psw deleted file mode 100644 index 02a2041ee..000000000 --- a/nx-X11/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/nx-X11/lib/dpstk/ColorSB.c b/nx-X11/lib/dpstk/ColorSB.c deleted file mode 100644 index d2d71088e..000000000 --- a/nx-X11/lib/dpstk/ColorSB.c +++ /dev/null @@ -1,3388 +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 - */ -/* $XFree86$ */ - -#ifndef X_NOT_POSIX -#include -#endif - -#include -#include -#include -#include -#include - -/* There are no words to describe how I feel about having to do this */ - -#if XmVersion > 1001 -#include -#else -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include "dpsXcommonI.h" -#include -#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 -#include -#include -#include - -#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 Boolean SetColor (Widget w, CSBColorSpace space, double c1, double c2, double c3, double c4, Bool setSpace); -static Boolean SetValues (Widget old, Widget req, Widget new, ArgList args, Cardinal *num_args); -static XtGeometryResult GeometryManager (Widget w, XtWidgetGeometry *desired, XtWidgetGeometry *allowed); -static void ChangeLabel (Widget label, double n); -static void ChangeManaged (Widget w); -static void ClassInitialize (void); -static void ClassPartInitialize (WidgetClass widget_class); -static void CreateChildren (ColorSelectionBoxWidget csb); -static void Destroy (Widget widget); -static void DrawDock (ColorSelectionBoxWidget csb); -static void DrawPalette (ColorSelectionBoxWidget csb); -static void FillPatch (ColorSelectionBoxWidget csb); -static void GetColor (Widget w, CSBColorSpace space, float *c1, float *c2, float *c3, float *c4); -static void Initialize (Widget request, Widget new, ArgList args, Cardinal *num_args); -static void InitializeDock (ColorSelectionBoxWidget csb); -static void Realize (Widget w, XtValueMask *mask, XSetWindowAttributes *attr); -static void Resize (Widget widget); -static void SaveDockContents (ColorSelectionBoxWidget csb); -static void SetBackground (ColorSelectionBoxWidget csb); -static void SetCMYKValues (ColorSelectionBoxWidget csb); -static void SetColorSpace (ColorSelectionBoxWidget csb); -static void SetGrayValues (ColorSelectionBoxWidget csb); -static void SetHSBValues (ColorSelectionBoxWidget csb); -static void SetRGBValues (ColorSelectionBoxWidget csb); -static void SetRendering (ColorSelectionBoxWidget csb); -static void SetSliders (ColorSelectionBoxWidget csb); -static void UpdateColorSpaces (ColorSelectionBoxWidget csb, CSBColorSpace masterSpace); - -static void DockPress (Widget w, XtPointer data, XEvent *event, Boolean *goOn); -static void EyedropPointer (Widget w, XtPointer data, XEvent *event, Boolean *goOn); -static void FormResize (Widget w, XtPointer data, XEvent *event, Boolean *goOn); -static void PalettePress (Widget w, XtPointer data, XEvent *event, Boolean *goOn); -static void PatchPress (Widget w, XtPointer data, XEvent *event, Boolean *goOn); -static void PatchRelease (Widget w, XtPointer data, XEvent *event, Boolean *goOn); - -static void ApplyCallback (Widget w, XtPointer clientData, XtPointer callData); -static void DoEyedropCallback (Widget w, XtPointer clientData, XtPointer callData); -static void DrawDockCallback (Widget w, XtPointer clientData, XtPointer callData); -static void DrawPaletteCallback (Widget w, XtPointer clientData, XtPointer callData); -static void FillPatchCallback (Widget w, XtPointer clientData, XtPointer callData); -static void OKCallback (Widget w, XtPointer clientData, XtPointer callData); -static void SetCMYKCallback (Widget w, XtPointer clientData, XtPointer callData); -static void SetGrayCallback (Widget w, XtPointer clientData, XtPointer callData); -static void SetHSBCallback (Widget w, XtPointer clientData, XtPointer callData); -static void SetRGBCallback (Widget w, XtPointer clientData, XtPointer callData); -static void Slider1Callback (Widget w, XtPointer clientData, XtPointer callData); -static void Slider2Callback (Widget w, XtPointer clientData, XtPointer callData); -static void Slider3Callback (Widget w, XtPointer clientData, XtPointer callData); -static void Slider4Callback (Widget w, XtPointer clientData, XtPointer callData); - -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(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(String from, String 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( - Display *dpy, - XrmValuePtr args, - Cardinal *num_args, - XrmValuePtr from, - XrmValuePtr 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( - Display *dpy, - XrmValuePtr args, - Cardinal *num_args, - XrmValuePtr from, - XrmValuePtr 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(void) -{ - /* 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(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( - ColorSelectionBoxWidget csb, - int xWidth, int xHeight, - float *uWidth, float *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(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(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(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(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(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( - 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( - 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( - Widget w, - XtPointer clientData, XtPointer 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( - Widget w, - XtPointer clientData, XtPointer 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( - Widget w, - XtPointer clientData, XtPointer 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( - Widget w, - XtPointer clientData, XtPointer 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(ColorSelectionBoxWidget csb) -{ - CSBCallbackRec rec; - - FillCallbackRec(csb, &rec); - rec.reason = CSBValueChanged; - XtCallCallbackList((Widget) csb, csb->csb.value_changed_callback, - (XtPointer) &rec); -} - -/* ARGSUSED */ - -static void ChangeLabelCallback( - Widget w, - XtPointer clientData, XtPointer callData) -{ - XmScaleCallbackStruct *scaleData = (XmScaleCallbackStruct *) callData; - - ChangeLabel((Widget) clientData, ((float) scaleData->value) / 100.0); -} - -static void ChangeLabel(Widget label, double n) -{ - char buf[10]; - - sprintf(buf, "%d", TO_PCT(n)); - XtVaSetValues(label, XmNlabelString, CS(buf, label), NULL); -} - -static void CreateModelMenu(Widget parent, Widget 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( - Widget w, - XtPointer clientData, XtPointer callData) -{ - RenderingRec *r = (RenderingRec *) clientData; - - r->csb->csb.current_rendering = r->rendering; - FillPatch(r->csb); -} - -static void CreateDisplayMenu(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( - Widget w, - XtPointer clientData, XtPointer 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(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(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(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(String labelString, String labels[4], int n) -{ - 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(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(Widget *children, int n) -{ - XtManageChildren(children, n); -} - -static void UnmapChildren(Widget *children, int n) -{ - XtUnmanageChildren(children, n); -} - -static void SetSliders(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(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( - Widget w, - XtPointer clientData, XtPointer 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(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( - Widget w, - XtPointer clientData, XtPointer 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(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( - Widget w, - XtPointer clientData, XtPointer 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(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( - Widget w, - XtPointer clientData, XtPointer 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(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(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(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) { - default: - 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(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( - 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( - Widget w, - XtPointer clientData, XtPointer 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( - Widget w, - XtPointer clientData, XtPointer 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; - case CSBSpaceGray: - break; - } - - UpdateColorSpaces(csb, csb->csb.current_space); - DoValueChangedCallback(csb); - FillPatch(csb); -} - -/* ARGSUSED */ - -static void Slider3Callback( - Widget w, - XtPointer clientData, XtPointer 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; - case CSBSpaceGray: - break; - } - - UpdateColorSpaces(csb, csb->csb.current_space); - DoValueChangedCallback(csb); - FillPatch(csb); -} - -/* ARGSUSED */ - -static void Slider4Callback( - Widget w, - XtPointer clientData, XtPointer 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(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( - Widget w, - XtPointer clientData, XtPointer 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(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")) != 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 buf; -} - -static void AllocateDock(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(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(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( - Widget w, - XtPointer clientData, XtPointer callData) -{ - ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) clientData; - - XClearArea(XtDisplay(csb), XtWindow(csb->csb.dock_child), - 0, 0, 1000, 1000, False); - DrawDock(csb); -} - -static void DrawDock(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( - ColorSelectionBoxWidget csb, - int x_offset, - int 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( - 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(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(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( - ColorSelectionBoxWidget csb, - Dimension pixelWidth, - float w, - float 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(ColorSelectionBoxWidget csb) -{ - DrawPaletteCallback(csb->csb.palette_child, - (XtPointer) csb, (XtPointer) NULL); -} - -/* ARGSUSED */ - -static void DrawPaletteCallback( - Widget wid, - XtPointer clientData, XtPointer 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( - 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( - Widget w, - XtPointer clientData, XtPointer 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( - 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 = 0; - 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( - 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( - 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( - 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(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( - Widget request, Widget 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) -{ - 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(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( - Widget w, - XtWidgetGeometry *desired, XtWidgetGeometry *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(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(ColorSelectionBoxWidget csb) -{ - Widget w; - - switch(csb->csb.current_rendering) { - default: - case CSBDisplayDPS: - w = XtNameToWidget((Widget) csb, "*displayDPS"); - break; - case CSBDisplayX: - w = XtNameToWidget((Widget) csb, "*displayX"); - 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(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( - 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( - Widget old, Widget req, Widget new, - ArgList args, - Cardinal *num_args) -{ - ColorSelectionBoxWidget oldcsb = (ColorSelectionBoxWidget) old; - ColorSelectionBoxWidget newcsb = (ColorSelectionBoxWidget) new; - Bool inited; - char buf[10]; - Widget w = 0; - 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( - 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) -{ - ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) widget; - - XtResizeWidget(csb->csb.form_child, csb->core.width, csb->core.height, 0); -} - -static Boolean SetColor( - Widget w, - CSBColorSpace space, - double c1, double c2, double c3, double 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( - Widget w, - CSBColorSpace space, - double c1, double c2, double c3, double 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( - Widget w, - CSBColorSpace space, - float *c1, float *c2, float *c3, float *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( - Widget w, - CSBColorSpace space, - float *c1, float *c2, float *c3, float *c4) -{ - XtCheckSubclass(w, colorSelectionBoxWidgetClass, NULL); - - (*((ColorSelectionBoxWidgetClass) XtClass(w))-> - csb_class.get_color) (w, space, c1, c2, c3, c4); -} diff --git a/nx-X11/lib/dpstk/ColorSelect.ad b/nx-X11/lib/dpstk/ColorSelect.ad deleted file mode 100644 index 8c3baa8c6..000000000 --- a/nx-X11/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/nx-X11/lib/dpstk/DPSScrollW.c b/nx-X11/lib/dpstk/DPSScrollW.c deleted file mode 100644 index 9c2f7e005..000000000 --- a/nx-X11/lib/dpstk/DPSScrollW.c +++ /dev/null @@ -1,3500 +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 - */ -/* $XFree86$ */ - -#include -#include -#include -#include -#include -#include - -/* There are no words to describe how I feel about having to do this */ - -#if XmVersion > 1001 -#include -#else -#include -#endif - -#include -#include -#include - -#include -#include "dpsXcommonI.h" -#include -#include "DSWwraps.h" -#include -#include - -#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 Boolean GiveFeedbackPixmap(Widget w, Pixmap p, int width, int height, int depth, Screen *screen); -static Boolean SetValues(Widget old, Widget req, Widget new, ArgList args, Cardinal *num_args); -static Boolean TakeFeedbackPixmap(Widget w, Pixmap *p, int *width, int *height, int *depth, Screen **screen); -static XtGeometryResult GeometryManager(Widget w, XtWidgetGeometry *desired, XtWidgetGeometry *allowed); -static XtGeometryResult QueryGeometry(Widget w, XtWidgetGeometry *desired, XtWidgetGeometry *allowed); -static void AbortPendingDrawing(Widget w); -static void AddExposureToPending(DPSScrolledWindowWidget dsw, XExposeEvent *ev); -static void AddRectsToDirtyArea(DPSScrolledWindowWidget dsw, float *newRect, int n); -static void AddRectsToPending(DPSScrolledWindowWidget dsw, int *newRect, int n); -static void AddToDirtyArea(Widget w, float *rect, long n); -static void AddUserSpaceRectsToPending(DPSScrolledWindowWidget dsw, float *newRect, int n); -static void CallFeedbackCallback(DPSScrolledWindowWidget dsw, float *r, int n); -static void CheckFeedbackPixmap(DPSScrolledWindowWidget dsw); -static void ClassPartInitialize(WidgetClass widget_class); -static void ConvertPSToX(Widget w, double psX, double psY, int *xX, int *xY); -static void ConvertToOrigPS(DPSScrolledWindowWidget dsw, int xX, int xY, float *psX, float *psY); -static void ConvertToPS(DPSScrolledWindowWidget dsw, float xX, float xY, float *psX, float *psY); -static void ConvertToX(DPSScrolledWindowWidget dsw, float psX, float psY, int *xX, int *xY); -static void ConvertXToPS(Widget w, long xX, long xY, float *psX, float *psY); -static void CopyRectsToCurrentDrawing(DPSScrolledWindowWidget dsw, float *newRect, int n); -static void CopyRectsToDirtyArea(DPSScrolledWindowWidget dsw, float *newRect, int n); -static void CopyToFeedbackPixmap(DPSScrolledWindowWidget dsw, float *rects, int n); -static void Destroy(Widget widget); -static void DrawingAreaExpose(Widget w, XtPointer clientData, XtPointer callData); -static void DrawingAreaGraphicsExpose(Widget w, XtPointer clientData, XEvent *event, Boolean *goOn); -static void EndFeedbackDrawing(Widget w, int restore); -static void FinishDrawing(DPSScrolledWindowWidget dsw); -static void FinishPendingDrawing(Widget w); -static void GetDrawingInfo(Widget w, DSWDrawableType *type, Drawable *drawable, DPSGState *gstate, DPSContext *context); -static void GetScrollInfo(Widget w, int *h_value, int *h_size, int *h_max, int *v_value, int *v_size, int *v_max); -static void HScrollCallback(Widget w, XtPointer clientData, XtPointer callData); -static void Initialize(Widget request, Widget new, ArgList args, Cardinal *num_args); -static void Realize(Widget w, XtValueMask *mask, XSetWindowAttributes *attr); -static void Resize(Widget w); -static void ScrollBy(Widget w, long dx, long dy); -static void ScrollMoved(DPSScrolledWindowWidget dsw); -static void ScrollPoint(Widget w, double psX, double psY, long xX, long xY); -static void ScrollTo(Widget w, long x, long y); -static void SetFeedbackDirtyArea(Widget w, float *rects, int count, XtPointer continue_feedback_data); -static void SetScale(Widget w, double scale, long fixedX, long fixedY); -static void SetScaleAndScroll(Widget w, double scale, double psX, double psY, long xX, long xY); -static void StartFeedbackDrawing(Widget w, XtPointer start_feedback_data); -static void UpdateDrawing(Widget w, float *rects, int count); -static void VScrollCallback(Widget w, XtPointer clientData, XtPointer callData); - -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(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( - float **r, - short *r_size, - short num_r, - int n, int 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( - int **r, - short *r_size, - short num_r, - int n, int 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(float *r1, float *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(float *src, float *sub, float *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(float *src, float *dst) -{ - LEFT(dst) = LEFT(src); - BOTTOM(dst) = BOTTOM(src); - WIDTH(dst) = WIDTH(src); - HEIGHT(dst) = HEIGHT(src); -} - -static void Intersection(float *r1, float *r2, float *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( - 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( - 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(float *rect, 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(DPSScrolledWindowWidget dsw, int *dx, int *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(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(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(Widget request, Widget 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) -{ - 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(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(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(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)(Display *, XErrorEvent *); - -static int PixmapHandler(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(DPSScrolledWindowWidget dsw, unsigned w, unsigned h) -{ - Pixmap p; - unsigned int dBytes; - Widget wid = dsw->sw.drawing_area; - unsigned area = (w * h); - - if (dsw->sw.pixmap_limit > 0) { - if (area > (unsigned)dsw->sw.pixmap_limit) return None; - } else if (dsw->sw.pixmap_limit < 0 - && area > (unsigned)(dsw->sw.unscaled_width * dsw->sw.unscaled_height) - && area > (unsigned)(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 (area * dBytes > (unsigned)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(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(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( - 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( - 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( - 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( - 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( - 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( - 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( - 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( - 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(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( - 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( - 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(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(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(DPSScrolledWindowWidget dsw, int deltaX, int deltaY) -{ - 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(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(XtPointer clientData, XtIntervalId *id) -{ - DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) clientData; - - if (dsw->sw.drawing_stage == DSWStart) StartDrawing(dsw); -} - -static void SetUpInitialInformation(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( - 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(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(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(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( - DPSScrolledWindowWidget dsw, - int deltaX, int 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( - DPSScrolledWindowWidget dsw, - int deltaX, int 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( - Widget w, - XtPointer clientData, XtPointer 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( - Widget w, - XtPointer clientData, XtPointer 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(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( - 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( - 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( - 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( - 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( - 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( - 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( - 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( - 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(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( - Widget w, - XtPointer clientData, XtPointer 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(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(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(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(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 > (unsigned)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(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(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(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( - Widget old, Widget req, Widget 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( - Widget w, - XtWidgetGeometry *desired, XtWidgetGeometry *allowed) -{ - /* Pass geometry requests up to our parent */ - return XtMakeGeometryRequest(XtParent(w), desired, allowed); -} - -static XtGeometryResult QueryGeometry( - Widget w, - XtWidgetGeometry *desired, XtWidgetGeometry *allowed) -{ - DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) w; - - /* Pass geometry requests down to our child */ - return XtQueryGeometry(dsw->sw.scrolled_window, desired, allowed); -} - -static void CopyToFeedbackPixmap( - 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( - 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( - Widget w, - double scale, - long fixedX, long fixedY) -{ - float psX, psY; - - ConvertToPS((DPSScrolledWindowWidget) w, (float) fixedX, (float) fixedY, - &psX, &psY); - SetScaleAndScroll(w, scale, psX, psY, fixedX, fixedY); -} - -void DSWSetScale( - Widget w, - double scale, - long fixedX, long fixedY) -{ - XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL); - - (*((DPSScrolledWindowWidgetClass) XtClass(w))-> - sw_class.set_scale) (w, scale, fixedX, fixedY); -} - -static void ScrollPoint( - Widget w, - double psX, double psY, - long xX, long 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( - Widget w, - double psX, double psY, - long xX, long xY) -{ - XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL); - - (*((DPSScrolledWindowWidgetClass) XtClass(w))-> - sw_class.scroll_point) (w, psX, psY, xX, xY); -} - -static void ScrollBy(Widget w, long dx, long 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(Widget w, long dx, long dy) -{ - XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL); - - (*((DPSScrolledWindowWidgetClass) XtClass(w))-> - sw_class.scroll_by) (w, dx, dy); -} - -static void ScrollTo(Widget w, long x, long 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(Widget w, long x, long y) -{ - XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL); - - (*((DPSScrolledWindowWidgetClass) XtClass(w))-> - sw_class.scroll_to) (w, x, y); -} - -static void SetScaleAndScroll( - Widget w, - double scale, - double psX, double psY, - long xX, long 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( - Widget w, - double scale, - double psX, double psY, - long xX, long xY) -{ - XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL); - - (*((DPSScrolledWindowWidgetClass) XtClass(w))-> - sw_class.set_scale_and_scroll) (w, scale, psX, psY, xX, xY); -} - -static void ConvertXToPS( - Widget w, - long xX, long xY, - float *psX, float *psY) -{ - ConvertToPS((DPSScrolledWindowWidget) w, (float) xX, (float) xY, psX, psY); -} - -void DSWConvertXToPS( - Widget w, - long xX, long xY, - float *psX, float *psY) -{ - XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL); - - (*((DPSScrolledWindowWidgetClass) XtClass(w))-> - sw_class.convert_x_to_ps) (w, xX, xY, psX, psY); -} - -static void ConvertPSToX( - Widget w, - double psX, double psY, - int *xX, int *xY) -{ - ConvertToX((DPSScrolledWindowWidget) w, psX, psY, xX, xY); -} - -void DSWConvertPSToX( - Widget w, - double psX, double psY, - int *xX, int *xY) -{ - XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL); - - (*((DPSScrolledWindowWidgetClass) XtClass(w))-> - sw_class.convert_ps_to_x) (w, psX, psY, xX, xY); -} - -static void AddToDirtyArea( - 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( - 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( - Widget w, - Pixmap *p, - int *width, int *height, int *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( - Widget w, - Pixmap *p, - int *width, int *height, int *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( - 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( - 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( - Widget w, - int 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( - Widget w, - Bool restore) -{ - XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL); - - (*((DPSScrolledWindowWidgetClass) XtClass(w))-> - sw_class.end_feedback_drawing) (w, restore); -} - -static void SetFeedbackDirtyArea( - 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( - 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(Widget w) -{ - FinishDrawing((DPSScrolledWindowWidget) w); -} - -void DSWFinishPendingDrawing(Widget w) -{ - XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL); - - (*((DPSScrolledWindowWidgetClass) XtClass(w))-> - sw_class.finish_pending_drawing) (w); -} - -static void AbortPendingDrawing(Widget w) -{ - AbortDrawing((DPSScrolledWindowWidget) w); -} - -void DSWAbortPendingDrawing(Widget w) -{ - XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL); - - (*((DPSScrolledWindowWidgetClass) XtClass(w))-> - sw_class.abort_pending_drawing) (w); -} - -static void UpdateDrawing( - 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( - Widget w, - float *rects, - int count) -{ - XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL); - - (*((DPSScrolledWindowWidgetClass) XtClass(w))-> - sw_class.update_drawing) (w, rects, count); -} - -static void GetScrollInfo( - Widget w, - int *h_value, int *h_size, int *h_max, int *v_value, int *v_size, int *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( - Widget w, - int *h_value, int *h_size, int *h_max, int *v_value, int *v_size, int *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( - 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( - 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( - Widget w, - Pixmap p, - int width, int height, int depth, - Screen *screen) -{ - DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) w; - - if ((unsigned) 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( - Widget w, - Pixmap p, - int width, int height, int 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( - DPSScrolledWindowWidget dsw, - float psX, - float psY, - int *xX, - int *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( - DPSScrolledWindowWidget dsw, - float xX, float xY, - float *psX, float *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( - DPSScrolledWindowWidget dsw, - int xX, int xY, - float *psX, float *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/nx-X11/lib/dpstk/DSWwraps.psw b/nx-X11/lib/dpstk/DSWwraps.psw deleted file mode 100644 index 84c4268a4..000000000 --- a/nx-X11/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/nx-X11/lib/dpstk/FSBwraps.psw b/nx-X11/lib/dpstk/FSBwraps.psw deleted file mode 100644 index c36a0d78c..000000000 --- a/nx-X11/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 // 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 " 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/nx-X11/lib/dpstk/FontCreato.c b/nx-X11/lib/dpstk/FontCreato.c deleted file mode 100644 index 5164665cc..000000000 --- a/nx-X11/lib/dpstk/FontCreato.c +++ /dev/null @@ -1,1610 +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 - */ -/* $XFree86$ */ - -#include -#include - -#include -#include -#include -#include - -/* There are no words to describe how I feel about having to do this */ - -#if XmVersion > 1001 -#include -#else -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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 Boolean SetValues(Widget old, Widget req, Widget new, ArgList args, Cardinal *num_args); -static XtGeometryResult GeometryManager(Widget w, XtWidgetGeometry *desired, XtWidgetGeometry *allowed); -static void ChangeManaged(Widget w); -static void ClassInitialize(void); -static void Destroy(Widget widget); -static void Initialize(Widget request, Widget new, ArgList args, Cardinal *num_args); -static void Resize(Widget widget); - -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(void) -{ - XtInitializeWidgetClass(fontSelectionBoxWidgetClass); - - CSempty = UnsharedCS(""); - opticalSize = Canonical("OpticalSize"); -} - -/* ARGSUSED */ - -static void ResizePreview( - Widget widget, - XtPointer clientData, XtPointer 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(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 widget, - XtPointer clientData, XtPointer callData) -{ - FontCreatorWidget fc = (FontCreatorWidget) clientData; - - DrawMM(fc); -} - -/* ARGSUSED */ - -static void ExposeCallback( - Widget widget, - XtPointer clientData, XtPointer 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(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(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(FontCreatorWidget fc, FontRec *oldf, int *carry_values) -{ - int i; - char buf[20]; - XmString cs; - BlendDataRec *bd = fc->creator.font->blend_data, *oldbd = 0; - 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(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(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(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 widget, - XtPointer clientData, XtPointer 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(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 widget, - XtPointer clientData, XtPointer 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 widget, - XtPointer clientData, XtPointer 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 widget, - XtPointer clientData, XtPointer 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 widget, - XtPointer clientData, XtPointer callData) -{ - XtDestroyWidget(widget); -} - -static void PutUpDialog(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(FontCreatorWidget fc) -{ - PutUpDialog(fc, "noNameMessage"); -} - -static void UsedName(FontCreatorWidget fc) -{ - PutUpDialog(fc, "usedNameMessage"); -} - -static void SomeUsedName(FontCreatorWidget fc) -{ - PutUpDialog(fc, "someUsedNameMessage"); -} - -static void NoSuchName(FontCreatorWidget fc) -{ - PutUpDialog(fc, "noSuchNameMessage"); -} - -static Boolean DoAdd(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 widget, - XtPointer clientData, XtPointer 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(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 widget, - XtPointer clientData, XtPointer 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(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 widget, - XtPointer clientData, XtPointer 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 widget, - XtPointer clientData, XtPointer callData) -{ - FontCreatorWidget fc = (FontCreatorWidget) clientData; - - XtUnmanageChild(fc->creator.option_box); -} - -/* ARGSUSED */ - -static void ShowOptions( - Widget widget, - XtPointer clientData, XtPointer callData) -{ - FontCreatorWidget fc = (FontCreatorWidget) clientData; - - XtManageChild(fc->creator.option_box); -} - -/* ARGSUSED */ - -static void GenerateCallback( - Widget widget, - XtPointer clientData, XtPointer 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 widget, - XtPointer clientData, XtPointer 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 widget, - XtPointer clientData, XtPointer 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 widget, - XtPointer clientData, XtPointer 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 widget, - XtPointer clientData, XtPointer 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 widget, - XtPointer clientData, XtPointer 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(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( - 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; (Cardinal)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(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( - Widget request, Widget 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(FontCreatorWidget fc, BlendRec *cur_b) -{ - int i, cur = 0; - 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(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) -{ - FontCreatorWidget fc = (FontCreatorWidget) widget; - - if (fc->creator.gstate != 0) { - XDPSFreeContextGState(fc->creator.fsb->fsb.context, - fc->creator.gstate); - } -} - -static void Resize(Widget widget) -{ - FontCreatorWidget fc = (FontCreatorWidget) widget; - - XtResizeWidget(fc->creator.pane_child, fc->core.width, fc->core.height, 0); -} - -/* ARGSUSED */ - -static Boolean SetValues( - Widget old, Widget req, Widget 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( - Widget w, - XtWidgetGeometry *desired, XtWidgetGeometry *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(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/nx-X11/lib/dpstk/FontSB.c b/nx-X11/lib/dpstk/FontSB.c deleted file mode 100644 index a529f3af0..000000000 --- a/nx-X11/lib/dpstk/FontSB.c +++ /dev/null @@ -1,4884 +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 - */ -/* $XFree86$ */ - -#include -#include -#include -#include -#include -#include -#include -#include - -/* There are no words to describe how I feel about having to do this */ - -#if XmVersion > 1001 -#include -#else -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "dpsXcommonI.h" -#include -#include -#include -#include -#include "FSBwraps.h" -#include "FontSBI.h" -#include -#include -#include - -#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 Boolean ChangeBlends(Widget w, String base_name, String blend_name, FSBBlendAction action, int *axis_values, float *axis_percents); -static Boolean DownloadFontName(Widget w, String name); -static Boolean MatchFontFace(Widget w, String old_face, String new_family, String *new_face); -static Boolean SetValues(Widget old, Widget req, Widget new, ArgList args, Cardinal *num_args); -static Boolean Verify(FontSelectionBoxWidget fsb, FSBValidateCallbackRec *cb, String afm, Boolean doIt); -static String FindAFM(Widget w, String name); -static String FindFontFile(Widget w, String name); -static XtGeometryResult GeometryManager(Widget w, XtWidgetGeometry *desired, XtWidgetGeometry *allowed); -static void ChangeManaged(Widget w); -static void ClassInitialize(void); -static void ClassPartInitialize(WidgetClass widget_class); -static void Destroy(Widget widget); -static void DisplayFontFamilies(FontSelectionBoxWidget fsb); -static void FontFamilyFaceBlendToName(Widget w, String family, String face, String blend, String *font_name); -static void FontFamilyFaceToName(Widget w, String family, String face, String *font_name); -static void FontNameToFamilyFace(Widget w, String font_name, String *family, String *face); -static void FontNameToFamilyFaceBlend(Widget w, String font_name, String *family, String *face, String *blend); -static void FreeFontRec(FontRec *f); -static void GetBlendInfo(Widget w, String name, int *num_axes_return, int *num_designs_return, String **axis_names_return, float **blend_positions_return, int **blend_map_count_return, int **blend_design_coords_return, float **blend_normalized_coords_return); -static void GetBlendList(Widget w, String name, int *count_return, String **blend_return, String **font_name_return, float **axis_values_return); -static void GetFaceList(Widget w, String family, int *count, String **face_list, String **font_list); -static void GetFamilyList(Widget w, int *count, String **list); -static void GetTextDimensions(Widget w, String text, String font, double size, double x, double y, float *dx, float *dy, float *left, float *right, float *top, float *bottom); -static void Initialize(Widget request, Widget new, ArgList args, Cardinal *num_args); -static void ReadBlends(FontSelectionBoxWidget fsb); -static void RefreshFontList(Widget w); -static void Resize(Widget widget); -static void SetFontFamilyFace(Widget w, String family, String face, Bool family_multiple, Bool face_multiple); -static void SetFontFamilyFaceBlend(Widget w, String family, String face, String blend, Bool family_multiple, Bool face_multiple); -static void SetFontName(Widget w, String name, Bool name_multiple); -static void SetFontSize(Widget w, double size, Bool size_multiple); -static void SetUpCurrentSelections(FontSelectionBoxWidget fsb); -static void UndefUnusedFonts(Widget w); -static void WriteBlends(FontSelectionBoxWidget fsb); - -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( - Display *dpy, - XrmValuePtr args, - Cardinal *num_args, - XrmValuePtr from, - XrmValuePtr 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( - 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(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(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(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(void) -{ - /* Register a converter for string to int list */ - - XtSetTypeConverter(XtRString, XtRFloatList, - CvtStringToFloatList, (XtConvertArgList) NULL, 0, - XtCacheAll | XtCacheRefCount, FloatListDestructor); - - CSempty = UnsharedCS(""); -} - -static void ClassPartInitialize(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( - String name, String family, String fullname, String weight, - String *familyReturn, String *fullnameReturn, String *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(String family, String 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(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( - char *buf, - float *blendPos, - int *axes, int *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( - 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( - 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( - FontSelectionBoxWidget fsb, - char *name, - int *axes, - int *designs, - char *axisNames, - float *blendPos, - int *breakCount, - int *blendBreak, - float *blendBreakValue) -{ - 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( - FontSelectionBoxWidget fsb, - int serverNum, - String name, String family, String fullname, String 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(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(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( - FontSelectionBoxWidget fsb, - char *family, char *fonts, char *weight, char *fullname, char *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(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(FontSelectionBoxWidget fsb) -{ - XtSetSensitive(fsb->fsb.reset_button_child, True); -} - -static void DesensitizeReset(FontSelectionBoxWidget fsb) -{ - XtSetSensitive(fsb->fsb.reset_button_child, False); -} - -static void ManageFamilyMultiple(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(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(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(FontSelectionBoxWidget fsb) -{ - XtManageChild(fsb->fsb.size_multiple_label_child); -} - -static void UnmanageFamilyMultiple(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(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(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(FontSelectionBoxWidget fsb) -{ - XtUnmanageChild(fsb->fsb.size_multiple_label_child); -} - -/* Callbacks for subwidgets */ - -static Boolean DownloadFont( - 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 // 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, ¤tShared); - 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( - FontSelectionBoxWidget fsb, - Boolean all) -{ - FontRec *f, *nextf, **start; - int i; - - if (!all - && (Cardinal)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 && (Cardinal)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(Widget w) -{ - FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) w; - - UndefSomeUnusedFonts(fsb, True); -} - -Boolean _FSBDownloadFontIfNecessary( - 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( - 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(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(FontSelectionBoxWidget fsb) -{ - if (fsb->fsb.auto_preview) DoPreview(fsb, False); - DoValueChangedCallback(fsb); -} - -/* ARGSUSED */ - -static void PreviewText( - Widget widget, - XtPointer clientData, XtPointer 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 widget, - XtPointer clientData, XtPointer callData) -{ - FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) clientData; - - DoPreview(fsb, False); -} - -/* ARGSUSED */ - -static void DismissSamplerCallback( - Widget widget, - XtPointer clientData, XtPointer callData) -{ - FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) clientData; - - fsb->fsb.show_sampler = False; -} - -static void ShowSampler(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(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 widget, - XtPointer clientData, XtPointer callData) -{ - FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) clientData; - - ShowCreator(fsb); -} - -/* ARGSUSED */ - -static void ShowSamplerCallback( - Widget widget, - XtPointer clientData, XtPointer callData) -{ - FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) clientData; - - ShowSampler(fsb); -} - -/* ARGSUSED */ - -static void PreviewDoubleClick( - Widget widget, - XtPointer clientData, XtPointer callData) -{ - FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) clientData; - - DoPreview(fsb, False); -} - -/* ARGSUSED */ - -static void ResizePreview( - Widget widget, - XtPointer clientData, XtPointer 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( - 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(Widget w, String name) -{ - return FindAFMRecursive(w, name, True); -} - -static String FindFontFileRecursive( - 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(Widget w, String name) -{ - return FindFontFileRecursive(w, name, True); -} - -static Boolean Verify( - 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( - 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((Widget)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 widget, - XtPointer clientData, XtPointer 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 widget, - XtPointer clientData, XtPointer callData) -{ - FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) clientData; - - (void) VerifyAndCallback(fsb, FSBApply, fsb->fsb.apply_callback); - WriteBlends(fsb); - DesensitizeReset(fsb); -} - -static void ResetFSB( - 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((Widget)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 widget, - XtPointer clientData, XtPointer callData) -{ - FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) clientData; - - ResetFSB(fsb, FSBReset); - DesensitizeReset(fsb); -} - -/* ARGSUSED */ - -static void CancelCallback( - Widget widget, - XtPointer clientData, XtPointer 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 widget, - XtPointer clientData, XtPointer 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 widget, - XtPointer clientData, XtPointer 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 widget, - XtPointer clientData, XtPointer 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( - 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(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( - FILE *f, - String family, String face, String blend, String 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(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( - String buf, String family, String face, String blend, String 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(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 = 0; - 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( - 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 widget, - XtPointer clientData, XtPointer callData) -{ - XtDestroyWidget(widget); -} - -static void FlushFont( - FontSelectionBoxWidget fsb, - FontRec *font) -{ - FontRec *f = 0, *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); - } - } -} - -void _FSBFlushFont( - FontSelectionBoxWidget fsb, - FontRec *font) -{ - if (font == fsb->fsb.currently_previewed) _FSBBogusFont(fsb, font); - else FlushFont(fsb, font); -} - -void _FSBBogusFont( - 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( - 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( - 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( - 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 widget, - XtPointer clientData, XtPointer 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 widget, - XtPointer clientData, XtPointer 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( - 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; (Cardinal)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(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(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(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(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(FontSelectionBoxWidget fsb) -{ - if (fsb->fsb.use_font_name) SetUpCurrentFontFromName(fsb); - else SetUpCurrentFontFromFamilyFace(fsb); -} - -static void SetUpCurrentSize(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(FontSelectionBoxWidget fsb) -{ - SetUpCurrentFont(fsb); - SetUpCurrentSize(fsb); - if (fsb->fsb.preview_on_change) DoPreview(fsb, False); - DoValueChangedCallback(fsb); -} - -/* ARGSUSED */ - -static void Initialize( - Widget request, Widget 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(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( - 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) -{ - 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) -{ - FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) widget; - - XtResizeWidget(fsb->fsb.pane_child, fsb->core.width, fsb->core.height, 0); -} - -/* ARGSUSED */ - -static Boolean SetValues( - Widget old, Widget req, Widget 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((Widget)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( - Widget w, - XtWidgetGeometry *desired, XtWidgetGeometry *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(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( - Widget w, - String name, - Bool name_multiple) -{ - XtVaSetValues(w, XtNfontName, name, XtNuseFontName, True, - XtNfontNameMultiple, name_multiple, NULL); -} - -void FSBSetFontName( - 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( - Widget w, - String family, String face, - Bool family_multiple, Bool face_multiple) -{ - XtVaSetValues(w, XtNfontFamily, family, XtNfontFace, face, - XtNuseFontName, False, - XtNfontFamilyMultiple, family_multiple, - XtNfontFaceMultiple, face_multiple, NULL); -} - -void FSBSetFontFamilyFace( - Widget w, - String family, String face, - Bool family_multiple, Bool 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( - 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( - 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(Widget w) -{ - FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) w; - - UndefUnusedFonts((Widget)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( - Widget w) -{ - XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL); - - (*((FontSelectionBoxWidgetClass) - XtClass(w))->fsb_class.refresh_font_list) (w); -} - -static void GetFamilyList( - 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( - Widget w, - int *count, - String **list) -{ - XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL); - - (*((FontSelectionBoxWidgetClass) - XtClass(w))->fsb_class.get_family_list) (w, count, list); -} - -static void GetFaceList( - Widget w, - String family, - int *count, - String **face_list, String **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( - Widget w, - String family, - int *count_return, - String **face_list, String **font_list) -{ - XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL); - - (*((FontSelectionBoxWidgetClass) - XtClass(w))->fsb_class.get_face_list) (w, family, count_return, - face_list, font_list); -} - -void FSBUndefineUnusedFonts( - Widget w) -{ - XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL); - - (*((FontSelectionBoxWidgetClass) - XtClass(w))->fsb_class.undef_unused_fonts) (w); -} - -static Boolean DownloadFontName(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( - 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( - Widget w, - String old_face, String 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( - Widget w, - String old_face, String 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( - Widget w, - String font_name, - String *family, String *face, String *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( - Widget w, - String font_name, - String *family, String *face) -{ - String blend; - - FontNameToFamilyFaceBlend(w, font_name, family, face, &blend); -} - -void FSBFontNameToFamilyFace( - Widget w, - String font_name, - String *family, String *face) -{ - XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL); - - (*((FontSelectionBoxWidgetClass) - XtClass(w))->fsb_class.font_name_to_family_face) (w, font_name, - family, face); -} - -static void FontFamilyFaceBlendToName( - Widget w, - String family, String face, String 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( - Widget w, - String family, String face, - String *font_name) -{ - FontFamilyFaceBlendToName(w, family, face, NULL, font_name); -} - -void FSBFontFamilyFaceToName( - Widget w, - String family, String 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( - Widget w, - String font_name) -{ - XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL); - - return (*((FontSelectionBoxWidgetClass) XtClass(w))-> - fsb_class.find_afm) (w, font_name); -} - -String FSBFindFontFile( - Widget w, - String font_name) -{ - XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL); - - return (*((FontSelectionBoxWidgetClass) XtClass(w))-> - fsb_class.find_font_file) (w, font_name); -} - -static void GetTextDimensions( - Widget w, - String text, String font, - double size, double x, double y, - float *dx, float *dy, float *left, float *right, float *top, float *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( - Widget w, - String text, String font, - double size, double x, double y, - float *dx, float *dy, float *left, float *right, float *top, float *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( - Widget w, - String family, - String face, - String blend, - Bool family_multiple, - Bool face_multiple) -{ - XtVaSetValues(w, XtNfontFamily, family, XtNfontFace, face, - XtNfontBlend, blend, XtNuseFontName, False, - XtNfontFamilyMultiple, family_multiple, - XtNfontFaceMultiple, face_multiple, NULL); -} - -void FSBSetFontFamilyFaceBlend( - Widget w, - String font_family, - String font_face, - String font_blend, - Bool font_family_multiple, - Bool 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( - Widget w, - String font_name, - String *family, - String *face, - String *blend) -{ - XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL); - - (*((FontSelectionBoxWidgetClass) XtClass(w))-> - fsb_class.font_name_to_family_face_blend) (w, font_name, family, - face, blend); -} - -void FSBFontFamilyFaceBlendToName( - Widget w, - String family, - String face, - String 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( - Widget w, - String name, - int *count_return, - String **blend_return, - String **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( - Widget w, - String name, - int *count_return, - String **blend_return, - String **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( - Widget w, - String name, - int *num_axes_return, - int *num_designs_return, - String **axis_names_return, - float **blend_positions_return, - int **blend_map_count_return, - int **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( - Widget w, - String name, - int *num_axes_return, - int *num_designs_return, - String **axis_names_return, - float **blend_positions_return, - int **blend_map_count_return, - int **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( - Widget w, - String base_name, - String 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( - Widget w, - String base_name, - String 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( - 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( - 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( - 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/nx-X11/lib/dpstk/FontSBI.h b/nx-X11/lib/dpstk/FontSBI.h deleted file mode 100644 index 87d59df40..000000000 --- a/nx-X11/lib/dpstk/FontSBI.h +++ /dev/null @@ -1,57 +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 - */ -/* $XFree86$ */ - -#ifndef _FontSelectionBoxI_H -#define _FontSelectionBoxI_H - -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 /* _FontSelectionBoxI_H */ -/* DON'T ADD ANYTHING AFTER THIS #endif */ diff --git a/nx-X11/lib/dpstk/FontSample.c b/nx-X11/lib/dpstk/FontSample.c deleted file mode 100644 index 9bccdf30d..000000000 --- a/nx-X11/lib/dpstk/FontSample.c +++ /dev/null @@ -1,1814 +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 - */ -/* $XFree86$ */ - -#include -#include -#include -#include -#include -#include -#include -#include - -/* There are no words to describe how I feel about having to do this */ - -#if XmVersion > 1001 -#include -#else -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "FSBwraps.h" -#include "FontSBI.h" -#include - -#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(XtPointer client_data); -static Boolean DisplaySelectedWorkProc(XtPointer client_data); -static Boolean DisplaySelectedFamilyWorkProc(XtPointer client_data); -static Boolean DisplayFilteredWorkProc(XtPointer client_data); - -#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 Boolean SetValues(Widget old, Widget req, Widget new, ArgList args, Cardinal *num_args); -static XtGeometryResult GeometryManager(Widget w, XtWidgetGeometry *desired, XtWidgetGeometry *allowed); -static void Cancel(Widget w); -static void ChangeManaged(Widget w); -static void ClassInitialize(void); -static void ClassPartInitialize(WidgetClass widget_class); -static void ClickAction(Widget widget, XEvent *event, String *params, Cardinal *num_params); -static void Destroy(Widget widget); -static void Initialize(Widget request, Widget new, ArgList args, Cardinal *num_args); -static void Resize(Widget widget); - -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; - -struct _FilterRec; - -typedef Boolean (*MatchProc)(String name, struct _FilterRec *filter); - -typedef struct _FilterRec { - char *name; - char *particles[9]; - MatchProc special; -} FilterRec; - -static Boolean MatchRoman(String name, FilterRec *filter); -static Boolean MatchMedium(String name, FilterRec *filter); -static Boolean MatchBlack(String name, FilterRec *filter); - -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(FontSamplerWidget s, XmString string) -{ - XtVaSetValues(s->sampler.font_label_child, XmNlabelString, string, NULL); -} - -static void UnhighlightFont(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(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 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( - DisplayRecord *info, - Position newHeight, - Position oldHeight, - Position 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 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(void) -{ - XtInitializeWidgetClass(fontSelectionBoxWidgetClass); -} - -static void ClassPartInitialize(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(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) -{ - return XmToggleButtonGadgetGetState(widget); -} - -/* ARGSUSED */ - -static void DisplayCallback(Widget widget, XtPointer clientData, XtPointer 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(FontSamplerWidget s) -{ - XtSetSensitive(s->sampler.stop_button_child, False); - s->sampler.current_display_proc = None; -} - -/* ARGSUSED */ - -static void FilterCallback(Widget widget, XtPointer clientData, XtPointer 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 widget, XtPointer clientData, XtPointer 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 widget, XtPointer clientData, XtPointer 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 widget, XtPointer clientData, XtPointer 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 widget, XtPointer clientData, XtPointer 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 widget, XtPointer clientData, XtPointer 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 widget, XtPointer clientData, XtPointer 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 widget, XtPointer clientData, XtPointer 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 widget, XtPointer clientData, XtPointer 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 widget, XtPointer clientData, XtPointer 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(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; (Cardinal)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(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(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( - Widget request, Widget 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(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(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(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(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(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(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(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(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(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( - 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(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) -{ - 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) -{ - FontSamplerWidget s = (FontSamplerWidget) widget; - - XtResizeWidget(s->sampler.panel_child, s->core.width, s->core.height, 0); -} - -/* ARGSUSED */ - -static XtGeometryResult GeometryManager( - Widget w, - XtWidgetGeometry *desired, XtWidgetGeometry *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(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( - Widget old, Widget req, Widget 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(Widget w) -{ - FontSamplerWidget s = (FontSamplerWidget) w; - - if (s->sampler.current_display_proc != None) { - XtRemoveWorkProc(s->sampler.current_display_proc); - } -} - -void FSBCancelSampler(Widget w) -{ - XtCheckSubclass(w, fontSamplerWidgetClass, NULL); - - (*((FontSamplerWidgetClass) XtClass(w))->sampler_class.cancel) (w); -} - -#ifdef NO_STRSTR_AVAILABLE -String strstr(String s1, String 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/nx-X11/lib/dpstk/FontSelect.ad b/nx-X11/lib/dpstk/FontSelect.ad deleted file mode 100644 index 6d3440a9e..000000000 --- a/nx-X11/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\ - : 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/nx-X11/lib/dpstk/Imakefile b/nx-X11/lib/dpstk/Imakefile deleted file mode 100644 index 323e584f6..000000000 --- a/nx-X11/lib/dpstk/Imakefile +++ /dev/null @@ -1,91 +0,0 @@ -XCOMM $XFree86: xc/lib/dpstk/Imakefile,v 1.5 2000/05/23 19:32:52 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 - -#ifdef SharedDPSTKReqs -REQUIREDLIBS = SharedDPSTKReqs -#endif - - PSWRAP = PsWrap - -#if HasMotif -INCLUDES = $(MOTIFINCLUDES) - -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 - -.SUFFIXES: .psw - -.psw.c : - RunProgram(PSWRAP,-o $*.c -a -f $*.h -h $*.h $<) - -includes:: $(SRCS) - -#if HasMotif - -includes:: $(MOTIFSRCS) - -#if DoSharedLib -SharedDepLibraryTarget(dpstkXm,$(SODPSREV),$(MOTIFOBJS),$(MOTIFOBJS) $(MOTIFLIB) $(DPSTKLIB) $(PSRESLIB),.,.) -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 /* HasMotif */ - -clean :: - ${RM} $(DERIVED_FILES) $(MOTIFOBJS) - -DependTarget() - diff --git a/nx-X11/lib/dpstk/XDPSpreview.c b/nx-X11/lib/dpstk/XDPSpreview.c deleted file mode 100644 index d36331b71..000000000 --- a/nx-X11/lib/dpstk/XDPSpreview.c +++ /dev/null @@ -1,636 +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 - */ -/* $XFree86$ */ - -#include -#include -#include -#include -#include -#include - -#ifndef NeXT -#include -#endif - -#include -#include -#include "XDPSpwraps.h" -#include "dpsXcommonI.h" -#include -#include - -#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(FILE *file, XRectangle *bb); -static void FillPixmapWithGray( - Screen *screen, - Drawable dest, - XRectangle *bbox, - int xOffset, int yOffset, - double pixelsPerPoint, - Bool createMask); - -static XDPSRewindFunction rewindFunction = XDPSFileRewindFunc; -static DPSPointer rewindClientData = NULL; -static XDPSGetsFunction getsFunction = XDPSFileGetsFunc; -static DPSPointer getsClientData = NULL; - -int XDPSSetFileFunctions( - XDPSRewindFunction rewindFunc, - DPSPointer rewindData, - XDPSGetsFunction getsFunc, - DPSPointer getsData) -{ - if (rewindFunc != NULL) { - rewindFunction = rewindFunc; - rewindClientData = rewindData; - } - if (getsFunc != NULL) { - getsFunction = getsFunc; - getsClientData = getsData; - } - return 0; -} - -/* ARGSUSED */ - -void XDPSFileRewindFunc(FILE *f, DPSPointer data) -{ - rewind(f); -} - -/* ARGSUSED */ - -char *XDPSFileGetsFunc(char *buf, int n, FILE *f, DPSPointer data) -{ - return fgets(buf, n, f); -} - -void XDPSEmbeddedEPSFRewindFunc(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(char *buf, int n, FILE *f, DPSPointer data) -{ - XDPSPosition *p = (XDPSPosition *) data; - int count; - unsigned 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 ((int)len == n-1 && buf[n-1] != '\n') p->continuedLine = True; - else p->continuedLine = False; - - return buf; -} - -int XDPSCreatePixmapForEPSF( - 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 *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; - unsigned 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) -{ - return (float) WidthOfScreen(screen) * mmPerPoint / - (float) WidthMMOfScreen(screen); -} - -static int timeStart = 200, maxDoubles = 3; - -void XDPSSetImagingTimeout(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( - 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( - 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( - 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( - 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( - 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(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( - DPSContext context, - Screen *screen, - Drawable dest, - FILE *file, - int drawableHeight, - int drawableDepth, - XRectangle *bbox, - int xOffset, int yOffset, - double pixelsPerPoint, - Bool clear, Bool 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 // 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 = 0, 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 *screen, - Drawable dest, - XRectangle *bbox, - int xOffset, int 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/nx-X11/lib/dpstk/XDPSpwraps.psw b/nx-X11/lib/dpstk/XDPSpwraps.psw deleted file mode 100644 index b5ff4c4bd..000000000 --- a/nx-X11/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 // 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/nx-X11/lib/dpstk/XDPSshare.c b/nx-X11/lib/dpstk/XDPSshare.c deleted file mode 100644 index ef146db4e..000000000 --- a/nx-X11/lib/dpstk/XDPSshare.c +++ /dev/null @@ -1,727 +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 - */ -/* $XFree86: xc/lib/dpstk/XDPSshare.c,v 1.2 2000/06/07 22:03:01 tsi Exp $ */ - -#include -#include - -#include - -#include -#include -#include -#include - -#include "XDPSswraps.h" -#include "dpsXcommonI.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. -*/ - -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 LookupDisplayInfo(Display *display); - -static ContextInfo AllocContextInfo(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(DPSContext context) -{ - if (extensionId == 0) extensionId = DPSGenerateExtensionRecID(); - - return (ContextInfo) DPSGetContextExtensionRec(context, extensionId); -} - -static ContextInfo RemoveContextInfo(DPSContext context) -{ - return (ContextInfo) DPSRemoveContextExtensionRec(context, - extensionId); -} - -/* May only be called for a display in the display list. */ - -static ContextInfo LookupContext( - 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 *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) -{ - DisplayInfo d = displayList; - - while (d != NULL && d->display != display) d = d->next; - return d; -} - -static DisplayInfo LookupDisplayInfo(Display *display) -{ - DisplayInfo d = FindDisplayInfo(display); - - if (d == NULL) d = AllocDisplayInfo(display, (DPSContext) NULL); - - return d; -} - -int _XDPSSetComponentInitialized(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( - 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( - DPSContext context, - Screen *screen, - int depth) -{ - return XDPSSetContextParameters(context, screen, depth, None, 0, - (XDPSStandardColormap *) NULL, - (XDPSStandardColormap *) NULL, - XDPSContextScreenDepth); -} - -int XDPSSetContextDrawable( - 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( - DPSContext context, - XDPSStandardColormap *map) -{ - return XDPSSetContextParameters(context, (Screen *) NULL, 0, None, 0, - map, (XDPSStandardColormap *) NULL, - XDPSContextRGBMap); -} - -int XDPSSetContextGrayMap( - DPSContext context, - XDPSStandardColormap *map) -{ - return XDPSSetContextParameters(context, (Screen *) NULL, 0, None, 0, - map, (XDPSStandardColormap *) NULL, - XDPSContextGrayMap); -} - -static GC DisplayInfoSharedGC(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( - 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 = 0; - int red_max = 0; - int red_mult = 0; - int green_max = 0; - int green_mult = 0; - int blue_max = 0; - int blue_mult = 0; - int gray_base_pixel = 0; - int gray_max = 0; - int gray_mult = 0; - - 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( - 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(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(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(DPSContext context, DPSGState gs) -{ - _DPSSUpdateGState(context, gs); - - return dps_status_success; -} - -int XDPSFreeContextGState(DPSContext context, DPSGState gs) -{ - _DPSSUndefineUserObject(context, gs); - - return dps_status_success; -} - -int XDPSSetContextGState( - DPSContext context, - DPSGState gs) -{ - _DPSSRestoreGState(context, gs); - - return dps_status_success; -} - -int XDPSPushContextGState( - DPSContext context, - DPSGState gs, - DPSPointer *pushCookieReturn) -{ - int status; - - DPSgsave(context); - - status = XDPSSetContextGState(context, gs); - *pushCookieReturn = (DPSPointer) context; - return status; -} - -int XDPSPopContextGState(DPSPointer pushCookie) -{ - DPSContext context = (DPSContext) pushCookie; - - DPSgrestore(context); - return dps_status_success; -} - -void XDPSRegisterContext(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) -{ - 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(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(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) -{ - 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); - free((char *) d->validDepths); - free((char *) d->gcForDepth); - free((char *) d); -} - -int XDPSChainTextContext(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) -{ - 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(void) -{ - return DPSDefineAsUserObj(DPSGetCurrentContext()); -} - -void PSRedefineUserObj(int uo) -{ - DPSRedefineUserObj(DPSGetCurrentContext(), uo); -} - -void PSUndefineUserObj(int uo) -{ - DPSUndefineUserObj(DPSGetCurrentContext(), uo); -} - -int DPSDefineAsUserObj(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(DPSContext ctxt, int uo) -{ - _DPSSDefineUserObject(ctxt, uo); -} - -void DPSUndefineUserObj(DPSContext ctxt, int uo) -{ - _DPSSUndefineUserObject(ctxt, uo); -} - -int PSReserveUserObjIndices(int number) -{ - return DPSReserveUserObjIndices(DPSGetCurrentContext(), number); -} - -int DPSReserveUserObjIndices(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(int start, int number) -{ - DPSReturnUserObjIndices(DPSGetCurrentContext(), start, number); -} - -void DPSReturnUserObjIndices(DPSContext ctxt, int start, int number) -{ - /* Nothing left any more */ -} - -#ifdef NO_XLISTDEPTHS -/* This function copyright 1989 Massachusetts Institute of Technology */ - -/* - * XListDepths - return info from connection setup - */ -int *XListDepths ( - 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/nx-X11/lib/dpstk/XDPSswraps.psw b/nx-X11/lib/dpstk/XDPSswraps.psw deleted file mode 100644 index f878c765a..000000000 --- a/nx-X11/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/nx-X11/lib/dpstk/XDPSuserpath.c b/nx-X11/lib/dpstk/XDPSuserpath.c deleted file mode 100644 index 251f74574..000000000 --- a/nx-X11/lib/dpstk/XDPSuserpath.c +++ /dev/null @@ -1,240 +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 - */ -/* $XFree86$ */ - -#include -#include -#include - -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/nx-X11/lib/dpstk/dpsXcommonI.h b/nx-X11/lib/dpstk/dpsXcommonI.h deleted file mode 100644 index 2e91dc629..000000000 --- a/nx-X11/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/nx-X11/lib/dpstk/dpstk-def.cpp b/nx-X11/lib/dpstk/dpstk-def.cpp deleted file mode 100644 index ada432c37..000000000 --- a/nx-X11/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$ */ diff --git a/nx-X11/lib/dpstk/eyedrop16.xbm b/nx-X11/lib/dpstk/eyedrop16.xbm deleted file mode 100644 index 2f5a772d7..000000000 --- a/nx-X11/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/nx-X11/lib/dpstk/eyedrop32.xbm b/nx-X11/lib/dpstk/eyedrop32.xbm deleted file mode 100644 index 5bc98a02c..000000000 --- a/nx-X11/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/nx-X11/lib/dpstk/eyedropmask16.xbm b/nx-X11/lib/dpstk/eyedropmask16.xbm deleted file mode 100644 index e1a696dd6..000000000 --- a/nx-X11/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/nx-X11/lib/dpstk/eyedropmask32.xbm b/nx-X11/lib/dpstk/eyedropmask32.xbm deleted file mode 100644 index 8e12f00e7..000000000 --- a/nx-X11/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/nx-X11/lib/dpstk/heyedrop.xbm b/nx-X11/lib/dpstk/heyedrop.xbm deleted file mode 100644 index ea51ae599..000000000 --- a/nx-X11/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/nx-X11/lib/dpstk/square.xbm b/nx-X11/lib/dpstk/square.xbm deleted file mode 100644 index d05789431..000000000 --- a/nx-X11/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/nx-X11/lib/dpstk/squaremask.xbm b/nx-X11/lib/dpstk/squaremask.xbm deleted file mode 100644 index ea2e0d96b..000000000 --- a/nx-X11/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/nx-X11/lib/expat/Imakefile b/nx-X11/lib/expat/Imakefile deleted file mode 100644 index c7ff20bb3..000000000 --- a/nx-X11/lib/expat/Imakefile +++ /dev/null @@ -1,53 +0,0 @@ -XCOMM $XFree86: xc/lib/expat/Imakefile,v 1.8tsi Exp $ - -#define DoNormalLib NormalLibExpat -#define DoSharedLib SharedLibExpat -#define DoExtraLib SharedLibExpat -#define DoDebugLib DebugLibExpat -#define DoProfileLib ProfileLibExpat -#define HasSharedData YES -#define LibName expat -#define SoRev SOEXPATREV -#ifdef SharedLibtoolExpatRev -#define SharedLibtoolRev SharedLibtoolExpatRev -#endif -#define LibHeaders YES - -#include - -EXPATTOP = $(TOP)/extras/expat -EXPATSRC = $(EXPATTOP)/lib -EXPATINC = $(EXPATTOP)/lib - -INCLUDES = -I$(EXPATINC) -I$(EXPATTOP) -I. - -/* - * Endianness (for short's) - * - * XML_BYTE_ORDER == 12 big endian - * XML_BYTE_ORDER == 21 little endian - * XML_BYTE_ORDER == anything else determined at run-time. - */ -DEFINES = -DXML_BYTE_ORDER=0 -DX_BYTE_ORDER=$(X_BYTE_ORDER) -REQUIREDLIBS=$(LDPRELIBS) - -SRCS = xmlparse.c xmltok.c xmlrole.c -OBJS = xmlparse.o xmltok.o xmlrole.o - -HEADERS = expat.h - -#include - -#if DoSharedLib && SharedDataSeparation -SpecialCObjectRule(sharedlib,NullParameter,$(SHLIBDEF)) -#endif - - -DependTarget() - -LinkSourceFile(xmlparse.c,$(EXPATSRC)) -LinkSourceFile(xmltok.c,$(EXPATSRC)) -LinkSourceFile(xmlrole.c,$(EXPATSRC)) -LinkSourceFile(expat.h,$(EXPATINC)) - - diff --git a/nx-X11/lib/expat/expat-def.cpp b/nx-X11/lib/expat/expat-def.cpp deleted file mode 100644 index d5fd2e3cc..000000000 --- a/nx-X11/lib/expat/expat-def.cpp +++ /dev/null @@ -1,73 +0,0 @@ -LIBRARY expat -VERSION LIBRARY_VERSION -EXPORTS -XML_DefaultCurrent -XML_ErrorString -XML_ExpatVersion -XML_ExpatVersionInfo -XML_ExternalEntityParserCreate -XML_GetBase -XML_GetBuffer -XML_GetCurrentByteCount -XML_GetCurrentByteIndex -XML_GetCurrentColumnNumber -XML_GetCurrentLineNumber -XML_GetErrorCode -XML_GetIdAttributeIndex -XML_GetInputContext -XML_GetSpecifiedAttributeCount -XML_Parse -XML_ParseBuffer -XML_ParserCreate -XML_ParserCreateNS -XML_ParserCreate_MM -XML_ParserFree -XML_SetAttlistDeclHandler -XML_SetBase -XML_SetCdataSectionHandler -XML_SetCharacterDataHandler -XML_SetCommentHandler -XML_SetDefaultHandler -XML_SetDefaultHandlerExpand -XML_SetDoctypeDeclHandler -XML_SetElementDeclHandler -XML_SetElementHandler -XML_SetEncoding -XML_SetEndCdataSectionHandler -XML_SetEndDoctypeDeclHandler -XML_SetEndElementHandler -XML_SetEndNamespaceDeclHandler -XML_SetEntityDeclHandler -XML_SetExternalEntityRefHandler -XML_SetExternalEntityRefHandlerArg -XML_SetNamespaceDeclHandler -XML_SetNotStandaloneHandler -XML_SetNotationDeclHandler -XML_SetParamEntityParsing -XML_SetProcessingInstructionHandler -XML_SetReturnNSTriplet -XML_SetStartCdataSectionHandler -XML_SetStartDoctypeDeclHandler -XML_SetStartElementHandler -XML_SetStartNamespaceDeclHandler -XML_SetUnknownEncodingHandler -XML_SetUnparsedEntityDeclHandler -XML_SetUserData -XML_SetXmlDeclHandler -XML_UseParserAsHandlerArg -XmlPrologStateInit -XmlPrologStateInitExternalEntity -XmlGetUtf16InternalEncoding -XmlGetUtf16InternalEncodingNS -XmlGetUtf8InternalEncoding -XmlGetUtf8InternalEncodingNS -XmlInitEncoding -XmlInitEncodingNS -XmlInitUnknownEncoding -XmlInitUnknownEncodingNS -XmlParseXmlDecl -XmlParseXmlDeclNS -XmlSizeOfUnknownEncoding -XmlUtf16Encode -XmlUtf8Encode -/* $XFree86$ */ diff --git a/nx-X11/lib/expat/expat_config.h b/nx-X11/lib/expat/expat_config.h deleted file mode 100644 index 4a0e05c16..000000000 --- a/nx-X11/lib/expat/expat_config.h +++ /dev/null @@ -1,65 +0,0 @@ -/* $XFree86: xc/lib/expat/expat_config.h,v 1.2 2003/04/12 13:50:16 tsi Exp $ */ -/* config.h. Generated automatically by configure. */ -/* config.h.in. Generated automatically from configure.in by autoheader. */ - -#include - -/* Define to empty if the keyword does not work. */ -/* #undef const */ - -/* Define if you have a working `mmap' system call. */ -/* #undef HAVE_MMAP */ - -/* Define to `long' if doesn't define. */ -/* #undef off_t */ - -/* Define to `unsigned' if doesn't define. */ -/* #undef size_t */ - -#ifndef X_NOT_POSIX - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define if you have the header file. */ -#define HAVE_UNISTD_H 1 - -#endif - -/* Define if you have the bcopy function. */ -/* #undef HAVE_BCOPY */ - -/* Define if you have the getpagesize function. */ -/* #undef HAVE_GETPAGESIZE */ - -/* Define if you have the memmove function. */ -#define HAVE_MEMMOVE 1 - -#if X_BYTE_ORDER==X_BIG_ENDIAN -#define BYTEORDER 4321 -#endif - -#if X_BYTE_ORDER==X_LITTLE_ENDIAN -#define BYTEORDER 1234 -#endif - -#ifndef BYTEORDER -#error "Unknown byte order" -#endif - -#define XML_NS -#define XML_DTD - -#define XML_CONTEXT_BYTES 1024 - -#ifndef HAVE_MEMMOVE -#ifdef HAVE_BCOPY -#define memmove(d,s,l) bcopy((s),(d),(l)) -#else -#define memmove(d,s,l) ;punting on memmove; -#endif - -#endif diff --git a/nx-X11/lib/font/FreeType/Imakefile b/nx-X11/lib/font/FreeType/Imakefile deleted file mode 100644 index 57361471b..000000000 --- a/nx-X11/lib/font/FreeType/Imakefile +++ /dev/null @@ -1,47 +0,0 @@ -XCOMM $XFree86: xc/lib/font/FreeType/Imakefile,v 1.30 2003/11/05 16:54:28 tsi Exp $ - -#if BuildServer && DoLoadableServer -#define IHaveSubdirs -#define NoLibSubdirs -#define PassCDebugFlags -SUBDIRS = module -#endif - -#if !HasFreetype2 -EXTRAINCLUDES = -I$(FT2SOURCEDIR)/truetype -INTERNALDEFINES = -DUSE_INTERNAL_FREETYPE -#endif - -DEFINES = ServerExtraDefines StrcasecmpDefines Freetype2BuildDefines \ - -DXFREE86_FT2 $(INTERNALDEFINES) - -FT2SOURCEDIR = $(TOP)/extras/freetype2/src -FT2INCS = $(FREETYPE2INCLUDES) - -INCLUDES = $(FT2INCS) -I. -I$(FONTINCSRC) -I../include -I$(XINCLUDESRC) \ - -I$(SERVERSRC)/include $(EXTRAINCLUDES) \ - -I$(INCLUDESRC) - -SRCS = xttcap.c ftfuncs.c ftenc.c fttools.c -OBJS = xttcap.o ftfuncs.o ftenc.o fttools.o - -#if BuildFontLib -#define DoNormalLib NormalLibFont -#define DoSharedLib SharedLibFont -#define DoDebugLib DebugLibFont -#define DoProfileLib ProfileLibFont -#include -LibraryObjectRule() - -SubdirLibraryRule($(OBJS)) -NormalLintTarget($(SRCS)) - -#endif - -#if BuildServer && DoLoadableServer -MakeSubdirs($(SUBDIRS)) -DependSubdirs($(SUBDIRS)) -#endif - -DependTarget() - diff --git a/nx-X11/lib/font/FreeType/ft.h b/nx-X11/lib/font/FreeType/ft.h deleted file mode 100644 index 8ad8403d5..000000000 --- a/nx-X11/lib/font/FreeType/ft.h +++ /dev/null @@ -1,96 +0,0 @@ -/* -Copyright (c) 1997 by Mark Leisher -Copyright (c) 1998-2002 by Juliusz Chroboczek - -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 -AUTHORS OR 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. -*/ - -/* $XFree86: xc/lib/font/FreeType/ft.h,v 1.22 2003/06/08 15:41:13 herrb Exp $ */ - -#ifndef _FT_H_ -#define _FT_H_ - -#include - -#define FREETYPE_VERSION (FREETYPE_MAJOR * 1000000 + FREETYPE_MINOR * 1000 + FREETYPE_PATCH) - -#undef DEBUG_TRUETYPE - -#ifdef DEBUG_TRUETYPE -#define MUMBLE(s) (ErrorF((s))) -#define MUMBLE1(s,x) (ErrorF((s),(x))) -#else -#define MUMBLE(s) -#define MUMBLE1(s,x) -#endif - -#undef MAX -#define MAX(h,i) ((h) > (i) ? (h) : (i)) -#define ADJUSTMAX(m,v) if((v)>(m)) (m)=(v) -#undef MIN -#define MIN(l,o) ((l) < (o) ? (l) : (o)) -#define ADJUSTMIN(m,v) if ((v)<(m)) (m)=(v) - -/* When comparing floating point values, we want to ignore small errors. */ -#define NEGLIGIBLE ((double)0.001) -/* Are x and y significantly different? */ -#define DIFFER(x,y) (fabs((x)-(y))>=NEGLIGIBLE*fabs(x)) -/* Is x significantly different from 0 w.r.t. y? */ -#define DIFFER0(x,y) (fabs(x)>=NEGLIGIBLE*fabs(y)) - -#ifndef ABS -#define ABS(x) ((x) >= 0 ? (x) : -(x)) -#endif - -/* Two to the sixteenth power, as a double. */ -#define TWO_SIXTEENTH ((double)(1<<16)) -#define TWO_SIXTH ((double)(1<<6)) - -/* Data structures used across files */ - -typedef struct _FTMapping -{ - int named; - FT_CharMap cmap; - int base; - struct _FontMap *mapping; /* allow inclusion without fontenc.h */ -} FTMappingRec, *FTMappingPtr; - -/* Prototypes */ - -/* ftfuncs.c */ - -#if 0 -void FreeTypeRegisterFontFileFunctions(void); -#endif - -/* ftenc.c */ - -int FTPickMapping(char*, int, char*, FT_Face, FTMappingPtr); -unsigned FTRemap(FT_Face face, FTMappingPtr, unsigned code); - -/* fttools.c */ - -int FTtoXReturnCode(int); -int FTGetEnglishName(FT_Face, int, char *, int); -int FTcheckForTTCName(char*, char**, int*); - -extern void ErrorF(const char*, ...); - -#endif /* _FT_H_ */ diff --git a/nx-X11/lib/font/FreeType/ftenc.c b/nx-X11/lib/font/FreeType/ftenc.c deleted file mode 100644 index a9d6494ff..000000000 --- a/nx-X11/lib/font/FreeType/ftenc.c +++ /dev/null @@ -1,242 +0,0 @@ -/* -Copyright (c) 1998-2003 by Juliusz Chroboczek - -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 -AUTHORS OR 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. -*/ -/* $XFree86: xc/lib/font/FreeType/ftenc.c,v 1.24 2003/10/19 18:53:49 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#ifndef FONTMODULE -#include -#else -#include "Xmd.h" -#include "Xdefs.h" -#include "xf86_ansic.h" -#endif - -#include -#include -#include - -#include -#include -#include -#include FT_FREETYPE_H -#include FT_TRUETYPE_IDS_H -#include FT_TRUETYPE_TABLES_H -#include FT_TYPE1_TABLES_H -#include FT_BDF_H -#include FT_XFREE86_H -#include "ft.h" - -static int find_cmap(int, int, int, FT_Face, FT_CharMap *); - -static int -FTEncFontSpecific(char *encoding) -{ - char *p = encoding; - - if(strcasecmp(encoding, "microsoft-symbol") == 0) - return 1; - - while(*p != '-') { - if(*p == '\0') - return 0; - p++; - } - p++; - return (strcasecmp(p, "fontspecific") == 0); -} - -int -FTPickMapping(char *xlfd, int length, char *filename, FT_Face face, - FTMappingPtr tm) -{ - FontEncPtr encoding; - FontMapPtr mapping; - FT_CharMap cmap; - int ftrc; - int symbol = 0; - const char *enc, *reg; - char *encoding_name = 0; - char buf[20]; - - if(xlfd) - encoding_name = FontEncFromXLFD(xlfd, length); - if(!encoding_name) - encoding_name = "iso8859-1"; - - symbol = FTEncFontSpecific(encoding_name); - - ftrc = FT_Get_BDF_Charset_ID(face, &enc, ®); - if(ftrc == 0) { - /* Disable reencoding for non-Unicode fonts. This will - currently only work for BDFs. */ - if(strlen(enc) + strlen(reg) > 18) - goto native; - strcpy(buf, enc); - strcat(buf, "-"); - strcat(buf, reg); - ErrorF("%s %s\n", buf, encoding_name); - if(strcasecmp(buf, "iso10646-1") != 0) { - if(strcasecmp(buf, encoding_name) == 0) - goto native; - return BadFontFormat; - } - } else if(symbol) { - ftrc = FT_Select_Charmap(face, ft_encoding_adobe_custom); - if(ftrc == 0) - goto native; - } - - encoding = FontEncFind(encoding_name, filename); - if(symbol && encoding == NULL) - encoding = FontEncFind("microsoft-symbol", filename); - if(encoding == NULL) { - ErrorF("FreeType: couldn't find encoding '%s' for '%s'\n", - encoding_name, filename); - return BadFontName; - } - - if(FT_Has_PS_Glyph_Names(face)) { - for(mapping = encoding->mappings; mapping; mapping = mapping->next) { - if(mapping->type == FONT_ENCODING_POSTSCRIPT) { - tm->named = 1; - tm->base = 0; - tm->mapping = mapping; - return Successful; - } - } - } - - for(mapping = encoding->mappings; mapping; mapping = mapping->next) { - if(find_cmap(mapping->type, mapping->pid, mapping->eid, face, - &cmap)) { - tm->named = 0; - tm->cmap = cmap; - if(symbol) { - /* deal with an undocumented ``feature'' of the - Microsft-Symbol cmap */ - TT_OS2 *os2; - os2 = FT_Get_Sfnt_Table(face, ft_sfnt_os2); - if(os2) - tm->base = os2->usFirstCharIndex - 0x20; - else - tm->base = 0; - } else - tm->base = 0; - tm->mapping = mapping; - return Successful; - } - } - - return BadFontFormat; - - native: - tm->named = 0; - tm->cmap = face->charmap; - tm->base = 0; - tm->mapping = NULL; - return Successful; -} - -static int -find_cmap(int type, int pid, int eid, FT_Face face, FT_CharMap *cmap_return) -{ - int i, n; - FT_CharMap cmap = NULL; - - n = face->num_charmaps; - - switch(type) { - case FONT_ENCODING_TRUETYPE: /* specific cmap */ - for(i=0; icharmaps[i]; - if(cmap->platform_id == pid && cmap->encoding_id == eid) { - *cmap_return = cmap; - return 1; - } - } - break; - case FONT_ENCODING_UNICODE: /* any Unicode cmap */ - /* prefer Microsoft Unicode */ - for(i=0; icharmaps[i]; - if(cmap->platform_id == TT_PLATFORM_MICROSOFT && - cmap->encoding_id == TT_MS_ID_UNICODE_CS) { - *cmap_return = cmap; - return 1; - } - } - break; - /* Try Apple Unicode */ - for(i=0; icharmaps[i]; - if(cmap->platform_id == TT_PLATFORM_APPLE_UNICODE) { - *cmap_return = cmap; - return 1; - } - } - /* ISO Unicode? */ - for(i=0; icharmaps[i]; - if(cmap->platform_id == TT_PLATFORM_ISO) { - *cmap_return = cmap; - return 1; - } - } - break; - default: - return 0; - } - return 0; -} - -unsigned -FTRemap(FT_Face face, FTMappingPtr tm, unsigned code) -{ - unsigned index; - char *name; - unsigned glyph_index; - - if(tm->mapping) { - if(tm->named) { - name = FontEncName(code, tm->mapping); - if(!name) - return 0; - glyph_index = FT_Get_Name_Index(face, name); - return glyph_index; - } else { - index = FontEncRecode(code, tm->mapping) + tm->base; - FT_Set_Charmap(face, tm->cmap); - glyph_index = FT_Get_Char_Index(face, index); - return glyph_index; - } - } else { - if(code < 0x100) { - index = code; - FT_Set_Charmap(face, tm->cmap); - glyph_index = FT_Get_Char_Index(face, index); - return glyph_index; - } else - return 0; - } -} diff --git a/nx-X11/lib/font/FreeType/ftfuncs.c b/nx-X11/lib/font/FreeType/ftfuncs.c deleted file mode 100644 index d3c9d9eeb..000000000 --- a/nx-X11/lib/font/FreeType/ftfuncs.c +++ /dev/null @@ -1,3851 +0,0 @@ -/* -Copyright (c) 1997 by Mark Leisher -Copyright (c) 1998-2003 by Juliusz Chroboczek -Copyright (c) 1998 Go Watanabe, All rights reserved. -Copyright (c) 1998 Kazushi (Jam) Marukawa, All rights reserved. -Copyright (c) 1998 Takuya SHIOZAKI, All rights reserved. -Copyright (c) 1998 X-TrueType Server Project, All rights reserved. -Copyright (c) 2003-2004 After X-TT Project, 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 -AUTHORS OR 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. -*/ -/* $XdotOrg: xc/lib/font/FreeType/ftfuncs.c,v 1.13 2005/10/23 18:32:05 ajax Exp $ */ - -/* $XFree86: xc/lib/font/FreeType/ftfuncs.c,v 1.43 2004/02/07 04:37:18 dawes Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include - -#ifndef FONTMODULE -#include -#include -#else -#include "Xmd.h" -#include "Xdefs.h" -#include "xf86_ansic.h" -#endif - -#include -#include -#include -#include -#include FT_FREETYPE_H -#include FT_SIZES_H -#include FT_TRUETYPE_IDS_H -#include FT_TRUETYPE_TABLES_H -#include FT_TYPE1_TABLES_H -#include FT_XFREE86_H -#include FT_BBOX_H -#include FT_INTERNAL_TRUETYPE_TYPES_H -#include FT_TRUETYPE_TAGS_H -#include FT_INTERNAL_SFNT_H -#include FT_INTERNAL_STREAM_H -/* - * If you want to use FT_Outline_Get_CBox instead of - * FT_Outline_Get_BBox, define here. - */ -/* #define USE_GET_CBOX */ -#ifdef USE_GET_CBOX -#include FT_OUTLINE_H -#endif - -#include -#include "ft.h" -#include "ftfuncs.h" -#include "xttcap.h" - -/* Work around FreeType bug */ -#define WORK_AROUND_UPM 2048 - -#ifndef True -#define True (-1) -#endif /* True */ -#ifndef False -#define False (0) -#endif /* False */ - -#define FLOOR64(x) ((x) & -64) -#define CEIL64(x) (((x) + 64 - 1) & -64) - -/* - * If you want very lazy method(vl=y) AS DEFAULT when - * handling large charset, define here. - */ -/* #define DEFAULT_VERY_LAZY 1 */ /* Always */ -#define DEFAULT_VERY_LAZY 2 /* Multi-byte only */ -/* #define DEFAULT_VERY_LAZY 256 */ /* Unicode only */ - -/* Does the X accept noSuchChar? */ -#define X_ACCEPTS_NO_SUCH_CHAR -/* Does the XAA accept NULL noSuchChar.bits?(dangerous) */ -/* #define XAA_ACCEPTS_NULL_BITS */ - -#ifdef X_ACCEPTS_NO_SUCH_CHAR -static CharInfoRec noSuchChar = { /* metrics */{0,0,0,0,0,0}, - /* bits */ NULL }; -#endif - -/* The propery names for all the XLFD properties. */ - -static char *xlfd_props[] = { - "FOUNDRY", - "FAMILY_NAME", - "WEIGHT_NAME", - "SLANT", - "SETWIDTH_NAME", - "ADD_STYLE_NAME", - "PIXEL_SIZE", - "POINT_SIZE", - "RESOLUTION_X", - "RESOLUTION_Y", - "SPACING", - "AVERAGE_WIDTH", - "CHARSET_REGISTRY", - "CHARSET_ENCODING", -}; - - -static int ftypeInitP = 0; /* is the engine initialised? */ -FT_Library ftypeLibrary; - -static FTFacePtr faceTable[NUMFACEBUCKETS]; - -static unsigned -hash(char *string) -{ - int i; - unsigned u = 0; - for(i = 0; string[i] != '\0'; i++) - u = (u<<5) + (u >> (NUMFACEBUCKETS - 5)) + (unsigned char)string[i]; - return u; -} - -static int -ifloor(int x, int y) -{ - if(x >= 0) - return x/y; - else - return x/y - 1; -} - -static int -iceil(int x, int y) -{ - return ifloor(x + y - 1, y); -} - -static int -FreeTypeOpenFace(FTFacePtr *facep, char *FTFileName, char *realFileName, int faceNumber) -{ - FT_Error ftrc; - int bucket; - FTFacePtr face, otherFace; - - if (!ftypeInitP) { - ftrc = FT_Init_FreeType(&ftypeLibrary); - if (ftrc != 0) { - ErrorF("FreeType: error initializing ftypeEngine: %d\n", ftrc); - return AllocError; - } - ftypeInitP = 1; - } - - /* Try to find a matching face in the hashtable */ - bucket = hash(FTFileName)%NUMFACEBUCKETS; - otherFace = faceTable[bucket]; - while(otherFace) { - if( strcmp(otherFace->filename, FTFileName) == 0 ) break; - otherFace = otherFace->next; - } - if(otherFace) { - MUMBLE1("Returning cached face: %s\n", otherFace->filename); - *facep = otherFace; - return Successful; - } - - /* No cached match; need to make a new one */ - face = (FTFacePtr)xalloc(sizeof(FTFaceRec)); - if(face == NULL) { - return AllocError; - } - memset(face, 0, sizeof(FTFaceRec)); - - face->filename = (char*)xalloc(strlen(FTFileName)+1); - if(face->filename == NULL) { - xfree(face); - return AllocError; - } - strcpy(face->filename, FTFileName); - - ftrc = FT_New_Face(ftypeLibrary, realFileName, faceNumber, &face->face); - if(ftrc != 0) { - ErrorF("FreeType: couldn't open face %s: %d\n", FTFileName, ftrc); - xfree(face->filename); - xfree(face); - return BadFontName; - } - - face->bitmap = ((face->face->face_flags & FT_FACE_FLAG_SCALABLE) == 0); - if(!face->bitmap) { - TT_MaxProfile *maxp; - maxp = FT_Get_Sfnt_Table(face->face, ft_sfnt_maxp); - if(maxp && maxp->maxContours == 0) - face->bitmap = 1; - } - /* Insert face in hashtable and return it */ - face->next = faceTable[bucket]; - faceTable[bucket] = face; - *facep = face; - return Successful; -} - -static void -FreeTypeFreeFace(FTFacePtr face) -{ - int bucket; - FTFacePtr otherFace; - - if(!face->instances) { - bucket = hash(face->filename) % NUMFACEBUCKETS; - if(faceTable[bucket] == face) - faceTable[bucket] = face->next; - else { - otherFace = faceTable[bucket]; - while(otherFace) { - if(otherFace->next == face) - break; - otherFace = otherFace->next; - } - if(otherFace && otherFace->next) - otherFace->next = otherFace->next->next; - else - ErrorF("FreeType: freeing unknown face\n"); - } - MUMBLE1("Closing face: %s\n", face->filename); - FT_Done_Face(face->face); - xfree(face->filename); - xfree(face); - } -} - -static int -TransEqual(FTNormalisedTransformationPtr t1, FTNormalisedTransformationPtr t2) -{ - if(t1->scale != t2->scale) - return 0; - else if(t1->xres != t2->xres || t1->yres != t2->yres) - return 0; - else if(t1->nonIdentity != t2->nonIdentity) - return 0; - else if(t1->nonIdentity && t2->nonIdentity) { - return - t1->matrix.xx == t2->matrix.xx && - t1->matrix.yx == t2->matrix.yx && - t1->matrix.yy == t2->matrix.yy && - t1->matrix.xy == t2->matrix.xy; - } else - return 1; -} - -static int -BitmapFormatEqual(FontBitmapFormatPtr f1, FontBitmapFormatPtr f2) -{ - return - f1->bit == f2->bit && - f1->byte == f2->byte && - f1->glyph == f2->glyph; -} - -static int -TTCapEqual(struct TTCapInfo *t1, struct TTCapInfo *t2) -{ - return - t1->autoItalic == t2->autoItalic && - t1->scaleWidth == t2->scaleWidth && - t1->scaleBBoxWidth == t2->scaleBBoxWidth && - t1->scaleBBoxHeight == t2->scaleBBoxHeight && - t1->doubleStrikeShift == t2->doubleStrikeShift && - t1->adjustBBoxWidthByPixel == t2->adjustBBoxWidthByPixel && - t1->adjustLeftSideBearingByPixel == t2->adjustLeftSideBearingByPixel && - t1->adjustRightSideBearingByPixel == t2->adjustRightSideBearingByPixel && - t1->flags == t2->flags && - t1->scaleBitmap == t2->scaleBitmap && - /* - If we use forceConstantSpacing, - we *MUST* allocate new instance. - */ - t1->forceConstantSpacingEnd < 0 && - t2->forceConstantSpacingEnd < 0; -} - -static int -FTInstanceMatch(FTInstancePtr instance, - char *FTFileName, FTNormalisedTransformationPtr trans, - int spacing, FontBitmapFormatPtr bmfmt, - struct TTCapInfo *tmp_ttcap, FT_Int32 load_flags) -{ - if(strcmp(instance->face->filename, FTFileName) != 0) { - return 0; - } else if(!TransEqual(&instance->transformation, trans)) { - return 0; - } else if( spacing != instance->spacing ) { - return 0; - } else if( load_flags != instance->load_flags ) { - return 0; - } else if(!BitmapFormatEqual(&instance->bmfmt, bmfmt)) { - return 0; - } else if(!TTCapEqual(&instance->ttcap, tmp_ttcap)) { - return 0; - } else { - return 1; - } -} - -static int -FreeTypeActivateInstance(FTInstancePtr instance) -{ - FT_Error ftrc; - if(instance->face->active_instance == instance) - return Successful; - - ftrc = FT_Activate_Size(instance->size); - if(ftrc != 0) { - instance->face->active_instance = NULL; - ErrorF("FreeType: couldn't activate instance: %d\n", ftrc); - return FTtoXReturnCode(ftrc); - } - FT_Set_Transform(instance->face->face, - instance->transformation.nonIdentity ? - &instance->transformation.matrix : 0, - 0); - - instance->face->active_instance = instance; - return Successful; -} - -static int -FTFindSize(FT_Face face, FTNormalisedTransformationPtr trans, - int *x_return, int *y_return) -{ - int tx, ty, x, y; - int i, j; - int d, dd; - - if(trans->nonIdentity) - return BadFontName; - - tx = (int)(trans->scale * trans->xres / 72.0 + 0.5); - ty = (int)(trans->scale * trans->yres / 72.0 + 0.5); - - d = 100; - j = -1; - for(i = 0; i < face->num_fixed_sizes; i++) { - x = face->available_sizes[i].width; - y = face->available_sizes[i].height; - if(ABS(x - tx) <= 1 && ABS(y - ty) <= 1) { - dd = ABS(x - tx) * ABS(x - tx) + ABS(y - ty) * ABS(y - ty); - if(dd < d) { - j = i; - d = dd; - } - } - } - if(j < 0) - return BadFontName; - - *x_return = face->available_sizes[j].width; - *y_return = face->available_sizes[j].height; - return Successful; -} - -static int -FreeTypeOpenInstance(FTInstancePtr *instance_return, FTFacePtr face, - char *FTFileName, FTNormalisedTransformationPtr trans, - int spacing, FontBitmapFormatPtr bmfmt, - struct TTCapInfo *tmp_ttcap, FT_Int32 load_flags) -{ - FT_Error ftrc; - int xrc; - FTInstancePtr instance, otherInstance; - - /* Search for a matching instance */ - for(otherInstance = face->instances; - otherInstance; - otherInstance = otherInstance->next) { - if(FTInstanceMatch(otherInstance, FTFileName, trans, spacing, bmfmt, - tmp_ttcap, load_flags)) break; - } - if(otherInstance) { - MUMBLE("Returning cached instance\n"); - otherInstance->refcount++; - *instance_return = otherInstance; - return Successful; - } - - /* None matching found */ - instance = (FTInstancePtr)xalloc(sizeof(FTInstanceRec)); - if(instance == NULL) { - return AllocError; - } - - instance->refcount = 1; - instance->face = face; - - instance->load_flags = load_flags; - instance->spacing = spacing; /* Actual spacing */ - instance->pixel_size =0; - instance->pixel_width_unit_x =0; - instance->pixel_width_unit_y =0; - instance->charcellMetrics = NULL; - instance->averageWidth = 0; - instance->rawAverageWidth = 0; - instance->forceConstantMetrics = NULL; - - instance->transformation = *trans; - instance->bmfmt = *bmfmt; - instance->glyphs = NULL; - instance->available = NULL; - - if( 0 <= tmp_ttcap->forceConstantSpacingEnd ) - instance->nglyphs = 2 * instance->face->face->num_glyphs; - else - instance->nglyphs = instance->face->face->num_glyphs; - - /* Store the TTCap info. */ - memcpy((char*)&instance->ttcap, (char*)tmp_ttcap, - sizeof(struct TTCapInfo)); - - ftrc = FT_New_Size(instance->face->face, &instance->size); - if(ftrc != 0) { - ErrorF("FreeType: couldn't create size object: %d\n", ftrc); - xfree(instance); - return FTtoXReturnCode(ftrc); - } - FreeTypeActivateInstance(instance); - if(!face->bitmap) { - ftrc = FT_Set_Char_Size(instance->face->face, - (int)(trans->scale*(1<<6) + 0.5), - (int)(trans->scale*(1<<6) + 0.5), - trans->xres, trans->yres); - } else { - int xsize, ysize; - xrc = FTFindSize(face->face, trans, &xsize, &ysize); - if(xrc != Successful) { - xfree(instance); - return xrc; - } - ftrc = FT_Set_Pixel_Sizes(instance->face->face, xsize, ysize); - } - if(ftrc != 0) { - FT_Done_Size(instance->size); - xfree(instance); - return FTtoXReturnCode(ftrc); - } - - if( FT_IS_SFNT( face->face ) ) { - /* See Set_Char_Sizes() in ttdriver.c */ - FT_Error err; - TT_Face tt_face; - FT_Long tt_dim_x, tt_dim_y; - FT_UShort tt_x_ppem, tt_y_ppem; - FT_F26Dot6 tt_char_width, tt_char_height; - SFNT_Service sfnt; - tt_face=(TT_Face)face->face; - tt_char_width = (int)(trans->scale*(1<<6) + 0.5); - tt_char_height = (int)(trans->scale*(1<<6) + 0.5); - if ( ( tt_face->header.Flags & 8 ) != 0 ) { - tt_dim_x = ( ( tt_char_width * trans->xres + (36+32*72) ) / 72 ) & -64; - tt_dim_y = ( ( tt_char_height * trans->yres + (36+32*72) ) / 72 ) & -64; - } - else{ - tt_dim_x = ( ( tt_char_width * trans->xres + 36 ) / 72 ); - tt_dim_y = ( ( tt_char_height * trans->yres + 36 ) / 72 ); - } - tt_x_ppem = (FT_UShort)( tt_dim_x >> 6 ); - tt_y_ppem = (FT_UShort)( tt_dim_y >> 6 ); - /* See Reset_SBit_Size() in ttobjs.c */ - sfnt = (SFNT_Service)tt_face->sfnt; - err = sfnt->set_sbit_strike(tt_face,tt_x_ppem,tt_y_ppem,&instance->strike_index); - if ( err ) instance->strike_index=0xFFFFU; - } - - /* maintain a linked list of instances */ - instance->next = instance->face->instances; - instance->face->instances = instance; - - *instance_return = instance; - return Successful; -} - -static void -FreeTypeFreeInstance(FTInstancePtr instance) -{ - FTInstancePtr otherInstance; - - if( instance == NULL ) return; - - if(instance->face->active_instance == instance) - instance->face->active_instance = NULL; - instance->refcount--; - if(instance->refcount <= 0) { - int i,j; - - if(instance->face->instances == instance) - instance->face->instances = instance->next; - else { - for(otherInstance = instance->face->instances; - otherInstance; - otherInstance = otherInstance->next) - if(otherInstance->next == instance) { - otherInstance->next = instance->next; - break; - } - } - - FT_Done_Size(instance->size); - FreeTypeFreeFace(instance->face); - - if(instance->charcellMetrics) { - xfree(instance->charcellMetrics); - } - if(instance->forceConstantMetrics) { - xfree(instance->forceConstantMetrics); - } - if(instance->glyphs) { - for(i = 0; i < iceil(instance->nglyphs, FONTSEGMENTSIZE); i++) { - if(instance->glyphs[i]) { - for(j = 0; j < FONTSEGMENTSIZE; j++) { - if(instance->available[i][j] == - FT_AVAILABLE_RASTERISED) - xfree(instance->glyphs[i][j].bits); - } - xfree(instance->glyphs[i]); - } - } - xfree(instance->glyphs); - } - if(instance->available) { - for(i = 0; i < iceil(instance->nglyphs, FONTSEGMENTSIZE); i++) { - if(instance->available[i]) - xfree(instance->available[i]); - } - xfree(instance->available); - } - xfree(instance); - } -} - -static int -FreeTypeInstanceFindGlyph(unsigned idx_in, int flags, FTInstancePtr instance, - CharInfoPtr **glyphs, int ***available, - int *found, int *segmentP, int *offsetP) -{ - int segment, offset; - unsigned idx = idx_in; - - if( 0 <= instance->ttcap.forceConstantSpacingEnd ){ - if( (flags & FT_FORCE_CONSTANT_SPACING) ) - idx += instance->nglyphs / 2 ; - } - - if(idx > instance->nglyphs) { - *found = 0; - return Successful; - } - - if(*available == NULL) { - *available = - (int**)xalloc(sizeof(int*) * iceil(instance->nglyphs, - FONTSEGMENTSIZE)); - if(*available == NULL) - return AllocError; - memset((char*)(*available), 0, - sizeof(int*) * iceil(instance->nglyphs, FONTSEGMENTSIZE)); - } - - segment = ifloor(idx, FONTSEGMENTSIZE); - offset = idx - segment * FONTSEGMENTSIZE; - - if((*available)[segment] == NULL) { - (*available)[segment] = (int*)xalloc(sizeof(int) * FONTSEGMENTSIZE); - if((*available)[segment] == NULL) - return AllocError; - memset((char*)(*available)[segment], 0, sizeof(int) * FONTSEGMENTSIZE); - } - - if(*glyphs == NULL) { - *glyphs = (CharInfoPtr*)xalloc(sizeof(CharInfoPtr)* - iceil(instance->nglyphs, - FONTSEGMENTSIZE)); - if(*glyphs == NULL) - return AllocError; - memset((char*)(*glyphs), 0, - sizeof(CharInfoPtr)*iceil(instance->nglyphs, FONTSEGMENTSIZE)); - } - - if((*glyphs)[segment] == NULL) { - (*glyphs)[segment]= - (CharInfoPtr)xalloc(sizeof(CharInfoRec) * FONTSEGMENTSIZE); - if((*glyphs)[segment] == NULL) - return AllocError; - } - - *found = 1; - *segmentP = segment; - *offsetP = offset; - return Successful; -} - -static int -FreeTypeInstanceGetGlyph(unsigned idx, int flags, CharInfoPtr *g, FTInstancePtr instance) -{ - int found, segment, offset; - int xrc; - int ***available; - CharInfoPtr **glyphs; - - available = &instance->available; - glyphs = &instance->glyphs; - - xrc = FreeTypeInstanceFindGlyph(idx, flags, instance, glyphs, available, - &found, &segment, &offset); - if(xrc != Successful) - return xrc; - - if(!found || (*available)[segment][offset] == FT_AVAILABLE_NO) { - *g = NULL; - return Successful; - } - - if((*available)[segment][offset] == FT_AVAILABLE_RASTERISED) { - *g = &(*glyphs)[segment][offset]; - return Successful; - } - - flags |= FT_GET_GLYPH_BOTH; - - xrc = FreeTypeRasteriseGlyph(idx, flags, - &(*glyphs)[segment][offset], instance, - (*available)[segment][offset] >= FT_AVAILABLE_METRICS); - if(xrc != Successful && (*available)[segment][offset] >= FT_AVAILABLE_METRICS) { - ErrorF("Warning: FreeTypeRasteriseGlyph() returns an error,\n"); - ErrorF("\tso the backend tries to set a white space.\n"); - xrc = FreeTypeRasteriseGlyph(idx, flags | FT_GET_DUMMY, - &(*glyphs)[segment][offset], instance, - (*available)[segment][offset] >= FT_AVAILABLE_METRICS); - } - if(xrc == Successful) { - (*available)[segment][offset] = FT_AVAILABLE_RASTERISED; - /* return the glyph */ - *g = &(*glyphs)[segment][offset]; - } - return xrc; -} - -static int -FreeTypeInstanceGetGlyphMetrics(unsigned idx, int flags, - xCharInfo **metrics, FTInstancePtr instance ) -{ - int xrc; - int found, segment, offset; - - /* Char cell */ - if(instance->spacing == FT_CHARCELL) { - *metrics = instance->charcellMetrics; - return Successful; - } - /* Force constant metrics */ - if( flags & FT_FORCE_CONSTANT_SPACING) { - *metrics = instance->forceConstantMetrics; - return Successful; - } - - /* Not char cell */ - - xrc = FreeTypeInstanceFindGlyph(idx, flags, instance, - &instance->glyphs, &instance->available, - &found, &segment, &offset); - if(xrc != Successful) - return xrc; - if(!found) { - *metrics = NULL; - return Successful; - } - if( instance->available[segment][offset] == FT_AVAILABLE_NO ) { - *metrics = NULL; - return Successful; - } - - if( instance->available[segment][offset] >= FT_AVAILABLE_METRICS ) { - *metrics = &instance->glyphs[segment][offset].metrics; - return Successful; - } - - flags |= FT_GET_GLYPH_METRICS_ONLY; - - xrc = FreeTypeRasteriseGlyph(idx, flags, - &instance->glyphs[segment][offset], - instance, 0); - if(xrc == Successful) { - instance->available[segment][offset] = FT_AVAILABLE_METRICS; - *metrics = &instance->glyphs[segment][offset].metrics; - } - return xrc; -} - -/* - * Pseudo enbolding similar as Microsoft Windows. - * It is useful but poor. - */ -static void -ft_make_up_bold_bitmap( char *raster, int bpr, int ht, int ds_mode) -{ - int x, y; - unsigned char *p = (unsigned char *)raster; - if ( ds_mode & TTCAP_DOUBLE_STRIKE_MKBOLD_EDGE_LEFT ) { - for (y=0; y>1) | lsb; - *p &= ~(rev_pat & (*p << 1)); - lsb = tmp; - p++; - } - } - } - else { - for (y=0; y>1) | lsb; - lsb = tmp; - p++; - } - } - } -} - -static void -ft_make_up_italic_bitmap( char *raster, int bpr, int ht, int shift, - int h_total, int h_offset, double a_italic) -{ - int x, y; - unsigned char *p = (unsigned char *)raster; - if ( a_italic < 0 ) shift = -shift; - for (y=0; y>=tmp_shift; - } - } - if ( tmp_byte_shift ) { - for (x=bpr-1;0>(8-tmp_shift); - tmp_p[x]<<=tmp_shift; - } - } - if ( tmp_byte_shift ) { - for (x=0;xnumber_Of_HMetrics; - - if ( k == 0 ) { - *bearing = *advance = 0; - return; - } - - if ( idx < (FT_UInt)k ) { - longs_m = (TT_LongMetrics )header->long_metrics + idx; - *bearing = longs_m->bearing; - *advance = longs_m->advance; - } - else { - *bearing = ((TT_ShortMetrics*)header->short_metrics)[idx - k]; - *advance = ((TT_LongMetrics )header->long_metrics)[k - 1].advance; - } -} - -static int -ft_get_very_lazy_bbox( FT_UInt index, - FT_Face face, - FT_Size size, - double slant, - FT_Matrix *matrix, - FT_BBox *bbox, - FT_Long *horiAdvance, - FT_Long *vertAdvance) -{ - if ( FT_IS_SFNT( face ) ) { - TT_Face ttface = (TT_Face)face; - FT_Size_Metrics *smetrics = &size->metrics; - FT_Short leftBearing = 0; - FT_UShort advance = 0; - FT_Vector p0, p1, p2, p3; - - /* horizontal */ - tt_get_metrics(&ttface->horizontal, index, - &leftBearing, &advance); - -#if 0 - fprintf(stderr,"x_scale=%f y_scale=%f\n", - (double)smetrics->x_scale,(double)smetrics->y_scale); -#endif - bbox->xMax = *horiAdvance = - FT_MulFix( advance, smetrics->x_scale ); - bbox->xMin = - FT_MulFix( leftBearing, smetrics->x_scale ); - /* vertical */ - bbox->yMin = FT_MulFix( face->bbox.yMin, - smetrics->y_scale ); - bbox->yMax = FT_MulFix( face->bbox.yMax, - smetrics->y_scale ); - /* slant */ - if( 0 < slant ) { - bbox->xMax += slant * bbox->yMax; - bbox->xMin += slant * bbox->yMin; - } - else if( slant < 0 ) { - bbox->xMax += slant * bbox->yMin; - bbox->xMin += slant * bbox->yMax; - } - - *vertAdvance = -1; /* We don't support */ - - p0.x = p2.x = bbox->xMin; - p1.x = p3.x = bbox->xMax; - p0.y = p1.y = bbox->yMin; - p2.y = p3.y = bbox->yMax; - - FT_Vector_Transform(&p0, matrix); - FT_Vector_Transform(&p1, matrix); - FT_Vector_Transform(&p2, matrix); - FT_Vector_Transform(&p3, matrix); - -#if 0 - fprintf(stderr, - "->(%.1f %.1f) (%.1f %.1f)" - " (%.1f %.1f) (%.1f %.1f)\n", - p0.x / 64.0, p0.y / 64.0, - p1.x / 64.0, p1.y / 64.0, - p2.x / 64.0, p2.y / 64.0, - p3.x / 64.0, p3.y / 64.0); -#endif - bbox->xMin = MIN(p0.x, MIN(p1.x, MIN(p2.x, p3.x))); - bbox->xMax = MAX(p0.x, MAX(p1.x, MAX(p2.x, p3.x))); - bbox->yMin = MIN(p0.y, MIN(p1.y, MIN(p2.y, p3.y))); - bbox->yMax = MAX(p0.y, MAX(p1.y, MAX(p2.y, p3.y))); - return 0; /* Successful */ - } - return -1; -} - -static FT_Error -FT_Do_SBit_Metrics( FT_Face ft_face, FT_Size ft_size, FT_ULong strike_index, - FT_UShort glyph_index, FT_Glyph_Metrics *metrics_return, - int *sbitchk_incomplete_but_exist ) -{ -#if (FREETYPE_VERSION >= 2001008) - SFNT_Service sfnt; - TT_Face face; - FT_Error error; - FT_Stream stream; - TT_SBit_Strike strike; - TT_SBit_Range range; - TT_SBit_MetricsRec elem_metrics; - FT_ULong ebdt_pos; - FT_ULong glyph_offset; - ; - - if ( ! FT_IS_SFNT( ft_face ) ) - { - error=-1; - goto Exit; - } - - face = (TT_Face)ft_face; - sfnt = (SFNT_Service)face->sfnt; - - if (strike_index != 0xFFFFU && sfnt && sfnt->find_sbit_image && - sfnt->load_sbits) { - /* Check whether there is a glyph sbit for the current index */ - error = sfnt->find_sbit_image( face, glyph_index, strike_index, - &range, &strike, &glyph_offset ); - } - else error=-1; - if ( error ) goto Exit; - - if ( metrics_return == NULL ) goto Exit; - - stream = face->root.stream; - - /* now, find the location of the `EBDT' table in */ - /* the font file */ - error = face->goto_table( face, TTAG_EBDT, stream, 0 ); - if ( error ) - error = face->goto_table( face, TTAG_bdat, stream, 0 ); - if (error) - goto Exit; - - ebdt_pos = FT_STREAM_POS(); - - /* place stream at beginning of glyph data and read metrics */ - if ( FT_STREAM_SEEK( ebdt_pos + glyph_offset ) ) - goto Exit; - - error = sfnt->load_sbit_metrics( stream, range, &elem_metrics ); - if ( error ) - goto Exit; - - metrics_return->width = (FT_Pos)elem_metrics.width << 6; - metrics_return->height = (FT_Pos)elem_metrics.height << 6; - - metrics_return->horiBearingX = (FT_Pos)elem_metrics.horiBearingX << 6; - metrics_return->horiBearingY = (FT_Pos)elem_metrics.horiBearingY << 6; - metrics_return->horiAdvance = (FT_Pos)elem_metrics.horiAdvance << 6; - - metrics_return->vertBearingX = (FT_Pos)elem_metrics.vertBearingX << 6; - metrics_return->vertBearingY = (FT_Pos)elem_metrics.vertBearingY << 6; - metrics_return->vertAdvance = (FT_Pos)elem_metrics.vertAdvance << 6; - - Exit: - return error; -#else /* if (FREETYPE_VERSION < 2001008) */ - TT_Face face; - SFNT_Service sfnt; - if ( ! FT_IS_SFNT( ft_face ) ) return -1; - face = (TT_Face)ft_face; - sfnt = (SFNT_Service)face->sfnt; - if ( strike_index != 0xFFFFU && sfnt->load_sbits ) { - if ( sbitchk_incomplete_but_exist ) *sbitchk_incomplete_but_exist=1; - } - return -1; -#endif -} - -int -FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp, - FTInstancePtr instance, int hasMetrics) -{ - FTFacePtr face; - FT_BBox bbox; - FT_Long outline_hori_advance, outline_vert_advance; - FT_Glyph_Metrics sbit_metrics; - FT_Glyph_Metrics *bitmap_metrics=NULL, *metrics = NULL; - char *raster; - int wd, ht, bpr; /* width, height, bytes per row */ - int wd_actual, ht_actual; - int ftrc, is_outline, correct, b_shift=0; - int dx, dy; - int leftSideBearing, rightSideBearing, characterWidth, rawCharacterWidth, - ascent, descent; - int sbitchk_incomplete_but_exist; - double bbox_center_raw; - - face = instance->face; - - FreeTypeActivateInstance(instance); - - if(!tgp) return AllocError; - - /* - * PREPARE METRICS - */ - - if(!hasMetrics) { - if( instance->spacing == FT_CHARCELL || flags & FT_GET_DUMMY ){ - memcpy((char*)&tgp->metrics, - (char*)instance->charcellMetrics, - sizeof(xCharInfo)); - } - else if( flags & FT_FORCE_CONSTANT_SPACING ) { - memcpy((char*)&tgp->metrics, - (char*)instance->forceConstantMetrics, - sizeof(xCharInfo)); - } - /* mono or prop. */ - else{ - int new_width; - double ratio; - - sbitchk_incomplete_but_exist=0; - if( ! (instance->load_flags & FT_LOAD_NO_BITMAP) ) { - if( FT_Do_SBit_Metrics(face->face,instance->size,instance->strike_index, - idx,&sbit_metrics,&sbitchk_incomplete_but_exist)==0 ) { - bitmap_metrics = &sbit_metrics; - } - } - if( bitmap_metrics == NULL ) { - if ( sbitchk_incomplete_but_exist==0 && (instance->ttcap.flags & TTCAP_IS_VERY_LAZY) ) { - if( ft_get_very_lazy_bbox( idx, face->face, instance->size, - instance->ttcap.vl_slant, - &instance->transformation.matrix, - &bbox, &outline_hori_advance, - &outline_vert_advance ) == 0 ) { - goto bbox_ok; /* skip exact calculation */ - } - } - ftrc = FT_Load_Glyph(instance->face->face, idx, - instance->load_flags); - if(ftrc != 0) return FTtoXReturnCode(ftrc); - metrics = &face->face->glyph->metrics; - if( face->face->glyph->format == FT_GLYPH_FORMAT_BITMAP ) { - bitmap_metrics = metrics; - } - } - - if( bitmap_metrics ) { - FT_Pos factor; - - leftSideBearing = bitmap_metrics->horiBearingX / 64; - rightSideBearing = (bitmap_metrics->width + bitmap_metrics->horiBearingX) / 64; - bbox_center_raw = (2.0 * bitmap_metrics->horiBearingX + bitmap_metrics->width)/2.0/64.0; - characterWidth = (int)floor(bitmap_metrics->horiAdvance - * instance->ttcap.scaleBBoxWidth / 64.0 + .5); - ascent = bitmap_metrics->horiBearingY / 64; - descent = (bitmap_metrics->height - bitmap_metrics->horiBearingY) / 64 ; - /* */ - new_width = characterWidth; - if( instance->ttcap.flags & TTCAP_DOUBLE_STRIKE_CORRECT_B_BOX_WIDTH ) - new_width += instance->ttcap.doubleStrikeShift; - new_width += instance->ttcap.adjustBBoxWidthByPixel; - ratio = (double)new_width/characterWidth; - characterWidth = new_width; - /* adjustment by pixel unit */ - if( instance->ttcap.flags & TTCAP_DOUBLE_STRIKE ) - rightSideBearing += instance->ttcap.doubleStrikeShift; - rightSideBearing += instance->ttcap.adjustRightSideBearingByPixel; - leftSideBearing += instance->ttcap.adjustLeftSideBearingByPixel; - rightSideBearing += instance->ttcap.rsbShiftOfBitmapAutoItalic; - leftSideBearing += instance->ttcap.lsbShiftOfBitmapAutoItalic; - /* */ - factor = bitmap_metrics->horiAdvance; - rawCharacterWidth = (unsigned short)(short)(floor(1000 * factor - * instance->ttcap.scaleBBoxWidth * ratio / 64. - / instance->pixel_size)); - } - else { - /* Outline */ -#ifdef USE_GET_CBOX - /* Very fast?? */ - FT_Outline_Get_CBox(&face->face->glyph->outline, &bbox); - ftrc=0; /* FT_Outline_Get_CBox returns nothing. */ -#else - /* Calculate exact metrics */ - ftrc=FT_Outline_Get_BBox(&face->face->glyph->outline, &bbox); -#endif - if( ftrc != 0 ) return FTtoXReturnCode(ftrc); - outline_hori_advance = metrics->horiAdvance; - outline_vert_advance = metrics->vertAdvance; - bbox_ok: - descent = CEIL64(-bbox.yMin - 32) / 64; - leftSideBearing = FLOOR64(bbox.xMin + 32) / 64; - ascent = FLOOR64(bbox.yMax + 32) / 64; - rightSideBearing = FLOOR64(bbox.xMax + 32) / 64; - bbox_center_raw = (double)(bbox.xMax + bbox.xMin)/2.0/64.; - if ( instance->pixel_width_unit_x != 0 ) - characterWidth = - (int)floor( outline_hori_advance - * instance->ttcap.scaleBBoxWidth - * instance->pixel_width_unit_x / 64. + .5); - else { - characterWidth = - (int)floor( outline_vert_advance - * instance->ttcap.scaleBBoxHeight - * instance->pixel_width_unit_y / 64. + .5); - if(characterWidth <= 0) - characterWidth = instance->charcellMetrics->characterWidth; - } - /* */ - new_width = characterWidth; - if( instance->ttcap.flags & TTCAP_DOUBLE_STRIKE_CORRECT_B_BOX_WIDTH ) - new_width += instance->ttcap.doubleStrikeShift; - new_width += instance->ttcap.adjustBBoxWidthByPixel; - ratio = (double)new_width/characterWidth; - characterWidth = new_width; - if ( instance->pixel_width_unit_x != 0 ) - rawCharacterWidth = - (unsigned short)(short)(floor(1000 * outline_hori_advance - * instance->ttcap.scaleBBoxWidth * ratio - * instance->pixel_width_unit_x / 64.)); - else { - rawCharacterWidth = - (unsigned short)(short)(floor(1000 * outline_vert_advance - * instance->ttcap.scaleBBoxHeight * ratio - * instance->pixel_width_unit_y / 64.)); - if(rawCharacterWidth <= 0) - rawCharacterWidth = instance->charcellMetrics->attributes; - } - /* adjustment by pixel unit */ - if( instance->ttcap.flags & TTCAP_DOUBLE_STRIKE ) - rightSideBearing += instance->ttcap.doubleStrikeShift; - rightSideBearing += instance->ttcap.adjustRightSideBearingByPixel; - leftSideBearing += instance->ttcap.adjustLeftSideBearingByPixel; - } - - /* Set the glyph metrics. */ - tgp->metrics.attributes = (unsigned short)((short)rawCharacterWidth); - tgp->metrics.leftSideBearing = leftSideBearing; - tgp->metrics.rightSideBearing = rightSideBearing; - tgp->metrics.characterWidth = characterWidth; - tgp->metrics.ascent = ascent; - tgp->metrics.descent = descent; - /* Update the width to match the width of the font */ - if( instance->spacing != FT_PROPORTIONAL ) - tgp->metrics.characterWidth = instance->charcellMetrics->characterWidth; - if(instance->ttcap.flags & TTCAP_MONO_CENTER){ - b_shift = (int)floor((instance->advance/2.0-bbox_center_raw) + .5); - tgp->metrics.leftSideBearing += b_shift; - tgp->metrics.rightSideBearing += b_shift; - } - } - } - - if( flags & FT_GET_GLYPH_METRICS_ONLY ) return Successful; - - /* - * CHECK THE NECESSITY OF BITMAP POSITION'S CORRECTION - */ - - correct=0; - if( instance->spacing == FT_CHARCELL ) correct=1; - else if( flags & FT_FORCE_CONSTANT_SPACING ) correct=1; - else{ - int sbit_available=0; - sbitchk_incomplete_but_exist=0; - if( !(instance->load_flags & FT_LOAD_NO_BITMAP) ) { - if( FT_Do_SBit_Metrics(face->face,instance->size, - instance->strike_index,idx,NULL, - &sbitchk_incomplete_but_exist)==0 ) { - sbit_available=1; - } - } - if( sbit_available == 0 ) { - if ( sbitchk_incomplete_but_exist==0 && (instance->ttcap.flags & TTCAP_IS_VERY_LAZY) ) { - if( FT_IS_SFNT(face->face) ) correct=1; - } - } - } - - /* - * RENDER AND ALLOCATE BUFFER - */ - - if( flags & FT_GET_DUMMY ) is_outline = -1; - else { - if( !metrics ) { - ftrc = FT_Load_Glyph(instance->face->face, idx, - instance->load_flags); - metrics = &face->face->glyph->metrics; - - if(ftrc != 0) return FTtoXReturnCode(ftrc); - } - - if( face->face->glyph->format != FT_GLYPH_FORMAT_BITMAP ) { - ftrc = FT_Render_Glyph(face->face->glyph,FT_RENDER_MODE_MONO); - if( ftrc != 0 ) return FTtoXReturnCode(ftrc); - is_outline = 1; - } - else{ - is_outline=0; - } - } - - /* Spacial case */ - if( (instance->ttcap.flags & TTCAP_MONO_CENTER) && hasMetrics ) { - if( is_outline == 1 ){ - if( correct ){ - if( ft_get_very_lazy_bbox( idx, face->face, instance->size, - instance->ttcap.vl_slant, - &instance->transformation.matrix, - &bbox, &outline_hori_advance, - &outline_vert_advance ) != 0 ){ - is_outline = -1; /* <- error */ - } - } - else { -#ifdef USE_GET_CBOX - FT_Outline_Get_CBox(&face->face->glyph->outline, &bbox); - ftrc=0; -#else - ftrc=FT_Outline_Get_BBox(&face->face->glyph->outline, &bbox); -#endif - if( ftrc != 0 ) return FTtoXReturnCode(ftrc); - } - bbox_center_raw = (double)(bbox.xMax + bbox.xMin)/2.0/64.; - } - else if( is_outline == 0 ) - bbox_center_raw = (2.0 * metrics->horiBearingX + metrics->width)/2.0/64.0; - else - bbox_center_raw = 0; - b_shift = (int)floor((instance->advance/2.0-bbox_center_raw) + .5); - } - - wd_actual = tgp->metrics.rightSideBearing - tgp->metrics.leftSideBearing; - ht_actual = tgp->metrics.ascent + tgp->metrics.descent; - - /* The X convention is to consider a character with an empty - * bounding box as undefined. This convention is broken. */ - - if(wd_actual <= 0) wd = 1; - else wd=wd_actual; - if(ht_actual <= 0) ht = 1; - else ht=ht_actual; - - bpr = (((wd + (instance->bmfmt.glyph<<3) - 1) >> 3) & - -instance->bmfmt.glyph); - raster = (char*)xalloc(ht * bpr); - if(raster == NULL) - return AllocError; - memset(raster, 0, ht * bpr); - - tgp->bits = raster; - - /* If FT_GET_DUMMY is set, we return white space. */ - if ( is_outline == -1 ) return Successful; - - if ( wd_actual <= 0 || ht_actual <= 0 ) return Successful; - - /* - * CALCULATE OFFSET, dx AND dy. - */ - - dx = face->face->glyph->bitmap_left - tgp->metrics.leftSideBearing; - dy = tgp->metrics.ascent - face->face->glyph->bitmap_top; - - if(instance->ttcap.flags & TTCAP_MONO_CENTER) - dx += b_shift; - - /* To prevent chipped bitmap, we correct dx and dy if needed. */ - if( correct && is_outline==1 ){ - int lsb, rsb, asc, des; - int chip_left,chip_right,chip_top,chip_bot; -#ifdef USE_GET_CBOX - FT_Outline_Get_CBox(&face->face->glyph->outline, &bbox); - ftrc=0; -#else - ftrc=FT_Outline_Get_BBox(&face->face->glyph->outline, &bbox); -#endif - if( ftrc != 0 ) return FTtoXReturnCode(ftrc); - des = CEIL64(-bbox.yMin - 32) / 64; - lsb = FLOOR64(bbox.xMin + 32) / 64; - asc = FLOOR64(bbox.yMax + 32) / 64; - rsb = FLOOR64(bbox.xMax + 32) / 64; - rightSideBearing = tgp->metrics.rightSideBearing; - leftSideBearing = tgp->metrics.leftSideBearing; - if( instance->ttcap.flags & TTCAP_DOUBLE_STRIKE ) - rightSideBearing -= instance->ttcap.doubleStrikeShift; - /* special case */ - if(instance->ttcap.flags & TTCAP_MONO_CENTER){ - leftSideBearing -= b_shift; - rightSideBearing -= b_shift; - } - chip_left = lsb - leftSideBearing; - chip_right = rightSideBearing - rsb; - if( flags & FT_FORCE_CONSTANT_SPACING ){ - if( instance->ttcap.force_c_adjust_lsb_by_pixel != 0 || - instance->ttcap.force_c_adjust_rsb_by_pixel != 0 ){ - chip_left=0; - chip_right=0; - } - } - else{ - if( instance->ttcap.adjustRightSideBearingByPixel != 0 || - instance->ttcap.adjustLeftSideBearingByPixel != 0 ){ - chip_left=0; - chip_right=0; - } - } - chip_top = tgp->metrics.ascent - asc; - chip_bot = tgp->metrics.descent - des; - if( chip_left < 0 && 0 < chip_right ) dx++; - else if( chip_right < 0 && 0 < chip_left ) dx--; - if( chip_top < 0 && 0 < chip_bot ) dy++; - else if( chip_bot < 0 && 0 < chip_top ) dy--; - } - - /* - * COPY RASTER - */ - - { - FT_Bitmap *bitmap; - int i, j; - unsigned char *current_raster; - unsigned char *current_buffer; - int mod_dx0,mod_dx1; - int div_dx; - bitmap = &face->face->glyph->bitmap; - if( 0 <= dx ){ - div_dx = dx / 8; - mod_dx0 = dx % 8; - mod_dx1 = 8-mod_dx0; - } - else{ - div_dx = dx / 8 -1; - mod_dx1 = -dx % 8; - mod_dx0 = 8-mod_dx1; - } - for( i = MAX(0, dy) ; irows <= i-dy ) break; - current_buffer=(unsigned char *)(bitmap->buffer+bitmap->pitch*(i-dy)); - current_raster=(unsigned char *)(raster+i*bpr); - j = MAX(0,div_dx); - jj = j-div_dx; - prev_jj = jj-1; - if( jpitch ) - current_raster[j]|=current_buffer[prev_jj]<pitch ){ - current_raster[j]|=current_buffer[jj]>>mod_dx0; - j++; prev_jj++; jj++; - for( ; jpitch <= jj ) break; - current_raster[j]|=current_buffer[jj]>>mod_dx0; - } - } - } - } - } - - /* by TTCap */ - if ( instance->ttcap.flags & TTCAP_DOUBLE_STRIKE ) { - int i; - for( i=0 ; i < instance->ttcap.doubleStrikeShift ; i++ ) - ft_make_up_bold_bitmap( raster, bpr, ht, instance->ttcap.flags); - } - if ( is_outline == 0 && - ( instance->ttcap.lsbShiftOfBitmapAutoItalic != 0 || - instance->ttcap.rsbShiftOfBitmapAutoItalic != 0 ) ) { - ft_make_up_italic_bitmap( raster, bpr, ht, - - instance->ttcap.lsbShiftOfBitmapAutoItalic - + instance->ttcap.rsbShiftOfBitmapAutoItalic, - instance->charcellMetrics->ascent - + instance->charcellMetrics->descent, - instance->charcellMetrics->ascent - - tgp->metrics.ascent, - instance->ttcap.autoItalic); - } - - if(instance->bmfmt.bit == LSBFirst) { - BitOrderInvert((unsigned char*)(tgp->bits), ht*bpr); - } - - if(instance->bmfmt.byte != instance->bmfmt.bit) { - switch(instance->bmfmt.scan) { - case 1: - break; - case 2: - TwoByteSwap((unsigned char*)(tgp->bits), ht*bpr); - break; - case 4: - FourByteSwap((unsigned char*)(tgp->bits), ht*bpr); - break; - default: - ; - } - } - - return Successful; -} - -static void -FreeTypeFreeFont(FTFontPtr font) -{ - FreeTypeFreeInstance(font->instance); - if(font->ranges) - xfree(font->ranges); - if(font->dummy_char.bits) - xfree(font->dummy_char.bits); - xfree(font); -} - -/* Free a font. If freeProps is 0, don't free the properties. */ - -static void -FreeTypeFreeXFont(FontPtr pFont, int freeProps) -{ - FTFontPtr tf; - - if(pFont) { - if((tf = (FTFontPtr)pFont->fontPrivate)) { - FreeTypeFreeFont(tf); - } - if(freeProps && pFont->info.nprops>0) { - xfree(pFont->info.isStringProp); - xfree(pFont->info.props); - } - DestroyFontRec(pFont); - } -} - - -/* Unload a font */ - -static void -FreeTypeUnloadXFont(FontPtr pFont) -{ - MUMBLE("Unloading\n"); - FreeTypeFreeXFont(pFont, 1); -} - -/* Add the font properties, including the Font name, the XLFD - properties, some strings from the font, and various typographical - data. We only provide data readily available in the tables in the - font for now, altough FIGURE_WIDTH would be a good idea as it is - used by Xaw. */ - -static int -FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info, - char *fontname, int rawAverageWidth, Bool font_properties) -{ - int i, j, maxprops; - char *sp, *ep, val[MAXFONTNAMELEN], *vp; - FTFacePtr face; - FTInstancePtr instance; - FTNormalisedTransformationPtr trans; - int upm; - TT_OS2 *os2; - TT_Postscript *post; - PS_FontInfoRec t1info_rec, *t1info; - int xlfdProps = 0; - int ftrc; - - instance = font->instance; - face = instance->face; - trans = &instance->transformation; - upm = face->face->units_per_EM; - if(upm == 0) { - /* Work around FreeType bug */ - upm = WORK_AROUND_UPM; - } - - os2 = FT_Get_Sfnt_Table(face->face, ft_sfnt_os2); - post = FT_Get_Sfnt_Table(face->face, ft_sfnt_post); - ftrc = FT_Get_PS_Font_Info(face->face, &t1info_rec); - if(ftrc == 0) - t1info = &t1info_rec; - else - t1info = NULL; - - if(t1info) { - os2 = NULL; - post = NULL; - } - - info->nprops = 0; /* in case we abort */ - - strcpy(val, fontname); - if(FontParseXLFDName(val, vals, FONT_XLFD_REPLACE_VALUE)) { - xlfdProps = 1; - } else { - MUMBLE("Couldn't parse XLFD\n"); - xlfdProps = 0; - } - - maxprops= - 1 + /* NAME */ - (xlfdProps ? 14 : 0) + /* from XLFD */ - 5 + - ( !face->bitmap ? 3 : 0 ) + /* raw_av,raw_asc,raw_dec */ - ( font_properties ? 2 : 0 ) + /* asc,dec */ - ( (font_properties && os2) ? 6 : 0 ) + - ( (font_properties && (post || t1info)) ? 3 : 0 ) + - 2; /* type */ - - info->props = (FontPropPtr)xalloc(maxprops * sizeof(FontPropRec)); - if(info->props == NULL) - return AllocError; - - info->isStringProp = (char*)xalloc(maxprops); - if(info->isStringProp == NULL) { - xfree(info->props); - return AllocError; - } - - memset((char *)info->isStringProp, 0, maxprops); - - i = 0; - - info->props[i].name = MakeAtom("FONT", 4, TRUE); - info->props[i].value = MakeAtom(val, strlen(val), TRUE); - info->isStringProp[i] = 1; - i++; - - if(*val && *(sp = val + 1)) { - for (j = 0, sp = val + 1; j < 14; j++) { - if (j == 13) - /* Handle the case of the final field containing a subset - specification. */ - for (ep = sp; *ep && *ep != '['; ep++); - else - for (ep = sp; *ep && *ep != '-'; ep++); - - info->props[i].name = - MakeAtom(xlfd_props[j], strlen(xlfd_props[j]), TRUE); - - switch(j) { - case 6: /* pixel size */ - info->props[i].value = - (int)(fabs(vals->pixel_matrix[3]) + 0.5); - i++; - break; - case 7: /* point size */ - info->props[i].value = - (int)(fabs(vals->point_matrix[3])*10.0 + 0.5); - i++; - break; - case 8: /* resolution x */ - info->props[i].value = vals->x; - i++; - break; - case 9: /* resolution y */ - info->props[i].value = vals->y; - i++; - break; - case 11: /* average width */ - info->props[i].value = vals->width; - i++; - break; - default: /* a string */ - info->props[i].value = MakeAtom(sp, ep - sp, TRUE); - info->isStringProp[i] = 1; - i++; - } - sp = ++ep; - } - } - - info->props[i].name = MakeAtom("RAW_PIXEL_SIZE", 14, TRUE); - info->props[i].value = 1000; - i++; - - info->props[i].name = MakeAtom("RAW_POINT_SIZE", 14, TRUE); - info->props[i].value = (long)(72270.0 / (double)vals->y + .5); - i++; - - if(!face->bitmap) { - info->props[i].name = MakeAtom("RAW_AVERAGE_WIDTH", 17, TRUE); - info->props[i].value = rawAverageWidth; - i++; - } - - if ( font_properties ) { - info->props[i].name = MakeAtom("FONT_ASCENT", 11, TRUE); - info->props[i].value = info->fontAscent; - i++; - } - - if(!face->bitmap) { - info->props[i].name = MakeAtom("RAW_ASCENT", 10, TRUE); - info->props[i].value = - ((double)face->face->ascender/(double)upm*1000.0); - i++; - } - - if ( font_properties ) { - info->props[i].name = MakeAtom("FONT_DESCENT", 12, TRUE); - info->props[i].value = info->fontDescent; - i++; - } - - if(!face->bitmap) { - info->props[i].name = MakeAtom("RAW_DESCENT", 11, TRUE); - info->props[i].value = - -((double)face->face->descender/(double)upm*1000.0); - i++; - } - - j = FTGetEnglishName(face->face, TT_NAME_ID_COPYRIGHT, - val, MAXFONTNAMELEN); - vp = val; - if (j < 0) { - if(t1info && t1info->notice) { - vp = t1info->notice; - j = strlen(vp); - } - } - if(j > 0) { - info->props[i].name = MakeAtom("COPYRIGHT", 9, TRUE); - info->props[i].value = MakeAtom(vp, j, TRUE); - info->isStringProp[i] = 1; - i++; - } - - j = FTGetEnglishName(face->face, TT_NAME_ID_FULL_NAME, - val, MAXFONTNAMELEN); - vp = val; - if (j < 0) { - if(t1info && t1info->full_name) { - vp = t1info->full_name; - j = strlen(vp); - } - } - if(j > 0) { - info->props[i].name = MakeAtom("FACE_NAME", 9, TRUE); - info->props[i].value = MakeAtom(vp, j, TRUE); - info->isStringProp[i] = 1; - i++; - } - - vp = (char *)FT_Get_Postscript_Name(face->face); - if (vp) { - j = strlen(vp); - } else { - j = -1; - } - if (j < 0) { - j = FTGetEnglishName(face->face, TT_NAME_ID_PS_NAME, - val, MAXFONTNAMELEN); - vp = val; - } - if (j < 0) { - if(t1info && t1info->full_name) { - vp = t1info->full_name; - j = strlen(vp); - } - } - if(j > 0) { - info->props[i].name = MakeAtom("_ADOBE_POSTSCRIPT_FONTNAME", 26, TRUE); - info->props[i].value = MakeAtom(vp, j, TRUE); - info->isStringProp[i] = 1; - i++; - } - - /* These macros handle the case of a diagonal matrix. They convert - FUnits into pixels. */ -#define TRANSFORM_FUNITS_X(xval) \ - ((int) \ - floor( ((double)(xval)/(double)upm) * (double)vals->pixel_matrix[0] + 0.5 ) ) - -#define TRANSFORM_FUNITS_Y(yval) \ - ((int) \ - floor( ((double)(yval)/(double)upm) * (double)vals->pixel_matrix[3] + 0.5 ) ) - - /* In what follows, we assume the matrix is diagonal. In the rare - case when it is not, the values will be somewhat wrong. */ - - if( font_properties && os2 ) { - info->props[i].name = MakeAtom("SUBSCRIPT_SIZE",14,TRUE); - info->props[i].value = - TRANSFORM_FUNITS_Y(os2->ySubscriptYSize); - i++; - info->props[i].name = MakeAtom("SUBSCRIPT_X",11,TRUE); - info->props[i].value = - TRANSFORM_FUNITS_X(os2->ySubscriptXOffset); - i++; - info->props[i].name = MakeAtom("SUBSCRIPT_Y",11,TRUE); - info->props[i].value = - TRANSFORM_FUNITS_Y(os2->ySubscriptYOffset); - i++; - info->props[i].name = MakeAtom("SUPERSCRIPT_SIZE",16,TRUE); - info->props[i].value = - TRANSFORM_FUNITS_Y(os2->ySuperscriptYSize); - i++; - info->props[i].name = MakeAtom("SUPERSCRIPT_X",13,TRUE); - info->props[i].value = - TRANSFORM_FUNITS_X(os2->ySuperscriptXOffset); - i++; - info->props[i].name = MakeAtom("SUPERSCRIPT_Y",13,TRUE); - info->props[i].value = - TRANSFORM_FUNITS_Y(os2->ySuperscriptYOffset); - i++; - } - - if( font_properties && (post || t1info) ) { - int underlinePosition, underlineThickness; - - /* Raw underlineposition counts upwards, - but UNDERLINE_POSITION counts downwards. */ - if(post) { - underlinePosition = TRANSFORM_FUNITS_Y(-post->underlinePosition); - underlineThickness = TRANSFORM_FUNITS_Y(post->underlineThickness); - } else { - underlinePosition = - TRANSFORM_FUNITS_Y(-t1info->underline_position); - underlineThickness = - TRANSFORM_FUNITS_Y(t1info->underline_thickness); - } - if(underlineThickness <= 0) - underlineThickness = 1; - - info->props[i].name = MakeAtom("UNDERLINE_THICKNESS",19,TRUE); - info->props[i].value = underlineThickness; - i++; - - info->props[i].name = MakeAtom("UNDERLINE_POSITION",18,TRUE); - - info->props[i].value = underlinePosition; - - i++; - - /* The italic angle is often unreliable for Type 1 fonts */ - if(post && trans->matrix.xx == trans->matrix.yy) { - info->props[i].name = MakeAtom("ITALIC_ANGLE",12,TRUE); - info->props[i].value = - /* Convert from TT_Fixed to - 64th of a degree counterclockwise from 3 o'clock */ - 90*64+(post->italicAngle >> 10); - i++; - } -#undef TRANSFORM_FUNITS_X -#undef TRANSFORM_FUNITS_Y - } - - info->props[i].name = MakeAtom("FONT_TYPE", 9, TRUE); - vp = (char *)FT_Get_X11_Font_Format(face->face); - info->props[i].value = MakeAtom(vp, strlen(vp), TRUE); - info->isStringProp[i] = 1; - i++; - - info->props[i].name = MakeAtom("RASTERIZER_NAME", 15, TRUE); - info->props[i].value = MakeAtom("FreeType", 10, TRUE); - info->isStringProp[i] = 1; - i++; - - info->nprops = i; - return Successful; -} - -static int -ft_get_index(unsigned code, FTFontPtr font, unsigned *idx) -{ - - /* As a special case, we pass 0 even when it is not in the ranges; - this will allow for the default glyph, which should exist in any - TrueType font. */ - - /* This is not required... - if(code > 0 && font->nranges) { - int i; - for(i = 0; i < font->nranges; i++) - if((code >= - font->ranges[i].min_char_low+ - (font->ranges[i].min_char_high<<8)) && - (code <= - font->ranges[i].max_char_low + - (font->ranges[i].max_char_high<<8))) - break; - if(i == font->nranges) { - *idx = font->zero_idx; - return -1; - } - } - */ - if( font->info ) { - if( !( font->info->firstCol <= (code & 0x000ff) && - (code & 0x000ff) <= font->info->lastCol && - font->info->firstRow <= (code >> 8) && - (code >> 8) <= font->info->lastRow ) ) { - *idx = font->zero_idx; - /* Error: The code has not been parsed in ft_compute_bounds()! - We should not return any metrics. */ - return -1; - } - } - - *idx = FTRemap(font->instance->face->face, &font->mapping, code); - - return 0; -} - -static int -FreeTypeFontGetGlyph(unsigned code, int flags, CharInfoPtr *g, FTFontPtr font) -{ - unsigned idx = 0; - int xrc; - -#ifdef X_ACCEPTS_NO_SUCH_CHAR - if( ft_get_index(code,font,&idx) || idx == 0 || idx == font->zero_idx ) { - *g = NULL; - flags &= ~FT_FORCE_CONSTANT_SPACING; - /* if( font->instance->spacing != FT_CHARCELL ) */ - return Successful; - } -#else - if( ft_get_index(code,font,&idx) ) { - /* The code has not been parsed! */ - *g = NULL; - flags &= ~FT_FORCE_CONSTANT_SPACING; - } -#endif - - xrc = FreeTypeInstanceGetGlyph(idx, flags, g, font->instance); - if( xrc == Successful && *g != NULL ) - return Successful; - if( font->zero_idx != idx ) { - xrc = FreeTypeInstanceGetGlyph(font->zero_idx, flags, g, font->instance); - if( xrc == Successful && *g != NULL ) - return Successful; - } - return FreeTypeInstanceGetGlyph(font->zero_idx, flags|FT_GET_DUMMY, g, font->instance); -} - -static int -FreeTypeFontGetGlyphMetrics(unsigned code, int flags, xCharInfo **metrics, FTFontPtr font) -{ - unsigned idx = 0; - int xrc; - -#ifdef X_ACCEPTS_NO_SUCH_CHAR - if ( ft_get_index(code,font,&idx) || idx == 0 || idx == font->zero_idx ) { - *metrics = NULL; - flags &= ~FT_FORCE_CONSTANT_SPACING; - /* if( font->instance->spacing != FT_CHARCELL ) */ - return Successful; - } -#else - if ( ft_get_index(code,font,&idx) || idx == 0 || idx == font->zero_idx ) { - /* The code has not been parsed! */ - *metrics = NULL; - flags &= ~FT_FORCE_CONSTANT_SPACING; - } -#endif - - xrc = FreeTypeInstanceGetGlyphMetrics(idx, flags, metrics, font->instance); - if( xrc == Successful && *metrics != NULL ) - return Successful; - if( font->zero_idx != idx ) { - xrc = FreeTypeInstanceGetGlyphMetrics(font->zero_idx, flags, - metrics, font->instance); - if( xrc == Successful && *metrics != NULL ) - return Successful; - } - return FreeTypeInstanceGetGlyphMetrics(font->zero_idx, flags|FT_GET_DUMMY, metrics, font->instance); -} - -/* - * restrict code range - * - * boolean for the numeric zone: - * results = results & (ranges[0] | ranges[1] | ... ranges[nranges-1]) - */ - -static void -restrict_code_range(unsigned short *refFirstCol, - unsigned short *refFirstRow, - unsigned short *refLastCol, - unsigned short *refLastRow, - fsRange const *ranges, int nRanges) -{ - if (nRanges) { - int minCol = 256, minRow = 256, maxCol = -1, maxRow = -1; - fsRange const *r = ranges; - int i; - - for (i=0; imin_char_high != r->max_char_high) { - minCol = 0x00; - maxCol = 0xff; - } else { - if (minCol > r->min_char_low) - minCol = r->min_char_low; - if (maxCol < r->max_char_low) - maxCol = r->max_char_low; - } - if (minRow > r->min_char_high) - minRow = r->min_char_high; - if (maxRow < r->max_char_high) - maxRow = r->max_char_high; - r++; - } - - if (minCol > *refLastCol) - *refFirstCol = *refLastCol; - else if (minCol > *refFirstCol) - *refFirstCol = minCol; - - if (maxCol < *refFirstCol) - *refLastCol = *refFirstCol; - else if (maxCol < *refLastCol) - *refLastCol = maxCol; - - if (minRow > *refLastRow) { - *refFirstRow = *refLastRow; - *refFirstCol = *refLastCol; - } else if (minRow > *refFirstRow) - *refFirstRow = minRow; - - if (maxRow < *refFirstRow) { - *refLastRow = *refFirstRow; - *refLastCol = *refFirstCol; - } else if (maxRow < *refLastRow) - *refLastRow = maxRow; - } -} - - -static int -restrict_code_range_by_str(int count,unsigned short *refFirstCol, - unsigned short *refFirstRow, - unsigned short *refLastCol, - unsigned short *refLastRow, - char const *str) -{ - int nRanges = 0; - int result = 0; - fsRange *ranges = NULL; - char const *p, *q; - - p = q = str; - for (;;) { - int minpoint=0, maxpoint=65535; - long val; - - /* skip comma and/or space */ - while (',' == *p || isspace(*p)) - p++; - - /* begin point */ - if ('-' != *p) { - val = strtol(p, (char **)&q, 0); - if (p == q) - /* end or illegal */ - break; - if (val<0 || val>65535) { - /* out of zone */ - break; - } - minpoint = val; - p=q; - } - - /* skip space */ - while (isspace(*p)) - p++; - - if (',' != *p && '\0' != *p) { - /* contiune */ - if ('-' == *p) - /* hyphon */ - p++; - else - /* end or illegal */ - break; - - /* skip space */ - while (isspace(*p)) - p++; - - val = strtol(p, (char **)&q, 0); - if (p != q) { - if (val<0 || val>65535) - break; - maxpoint = val; - } else if (',' != *p && '\0' != *p) - /* end or illegal */ - break; - p=q; - } else - /* comma - single code */ - maxpoint = minpoint; - - if ( count <= 0 && minpoint>maxpoint ) { - int tmp; - tmp = minpoint; - minpoint = maxpoint; - maxpoint = tmp; - } - - /* add range */ -#if 0 - fprintf(stderr, "zone: 0x%04X - 0x%04X\n", minpoint, maxpoint); - fflush(stderr); -#endif - nRanges++; - ranges = (fsRange *)xrealloc(ranges, nRanges*sizeof(*ranges)); - if (NULL == ranges) - break; - { - fsRange *r = ranges+nRanges-1; - - r->min_char_low = minpoint & 0xff; - r->max_char_low = maxpoint & 0xff; - r->min_char_high = (minpoint>>8) & 0xff; - r->max_char_high = (maxpoint>>8) & 0xff; - } - } - - if (ranges) { - if ( count <= 0 ) { - restrict_code_range(refFirstCol, refFirstRow, refLastCol, refLastRow, - ranges, nRanges); - } - else { - int i; - fsRange *r; - for ( i=0 ; imin_char_low; - refLastCol[i] = r->max_char_low; - refFirstRow[i] = r->min_char_high; - refLastRow[i] = r->max_char_high; - } - result=i; - } - xfree(ranges); - } - return result; -} - -/* *face_number and *spacing are initialized but *load_flags is NOT. */ -static int -FreeTypeSetUpTTCap( char *fileName, FontScalablePtr vals, - char **dynStrRealFileName, char **dynStrFTFileName, - struct TTCapInfo *ret, int *face_number, FT_Int32 *load_flags, - int *spacing, Bool *font_properties, char **dynStrTTCapCodeRange ) -{ - int result = Successful; - SDynPropRecValList listPropRecVal; - SPropRecValContainer contRecValue; - Bool hinting=True; - Bool isEmbeddedBitmap = True; - Bool alwaysEmbeddedBitmap = False; - int pixel = vals->pixel; - - *font_properties=True; - *dynStrRealFileName=NULL; - *dynStrFTFileName=NULL; - *dynStrTTCapCodeRange=NULL; - - if (SPropRecValList_new(&listPropRecVal)) { - return AllocError; - } - - { - int len = strlen(fileName); - char *capHead = NULL; - { - /* font cap */ - char *p1=NULL, *p2=NULL; - - p1=strrchr(fileName, '/'); - if ( p1 == NULL ) p1 = fileName; - else p1++; - if (NULL != (p2=strrchr(p1, ':'))) { - /* colon exist in the right side of slash. */ - int dirLen = p1-fileName; - int baseLen = fileName+len - p2 -1; - - *dynStrRealFileName = (char *)xalloc(dirLen+baseLen+1); - if( *dynStrRealFileName == NULL ) { - result = AllocError; - goto quit; - } - if ( 0 < dirLen ) - memcpy(*dynStrRealFileName, fileName, dirLen); - strcpy(*dynStrRealFileName+dirLen, p2+1); - capHead = p1; - } else { - *dynStrRealFileName = xstrdup(fileName); - if( *dynStrRealFileName == NULL ) { - result = AllocError; - goto quit; - } - } - } - - /* font cap */ - if (capHead) { - if (SPropRecValList_add_by_font_cap(&listPropRecVal, - capHead)) { - result = BadFontPath; - goto quit; - } - } - } - - *face_number=0; - *spacing=0; - ret->autoItalic=0.0; - ret->scaleWidth=1.0; - ret->scaleBBoxWidth = 1.0; - ret->scaleBBoxHeight = 1.0; - ret->doubleStrikeShift = 1; - ret->adjustBBoxWidthByPixel = 0; - ret->adjustLeftSideBearingByPixel = 0; - ret->adjustRightSideBearingByPixel = 0; - ret->flags = 0; - ret->scaleBitmap = 0.0; - ret->forceConstantSpacingBegin = -1; - ret->forceConstantSpacingEnd = -1; - ret->force_c_representative_metrics_char_code = -2; - ret->force_c_scale_b_box_width = 1.0; - ret->force_c_scale_b_box_height = 1.0; - ret->force_c_adjust_width_by_pixel = 0; - ret->force_c_adjust_lsb_by_pixel = 0; - ret->force_c_adjust_rsb_by_pixel = 0; - ret->force_c_scale_lsb = 0.0; - ret->force_c_scale_rsb = 1.0; - /* */ - ret->vl_slant=0; - ret->lsbShiftOfBitmapAutoItalic=0; - ret->rsbShiftOfBitmapAutoItalic=0; - /* face number */ - { - char *beginptr=NULL,*endptr; - if ( SPropRecValList_search_record(&listPropRecVal, - &contRecValue, - "FaceNumber")) { - int lv; - beginptr = SPropContainer_value_str(contRecValue); - lv=strtol(beginptr, &endptr, 10); - if ( *beginptr != '\0' && *endptr == '\0' ) { - if ( 0 < lv ) *face_number = lv; - } - } - if( beginptr && 0 < *face_number ) { - char *slash; - *dynStrFTFileName = /* add -> ':'+strlen0+':'+strlen1+'\0' */ - (char *)xalloc(1+strlen(beginptr)+1+strlen(*dynStrRealFileName)+1); - if( *dynStrFTFileName == NULL ){ - result = AllocError; - goto quit; - } - **dynStrFTFileName = '\0'; - slash = strrchr(*dynStrRealFileName,'/'); - if( slash ) { - char *p; - strcat(*dynStrFTFileName,*dynStrRealFileName); - p = strrchr(*dynStrFTFileName,'/'); - p[1] = '\0'; - strcat(*dynStrFTFileName,":"); - strcat(*dynStrFTFileName,beginptr); - strcat(*dynStrFTFileName,":"); - strcat(*dynStrFTFileName,slash+1); - } - else{ - strcat(*dynStrFTFileName,":"); - strcat(*dynStrFTFileName,beginptr); - strcat(*dynStrFTFileName,":"); - strcat(*dynStrFTFileName,*dynStrRealFileName); - } - } - else{ - *dynStrFTFileName = (char *)xalloc(strlen(*dynStrRealFileName)+1); - if( *dynStrFTFileName == NULL ){ - result = AllocError; - goto quit; - } - **dynStrFTFileName = '\0'; - strcat(*dynStrFTFileName,*dynStrRealFileName); - } - } - /* - fprintf(stderr,"[Filename:%s]\n",fileName); - fprintf(stderr,"[RealFilename:%s]\n",*dynStrRealFileName); - fprintf(stderr,"[FTFilename:%s]\n",*dynStrFTFileName); - */ - /* slant control */ - if (SPropRecValList_search_record(&listPropRecVal, - &contRecValue, - "AutoItalic")) - ret->autoItalic = SPropContainer_value_dbl(contRecValue); - /* hinting control */ - if (SPropRecValList_search_record(&listPropRecVal, - &contRecValue, - "Hinting")) - hinting = SPropContainer_value_bool(contRecValue); - /* scaling */ - if (SPropRecValList_search_record(&listPropRecVal, - &contRecValue, - "ScaleWidth")) { - ret->scaleWidth = SPropContainer_value_dbl(contRecValue); - if (ret->scaleWidth<=0.0) { - fprintf(stderr, "ScaleWitdh needs plus.\n"); - result = BadFontName; - goto quit; - } - } - /* bbox adjustment */ - if (SPropRecValList_search_record(&listPropRecVal, - &contRecValue, - "ScaleBBoxWidth")) { - /* Scaling to Bounding Box Width */ - int lv; - char *endptr,*beginptr; - double v,scaleBBoxWidth=1.0,scaleBBoxHeight=1.0; - beginptr = SPropContainer_value_str(contRecValue); - do { - if ( strlen(beginptr) < 1 ) break; - v=strtod(beginptr, &endptr); - if ( endptr!=beginptr ) { - scaleBBoxWidth = v; - } - if ( *endptr != ';' && *endptr != ',' ) break; - if ( *endptr == ',' ) { - beginptr=endptr+1; - v=strtod(beginptr, &endptr); - if ( endptr!=beginptr ) { - scaleBBoxHeight = v; - } - } - if ( *endptr != ';' && *endptr != ',' ) break; - beginptr=endptr+1; - lv=strtol(beginptr, &endptr, 10); - if ( endptr!=beginptr ) { - ret->adjustBBoxWidthByPixel = lv; - } - if ( *endptr != ',' ) break; - beginptr=endptr+1; - lv=strtol(beginptr, &endptr, 10); - if ( endptr!=beginptr ) { - ret->adjustLeftSideBearingByPixel = lv; - } - if ( *endptr != ',' ) break; - beginptr=endptr+1; - lv=strtol(beginptr, &endptr, 10); - if ( endptr!=beginptr ) { - ret->adjustRightSideBearingByPixel = lv; - } - } while ( 0 ); - if (scaleBBoxWidth<=0.0) { - fprintf(stderr, "ScaleBBoxWitdh needs plus.\n"); - result = BadFontName; - goto quit; - } - if (scaleBBoxHeight<=0.0) { - fprintf(stderr, "ScaleBBoxHeight needs plus.\n"); - result = BadFontName; - goto quit; - } - ret->scaleBBoxWidth = scaleBBoxWidth; - ret->scaleBBoxHeight = scaleBBoxHeight; - } - /* spacing */ - if (SPropRecValList_search_record(&listPropRecVal, - &contRecValue, - "ForceSpacing")) { - char *strSpace = SPropContainer_value_str(contRecValue); - Bool err = False; - if (1 != strlen(strSpace)) - err = True; - else - switch (strSpace[0]) { - case 'M': - ret->flags |= TTCAP_MONO_CENTER; - *spacing = 'm'; - break; - case 'm': - case 'p': - case 'c': - *spacing = strSpace[0]; - break; - default: - err = True; - } - if (err) { - result = BadFontName; - goto quit; - } - } - /* doube striking */ - if (SPropRecValList_search_record(&listPropRecVal, - &contRecValue, - "DoubleStrike")) { - /* Set or Reset Auto Bold Flag */ - char *strDoubleStrike = SPropContainer_value_str(contRecValue); - Bool err = False; - if ( 0 < strlen(strDoubleStrike) ) { - switch (strDoubleStrike[0]) { - case 'm': - case 'M': - case 'l': - case 'L': - ret->flags |= TTCAP_DOUBLE_STRIKE; - ret->flags |= TTCAP_DOUBLE_STRIKE_MKBOLD_EDGE_LEFT; - break; - case 'y': - case 'Y': - ret->flags |= TTCAP_DOUBLE_STRIKE; - break; - case 'n': - case 'N': - ret->flags &= ~TTCAP_DOUBLE_STRIKE; - ret->flags &= ~TTCAP_DOUBLE_STRIKE_MKBOLD_EDGE_LEFT; - ret->flags &= ~TTCAP_DOUBLE_STRIKE_CORRECT_B_BOX_WIDTH; - break; - default: - err = True; - } - if ( err != True ) { - if ( strDoubleStrike[1] ) { - switch (strDoubleStrike[1]) { - case 'b': - case 'B': - case 'p': - case 'P': - case 'y': - case 'Y': - ret->flags |= TTCAP_DOUBLE_STRIKE_CORRECT_B_BOX_WIDTH; - break; - default: - break; - } - } - do { - char *comma_ptr=strchr(strDoubleStrike,';'); - if ( !comma_ptr ) comma_ptr=strchr(strDoubleStrike,','); - if ( !comma_ptr ) break; - if ( comma_ptr[1] ) { - char *endptr; - int mkboldMaxPixel; - mkboldMaxPixel=strtol(comma_ptr+1, &endptr, 10); - if ( endptr != comma_ptr+1 && mkboldMaxPixel <= pixel ) { - ret->flags &= ~TTCAP_DOUBLE_STRIKE_MKBOLD_EDGE_LEFT; - } - } - comma_ptr=strchr(comma_ptr+1,','); - if ( !comma_ptr ) break; - if ( comma_ptr[1] ) { - char *endptr; - int max_pixel; - max_pixel=strtol(comma_ptr+1, &endptr, 10); - if ( endptr != comma_ptr+1 && max_pixel <= pixel ) { - if( ret->flags & TTCAP_DOUBLE_STRIKE ) - ret->doubleStrikeShift += pixel / max_pixel; - } - } - } while(0); - } - } - else - err = True; - if (err) { - result = BadFontName; - goto quit; - } - } - /* very lazy metrics */ - if (SPropRecValList_search_record(&listPropRecVal, - &contRecValue, - "VeryLazyMetrics")){ - Bool isVeryLazy = SPropContainer_value_bool(contRecValue); - ret->flags |= TTCAP_DISABLE_DEFAULT_VERY_LAZY; - if( isVeryLazy == True ) - ret->flags |= TTCAP_IS_VERY_LAZY; - else - ret->flags &= ~TTCAP_IS_VERY_LAZY; - } - /* embedded bitmap */ - if (SPropRecValList_search_record(&listPropRecVal, - &contRecValue, - "EmbeddedBitmap")) { - char *strEmbeddedBitmap = SPropContainer_value_str(contRecValue); - Bool err = False; - if ( 1 == strlen(strEmbeddedBitmap) ) { - switch (strEmbeddedBitmap[0]) { - case 'y': - case 'Y': - isEmbeddedBitmap = True; - alwaysEmbeddedBitmap = True; - break; - case 'u': - case 'U': - isEmbeddedBitmap = True; - alwaysEmbeddedBitmap = False; - break; - case 'n': - case 'N': - isEmbeddedBitmap = False; - break; - default: - err = True; - } - } - else - err = True; - if (err) { - result = BadFontName; - goto quit; - } - } - /* scale bitmap */ - if((ret->flags & TTCAP_IS_VERY_LAZY) && - SPropRecValList_search_record(&listPropRecVal, - &contRecValue, - "VeryLazyBitmapWidthScale")) { - /* Scaling to Bitmap Bounding Box Width */ - double scaleBitmapWidth = SPropContainer_value_dbl(contRecValue); - - fprintf(stderr, "Warning: `bs' option is not required in X-TT version 2.\n"); -#if 0 - if (scaleBitmapWidth<=0.0) { - fprintf(stderr, "ScaleBitmapWitdh needs plus.\n"); - result = BadFontName; - goto quit; - } -#endif - ret->scaleBitmap = scaleBitmapWidth; - } - /* restriction of the code range */ - if (SPropRecValList_search_record(&listPropRecVal, - &contRecValue, - "CodeRange")) { - *dynStrTTCapCodeRange = xstrdup(SPropContainer_value_str(contRecValue)); - if( *dynStrTTCapCodeRange == NULL ) { - result = AllocError; - goto quit; - } - } - /* forceConstantSpacing{Begin,End} */ - if ( 1 /* ft->spacing == 'p' */ ){ - unsigned short first_col=0,last_col=0x00ff; - unsigned short first_row=0,last_row=0x00ff; - if (SPropRecValList_search_record(&listPropRecVal, - &contRecValue, - "ForceConstantSpacingCodeRange")) { - if ( restrict_code_range_by_str(1,&first_col, &first_row, - &last_col, &last_row, - SPropContainer_value_str(contRecValue)) == 1 ) { - ret->forceConstantSpacingBegin = (int)( first_row<<8 | first_col ); - ret->forceConstantSpacingEnd = (int)( last_row<<8 | last_col ); - if ( ret->forceConstantSpacingBegin <= ret->forceConstantSpacingEnd ) - ret->flags &= ~TTCAP_FORCE_C_OUTSIDE; - else ret->flags |= TTCAP_FORCE_C_OUTSIDE; - } - } - } - /* */ - if ( 1 ){ - unsigned short first_col=0, last_col=0x0ff; - unsigned short first_row=0, last_row=0x0ff; - if ( SPropRecValList_search_record(&listPropRecVal, - &contRecValue, - "ForceConstantSpacingMetrics")) { - char *strMetrics; - strMetrics = SPropContainer_value_str(contRecValue); - if ( strMetrics ) { - char *comma_ptr,*period_ptr,*semic_ptr; - semic_ptr=strchr(strMetrics,';'); - comma_ptr=strchr(strMetrics,','); - period_ptr=strchr(strMetrics,'.'); - if ( semic_ptr && comma_ptr ) - if ( semic_ptr < comma_ptr ) comma_ptr=NULL; - if ( semic_ptr && period_ptr ) - if ( semic_ptr < period_ptr ) period_ptr=NULL; - if ( !comma_ptr && !period_ptr && strMetrics != semic_ptr ) { - if ( restrict_code_range_by_str(1,&first_col, &first_row, - &last_col, &last_row, - SPropContainer_value_str(contRecValue)) == 1 ) { - ret->force_c_representative_metrics_char_code = - (int)( first_row<<8 | first_col ); - } - } - else { - double v; - char *endptr,*beginptr=strMetrics; - do { - v=strtod(beginptr, &endptr); - if ( endptr!=beginptr ) { - ret->force_c_scale_b_box_width = v; - } - if ( *endptr != ',' ) break; - beginptr=endptr+1; - v=strtod(beginptr, &endptr); - if ( endptr!=beginptr ) { - ret->force_c_scale_lsb = v; - ret->flags |= TTCAP_FORCE_C_LSB_FLAG; - } - if ( *endptr != ',' ) break; - beginptr=endptr+1; - v=strtod(beginptr, &endptr); - if ( endptr!=beginptr ) { - ret->force_c_scale_rsb = v; - ret->flags |= TTCAP_FORCE_C_RSB_FLAG; - } - if ( *endptr != ',' ) break; - beginptr=endptr+1; - v=strtod(beginptr, &endptr); - if ( endptr!=beginptr ) { - ret->force_c_scale_b_box_height = v; - } - } while (0); - } - if ( semic_ptr ) { - int lv; - char *endptr,*beginptr=semic_ptr+1; - do { - lv=strtol(beginptr, &endptr, 10); - if ( endptr!=beginptr ) { - ret->force_c_adjust_width_by_pixel=lv; - } - if ( *endptr != ',' ) break; - beginptr=endptr+1; - lv=strtol(beginptr, &endptr, 10); - if ( endptr!=beginptr ) { - ret->force_c_adjust_lsb_by_pixel=lv; - } - if ( *endptr != ',' ) break; - beginptr=endptr+1; - lv=strtol(beginptr, &endptr, 10); - if ( endptr!=beginptr ) { - ret->force_c_adjust_rsb_by_pixel=lv; - } - } while (0); - } - } - } - } - - if (SPropRecValList_search_record(&listPropRecVal, - &contRecValue, - "FontProperties")) { - /* Set or Reset the Flag of FontProperties */ - *font_properties=SPropContainer_value_bool(contRecValue); - } - - ret->force_c_scale_b_box_width *= ret->scaleBBoxWidth; - ret->force_c_scale_b_box_height *= ret->scaleBBoxHeight; - - ret->force_c_scale_b_box_width *= ret->scaleWidth; - ret->scaleBBoxWidth *= ret->scaleWidth; - - ret->force_c_adjust_rsb_by_pixel += ret->adjustRightSideBearingByPixel; - ret->force_c_adjust_lsb_by_pixel += ret->adjustLeftSideBearingByPixel; - - /* scaleWidth, scaleBBoxWidth, force_c_scale_b_box_width, force_c_scale_b_box_width */ - - /* by TTCap */ - if( hinting == False ) *load_flags |= FT_LOAD_NO_HINTING; - if( isEmbeddedBitmap == False ) *load_flags |= FT_LOAD_NO_BITMAP; - if( ret->autoItalic != 0 && alwaysEmbeddedBitmap == False ) - *load_flags |= FT_LOAD_NO_BITMAP; - - quit: - return result; -} - -static int -ft_get_trans_from_vals( FontScalablePtr vals, FTNormalisedTransformationPtr trans ) -{ - /* Compute the transformation matrix. We use floating-point - arithmetic for simplicity */ - - trans->xres = vals->x; - trans->yres = vals->y; - - /* This value cannot be 0. */ - trans->scale = hypot(vals->point_matrix[2], vals->point_matrix[3]); - trans->nonIdentity = 0; - - /* Try to round stuff. We want approximate zeros to be exact zeros, - and if the elements on the diagonal are approximately equal, we - want them equal. We do this to avoid breaking hinting. */ - if(DIFFER(vals->point_matrix[0], vals->point_matrix[3])) { - trans->nonIdentity = 1; - trans->matrix.xx = - (int)((vals->point_matrix[0]*(double)TWO_SIXTEENTH)/trans->scale); - trans->matrix.yy = - (int)((vals->point_matrix[3]*(double)TWO_SIXTEENTH)/trans->scale); - } else { - trans->matrix.xx = trans->matrix.yy = - ((vals->point_matrix[0] + vals->point_matrix[3])/2* - (double)TWO_SIXTEENTH)/trans->scale; - } - - if(DIFFER0(vals->point_matrix[1], trans->scale)) { - trans->matrix.yx = - (int)((vals->point_matrix[1]*(double)TWO_SIXTEENTH)/trans->scale); - trans->nonIdentity = 1; - } else - trans->matrix.yx = 0; - - if(DIFFER0(vals->point_matrix[2], trans->scale)) { - trans->matrix.xy = - (int)((vals->point_matrix[2]*(double)TWO_SIXTEENTH)/trans->scale); - trans->nonIdentity = 1; - } else - trans->matrix.xy=0; - return 0; -} - - -static int -is_fixed_width(FT_Face face) -{ - PS_FontInfoRec t1info_rec; - int ftrc; - - if(FT_IS_FIXED_WIDTH(face)) { - return 1; - } - - ftrc = FT_Get_PS_Font_Info(face, &t1info_rec); - if(ftrc == 0 && t1info_rec.is_fixed_pitch) { - return 1; - } - - return 0; -} - -static int -FreeTypeLoadFont(FTFontPtr font, FontInfoPtr info, FTFacePtr face, - char *FTFileName, FontScalablePtr vals, FontEntryPtr entry, - FontBitmapFormatPtr bmfmt, FT_Int32 load_flags, - struct TTCapInfo *tmp_ttcap, char *dynStrTTCapCodeRange, - int ttcap_spacing ) -{ - int xrc; - FTNormalisedTransformationRec trans; - int spacing, actual_spacing, zero_code; - long lastCode, firstCode; - TT_Postscript *post; - - ft_get_trans_from_vals(vals,&trans); - - /* Check for charcell in XLFD */ - spacing = FT_PROPORTIONAL; - if(entry->name.ndashes == 14) { - char *p; - int dashes = 0; - for(p = entry->name.name; - p <= entry->name.name + entry->name.length - 2; - p++) { - if(*p == '-') { - dashes++; - if(dashes == 11) { - if(p[1]=='c' && p[2]=='-') - spacing=FT_CHARCELL; - else if(p[1]=='m' && p[2]=='-') - spacing=FT_MONOSPACED; - break; - } - } - } - } - /* by TTCap */ - if( ttcap_spacing != 0 ) { - if( ttcap_spacing == 'c' ) spacing=FT_CHARCELL; - else if( ttcap_spacing == 'm' ) spacing=FT_MONOSPACED; - else spacing=FT_PROPORTIONAL; - } - - actual_spacing = spacing; - if( spacing == FT_PROPORTIONAL ) { - if( is_fixed_width(face->face) ) - actual_spacing = FT_MONOSPACED; - } - - if(entry->name.ndashes == 14) { - xrc = FTPickMapping(entry->name.name, entry->name.length, FTFileName, - face->face, &font->mapping); - if (xrc != Successful) - return xrc; - } else { - xrc = FTPickMapping(0, 0, FTFileName, - face->face, &font->mapping); - if (xrc != Successful) - return xrc; - } - - font->nranges = vals->nranges; - font->ranges = 0; - if(font->nranges) { - font->ranges = (fsRange*)xalloc(vals->nranges*sizeof(fsRange)); - if(font->ranges == NULL) - return AllocError; - memcpy((char*)font->ranges, (char*)vals->ranges, - vals->nranges*sizeof(fsRange)); - } - - zero_code=-1; - if(info) { - firstCode = 0; - lastCode = 0xFFFFL; - if(!font->mapping.mapping || - font->mapping.mapping->encoding->row_size == 0) { - /* linear indexing */ - lastCode=MIN(lastCode, - font->mapping.mapping ? - font->mapping.mapping->encoding->size-1 : - 0xFF); - if(font->mapping.mapping && font->mapping.mapping->encoding->first) - firstCode = font->mapping.mapping->encoding->first; - info->firstRow = firstCode/0x100; - info->lastRow = lastCode/0x100; - info->firstCol = - (info->firstRow || info->lastRow) ? 0 : (firstCode & 0xFF); - info->lastCol = info->lastRow ? 0xFF : (lastCode & 0xFF); - if ( firstCode == 0 ) zero_code=0; - } else { - /* matrix indexing */ - info->firstRow = font->mapping.mapping->encoding->first; - info->lastRow = MIN(font->mapping.mapping->encoding->size-1, - lastCode/0x100); - info->firstCol = font->mapping.mapping->encoding->first_col; - info->lastCol = MIN(font->mapping.mapping->encoding->row_size-1, - lastCode<0x100?lastCode:0xFF); - if( info->firstRow == 0 && info->firstCol == 0 ) zero_code=0; - } - - /* firstCode and lastCode are not valid in case of a matrix - encoding */ - - if( dynStrTTCapCodeRange ) { - restrict_code_range_by_str(0,&info->firstCol, &info->firstRow, - &info->lastCol, &info->lastRow, - dynStrTTCapCodeRange); - } - restrict_code_range(&info->firstCol, &info->firstRow, - &info->lastCol, &info->lastRow, - font->ranges, font->nranges); - } - font->info = info; - - /* zero code is frequently used. */ - if ( zero_code < 0 ) { - /* The fontenc should have the information of DefaultCh. - But we do not have such a information. - So we cannot but set 0. */ - font->zero_idx = 0; - } - else - font->zero_idx = FTRemap(face->face, - &font->mapping, zero_code); - - post = FT_Get_Sfnt_Table(face->face, ft_sfnt_post); - -#ifdef DEFAULT_VERY_LAZY - if( !( tmp_ttcap->flags & TTCAP_DISABLE_DEFAULT_VERY_LAZY ) ) - if( DEFAULT_VERY_LAZY <= 1 + info->lastRow - info->firstRow ) { - if( post ){ - tmp_ttcap->flags |= TTCAP_IS_VERY_LAZY; - } - } -#endif - /* We should always reset. */ - tmp_ttcap->flags &= ~TTCAP_DISABLE_DEFAULT_VERY_LAZY; - - if ( face->bitmap || actual_spacing == FT_CHARCELL ) - tmp_ttcap->flags &= ~TTCAP_IS_VERY_LAZY; - /* "vl=y" is available when TrueType or OpenType only */ - if ( !face->bitmap && !(FT_IS_SFNT( face->face )) ) - tmp_ttcap->flags &= ~TTCAP_IS_VERY_LAZY; - - if( post ) { - if( post->italicAngle != 0 ) - tmp_ttcap->vl_slant = -sin( (post->italicAngle/1024./5760.)*1.57079632679489661923 ); - /* fprintf(stderr,"angle=%g(%g)\n",tmp_ttcap->vl_slant,(post->italicAngle/1024./5760.)*90); */ - } - - xrc = FreeTypeOpenInstance(&font->instance, face, - FTFileName, &trans, actual_spacing, bmfmt, - tmp_ttcap, load_flags ); - return xrc; -} - -static void -adjust_min_max(xCharInfo *minc, xCharInfo *maxc, xCharInfo *tmp) -{ -#define MINMAX(field,ci) \ - if (minc->field > (ci)->field) \ - minc->field = (ci)->field; \ - if (maxc->field < (ci)->field) \ - maxc->field = (ci)->field; - - MINMAX(ascent, tmp); - MINMAX(descent, tmp); - MINMAX(leftSideBearing, tmp); - MINMAX(rightSideBearing, tmp); - MINMAX(characterWidth, tmp); - - if ((INT16)minc->attributes > (INT16)tmp->attributes) - minc->attributes = tmp->attributes; - if ((INT16)maxc->attributes < (INT16)tmp->attributes) - maxc->attributes = tmp->attributes; -#undef MINMAX -} - -static void -ft_compute_bounds(FTFontPtr font, FontInfoPtr pinfo, FontScalablePtr vals ) -{ - FTInstancePtr instance; - int row, col; - unsigned int c; - xCharInfo minchar, maxchar, *tmpchar = NULL; - int overlap, maxOverlap; - long swidth = 0; - long total_width = 0; - int num_cols, num_chars = 0; - int flags, skip_ok = 0; - int force_c_outside ; - - instance = font->instance; - force_c_outside = instance->ttcap.flags & TTCAP_FORCE_C_OUTSIDE; - - minchar.ascent = minchar.descent = - minchar.leftSideBearing = minchar.rightSideBearing = - minchar.characterWidth = minchar.attributes = 32767; - maxchar.ascent = maxchar.descent = - maxchar.leftSideBearing = maxchar.rightSideBearing = - maxchar.characterWidth = maxchar.attributes = -32767; - maxOverlap = -32767; - - /* Parse all glyphs */ - num_cols = 1 + pinfo->lastCol - pinfo->firstCol; - for (row = pinfo->firstRow; row <= pinfo->lastRow; row++) { - if ( skip_ok && tmpchar ) { - if ( !force_c_outside ) { - if ( instance->ttcap.forceConstantSpacingBegin < row<<8 - && row<<8 < (instance->ttcap.forceConstantSpacingEnd & 0x0ff00) ) { - if (tmpchar->characterWidth) { - num_chars += num_cols; - swidth += ABS(tmpchar->characterWidth)*num_cols; - total_width += tmpchar->characterWidth*num_cols; - continue; - } - } - else skip_ok=0; - } - else { /* for GB18030 proportional */ - if ( instance->ttcap.forceConstantSpacingBegin < row<<8 - || row<<8 < (instance->ttcap.forceConstantSpacingEnd & 0x0ff00) ) { - if (tmpchar->characterWidth) { - num_chars += num_cols; - swidth += ABS(tmpchar->characterWidth)*num_cols; - total_width += tmpchar->characterWidth*num_cols; - continue; - } - } - else skip_ok=0; - } - } - for (col = pinfo->firstCol; col <= pinfo->lastCol; col++) { - c = row<<8|col; - flags=0; - if ( !force_c_outside ) { - if ( c <= instance->ttcap.forceConstantSpacingEnd - && instance->ttcap.forceConstantSpacingBegin <= c ) - flags|=FT_FORCE_CONSTANT_SPACING; - } - else { /* for GB18030 proportional */ - if ( c <= instance->ttcap.forceConstantSpacingEnd - || instance->ttcap.forceConstantSpacingBegin <= c ) - flags|=FT_FORCE_CONSTANT_SPACING; - } -#if 0 - fprintf(stderr, "comp_bounds: %x ->", c); -#endif - if ( skip_ok == 0 || flags == 0 ){ - tmpchar=NULL; -#if 0 - fprintf(stderr, "%x\n", c); -#endif - if( FreeTypeFontGetGlyphMetrics(c, flags, &tmpchar, font) != Successful ) - continue; - } - if ( !tmpchar ) continue; - adjust_min_max(&minchar, &maxchar, tmpchar); - overlap = tmpchar->rightSideBearing - tmpchar->characterWidth; - if (maxOverlap < overlap) - maxOverlap = overlap; - - if (!tmpchar->characterWidth) - continue; - num_chars++; - swidth += ABS(tmpchar->characterWidth); - total_width += tmpchar->characterWidth; - - if ( flags & FT_FORCE_CONSTANT_SPACING ) skip_ok=1; - } - } - -#ifndef X_ACCEPTS_NO_SUCH_CHAR - /* Check code 0 */ - if( FreeTypeInstanceGetGlyphMetrics(font->zero_idx, 0, &tmpchar, font->instance) != Successful || tmpchar == NULL) - if( FreeTypeInstanceGetGlyphMetrics(font->zero_idx, FT_GET_DUMMY, &tmpchar, font->instance) != Successful ) - tmpchar = NULL; - if ( tmpchar ) { - adjust_min_max(&minchar, &maxchar, tmpchar); - overlap = tmpchar->rightSideBearing - tmpchar->characterWidth; - if (maxOverlap < overlap) - maxOverlap = overlap; - } -#endif - - /* AVERAGE_WIDTH ... 1/10 pixel unit */ - if (num_chars > 0) { - swidth = (swidth * 10.0 + num_chars / 2.0) / num_chars; - if (total_width < 0) - swidth = -swidth; - vals->width = swidth; - } else - vals->width = 0; - - /* - if (char_width.pixel) { - maxchar.characterWidth = char_width.pixel; - minchar.characterWidth = char_width.pixel; - } - */ - - pinfo->maxbounds = maxchar; - pinfo->minbounds = minchar; - pinfo->ink_maxbounds = maxchar; - pinfo->ink_minbounds = minchar; - pinfo->maxOverlap = maxOverlap; -} - -static int -compute_new_extents( FontScalablePtr vals, double scale, double lsb, double rsb, double desc, double asc, - int *lsb_result, int *rsb_result, int *desc_result, int *asc_result ) -{ -#define TRANSFORM_POINT(matrix, x, y, dest) \ - ((dest)[0] = (matrix)[0] * (x) + (matrix)[2] * (y), \ - (dest)[1] = (matrix)[1] * (x) + (matrix)[3] * (y)) - -#define CHECK_EXTENT(lsb, rsb, desc, asc, data) \ - ((lsb) > (data)[0] ? (lsb) = (data)[0] : 0 , \ - (rsb) < (data)[0] ? (rsb) = (data)[0] : 0, \ - (-desc) > (data)[1] ? (desc) = -(data)[1] : 0 , \ - (asc) < (data)[1] ? (asc) = (data)[1] : 0) - double newlsb, newrsb, newdesc, newasc; - double point[2]; - - /* Compute new extents for this glyph */ - TRANSFORM_POINT(vals->pixel_matrix, lsb, -desc, point); - newlsb = point[0]; - newrsb = newlsb; - newdesc = -point[1]; - newasc = -newdesc; - TRANSFORM_POINT(vals->pixel_matrix, lsb, asc, point); - CHECK_EXTENT(newlsb, newrsb, newdesc, newasc, point); - TRANSFORM_POINT(vals->pixel_matrix, rsb, -desc, point); - CHECK_EXTENT(newlsb, newrsb, newdesc, newasc, point); - TRANSFORM_POINT(vals->pixel_matrix, rsb, asc, point); - CHECK_EXTENT(newlsb, newrsb, newdesc, newasc, point); - - /* ???: lsb = (int)floor(newlsb * scale); */ - *lsb_result = (int)floor(newlsb * scale + 0.5); - *rsb_result = (int)floor(newrsb * scale + 0.5); - *desc_result = (int)ceil(newdesc * scale - 0.5); - *asc_result = (int)floor(newasc * scale + 0.5); - - return 0; -#undef CHECK_EXTENT -#undef TRANSFORM_POINT -} - -static int -is_matrix_unit(FontScalablePtr vals) -{ - double base_size; - FT_Matrix m; - - base_size = hypot(vals->point_matrix[2], vals->point_matrix[3]); - - m.xx = vals->point_matrix[0] / base_size * 65536; - m.xy = vals->point_matrix[2] / base_size * 65536; - m.yx = vals->point_matrix[1] / base_size * 65536; - m.yy = vals->point_matrix[3] / base_size * 65536; - - return (m.xx == 65536) && (m.yx == 0) && - (m.xy == 0) && (m.yy == 65536); -} - -/* Do all the real work for OpenFont or FontInfo */ -/* xf->info is only accessed through info, and xf might be null */ - -static int -FreeTypeLoadXFont(char *fileName, - FontScalablePtr vals, FontPtr xf, FontInfoPtr info, - FontBitmapFormatPtr bmfmt, FontEntryPtr entry) -{ - FTFontPtr font = NULL; - FTFacePtr face = NULL; - FTInstancePtr instance; - FT_Size_Metrics *smetrics; - int xrc=Successful; - int charcell; - long rawWidth = 0, rawAverageWidth = 0; - int upm, minLsb, maxRsb, ascent, descent, width, averageWidth; - double scale, base_width, base_height; - Bool orig_is_matrix_unit, font_properties; - int face_number, ttcap_spacing; - struct TTCapInfo tmp_ttcap; - struct TTCapInfo *ins_ttcap; - FT_Int32 load_flags = FT_LOAD_DEFAULT; /* orig: FT_LOAD_RENDER | FT_LOAD_MONOCHROME */ - char *dynStrRealFileName = NULL; /* foo.ttc */ - char *dynStrFTFileName = NULL; /* :1:foo.ttc */ - char *dynStrTTCapCodeRange = NULL; - - font = (FTFontPtr)xalloc(sizeof(FTFontRec)); - if(font == NULL) { - xrc = AllocError; - goto quit; - } - memset(font, 0, sizeof(FTFontRec)); - - xrc = FreeTypeSetUpTTCap(fileName, vals, - &dynStrRealFileName, &dynStrFTFileName, - &tmp_ttcap, &face_number, - &load_flags, &ttcap_spacing, - &font_properties, &dynStrTTCapCodeRange); - if ( xrc != Successful ) { - goto quit; - } - - xrc = FreeTypeOpenFace(&face, dynStrFTFileName, dynStrRealFileName, face_number); - if(xrc != Successful) { - goto quit; - } - - if( is_matrix_unit(vals) ) - orig_is_matrix_unit = True; - else { - orig_is_matrix_unit = False; - /* Turn off EmbeddedBitmap when original matrix is not diagonal. */ - load_flags |= FT_LOAD_NO_BITMAP; - } - - if( face->bitmap ) load_flags &= ~FT_LOAD_NO_BITMAP; - - /* Slant control by TTCap */ - if(!face->bitmap) { - vals->pixel_matrix[2] += - vals->pixel_matrix[0] * tmp_ttcap.autoItalic; - vals->point_matrix[2] += - vals->point_matrix[0] * tmp_ttcap.autoItalic; - vals->pixel_matrix[3] += - vals->pixel_matrix[1] * tmp_ttcap.autoItalic; - vals->point_matrix[3] += - vals->point_matrix[1] * tmp_ttcap.autoItalic; - } - - base_width=hypot(vals->pixel_matrix[0], vals->pixel_matrix[1]); - base_height=hypot(vals->pixel_matrix[2], vals->pixel_matrix[3]); - if(MAX(base_width, base_height) < 1.0 ) { - xrc = BadFontName; - goto quit; - } - - xrc = FreeTypeLoadFont(font, info, face, dynStrFTFileName, vals, entry, bmfmt, - load_flags, &tmp_ttcap, dynStrTTCapCodeRange, - ttcap_spacing ); - if(xrc != Successful) { - goto quit; - } - - instance = font->instance; - smetrics = &instance->size->metrics; - ins_ttcap = &instance->ttcap; - - upm = face->face->units_per_EM; - if(upm == 0) { - /* Work around FreeType bug */ - upm = WORK_AROUND_UPM; - } - scale = 1.0 / upm; - - charcell = (instance->spacing == FT_CHARCELL); - - if( instance->charcellMetrics == NULL ) { - - /* New instance */ - - long force_c_rawWidth = 0; - int force_c_lsb,force_c_rsb,force_c_width; - double unit_x=0,unit_y=0,advance; - CharInfoPtr tmpglyph; - - /* - * CALCULATE HEADER'S METRICS - */ - - /* for OUTLINE fonts */ - if(!face->bitmap) { - int new_width; - double ratio,force_c_ratio; - double width_x=0,width_y=0; - double force_c_width_x, force_c_rsb_x, force_c_lsb_x; - double tmp_rsb,tmp_lsb,tmp_asc,tmp_des; - double max_advance_height; - tmp_asc = face->face->bbox.yMax; - tmp_des = -(face->face->bbox.yMin); - if ( tmp_asc < face->face->ascender ) tmp_asc = face->face->ascender; - if ( tmp_des < -(face->face->descender) ) tmp_des = -(face->face->descender); - tmp_lsb = face->face->bbox.xMin; - tmp_rsb = face->face->bbox.xMax; - if ( tmp_rsb < face->face->max_advance_width ) tmp_rsb = face->face->max_advance_width; - /* apply scaleBBoxWidth */ - /* we should not ...??? */ - tmp_lsb *= ins_ttcap->scaleBBoxWidth; - tmp_rsb *= ins_ttcap->scaleBBoxWidth; - /* transform and rescale */ - compute_new_extents( vals, scale, tmp_lsb, tmp_rsb, tmp_des, tmp_asc, - &minLsb, &maxRsb, &descent, &ascent ); - /* */ - /* Consider vertical layouts */ - if( 0 < face->face->max_advance_height ) - max_advance_height = face->face->max_advance_height; - else - max_advance_height = tmp_asc + tmp_des; - if( vals->pixel_matrix[1] == 0 ){ - unit_x = fabs(vals->pixel_matrix[0]); - unit_y = 0; - width_x = face->face->max_advance_width * ins_ttcap->scaleBBoxWidth * unit_x; - } - else if( vals->pixel_matrix[3] == 0 ){ - unit_y = fabs(vals->pixel_matrix[2]); - unit_x = 0; - width_x = max_advance_height * ins_ttcap->scaleBBoxHeight * unit_y; - } - else{ - unit_x = fabs(vals->pixel_matrix[0] - - vals->pixel_matrix[1]*vals->pixel_matrix[2]/vals->pixel_matrix[3]); - unit_y = fabs(vals->pixel_matrix[2] - - vals->pixel_matrix[3]*vals->pixel_matrix[0]/vals->pixel_matrix[1]); - width_x = face->face->max_advance_width * ins_ttcap->scaleBBoxWidth * unit_x; - width_y = max_advance_height * ins_ttcap->scaleBBoxHeight * unit_y; - if( width_y < width_x ){ - width_x = width_y; - unit_x = 0; - } - else{ - unit_y = 0; - } - } - /* calculate correction ratio */ - width = (int)floor( (advance = width_x * scale) + 0.5); - new_width = width; - if( ins_ttcap->flags & TTCAP_DOUBLE_STRIKE_CORRECT_B_BOX_WIDTH ) - new_width += ins_ttcap->doubleStrikeShift; - new_width += ins_ttcap->adjustBBoxWidthByPixel; - ratio = (double)new_width/width; - width = new_width; - /* force constant */ - if( unit_x != 0 ) { - force_c_width_x = face->face->max_advance_width - * ins_ttcap->force_c_scale_b_box_width * unit_x; - force_c_lsb_x = face->face->max_advance_width - * ins_ttcap->force_c_scale_lsb * unit_x; - force_c_rsb_x = face->face->max_advance_width - * ins_ttcap->force_c_scale_rsb * unit_x; - } - else { - force_c_width_x = max_advance_height - * ins_ttcap->force_c_scale_b_box_height * unit_y; - force_c_lsb_x = max_advance_height - * ins_ttcap->force_c_scale_lsb * unit_y; - force_c_rsb_x = max_advance_height - * ins_ttcap->force_c_scale_rsb * unit_y; - } - /* calculate correction ratio */ - force_c_width = (int)floor(force_c_width_x * scale + 0.5); - new_width = force_c_width; - if( ins_ttcap->flags & TTCAP_DOUBLE_STRIKE_CORRECT_B_BOX_WIDTH ) - force_c_width += ins_ttcap->doubleStrikeShift; - new_width += ins_ttcap->force_c_adjust_width_by_pixel; - force_c_ratio = (double)new_width/force_c_width; - force_c_width = new_width; - /* force_c_lsb, force_c_rsb */ - if( ins_ttcap->flags & TTCAP_FORCE_C_LSB_FLAG ) - force_c_lsb = (int)floor( force_c_lsb_x * scale + 0.5 ); - else - force_c_lsb = minLsb; - if( ins_ttcap->flags & TTCAP_FORCE_C_RSB_FLAG ) - force_c_rsb = (int)floor( force_c_rsb_x * scale + 0.5 ); - else - force_c_rsb = maxRsb; - /* calculate shift of BitmapAutoItalic - (when diagonal matrix only) */ - if( orig_is_matrix_unit == True ) { - if( ins_ttcap->autoItalic != 0 ) { - double ai; - int ai_lsb,ai_rsb,ai_total; - if( 0 < ins_ttcap->autoItalic ) ai=ins_ttcap->autoItalic; - else ai = -ins_ttcap->autoItalic; - ai_total = (int)( (ascent+descent) * ai + 0.5); - ai_rsb = (int)((double)ai_total * ascent / ( ascent + descent ) + 0.5 ); - ai_lsb = -(ai_total - ai_rsb); - if( 0 < ins_ttcap->autoItalic ) { - ins_ttcap->lsbShiftOfBitmapAutoItalic = ai_lsb; - ins_ttcap->rsbShiftOfBitmapAutoItalic = ai_rsb; - } - else { - ins_ttcap->lsbShiftOfBitmapAutoItalic = -ai_rsb; - ins_ttcap->rsbShiftOfBitmapAutoItalic = -ai_lsb; - } - } - } - /* integer adjustment by TTCap */ - if( ins_ttcap->flags & TTCAP_DOUBLE_STRIKE ) - maxRsb += ins_ttcap->doubleStrikeShift; - maxRsb += ins_ttcap->adjustRightSideBearingByPixel; - minLsb += ins_ttcap->adjustLeftSideBearingByPixel; - /* */ - if( ins_ttcap->flags & TTCAP_DOUBLE_STRIKE ) - force_c_rsb += ins_ttcap->doubleStrikeShift; - force_c_rsb += ins_ttcap->force_c_adjust_rsb_by_pixel; - force_c_lsb += ins_ttcap->force_c_adjust_lsb_by_pixel; - /* apply to rawWidth */ - averageWidth = (int)floor(10 * width_x * scale - * ratio + 0.5); - rawWidth = floor(width_x * scale - * ratio * 1000. / base_height + 0.5); - rawAverageWidth = floor(width_x * scale * ratio * 10. - * 1000. / base_height + 0.5); - force_c_rawWidth = floor(force_c_width_x * scale - * force_c_ratio * 1000. / base_height + 0.5); - /* */ - } - /* for BITMAP fonts [if(face->bitmap)] */ - else { - /* These values differ from actual when outline, - so we must use them ONLY FOR BITMAP. */ - width = (int)floor(smetrics->max_advance * ins_ttcap->scaleBBoxWidth / 64.0 + .5); - descent = -smetrics->descender / 64; - ascent = smetrics->ascender / 64; - /* force constant */ - force_c_width = (int)floor(smetrics->max_advance - * ins_ttcap->force_c_scale_b_box_width / 64.0 + .5); - /* Preserve average width for bitmap fonts */ - if(vals->width != 0) - averageWidth = (int)floor(vals->width * ins_ttcap->scaleBBoxWidth +.5); - else - averageWidth = (int)floor(10.0 * smetrics->max_advance - * ins_ttcap->scaleBBoxWidth / 64.0 + .5); - rawWidth = 0; - rawAverageWidth = 0; - force_c_rawWidth = 0; - /* We don't consider vertical layouts */ - advance = (int)floor(smetrics->max_advance / 64.0 +.5); - unit_x = vals->pixel_matrix[0]; - unit_y = 0; - /* We can use 'width' only when bitmap. - This should not be set when outline. */ - minLsb = 0; - maxRsb = width; - /* force constant */ - if( ins_ttcap->flags & TTCAP_FORCE_C_LSB_FLAG ) - force_c_lsb = (int)floor(smetrics->max_advance - * ins_ttcap->force_c_scale_lsb / 64.0 + .5); - else - force_c_lsb = minLsb; - if( ins_ttcap->flags & TTCAP_FORCE_C_RSB_FLAG ) - force_c_rsb = (int)floor(smetrics->max_advance - * ins_ttcap->force_c_scale_rsb / 64.0 + .5); - else - force_c_rsb = maxRsb; - /* calculate shift of BitmapAutoItalic */ - if( ins_ttcap->autoItalic != 0 ) { - double ai; - int ai_lsb,ai_rsb,ai_total; - if( 0 < ins_ttcap->autoItalic ) ai=ins_ttcap->autoItalic; - else ai = -ins_ttcap->autoItalic; - ai_total = (int)( (ascent+descent) * ai + 0.5); - ai_rsb = (int)((double)ai_total * ascent / ( ascent + descent ) + 0.5 ); - ai_lsb = -(ai_total - ai_rsb); - if( 0 < ins_ttcap->autoItalic ) { - ins_ttcap->lsbShiftOfBitmapAutoItalic = ai_lsb; - ins_ttcap->rsbShiftOfBitmapAutoItalic = ai_rsb; - } - else { - ins_ttcap->lsbShiftOfBitmapAutoItalic = -ai_rsb; - ins_ttcap->rsbShiftOfBitmapAutoItalic = -ai_lsb; - } - } - /* integer adjustment by TTCap */ - if( ins_ttcap->flags & TTCAP_DOUBLE_STRIKE_CORRECT_B_BOX_WIDTH ) - width += ins_ttcap->doubleStrikeShift; - if( ins_ttcap->flags & TTCAP_DOUBLE_STRIKE ) - maxRsb += ins_ttcap->doubleStrikeShift; - maxRsb += ins_ttcap->adjustRightSideBearingByPixel; - minLsb += ins_ttcap->adjustLeftSideBearingByPixel; - /* We have not carried out matrix calculation, so this is done. */ - maxRsb += ins_ttcap->rsbShiftOfBitmapAutoItalic; - minLsb += ins_ttcap->lsbShiftOfBitmapAutoItalic; - /* force constant */ - if( ins_ttcap->flags & TTCAP_DOUBLE_STRIKE ) - force_c_rsb += ins_ttcap->doubleStrikeShift; - force_c_rsb += ins_ttcap->force_c_adjust_rsb_by_pixel; - force_c_lsb += ins_ttcap->force_c_adjust_lsb_by_pixel; - force_c_rsb += ins_ttcap->rsbShiftOfBitmapAutoItalic; - force_c_lsb += ins_ttcap->lsbShiftOfBitmapAutoItalic; - } - - /* SET CALCULATED VALUES TO INSTANCE */ - - /* Set actual height and cosine */ - instance->pixel_size = base_height; - instance->advance = advance; - if ( unit_x != 0 ){ - instance->pixel_width_unit_x = unit_x/base_height; - instance->pixel_width_unit_y = 0; - } - else{ - instance->pixel_width_unit_x = 0; - instance->pixel_width_unit_y = unit_y/base_height; - } - - /* header's metrics */ - instance->charcellMetrics = (xCharInfo*)xalloc(sizeof(xCharInfo)); - if(instance->charcellMetrics == NULL) { - xrc = AllocError; - goto quit; - } - instance->charcellMetrics->ascent = ascent; - instance->charcellMetrics->descent = descent; - instance->charcellMetrics->attributes = rawWidth; - instance->charcellMetrics->rightSideBearing = maxRsb; - instance->charcellMetrics->leftSideBearing = minLsb; - instance->charcellMetrics->characterWidth = width; - instance->averageWidth = averageWidth; - instance->rawAverageWidth = rawAverageWidth; - - /* Check code 0 */ - if( FreeTypeInstanceGetGlyph(font->zero_idx, 0, &tmpglyph, font->instance) != Successful - || tmpglyph == NULL) - if( FreeTypeInstanceGetGlyph(font->zero_idx, FT_GET_DUMMY, &tmpglyph, font->instance) - != Successful ) - tmpglyph = NULL; - if ( !tmpglyph ) { - xrc = AllocError; - goto quit; - } - - /* FORCE CONSTANT METRICS */ - if( 0 <= ins_ttcap->forceConstantSpacingEnd ) { - xCharInfo *tmpchar = NULL; - int c = ins_ttcap->force_c_representative_metrics_char_code; - /* header's metrics */ - if( instance->forceConstantMetrics == NULL ){ - instance->forceConstantMetrics = (xCharInfo*)xalloc(sizeof(xCharInfo)); - if(instance->forceConstantMetrics == NULL) { - xrc = AllocError; - goto quit; - } - } - /* Get Representative Metrics */ - if ( 0 <= c ) { - if( FreeTypeFontGetGlyphMetrics(c, 0, &tmpchar, font) != Successful ) - tmpchar = NULL; - } - if ( tmpchar && 0 < tmpchar->characterWidth ) { - instance->forceConstantMetrics->leftSideBearing = tmpchar->leftSideBearing; - instance->forceConstantMetrics->rightSideBearing = tmpchar->rightSideBearing; - instance->forceConstantMetrics->characterWidth = tmpchar->characterWidth; - instance->forceConstantMetrics->ascent = tmpchar->ascent; - instance->forceConstantMetrics->descent = tmpchar->descent; - instance->forceConstantMetrics->attributes = tmpchar->attributes; - } - else { - instance->forceConstantMetrics->leftSideBearing = force_c_lsb; - instance->forceConstantMetrics->rightSideBearing = force_c_rsb; - instance->forceConstantMetrics->characterWidth = force_c_width; - instance->forceConstantMetrics->ascent = ascent; - instance->forceConstantMetrics->descent = descent; - instance->forceConstantMetrics->attributes = force_c_rawWidth; - } - /* Check code 0 */ - if( FreeTypeInstanceGetGlyph(font->zero_idx, FT_FORCE_CONSTANT_SPACING, - &tmpglyph, font->instance) != Successful - || tmpglyph == NULL) - if( FreeTypeInstanceGetGlyph(font->zero_idx, FT_FORCE_CONSTANT_SPACING | FT_GET_DUMMY, - &tmpglyph, font->instance) - != Successful ) - tmpglyph = NULL; - if ( !tmpglyph ) { - xrc = AllocError; - goto quit; - } - } - } - else{ - - /* - * CACHED VALUES - */ - - width = instance->charcellMetrics->characterWidth; - ascent = instance->charcellMetrics->ascent; - descent = instance->charcellMetrics->descent; - rawWidth = instance->charcellMetrics->attributes; - maxRsb = instance->charcellMetrics->rightSideBearing; - minLsb = instance->charcellMetrics->leftSideBearing; - averageWidth = instance->averageWidth; - rawAverageWidth = instance->rawAverageWidth; - - } - - /* - * SET maxbounds, minbounds ... - */ - - if( !charcell ) { /* NOT CHARCELL */ - if( info ){ - /* - Calculate all glyphs' metrics. - maxbounds.ascent and maxbounds.descent are quite important values - for XAA. If ascent/descent of each glyph exceeds - maxbounds.ascent/maxbounds.descent, XAA causes SERVER CRASH. - Therefore, THIS MUST BE DONE. - */ - ft_compute_bounds(font,info,vals); - } - } - else{ /* CHARCELL */ - - /* - * SET CALCULATED OR CACHED VARIABLES - */ - - vals->width = averageWidth; - - if( info ){ - - info->maxbounds.leftSideBearing = minLsb; - info->maxbounds.rightSideBearing = maxRsb; - info->maxbounds.characterWidth = width; - info->maxbounds.ascent = ascent; - info->maxbounds.descent = descent; - info->maxbounds.attributes = - (unsigned short)(short)rawWidth; - - info->minbounds = info->maxbounds; - } - } - - /* set info */ - - if( info ){ - /* - info->fontAscent = ascent; - info->fontDescent = descent; - */ - info->fontAscent = info->maxbounds.ascent; - info->fontDescent = info->maxbounds.descent; - /* Glyph metrics are accurate */ - info->inkMetrics=1; - - memcpy((char *)&info->ink_maxbounds, - (char *)&info->maxbounds, sizeof(xCharInfo)); - memcpy((char *)&info->ink_minbounds, - (char *)&info->minbounds, sizeof(xCharInfo)); - - /* XXX - hack */ - info->defaultCh=0; - - /* Set the pInfo flags */ - /* Properties set by FontComputeInfoAccelerators: - pInfo->noOverlap; - pInfo->terminalFont; - pInfo->constantMetrics; - pInfo->constantWidth; - pInfo->inkInside; - */ - /* from lib/font/util/fontaccel.c */ - FontComputeInfoAccelerators(info); - } - - if(xf) - xf->fontPrivate = (void*)font; - - if(info) { - xrc = FreeTypeAddProperties(font, vals, info, entry->name.name, - rawAverageWidth, font_properties); - if (xrc != Successful) { - goto quit; - } - } - - quit: - if ( dynStrTTCapCodeRange ) xfree(dynStrTTCapCodeRange); - if ( dynStrFTFileName ) xfree(dynStrFTFileName); - if ( dynStrRealFileName ) xfree(dynStrRealFileName); - if ( xrc != Successful ) { - if( font ){ - if( face && font->instance == NULL ) FreeTypeFreeFace(face); - FreeTypeFreeFont(font); - } - } - return xrc; -} - -/* Routines used by X11 to get info and glyphs from the font. */ - -static int -FreeTypeGetMetrics(FontPtr pFont, unsigned long count, unsigned char *chars, - FontEncoding charEncoding, unsigned long *metricCount, - xCharInfo **metrics) -{ - unsigned int code = 0; - int flags = 0; - FTFontPtr tf; - struct TTCapInfo *ttcap; - xCharInfo **mp, *m; - - /* MUMBLE1("Get metrics for %ld characters\n", count);*/ - - tf = (FTFontPtr)pFont->fontPrivate; - ttcap = &tf->instance->ttcap; - mp = metrics; - - while (count-- > 0) { - switch (charEncoding) { - case Linear8Bit: - case TwoD8Bit: - code = *chars++; - break; - case Linear16Bit: - case TwoD16Bit: - code = (*chars++ << 8); - code |= *chars++; - /* */ - if ( !(ttcap->flags & TTCAP_FORCE_C_OUTSIDE) ) { - if ( (int)code <= ttcap->forceConstantSpacingEnd - && ttcap->forceConstantSpacingBegin <= (int)code ) - flags|=FT_FORCE_CONSTANT_SPACING; - else flags=0; - } - else { /* for GB18030 proportional */ - if ( (int)code <= ttcap->forceConstantSpacingEnd - || ttcap->forceConstantSpacingBegin <= (int)code ) - flags|=FT_FORCE_CONSTANT_SPACING; - else flags=0; - } - break; - } - - if(FreeTypeFontGetGlyphMetrics(code, flags, &m, tf) == Successful && m!=NULL) { - *mp++ = m; - } -#ifdef X_ACCEPTS_NO_SUCH_CHAR - else *mp++ = &noSuchChar.metrics; -#endif - } - - *metricCount = mp - metrics; - return Successful; -} - -static int -FreeTypeGetGlyphs(FontPtr pFont, unsigned long count, unsigned char *chars, - FontEncoding charEncoding, unsigned long *glyphCount, - CharInfoPtr *glyphs) -{ - unsigned int code = 0; - int flags = 0; - FTFontPtr tf; - CharInfoPtr *gp; - CharInfoPtr g; - struct TTCapInfo *ttcap; - - tf = (FTFontPtr)pFont->fontPrivate; - ttcap = &tf->instance->ttcap; - gp = glyphs; - - while (count-- > 0) { - switch (charEncoding) { - case Linear8Bit: case TwoD8Bit: - code = *chars++; - break; - case Linear16Bit: case TwoD16Bit: - code = *chars++ << 8; - code |= *chars++; - /* */ - if ( !(ttcap->flags & TTCAP_FORCE_C_OUTSIDE) ) { - if ( (int)code <= ttcap->forceConstantSpacingEnd - && ttcap->forceConstantSpacingBegin <= (int)code ) - flags|=FT_FORCE_CONSTANT_SPACING; - else flags=0; - } - else { /* for GB18030 proportional */ - if ( (int)code <= ttcap->forceConstantSpacingEnd - || ttcap->forceConstantSpacingBegin <= (int)code ) - flags|=FT_FORCE_CONSTANT_SPACING; - else flags=0; - } - break; - } - - if(FreeTypeFontGetGlyph(code, flags, &g, tf) == Successful && g!=NULL) { - *gp++ = g; - } -#ifdef X_ACCEPTS_NO_SUCH_CHAR - else { -#ifdef XAA_ACCEPTS_NULL_BITS - *gp++ = &noSuchChar; -#else - if ( tf->dummy_char.bits ) { - *gp++ = &tf->dummy_char; - } - else { - char *raster = NULL; - int wd_actual, ht_actual, wd, ht, bpr; - wd_actual = tf->info->maxbounds.rightSideBearing - tf->info->maxbounds.leftSideBearing; - ht_actual = tf->info->maxbounds.ascent + tf->info->maxbounds.descent; - if(wd_actual <= 0) wd = 1; - else wd=wd_actual; - if(ht_actual <= 0) ht = 1; - else ht=ht_actual; - bpr = (((wd + (tf->instance->bmfmt.glyph<<3) - 1) >> 3) & - -tf->instance->bmfmt.glyph); - raster = (char*)xalloc(ht * bpr); - if(raster) { - memset(raster, 0, ht * bpr); - tf->dummy_char.bits = raster; - *gp++ = &tf->dummy_char; - } - } -#endif - } -#endif - } - - *glyphCount = gp - glyphs; - return Successful; -} - -static int -FreeTypeSetUpFont(FontPathElementPtr fpe, FontPtr xf, FontInfoPtr info, - fsBitmapFormat format, fsBitmapFormatMask fmask, - FontBitmapFormatPtr bmfmt) -{ - int xrc; - int image; - - /* Get the default bitmap format information for this X installation. - Also update it for the client if running in the font server. */ - FontDefaultFormat(&bmfmt->bit, &bmfmt->byte, &bmfmt->glyph, &bmfmt->scan); - if ((xrc = CheckFSFormat(format, fmask, &bmfmt->bit, &bmfmt->byte, - &bmfmt->scan, &bmfmt->glyph, - &image)) != Successful) { - MUMBLE1("Aborting after checking FS format: %d\n", xrc); - return xrc; - } - - if(xf) { - xf->refcnt = 0; - xf->bit = bmfmt->bit; - xf->byte = bmfmt->byte; - xf->glyph = bmfmt->glyph; - xf->scan = bmfmt->scan; - xf->format = format; - xf->get_glyphs = FreeTypeGetGlyphs; - xf->get_metrics = FreeTypeGetMetrics; - xf->unload_font = FreeTypeUnloadXFont; - xf->unload_glyphs = 0; - xf->fpe = fpe; - xf->svrPrivate = 0; - xf->fontPrivate = 0; /* we'll set it later */ - xf->fpePrivate = 0; - } - - info->defaultCh = 0; - info->noOverlap = 0; /* not updated */ - info->terminalFont = 0; /* not updated */ - info->constantMetrics = 0; /* we'll set it later */ - info->constantWidth = 0; /* we'll set it later */ - info->inkInside = 1; - info->inkMetrics = 1; - info->allExist=0; /* not updated */ - info->drawDirection = LeftToRight; /* we'll set it later */ - info->cachable = 1; /* we don't do licensing */ - info->anamorphic = 0; /* can hinting lead to anamorphic scaling? */ - info->maxOverlap = 0; /* we'll set it later. */ - info->pad = 0; /* ??? */ - return Successful; -} - -/* Functions exported by the backend */ - -static int -FreeTypeOpenScalable(FontPathElementPtr fpe, FontPtr *ppFont, int flags, - FontEntryPtr entry, char *fileName, FontScalablePtr vals, - fsBitmapFormat format, fsBitmapFormatMask fmask, - FontPtr non_cachable_font) -{ - int xrc; - FontPtr xf; - FontBitmapFormatRec bmfmt; - - MUMBLE1("Open Scalable %s, XLFD=",fileName); -#ifdef DEBUG_TRUETYPE - fwrite(entry->name.name, entry->name.length, 1, stdout); -#endif - MUMBLE("\n"); - - xf = CreateFontRec(); - if (xf == NULL) - return AllocError; - - xrc = FreeTypeSetUpFont(fpe, xf, &xf->info, format, fmask, &bmfmt); - if(xrc != Successful) { - DestroyFontRec(xf); - return xrc; - } - xrc = FreeTypeLoadXFont(fileName, vals, xf, &xf->info, &bmfmt, entry); - if(xrc != Successful) { - MUMBLE1("Error during load: %d\n",xrc); - DestroyFontRec(xf); - return xrc; - } - - *ppFont = xf; - - return xrc; -} - -/* Routine to get requested font info. */ - -static int -FreeTypeGetInfoScalable(FontPathElementPtr fpe, FontInfoPtr info, - FontEntryPtr entry, FontNamePtr fontName, - char *fileName, FontScalablePtr vals) -{ - int xrc; - FontBitmapFormatRec bmfmt; - - MUMBLE("Get info, XLFD= "); -#ifdef DEBUG_TRUETYPE - fwrite(entry->name.name, entry->name.length, 1, stdout); -#endif - MUMBLE("\n"); - - xrc = FreeTypeSetUpFont(fpe, 0, info, 0, 0, &bmfmt); - if(xrc != Successful) { - return xrc; - } - - bmfmt.glyph <<= 3; - - xrc = FreeTypeLoadXFont(fileName, vals, 0, info, &bmfmt, entry); - if(xrc != Successful) { - MUMBLE1("Error during load: %d\n", xrc); - return xrc; - } - - return Successful; -} - -/* Renderer registration. */ - -/* Set the capabilities of this renderer. */ -#define CAPABILITIES (CAP_CHARSUBSETTING | CAP_MATRIX) - -/* Set it up so file names with either upper or lower case can be - loaded. We don't support compressed fonts. */ -static FontRendererRec renderers[] = { - {".ttf", 4, 0, FreeTypeOpenScalable, 0, - FreeTypeGetInfoScalable, 0, CAPABILITIES}, - {".TTF", 4, 0, FreeTypeOpenScalable, 0, - FreeTypeGetInfoScalable, 0, CAPABILITIES}, - {".ttc", 4, 0, FreeTypeOpenScalable, 0, - FreeTypeGetInfoScalable, 0, CAPABILITIES}, - {".TTC", 4, 0, FreeTypeOpenScalable, 0, - FreeTypeGetInfoScalable, 0, CAPABILITIES}, - {".otf", 4, 0, FreeTypeOpenScalable, 0, - FreeTypeGetInfoScalable, 0, CAPABILITIES}, - {".OTF", 4, 0, FreeTypeOpenScalable, 0, - FreeTypeGetInfoScalable, 0, CAPABILITIES}, - {".otc", 4, 0, FreeTypeOpenScalable, 0, - FreeTypeGetInfoScalable, 0, CAPABILITIES}, - {".OTC", 4, 0, FreeTypeOpenScalable, 0, - FreeTypeGetInfoScalable, 0, CAPABILITIES}, - {".pfa", 4, 0, FreeTypeOpenScalable, 0, - FreeTypeGetInfoScalable, 0, CAPABILITIES}, - {".PFA", 4, 0, FreeTypeOpenScalable, 0, - FreeTypeGetInfoScalable, 0, CAPABILITIES}, - {".pfb", 4, 0, FreeTypeOpenScalable, 0, - FreeTypeGetInfoScalable, 0, CAPABILITIES}, - {".PFB", 4, 0, FreeTypeOpenScalable, 0, - FreeTypeGetInfoScalable, 0, CAPABILITIES}, -}; -static int num_renderers = sizeof(renderers) / sizeof(renderers[0]); - -static FontRendererRec alt_renderers[] = { - {".bdf", 4, 0, FreeTypeOpenScalable, 0, - FreeTypeGetInfoScalable, 0, CAPABILITIES}, - {".BDF", 4, 0, FreeTypeOpenScalable, 0, - FreeTypeGetInfoScalable, 0, CAPABILITIES}, - {".pcf", 4, 0, FreeTypeOpenScalable, 0, - FreeTypeGetInfoScalable, 0, CAPABILITIES}, - {".PCF", 4, 0, FreeTypeOpenScalable, 0, - FreeTypeGetInfoScalable, 0, CAPABILITIES}, -}; - -static int num_alt_renderers = -sizeof(alt_renderers) / sizeof(alt_renderers[0]); - - -void -FreeTypeRegisterFontFileFunctions(void) -{ - int i; - - for (i = 0; i < num_renderers; i++) - FontFileRegisterRenderer(&renderers[i]); - - for (i = 0; i < num_alt_renderers; i++) - FontFilePriorityRegisterRenderer(&alt_renderers[i], -10); -} diff --git a/nx-X11/lib/font/FreeType/ftfuncs.h b/nx-X11/lib/font/FreeType/ftfuncs.h deleted file mode 100644 index f115a8b77..000000000 --- a/nx-X11/lib/font/FreeType/ftfuncs.h +++ /dev/null @@ -1,189 +0,0 @@ -/* -Copyright (c) 1998-2002 by Juliusz Chroboczek -Copyright (c) 2003 After X-TT Project, 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 -AUTHORS OR 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. -*/ -/* $XFree86: xc/lib/font/FreeType/ftfuncs.h,v 1.17 2003/12/21 04:02:07 dawes Exp $ */ - -/* Number of buckets in the hashtable holding faces */ -#define NUMFACEBUCKETS 32 - -/* Glyphs are held in segments of this size */ -#define FONTSEGMENTSIZE 16 - -/* A structure that holds bitmap order and padding info. */ - -typedef struct { - int bit; /* bit order */ - int byte; /* byte order */ - int glyph; /* glyph pad size */ - int scan; /* machine word size */ -} FontBitmapFormatRec, *FontBitmapFormatPtr; - -struct FTSize_s; - -/* At the lowest level, there is face; FTFaces are in one-to-one - correspondence with TrueType faces. Multiple instance may share - the same face. */ - -typedef struct _FTFace { - char *filename; - FT_Face face; - int bitmap; - struct _FTInstance *instances; - struct _FTInstance *active_instance; - struct _FTFace *next; /* link to next face in bucket */ -} FTFaceRec, *FTFacePtr; - -/* A transformation matrix with resolution information */ -typedef struct _FTNormalisedTransformation { - double scale; - int nonIdentity; /* if 0, matrix is the identity */ - FT_Matrix matrix; - int xres, yres; -} FTNormalisedTransformationRec, *FTNormalisedTransformationPtr; - -#define FT_PROPORTIONAL 0 -#define FT_MONOSPACED 1 -#define FT_CHARCELL 2 - -#define FT_AVAILABLE_UNKNOWN 0 -#define FT_AVAILABLE_NO 1 -#define FT_AVAILABLE_METRICS 2 -#define FT_AVAILABLE_RASTERISED 3 - -#define FT_GET_GLYPH_BOTH 0x01 -#define FT_GET_GLYPH_METRICS_ONLY 0x02 -#define FT_GET_DUMMY 0x04 -#define FT_FORCE_CONSTANT_SPACING 0x08 - -#define TTCAP_DOUBLE_STRIKE 0x0001 -#define TTCAP_DOUBLE_STRIKE_MKBOLD_EDGE_LEFT 0x0002 -#define TTCAP_DOUBLE_STRIKE_CORRECT_B_BOX_WIDTH 0x0008 -#define TTCAP_IS_VERY_LAZY 0x0010 -#define TTCAP_DISABLE_DEFAULT_VERY_LAZY 0x0020 -#define TTCAP_FORCE_C_LSB_FLAG 0x0100 -#define TTCAP_FORCE_C_RSB_FLAG 0x0200 -#define TTCAP_FORCE_C_OUTSIDE 0x0400 -#define TTCAP_MONO_CENTER 0x0800 - -/* TTCap */ -struct TTCapInfo { - long flags; - double autoItalic; - double scaleWidth; - double scaleBBoxWidth; - double scaleBBoxHeight; - int doubleStrikeShift; - int adjustBBoxWidthByPixel; - int adjustLeftSideBearingByPixel; - int adjustRightSideBearingByPixel; - double scaleBitmap; - int forceConstantSpacingBegin; - int forceConstantSpacingEnd; - /* We don't compare */ - int force_c_adjust_width_by_pixel; - int force_c_adjust_lsb_by_pixel; - int force_c_adjust_rsb_by_pixel; - int force_c_representative_metrics_char_code; - double force_c_scale_b_box_width; - double force_c_scale_b_box_height; - double force_c_scale_lsb; - double force_c_scale_rsb; - double vl_slant; - int lsbShiftOfBitmapAutoItalic; - int rsbShiftOfBitmapAutoItalic; -}; - -/* An instance builds on a face by specifying the transformation - matrix. Multiple fonts may share the same instance. */ - -/* This structure caches bitmap data */ -typedef struct _FTInstance { - FTFacePtr face; /* the associated face */ - FT_Size size; - FTNormalisedTransformationRec transformation; - FT_Int32 load_flags; - FT_ULong strike_index; - int spacing; /* actual spacing */ - double pixel_size; /* to calc attributes (actual height) */ - double pixel_width_unit_x; /* to calc horiz. width (cosine) */ - double pixel_width_unit_y; /* to calc vert. width (cosine) */ - xCharInfo *charcellMetrics; /* the header's metrics */ - int averageWidth; /* the header's metrics */ - long rawAverageWidth; /* the header's metrics */ - double advance; /* the header's metrics */ - xCharInfo *forceConstantMetrics; - FontBitmapFormatRec bmfmt; - unsigned nglyphs; - CharInfoPtr *glyphs; /* glyphs and available are used in parallel */ - int **available; - struct TTCapInfo ttcap; - int refcount; - struct _FTInstance *next; /* link to next instance */ -} FTInstanceRec, *FTInstancePtr; - -/* A font is an instance with coding information; fonts are in - one-to-one correspondence with X fonts */ -typedef struct _FTFont{ - FTInstancePtr instance; - FTMappingRec mapping; - unsigned zero_idx; - FontInfoPtr info; - int nranges; - CharInfoRec dummy_char; - fsRange *ranges; -} FTFontRec, *FTFontPtr; - -#ifndef NOT_IN_FTFUNCS - -/* Prototypes for some local functions */ - -static int FreeTypeOpenFace(FTFacePtr *facep, char *FTFileName, char *realFileName, int faceNumber); -static void FreeTypeFreeFace(FTFacePtr face); -static int -FreeTypeOpenInstance(FTInstancePtr *instancep, FTFacePtr face, - char *FTFileName, FTNormalisedTransformationPtr trans, - int spacing, FontBitmapFormatPtr bmfmt, - struct TTCapInfo *tmp_ttcap, FT_Int32 load_flags); -static void FreeTypeFreeInstance(FTInstancePtr instance); -static int -FreeTypeInstanceGetGlyph(unsigned idx, int flags, CharInfoPtr *g, FTInstancePtr instance); -static int -FreeTypeInstanceGetGlyphMetrics(unsigned idx, int flags, - xCharInfo **metrics, FTInstancePtr instance ); -static int -FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp, - FTInstancePtr instance, int hasMetrics ); -static void FreeTypeFreeFont(FTFontPtr font); -static void FreeTypeFreeXFont(FontPtr pFont, int freeProps); -static void FreeTypeUnloadXFont(FontPtr pFont); -static int -FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info, - char *fontname, int rawAverageWidth, Bool font_properties); -static int FreeTypeFontGetGlyph(unsigned code, int flags, CharInfoPtr *g, FTFontPtr font); -static int -FreeTypeLoadFont(FTFontPtr font, FontInfoPtr info, FTFacePtr face, - char *FTFileName, FontScalablePtr vals, FontEntryPtr entry, - FontBitmapFormatPtr bmfmt, FT_Int32 load_flags, - struct TTCapInfo *tmp_ttcap, char *dynStrTTCapCodeRange, - int ttcap_spacing ); - -#endif /* NOT_IN_FTFUNCS */ diff --git a/nx-X11/lib/font/FreeType/ftsystem.c b/nx-X11/lib/font/FreeType/ftsystem.c deleted file mode 100644 index 90c51c1bf..000000000 --- a/nx-X11/lib/font/FreeType/ftsystem.c +++ /dev/null @@ -1,332 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftsystem.c */ -/* */ -/* ANSI-specific FreeType low-level system interface (body). */ -/* */ -/* Copyright 1996-2001, 2002 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* Modified for XFree86. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - -/* Modified for XFree86 */ -/* $XFree86$ */ - - /*************************************************************************/ - /* */ - /* This file contains the default interface used by FreeType to access */ - /* low-level, i.e. memory management, i/o access as well as thread */ - /* synchronisation. It can be replaced by user-specific routines if */ - /* necessary. */ - /* */ - /*************************************************************************/ - - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include FT_CONFIG_CONFIG_H -#include FT_INTERNAL_DEBUG_H -#include FT_SYSTEM_H -#include FT_ERRORS_H -#include FT_TYPES_H - -#ifndef FONTMODULE -#include -#include -#else -#include "Xmd.h" -#define _XTYPEDEF_BOOL -#include "Xdefs.h" -#define DONT_DEFINE_WRAPPERS -#include "xf86_ansic.h" -#undef DONT_DEFINE_WRAPPERS -#define malloc(x) xf86malloc(x) -#define realloc(x, y) xf86realloc(x, y) -#define free(x) xf86free(x) -#define FILE XF86FILE -#define fopen(x, y) xf86fopen(x, y) -#define fclose(x) xf86fclose(x) -#define fseek(x, y, z) xf86fseek(x, y, z) -#define ftell(x) xf86ftell(x) -#define SEEK_SET XF86_SEEK_SET -#define SEEK_END XF86_SEEK_END -#define fread(x, y, z, t) xf86fread(x, y, z, t) -#endif - - - /*************************************************************************/ - /* */ - /* MEMORY MANAGEMENT INTERFACE */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* It is not necessary to do any error checking for the */ - /* allocation-related functions. This will be done by the higher level */ - /* routines like FT_Alloc() or FT_Realloc(). */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* */ - /* ft_alloc */ - /* */ - /* */ - /* The memory allocation function. */ - /* */ - /* */ - /* memory :: A pointer to the memory object. */ - /* */ - /* size :: The requested size in bytes. */ - /* */ - /* */ - /* The address of newly allocated block. */ - /* */ - FT_CALLBACK_DEF( void* ) - ft_alloc( FT_Memory memory, - long size ) - { - FT_UNUSED( memory ); - - return malloc( size ); - } - - - /*************************************************************************/ - /* */ - /* */ - /* ft_realloc */ - /* */ - /* */ - /* The memory reallocation function. */ - /* */ - /* */ - /* memory :: A pointer to the memory object. */ - /* */ - /* cur_size :: The current size of the allocated memory block. */ - /* */ - /* new_size :: The newly requested size in bytes. */ - /* */ - /* block :: The current address of the block in memory. */ - /* */ - /* */ - /* The address of the reallocated memory block. */ - /* */ - FT_CALLBACK_DEF( void* ) - ft_realloc( FT_Memory memory, - long cur_size, - long new_size, - void* block ) - { - FT_UNUSED( memory ); - FT_UNUSED( cur_size ); - - return realloc( block, new_size ); - } - - - /*************************************************************************/ - /* */ - /* */ - /* ft_free */ - /* */ - /* */ - /* The memory release function. */ - /* */ - /* */ - /* memory :: A pointer to the memory object. */ - /* */ - /* block :: The address of block in memory to be freed. */ - /* */ - FT_CALLBACK_DEF( void ) - ft_free( FT_Memory memory, - void* block ) - { - FT_UNUSED( memory ); - - free( block ); - } - - - /*************************************************************************/ - /* */ - /* RESOURCE MANAGEMENT INTERFACE */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ - /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ - /* messages during execution. */ - /* */ -#undef FT_COMPONENT -#define FT_COMPONENT trace_io - - /* We use the macro STREAM_FILE for convenience to extract the */ - /* system-specific stream handle from a given FreeType stream object */ -#define STREAM_FILE( stream ) ( (FILE*)stream->descriptor.pointer ) - - - /*************************************************************************/ - /* */ - /* */ - /* ft_ansi_stream_close */ - /* */ - /* */ - /* The function to close a stream. */ - /* */ - /* */ - /* stream :: A pointer to the stream object. */ - /* */ - FT_CALLBACK_DEF( void ) - ft_ansi_stream_close( FT_Stream stream ) - { - fclose( STREAM_FILE( stream ) ); - - stream->descriptor.pointer = NULL; - stream->size = 0; - stream->base = 0; - } - - - /*************************************************************************/ - /* */ - /* */ - /* ft_ansi_stream_io */ - /* */ - /* */ - /* The function to open a stream. */ - /* */ - /* */ - /* stream :: A pointer to the stream object. */ - /* */ - /* offset :: The position in the data stream to start reading. */ - /* */ - /* buffer :: The address of buffer to store the read data. */ - /* */ - /* count :: The number of bytes to read from the stream. */ - /* */ - /* */ - /* The number of bytes actually read. */ - /* */ - FT_CALLBACK_DEF( unsigned long ) - ft_ansi_stream_io( FT_Stream stream, - unsigned long offset, - unsigned char* buffer, - unsigned long count ) - { - FILE* file; - - - file = STREAM_FILE( stream ); - - fseek( file, offset, SEEK_SET ); - - return (unsigned long)fread( buffer, 1, count, file ); - } - - - /* documentation is in ftobjs.h */ - - FT_EXPORT_DEF( FT_Error ) - FT_Stream_Open( FT_Stream stream, - const char* filepathname ) - { - FILE* file; - - - if ( !stream ) - return FT_Err_Invalid_Stream_Handle; - - file = fopen( filepathname, "rb" ); - if ( !file ) - { - FT_ERROR(( "FT_Stream_Open:" )); - FT_ERROR(( " could not open `%s'\n", filepathname )); - - return FT_Err_Cannot_Open_Resource; - } - - fseek( file, 0, SEEK_END ); - stream->size = ftell( file ); - fseek( file, 0, SEEK_SET ); - - stream->descriptor.pointer = file; - stream->pathname.pointer = (char*)filepathname; - stream->pos = 0; - - stream->read = ft_ansi_stream_io; - stream->close = ft_ansi_stream_close; - - FT_TRACE1(( "FT_Stream_Open:" )); - FT_TRACE1(( " opened `%s' (%d bytes) successfully\n", - filepathname, stream->size )); - - return FT_Err_Ok; - } - - -#ifdef FT_DEBUG_MEMORY - - extern FT_Int - ft_mem_debug_init( FT_Memory memory ); - - extern void - ft_mem_debug_done( FT_Memory memory ); - -#endif - - - /* documentation is in ftobjs.h */ - - FT_EXPORT_DEF( FT_Memory ) - FT_New_Memory( void ) - { - FT_Memory memory; - - - memory = (FT_Memory)malloc( sizeof ( *memory ) ); - if ( memory ) - { - memory->user = 0; - memory->alloc = ft_alloc; - memory->realloc = ft_realloc; - memory->free = ft_free; -#ifdef FT_DEBUG_MEMORY - ft_mem_debug_init( memory ); -#endif - } - - return memory; - } - - - /* documentation is in ftobjs.h */ - - FT_EXPORT_DEF( void ) - FT_Done_Memory( FT_Memory memory ) - { -#ifdef FT_DEBUG_MEMORY - ft_mem_debug_done( memory ); -#endif -#undef free - memory->free( memory, memory ); - } - - -/* END */ diff --git a/nx-X11/lib/font/FreeType/fttools.c b/nx-X11/lib/font/FreeType/fttools.c deleted file mode 100644 index 9251838a9..000000000 --- a/nx-X11/lib/font/FreeType/fttools.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - Copyright (c) 1997 by Mark Leisher - Copyright (c) 1998-2002 by Juliusz Chroboczek - - 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 - AUTHORS OR 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. -*/ - -/* $XFree86: xc/lib/font/FreeType/fttools.c,v 1.6 2003/06/08 15:41:13 herrb Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#ifndef FONTMODULE -#include -#include -#else -#include "Xmd.h" -#include "Xdefs.h" -#include "xf86_ansic.h" -#endif - -#include -#include -#include FT_FREETYPE_H -#include FT_SFNT_NAMES_H -#include FT_TRUETYPE_IDS_H -#include "ft.h" - -/* backward compatibility hack */ -#if (FREETYPE_VERSION < 2001008) -# ifndef ft_isdigit -# define ft_isdigit isdigit -# endif -#endif - -#ifndef LSBFirst -#define LSBFirst 0 -#define MSBFirst 1 -#endif - -#define LOBYTE(s,byte) ((byte)==LSBFirst?*(char*)(s):*((char*)(s)+1)) -#define HIBYTE(s,byte) ((byte)==LSBFirst?*((char*)(s)+1):*(char*)(s)) - -int FTtoXReturnCode(int rc) -{ - if(rc == 0x40) - return AllocError; - /* Anything else stops the font matching mechanism */ - else return BadFontName; - -} - -/* Convert slen bytes from UCS-2 to ISO 8859-1. Byte specifies the - endianness of the string, max the maximum number of bytes written into - to. */ -static int -FTu2a(int slen, FT_Byte *from, char *to, int byte, int max) -{ - int i, n; - - n = 0; - for (i = 0; i < slen; i += 2) { - if(n >= max) - break; - if(HIBYTE(from+i, byte)!=0) - *to++='?'; - else - *to++ = LOBYTE(from+i,byte); - n++; - } - *to = 0; - return n; -} - -static int -FTGetName(FT_Face face, int nid, int pid, int eid, FT_SfntName *name_return) -{ - FT_SfntName name; - int n, i; - - n = FT_Get_Sfnt_Name_Count(face); - if(n <= 0) - return 0; - - for(i = 0; i < n; i++) { - if(FT_Get_Sfnt_Name(face, i, &name)) - continue; - if(name.name_id == nid && - name.platform_id == pid && - (eid < 0 || name.encoding_id == eid)) { - switch(name.platform_id) { - case TT_PLATFORM_APPLE_UNICODE: - case TT_PLATFORM_MACINTOSH: - if(name.language_id != TT_MAC_LANGID_ENGLISH) - continue; - break; - case TT_PLATFORM_MICROSOFT: - if(name.language_id != TT_MS_LANGID_ENGLISH_UNITED_STATES && - name.language_id != TT_MS_LANGID_ENGLISH_UNITED_KINGDOM) - break; - continue; - break; - default: - break; - } - *name_return = name; - return 1; - } - } - return 0; -} - -int -FTGetEnglishName(FT_Face face, int nid, char *name_return, int name_len) -{ - FT_SfntName name; - int len; - - if(FTGetName(face, nid, - TT_PLATFORM_MICROSOFT, TT_MS_ID_UNICODE_CS, &name) || - FTGetName(face, nid, - TT_PLATFORM_APPLE_UNICODE, -1, &name)) - return FTu2a(name.string_len, name.string, name_return, - MSBFirst, name_len); - - /* Pretend that Apple Roman is ISO 8859-1. */ - if(FTGetName(face, nid, TT_PLATFORM_MACINTOSH, TT_MAC_ID_ROMAN, &name)) { - len = name.string_len; - if(len > name_len) - len = name_len; - memcpy(name_return, name.string, len); - return len; - } - - /* Must be some font that can only be named in Polish or something. */ - return -1; -} - -int -FTcheckForTTCName(char *fileName, char **realFileName, int *faceNumber) -{ - int length; - int fn; - int i, j; - char *start, *realName; - - length = strlen(fileName); - if(length < 4) - return 0; - - if(strcasecmp(fileName + (length-4), ".ttc") != 0 && - strcasecmp(fileName + (length-4), ".otc") != 0) - return 0; - - realName = xalloc(length + 1); - if(realName == NULL) - return 0; - - strcpy(realName, fileName); - *realFileName=realName; - start = strchr(realName, ':'); - if(start) { - fn=0; - i=1; - while(ft_isdigit(start[i])) { - fn *= 10; - fn += start[i]-'0'; - i++; - } - if(start[i]==':') { - *faceNumber = fn; - i++; - j = 0; - while(start[i]) { - start[j++] = start[i++]; - } - start[j] = '\0'; - return 1; - } - } - - *faceNumber = 0; - return 1; -} diff --git a/nx-X11/lib/font/FreeType/module/Imakefile b/nx-X11/lib/font/FreeType/module/Imakefile deleted file mode 100644 index 855220b1e..000000000 --- a/nx-X11/lib/font/FreeType/module/Imakefile +++ /dev/null @@ -1,111 +0,0 @@ -XCOMM $XFree86: xc/lib/font/FreeType/module/Imakefile,v 1.16 2003/11/05 16:58:35 tsi Exp $ - -FT2INCDIR = $(TOP)/extras/freetype2/include -FT2SOURCEDIR = $(TOP)/extras/freetype2/src - -/*#define BuildFreetypeDlModule NO*/ - -#if !defined(BuildFreetypeDlModule) -# define BuildFreetypeDlModule (HasFreetype2 && HasDlopen) -#endif - -#if !BuildFreetypeDlModule -EXTRADEFINES = Freetype2BuildDefines -DFONTMODULE -# else -# undef MakeDllModules -# define MakeDllModules YES -#endif - - - -DEFINES = $(EXTRADEFINES) -DXFREE86_FT2 $(INTERNALDEFINES) -#define IHaveModules -#include - - -#if BuildFreetypeDlModule - -FT2INCLUDES = $(FREETYPE2INCLUDES) -EXTLIB = $(FREETYPE2LIB) - -# if !HasFreetype2 -LINKFT2LIB = -L$(BUILDLIBDIR) -# endif -#else - -FT2INCLUDES = -I$(FT2INCDIR) \ - -I$(FT2SOURCEDIR)/base \ - -I$(FT2SOURCEDIR)/gzip \ - -I$(FT2SOURCEDIR)/raster \ - -I$(FT2SOURCEDIR)/sfnt \ - -I$(FT2SOURCEDIR)/truetype \ - -I$(FT2SOURCEDIR)/cff \ - -I$(FT2SOURCEDIR)/type1 \ - -I$(FT2SOURCEDIR)/psaux \ - -I$(FT2SOURCEDIR)/psnames \ - -I$(FT2SOURCEDIR)/pshinter \ - -I$(FT2SOURCEDIR)/autohint \ - -I$(FT2SOURCEDIR)/bdf \ - -I$(FT2SOURCEDIR)/pcf \ - -I$(FT2SOURCEDIR)/lzw - -FT2SRCS = ftbase.c ftinit.c ftglyph.c ftbbox.c ftsystem.c fttype1.c ftxf86.c \ - ftgzip.c raster.c sfnt.c truetype.c cff.c type1.c \ - psaux.c psnames.c pshinter.c autohint.c ftlzw.c \ - ftbdf.c bdf.c pcf.c -FT2OBJS = ftbase.o ftinit.o ftglyph.o ftbbox.o ftsystem.o fttype1.o ftxf86.o \ - ftgzip.o raster.o sfnt.o truetype.o cff.o type1.o \ - psaux.o psnames.o pshinter.o autohint.o ftlzw.o \ - ftbdf.o bdf.o pcf.o -#endif - -INCLUDES = -I. -I.. -I$(FONTINCSRC) -I../../include -I$(XINCLUDESRC) \ - -I$(SERVERSRC)/include $(FT2INCLUDES) -I$(INCLUDESRC) - -SRCS = xttcap.c ftfuncs.c ftenc.c fttools.c $(FT2SRCS) ftmodule.c -OBJS = xttcap.o ftfuncs.o ftenc.o fttools.o $(FT2OBJS) ftmodule.o - -LinkSourceFile(ftenc.c,..) -LinkSourceFile(ftfuncs.c,..) -LinkSourceFile(fttools.c,..) -LinkSourceFile(xttcap.c,..) - -#if !BuildFreetypeDlModule -LinkSourceFile(ftbase.c,$(FT2SOURCEDIR)/base) -LinkSourceFile(ftinit.c,$(FT2SOURCEDIR)/base) -LinkSourceFile(ftglyph.c,$(FT2SOURCEDIR)/base) -LinkSourceFile(ftbbox.c,$(FT2SOURCEDIR)/base) -LinkSourceFile(ftsystem.c,..) -LinkSourceFile(ftutil.c,$(FT2SOURCEDIR)/base) -LinkSourceFile(fttype1.c,$(FT2SOURCEDIR)/base) -LinkSourceFile(ftxf86.c,$(FT2SOURCEDIR)/base) -LinkSourceFile(ftgzip.c,$(FT2SOURCEDIR)/gzip) -LinkSourceFile(raster.c,$(FT2SOURCEDIR)/raster) -LinkSourceFile(sfnt.c,$(FT2SOURCEDIR)/sfnt) -LinkSourceFile(truetype.c,$(FT2SOURCEDIR)/truetype) -LinkSourceFile(cff.c,$(FT2SOURCEDIR)/cff) -LinkSourceFile(type1.c,$(FT2SOURCEDIR)/type1) -LinkSourceFile(psaux.c,$(FT2SOURCEDIR)/psaux) -LinkSourceFile(psnames.c,$(FT2SOURCEDIR)/psnames) -LinkSourceFile(pshinter.c,$(FT2SOURCEDIR)/pshinter) -LinkSourceFile(autohint.c,$(FT2SOURCEDIR)/autohint) -LinkSourceFile(ftbdf.c,$(FT2SOURCEDIR)/base) -LinkSourceFile(bdf.c,$(FT2SOURCEDIR)/bdf) -LinkSourceFile(pcf.c,$(FT2SOURCEDIR)/pcf) -LinkSourceFile(ftlzw.c,$(FT2SOURCEDIR)/lzw) -#endif - -ModuleObjectRule() - -#if !BuildFreetypeDlModule -LibraryModuleTarget(freetype,$(OBJS)) -InstallLibraryModule(freetype,$(MODULEDIR),fonts) -InstallDriverSDKLibraryModule(freetype,$(DRIVERSDKMODULEDIR),fonts) -#else -DepDynamicModuleTarget(Concat3(lib,freetype,.so), $(OBJS), $(LINKFT2LIB) $(OBJS) $(EXTLIB)) -InstallDynamicModule(Concat3(lib,freetype,.so),$(MODULEDIR),fonts) -InstallDriverSDKDynamicModule(Concat3(lib,freetype,.so),$(DRIVERSDKMODULEDIR),fonts) -#endif - -DependTarget() - diff --git a/nx-X11/lib/font/FreeType/module/ft2build.h b/nx-X11/lib/font/FreeType/module/ft2build.h deleted file mode 100644 index 83b9d4802..000000000 --- a/nx-X11/lib/font/FreeType/module/ft2build.h +++ /dev/null @@ -1,45 +0,0 @@ -/***************************************************************************/ -/* */ -/* ft2build.h */ -/* */ -/* FreeType 2 build and setup macros. */ -/* */ -/* Copyright 1996-2001 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* Modified for XFree86. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - -/* $XFree86: xc/lib/font/FreeType/ft2build.h,v 1.3 2002/10/01 00:02:10 alanh Exp $ */ - -/* $XdotOrg: xc/lib/font/FreeType/module/ft2build.h,v 1.3 2005/07/03 07:00:58 daniels Exp $ */ - /*************************************************************************/ - /* */ - /* This file corresponds to the default "ft2build.h" file for */ - /* FreeType 2. It uses the "freetype" include root. */ - /* */ - /* Note that specific platforms might use a different configuration. */ - /* See builds/unix/ft2unix.h for an example. */ - /* */ - /*************************************************************************/ - -#ifndef __FT2_BUILD_GENERIC_H__ -#define __FT2_BUILD_GENERIC_H__ - -# if defined (FONTMODULE) -# include "ftheader.h" -# else -#include -# endif - -#endif /* __FT2_BUILD_GENERIC_H__ */ - - -/* END */ diff --git a/nx-X11/lib/font/FreeType/module/ftheader.h b/nx-X11/lib/font/FreeType/module/ftheader.h deleted file mode 100644 index ec1671c41..000000000 --- a/nx-X11/lib/font/FreeType/module/ftheader.h +++ /dev/null @@ -1,550 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftheader.h */ -/* */ -/* Build macros of the FreeType 2 library. */ -/* */ -/* Copyright 1996-2001, 2002 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ -/* $XFree86: xc/lib/font/FreeType/ftheader.h,v 1.4 2003/05/29 03:05:08 dawes Exp $ */ - -#ifndef __FT_HEADER_H__ -#define __FT_HEADER_H__ - - /*@***********************************************************************/ - /* */ - /* */ - /* FT_BEGIN_HEADER */ - /* */ - /* */ - /* This macro is used in association with @FT_END_HEADER in header */ - /* files to ensure that the declarations within are properly */ - /* encapsulated in an `extern "C" { .. }' block when included from a */ - /* C++ compiler. */ - /* */ -#ifdef __cplusplus -#define FT_BEGIN_HEADER extern "C" { -#else -#define FT_BEGIN_HEADER /* nothing */ -#endif - - - /*@***********************************************************************/ - /* */ - /* */ - /* FT_END_HEADER */ - /* */ - /* */ - /* This macro is used in association with @FT_BEGIN_HEADER in header */ - /* files to ensure that the declarations within are properly */ - /* encapsulated in an `extern "C" { .. }' block when included from a */ - /* C++ compiler. */ - /* */ -#ifdef __cplusplus -#define FT_END_HEADER } -#else -#define FT_END_HEADER /* nothing */ -#endif - - - /*************************************************************************/ - /* */ - /* Aliases for the FreeType 2 public and configuration files. */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /*
      */ - /* header_file_macros */ - /* */ - /* */ - /* Header File Macros */ - /* */ - /* <Abstract> */ - /* Macro definitions used to #include specific header files. */ - /* */ - /* <Description> */ - /* The following macros are defined to the name of specific */ - /* FreeType 2 header files. They can be used directly in #include */ - /* statements as in: */ - /* */ - /* { */ - /* #include FT_FREETYPE_H */ - /* #include FT_MULTIPLE_MASTERS_H */ - /* #include FT_GLYPH_H */ - /* } */ - /* */ - /* There are several reasons why we are now using macros to name */ - /* public header files. The first one is that such macros are not */ - /* limited to the infamous 8.3 naming rule required by DOS (and */ - /* `FT_MULTIPLE_MASTERS_H' is a lot more meaningful than `ftmm.h'). */ - /* */ - /* The second reason is that is allows for more flexibility in the */ - /* way FreeType 2 is installed on a given system. */ - /* */ - /*************************************************************************/ - - /* configuration files */ - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_CONFIG_CONFIG_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* FreeType 2 configuration data. */ - /* */ -#ifndef FT_CONFIG_CONFIG_H -#define FT_CONFIG_CONFIG_H <freetype/config/ftconfig.h> -#endif - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_CONFIG_STANDARD_LIBRARY_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* FreeType 2 configuration data. */ - /* */ -#ifndef FT_CONFIG_STANDARD_LIBRARY_H -#define FT_CONFIG_STANDARD_LIBRARY_H <myftstdlib.h> -#endif - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_CONFIG_OPTIONS_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* FreeType 2 project-specific configuration options. */ - /* */ -#ifndef FT_CONFIG_OPTIONS_H -#define FT_CONFIG_OPTIONS_H <ftoption.h> -#endif - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_CONFIG_MODULES_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the list of FreeType 2 modules that are statically linked to new */ - /* library instances in @FT_Init_FreeType. */ - /* */ -#ifndef FT_CONFIG_MODULES_H -#define FT_CONFIG_MODULES_H <ftmodule.h> -#endif - - /* public headers */ - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_FREETYPE_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the base FreeType 2 API. */ - /* */ -#define FT_FREETYPE_H <freetype/freetype.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_ERRORS_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the list of FreeType 2 error codes (and messages). */ - /* */ - /* It is included by @FT_FREETYPE_H. */ - /* */ -#define FT_ERRORS_H <freetype/fterrors.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_MODULE_ERRORS_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the list of FreeType 2 module error offsets (and messages). */ - /* */ -#define FT_MODULE_ERRORS_H <freetype/ftmoderr.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_SYSTEM_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the FreeType 2 interface to low-level operations (i.e. memory */ - /* management and stream i/o). */ - /* */ - /* It is included by @FT_FREETYPE_H. */ - /* */ -#define FT_SYSTEM_H <freetype/ftsystem.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_IMAGE_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* types definitions related to glyph images (i.e. bitmaps, outlines, */ - /* scan-converter parameters). */ - /* */ - /* It is included by @FT_FREETYPE_H. */ - /* */ -#define FT_IMAGE_H <freetype/ftimage.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_TYPES_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the basic data types defined by FreeType 2. */ - /* */ - /* It is included by @FT_FREETYPE_H. */ - /* */ -#define FT_TYPES_H <fttypes.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_LIST_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the list management API of FreeType 2. */ - /* */ - /* (Most applications will never need to include this file.) */ - /* */ -#define FT_LIST_H <freetype/ftlist.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_OUTLINE_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the scalable outline management API of FreeType 2. */ - /* */ -#define FT_OUTLINE_H <freetype/ftoutln.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_SIZES_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the API used to manage multiple @FT_Size objects per face. */ - /* */ -#define FT_SIZES_H <freetype/ftsizes.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_MODULE_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the module management API of FreeType 2. */ - /* */ -#define FT_MODULE_H <freetype/ftmodapi.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_RENDER_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the renderer module management API of FreeType 2. */ - /* */ -#define FT_RENDER_H <freetype/ftrender.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_TYPE1_TABLES_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the types and API specific to the Type 1 format. */ - /* */ -#define FT_TYPE1_TABLES_H <freetype/t1tables.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_TRUETYPE_IDS_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the enumeration values used to identify name strings, languages, */ - /* encodings, etc. This file really contains a _large_ set of */ - /* constant macro definitions, taken from the TrueType and OpenType */ - /* specifications. */ - /* */ -#define FT_TRUETYPE_IDS_H <freetype/ttnameid.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_TRUETYPE_TABLES_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the types and API specific to the TrueType (as well as OpenType) */ - /* format. */ - /* */ -#define FT_TRUETYPE_TABLES_H <freetype/tttables.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_TRUETYPE_TAGS_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the definitions of TrueType 4-byte `tags' used to identify blocks */ - /* in SFNT-based font formats (i.e. TrueType and OpenType). */ - /* */ -#define FT_TRUETYPE_TAGS_H <freetype/tttags.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_BDF_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the definitions of an API to access BDF-specific strings from a */ - /* face. */ - /* */ -#define FT_BDF_H <freetype/ftbdf.h> - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_GZIP_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the definitions of an API to support for gzip-compressed files. */ - /* */ -#define FT_GZIP_H <freetype/ftgzip.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_LZW_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the definitions of an API to support for LZW-compressed files. */ - /* */ -#define FT_LZW_H <freetype/ftlzw.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_WINFONTS_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the definitions of an API to support Windows .FNT files */ - /* */ -#define FT_WINFONTS_H <freetype/ftwinfnt.h> - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_GLYPH_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the API of the optional glyph management component. */ - /* */ -#define FT_GLYPH_H <freetype/ftglyph.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_BBOX_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the API of the optional exact bounding box computation routines. */ - /* */ -#define FT_BBOX_H <freetype/ftbbox.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_CACHE_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the API of the optional FreeType 2 cache sub-system. */ - /* */ -#define FT_CACHE_H <freetype/ftcache.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_CACHE_IMAGE_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the `glyph image' API of the FreeType 2 cache sub-system. */ - /* */ - /* It is used to define a cache for @FT_Glyph elements. You can also */ - /* see the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need */ - /* to store small glyph bitmaps, as it will use less memory. */ - /* */ -#define FT_CACHE_IMAGE_H <freetype/cache/ftcimage.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_CACHE_SMALL_BITMAPS_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the `small bitmaps' API of the FreeType 2 cache sub-system. */ - /* */ - /* It is used to define a cache for small glyph bitmaps in a */ - /* relatively memory-efficient way. You can also use the API defined */ - /* in @FT_CACHE_IMAGE_H if you want to cache arbitrary glyph images, */ - /* including scalable outlines. */ - /* */ -#define FT_CACHE_SMALL_BITMAPS_H <freetype/cache/ftcsbits.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_CACHE_CHARMAP_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the `charmap' API of the FreeType 2 cache sub-system. */ - /* */ -#define FT_CACHE_CHARMAP_H <freetype/cache/ftccmap.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_MAC_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the Macintosh-specific FreeType 2 API. The latter is used to */ - /* access fonts embedded in resource forks. */ - /* */ - /* This header file must be explicitly included by client */ - /* applications compiled on the Mac (note that the base API still */ - /* works though). */ - /* */ -#define FT_MAC_H <freetype/ftmac.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_MULTIPLE_MASTERS_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the optional multiple-masters management API of FreeType 2. */ - /* */ -#define FT_MULTIPLE_MASTERS_H <freetype/ftmm.h> - - - /*************************************************************************/ - /* */ - /* @macro: */ - /* FT_SFNT_NAMES_H */ - /* */ - /* @description: */ - /* A macro used in #include statements to name the file containing */ - /* the optional FreeType 2 API used to access embedded `name' strings */ - /* in SFNT-based font formats (i.e. TrueType and OpenType). */ - /* */ -#define FT_SFNT_NAMES_H <freetype/ftsnames.h> - - /* */ - -#define FT_TRIGONOMETRY_H <freetype/fttrigon.h> -#define FT_STROKER_H <freetype/ftstroke.h> -#define FT_SYNTHESIS_H <freetype/ftsynth.h> -#define FT_ERROR_DEFINITIONS_H <freetype/fterrdef.h> - -#define FT_CACHE_MANAGER_H <freetype/cache/ftcmanag.h> - -#define FT_CACHE_INTERNAL_LRU_H <freetype/cache/ftlru.h> -#define FT_CACHE_INTERNAL_GLYPH_H <freetype/cache/ftcglyph.h> -#define FT_CACHE_INTERNAL_CACHE_H <freetype/cache/ftccache.h> - -#define FT_XFREE86_H <freetype/ftxf86.h> - -#define FT_INCREMENTAL_H <freetype/ftincrem.h> - -#define FT_TRUETYPE_UNPATENTED_H <freetype/ttunpat.h> - - /* now include internal headers definitions from <freetype/internal/...> */ - -#define FT_INTERNAL_INTERNAL_H <freetype/internal/internal.h> -#include FT_INTERNAL_INTERNAL_H - - -#endif /* __FT2_BUILD_H__ */ - - -/* END */ diff --git a/nx-X11/lib/font/FreeType/module/ftmodule.c b/nx-X11/lib/font/FreeType/module/ftmodule.c deleted file mode 100644 index c2fe79089..000000000 --- a/nx-X11/lib/font/FreeType/module/ftmodule.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 1998-2002 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. - */ -/* $XFree86: xc/lib/font/FreeType/module/ftmodule.c,v 1.18 2003/11/02 04:30:57 dawes Exp $ */ - -#include "misc.h" - -#include <X11/fonts/fontmod.h> -#include "xf86Module.h" - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -static MODULESETUPPROTO(freetypeSetup); - - /* - * This is the module data function that is accessed when loading - * libfreetype as a module. - */ - -static XF86ModuleVersionInfo VersRec = -{ - "freetype", - MODULEVENDORSTRING " & the After X-TT Project", - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 2, 1, 0, - ABI_CLASS_FONT, /* Font module */ - ABI_FONT_VERSION, - MOD_CLASS_FONT, - {0,0,0,0} /* signature, to be patched into the file by a tool */ -}; - -XF86ModuleData freetypeModuleData = { &VersRec, freetypeSetup, NULL }; - -extern void FreeTypeRegisterFontFileFunctions(void); - -FontModule freetypeModule = { - FreeTypeRegisterFontFileFunctions, - "FreeType", - NULL -}; - -static pointer -freetypeSetup(pointer module, pointer opts, int *errmaj, int *errmin) -{ - freetypeModule.module = module; - LoadFont(&freetypeModule); - - /* Need a non-NULL return */ - return (pointer)1; -} diff --git a/nx-X11/lib/font/FreeType/module/ftmodule.h b/nx-X11/lib/font/FreeType/module/ftmodule.h deleted file mode 100644 index 443c97c29..000000000 --- a/nx-X11/lib/font/FreeType/module/ftmodule.h +++ /dev/null @@ -1,21 +0,0 @@ -/* $XFree86: xc/lib/font/FreeType/ftmodule.h,v 1.5 2003/10/24 16:33:08 tsi Exp $ */ - -FT_USE_MODULE(autohint_module_class) -FT_USE_MODULE(cff_driver_class) -/* FT_USE_MODULE(t1cid_driver_class) */ -FT_USE_MODULE(pcf_driver_class) -FT_USE_MODULE(bdf_driver_class) -FT_USE_MODULE(psaux_module_class) -FT_USE_MODULE(psnames_module_class) -FT_USE_MODULE(pshinter_module_class) -FT_USE_MODULE(ft_raster1_renderer_class) -FT_USE_MODULE(sfnt_module_class) -/* FT_USE_MODULE(ft_smooth_renderer_class) */ -/* FT_USE_MODULE(ft_smooth_lcd_renderer_class) */ -/* FT_USE_MODULE(ft_smooth_lcdv_renderer_class) */ -FT_USE_MODULE(tt_driver_class) -FT_USE_MODULE(t1_driver_class) -/* FT_USE_MODULE(t42_driver_class) */ -/* FT_USE_MODULE(pfr_driver_class) */ -/* FT_USE_MODULE(winfnt_driver_class) */ - diff --git a/nx-X11/lib/font/FreeType/module/ftoption.h b/nx-X11/lib/font/FreeType/module/ftoption.h deleted file mode 100644 index a527ec12d..000000000 --- a/nx-X11/lib/font/FreeType/module/ftoption.h +++ /dev/null @@ -1,567 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftoption.h */ -/* */ -/* User-selectable configuration macros (specification only). */ -/* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTOPTION_H__ -#define __FTOPTION_H__ - - -#include <ft2build.h> - - -FT_BEGIN_HEADER - - /*************************************************************************/ - /* */ - /* USER-SELECTABLE CONFIGURATION MACROS */ - /* */ - /* This file contains the default configuration macro definitions for */ - /* a standard build of the FreeType library. There are three ways to */ - /* use this file to build project-specific versions of the library: */ - /* */ - /* - You can modify this file by hand, but this is not recommended in */ - /* cases where you would like to build several versions of the */ - /* library from a single source directory. */ - /* */ - /* - You can put a copy of this file in your build directory, more */ - /* precisely in "$BUILD/freetype/config/ftoption.h", where "$BUILD" */ - /* is the name of a directory that is included _before_ the FreeType */ - /* include path during compilation. */ - /* */ - /* The default FreeType Makefiles and Jamfiles use the build */ - /* directory "builds/<system>" by default, but you can easily change */ - /* that for your own projects. */ - /* */ - /* - Copy the file <ft2build.h> to "$BUILD/ft2build.h" and modify it */ - /* slightly to pre-define the macro FT_CONFIG_OPTIONS_H used to */ - /* locate this file during the build. For example, */ - /* */ - /* #define FT_CONFIG_OPTIONS_H <myftoptions.h> */ - /* #include <freetype/config/ftheader.h> */ - /* */ - /* will use "$BUILD/myftoptions.h" instead of this file for macro */ - /* definitions. */ - /* */ - /* Note also that you can similarly pre-define the macro */ - /* FT_CONFIG_MODULES_H used to locate the file listing of the modules */ - /* that are statically linked to the library at compile time. By */ - /* default, this file is <freetype/config/ftmodule.h>. */ - /* */ - /* We highly recommend using the third method whenever possible. */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** G E N E R A L F R E E T Y P E 2 C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* Many compilers provide a non-ANSI 64-bit data type that can be used */ - /* by FreeType to speed up some computations. However, this will create */ - /* some problems when compiling the library in strict ANSI mode. */ - /* */ - /* For this reason, the use of 64-bit integers is normally disabled when */ - /* the __STDC__ macro is defined. You can however disable this by */ - /* defining the macro FT_CONFIG_OPTION_FORCE_INT64 here. */ - /* */ - /* For most compilers, this will only create compilation warnings when */ - /* building the library. */ - /* */ - /* ObNote: The compiler-specific 64-bit integers are detected in the */ - /* file "ftconfig.h" either statically or through the */ - /* `configure' script on supported platforms. */ - /* */ -#undef FT_CONFIG_OPTION_FORCE_INT64 - - - /*************************************************************************/ - /* */ - /* LZW-compressed file support. */ - /* */ - /* FreeType now handles font files that have been compressed with the */ - /* 'compress' program. This is mostly used to parse many of the PCF */ - /* files that come with various X11 distributions. The implementation */ - /* uses NetBSD's `zopen' to partially uncompress the file on the fly */ - /* (see src/lzw/ftgzip.c). */ - /* */ - /* Define this macro if you want to enable this `feature'. */ - /* */ -#define FT_CONFIG_OPTION_USE_LZW - - - /*************************************************************************/ - /* */ - /* Gzip-compressed file support. */ - /* */ - /* FreeType now handles font files that have been compressed with the */ - /* 'gzip' program. This is mostly used to parse many of the PCF files */ - /* that come with XFree86. The implementation uses `zlib' to */ - /* partially uncompress the file on the fly (see src/gzip/ftgzip.c). */ - /* */ - /* Define this macro if you want to enable this `feature'. See also */ - /* the macro FT_CONFIG_OPTION_SYSTEM_ZLIB below. */ - /* */ -#define FT_CONFIG_OPTION_USE_ZLIB - - - /*************************************************************************/ - /* */ - /* ZLib library selection */ - /* */ - /* This macro is only used when FT_CONFIG_OPTION_USE_ZLIB is defined. */ - /* It allows FreeType's `ftgzip' component to link to the system's */ - /* installation of the ZLib library. This is useful on systems like */ - /* Unix or VMS where it generally is already available. */ - /* */ - /* If you let it undefined, the component will use its own copy */ - /* of the zlib sources instead. These have been modified to be */ - /* included directly within the component and *not* export external */ - /* function names. This allows you to link any program with FreeType */ - /* _and_ ZLib without linking conflicts. */ - /* */ - /* Do not #undef this macro here since the build system might define */ - /* it for certain configurations only. */ - /* */ -/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */ - - - /*************************************************************************/ - /* */ - /* DLL export compilation */ - /* */ - /* When compiling FreeType as a DLL, some systems/compilers need a */ - /* special keyword in front OR after the return type of function */ - /* declarations. */ - /* */ - /* Two macros are used within the FreeType source code to define */ - /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ - /* */ - /* FT_EXPORT( return_type ) */ - /* */ - /* is used in a function declaration, as in */ - /* */ - /* FT_EXPORT( FT_Error ) */ - /* FT_Init_FreeType( FT_Library* alibrary ); */ - /* */ - /* */ - /* FT_EXPORT_DEF( return_type ) */ - /* */ - /* is used in a function definition, as in */ - /* */ - /* FT_EXPORT_DEF( FT_Error ) */ - /* FT_Init_FreeType( FT_Library* alibrary ) */ - /* { */ - /* ... some code ... */ - /* return FT_Err_Ok; */ - /* } */ - /* */ - /* You can provide your own implementation of FT_EXPORT and */ - /* FT_EXPORT_DEF here if you want. If you leave them undefined, they */ - /* will be later automatically defined as `extern return_type' to */ - /* allow normal compilation. */ - /* */ - /* Do not #undef these macros here since the build system might define */ - /* them for certain configurations only. */ - /* */ -/* #define FT_EXPORT(x) extern x */ -/* #define FT_EXPORT_DEF(x) x */ - - - /*************************************************************************/ - /* */ - /* Glyph Postscript Names handling */ - /* */ - /* By default, FreeType 2 is compiled with the `PSNames' module. This */ - /* module is in charge of converting a glyph name string into a */ - /* Unicode value, or return a Macintosh standard glyph name for the */ - /* use with the TrueType `post' table. */ - /* */ - /* Undefine this macro if you do not want `PSNames' compiled in your */ - /* build of FreeType. This has the following effects: */ - /* */ - /* - The TrueType driver will provide its own set of glyph names, */ - /* if you build it to support postscript names in the TrueType */ - /* `post' table. */ - /* */ - /* - The Type 1 driver will not be able to synthetize a Unicode */ - /* charmap out of the glyphs found in the fonts. */ - /* */ - /* You would normally undefine this configuration macro when building */ - /* a version of FreeType that doesn't contain a Type 1 or CFF driver. */ - /* */ -#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES - - - /*************************************************************************/ - /* */ - /* Postscript Names to Unicode Values support */ - /* */ - /* By default, FreeType 2 is built with the `PSNames' module compiled */ - /* in. Among other things, the module is used to convert a glyph name */ - /* into a Unicode value. This is especially useful in order to */ - /* synthetize on the fly a Unicode charmap from the CFF/Type 1 driver */ - /* through a big table named the `Adobe Glyph List' (AGL). */ - /* */ - /* Undefine this macro if you do not want the Adobe Glyph List */ - /* compiled in your `PSNames' module. The Type 1 driver will not be */ - /* able to synthetize a Unicode charmap out of the glyphs found in the */ - /* fonts. */ - /* */ -#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST - - - /*************************************************************************/ - /* */ - /* Support for Mac fonts */ - /* */ - /* Define this macro if you want support for outline fonts in Mac */ - /* format (mac dfont, mac resource, macbinary containing a mac */ - /* resource) on non-Mac platforms. */ - /* */ - /* Note that the `FOND' resource isn't checked. */ - /* */ -#define FT_CONFIG_OPTION_MAC_FONTS - - - /*************************************************************************/ - /* */ - /* Guessing methods to access embedded resource forks */ - /* */ - /* Enable extra Mac fonts support on non-Mac platforms (e.g. */ - /* GNU/Linux). */ - /* */ - /* Resource forks which include fonts data are stored sometimes in */ - /* locations which users or developers don't expected. In some cases, */ - /* resource forks start with some offset from the head of a file. In */ - /* other cases, the actual resource fork is stored in file different */ - /* from what the user specifies. If this option is activated, */ - /* FreeType tries to guess whether such offsets or different file */ - /* names must be used. */ - /* */ - /* Note that normal, direct access of resource forks is controlled via */ - /* the FT_CONFIG_OPTION_MAC_FONTS option. */ - /* */ -#ifdef FT_CONFIG_OPTION_MAC_FONTS -#define FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK -#endif - - - /*************************************************************************/ - /* */ - /* Allow the use of FT_Incremental_Interface to load typefaces that */ - /* contain no glyph data, but supply it via a callback function. */ - /* This allows FreeType to be used with the PostScript language, using */ - /* the GhostScript interpreter. */ - /* */ -/* #define FT_CONFIG_OPTION_INCREMENTAL */ - - - /*************************************************************************/ - /* */ - /* The size in bytes of the render pool used by the scan-line converter */ - /* to do all of its work. */ - /* */ - /* This must be greater than 4KByte. */ - /* */ -#define FT_RENDER_POOL_SIZE 16384L - - - /*************************************************************************/ - /* */ - /* FT_MAX_MODULES */ - /* */ - /* The maximum number of modules that can be registered in a single */ - /* FreeType library object. 32 is the default. */ - /* */ -#define FT_MAX_MODULES 32 - - - /*************************************************************************/ - /* */ - /* Debug level */ - /* */ - /* FreeType can be compiled in debug or trace mode. In debug mode, */ - /* errors are reported through the `ftdebug' component. In trace */ - /* mode, additional messages are sent to the standard output during */ - /* execution. */ - /* */ - /* Define FT_DEBUG_LEVEL_ERROR to build the library in debug mode. */ - /* Define FT_DEBUG_LEVEL_TRACE to build it in trace mode. */ - /* */ - /* Don't define any of these macros to compile in `release' mode! */ - /* */ - /* Do not #undef these macros here since the build system might define */ - /* them for certain configurations only. */ - /* */ -/* #define FT_DEBUG_LEVEL_ERROR */ -/* #define FT_DEBUG_LEVEL_TRACE */ - - - /*************************************************************************/ - /* */ - /* Memory Debugging */ - /* */ - /* FreeType now comes with an integrated memory debugger that is */ - /* capable of detecting simple errors like memory leaks or double */ - /* deletes. To compile it within your build of the library, you */ - /* should define FT_DEBUG_MEMORY here. */ - /* */ - /* Note that the memory debugger is only activated at runtime when */ - /* when the _environment_ variable "FT2_DEBUG_MEMORY" is defined also! */ - /* */ - /* Do not #undef this macro here since the build system might define */ - /* it for certain configurations only. */ - /* */ -/* #define FT_DEBUG_MEMORY */ - - - /*************************************************************************/ - /* */ - /* Module errors */ - /* */ - /* If this macro is set (which is _not_ the default), the higher byte */ - /* of an error code gives the module in which the error has occurred, */ - /* while the lower byte is the real error code. */ - /* */ - /* Setting this macro makes sense for debugging purposes only, since */ - /* it would break source compatibility of certain programs that use */ - /* FreeType 2. */ - /* */ - /* More details can be found in the files ftmoderr.h and fterrors.h. */ - /* */ -#undef FT_CONFIG_OPTION_USE_MODULE_ERRORS - - - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** S F N T D R I V E R C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_EMBEDDED_BITMAPS if you want to support */ - /* embedded bitmaps in all formats using the SFNT module (namely */ - /* TrueType & OpenType). */ - /* */ -#define TT_CONFIG_OPTION_EMBEDDED_BITMAPS - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_POSTSCRIPT_NAMES if you want to be able to */ - /* load and enumerate the glyph Postscript names in a TrueType or */ - /* OpenType file. */ - /* */ - /* Note that when you do not compile the `PSNames' module by undefining */ - /* the above FT_CONFIG_OPTION_POSTSCRIPT_NAMES, the `sfnt' module will */ - /* contain additional code used to read the PS Names table from a font. */ - /* */ - /* (By default, the module uses `PSNames' to extract glyph names.) */ - /* */ -#define TT_CONFIG_OPTION_POSTSCRIPT_NAMES - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_SFNT_NAMES if your applications need to */ - /* access the internal name table in a SFNT-based format like TrueType */ - /* or OpenType. The name table contains various strings used to */ - /* describe the font, like family name, copyright, version, etc. It */ - /* does not contain any glyph name though. */ - /* */ - /* Accessing SFNT names is done through the functions declared in */ - /* `freetype/ftnames.h'. */ - /* */ -#define TT_CONFIG_OPTION_SFNT_NAMES - - - /*************************************************************************/ - /* */ - /* TrueType CMap support */ - /* */ - /* Here you can fine-tune which TrueType CMap table format shall be */ - /* supported. */ -#define TT_CONFIG_CMAP_FORMAT_0 -#define TT_CONFIG_CMAP_FORMAT_2 -#define TT_CONFIG_CMAP_FORMAT_4 -#define TT_CONFIG_CMAP_FORMAT_6 -#define TT_CONFIG_CMAP_FORMAT_8 -#define TT_CONFIG_CMAP_FORMAT_10 -#define TT_CONFIG_CMAP_FORMAT_12 - - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** T R U E T Y P E D R I V E R C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_BYTECODE_INTERPRETER if you want to compile */ - /* a bytecode interpreter in the TrueType driver. Note that there are */ - /* important patent issues related to the use of the interpreter. */ - /* */ - /* By undefining this, you will only compile the code necessary to load */ - /* TrueType glyphs without hinting. */ - /* */ - /* Do not #undef this macro here, since the build system might */ - /* define it for certain configurations only. */ - /* */ -/* #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_UNPATENTED_HINTING (in addition to */ - /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER) to compile the unpatented */ - /* work-around hinting system. Note that for the moment, the algorithm */ - /* is only used when selected at runtime through the parameter tag */ - /* FT_PARAM_TAG_UNPATENTED_HINTING; or when the debug hook */ - /* FT_DEBUG_HOOK_UNPATENTED_HINTING is globally actived */ - /* */ -#define TT_CONFIG_OPTION_UNPATENTED_HINTING - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_INTERPRETER_SWITCH to compile the TrueType */ - /* bytecode interpreter with a huge switch statement, rather than a call */ - /* table. This results in smaller and faster code for a number of */ - /* architectures. */ - /* */ - /* Note however that on some compiler/processor combinations, undefining */ - /* this macro will generate faster, though larger, code. */ - /* */ -#define TT_CONFIG_OPTION_INTERPRETER_SWITCH - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED to compile the */ - /* TrueType glyph loader to use Apple's definition of how to handle */ - /* component offsets in composite glyphs. */ - /* */ - /* Apple and MS disagree on the default behavior of component offsets */ - /* in composites. Apple says that they should be scaled by the scale */ - /* factors in the transformation matrix (roughly, it's more complex) */ - /* while MS says they should not. OpenType defines two bits in the */ - /* composite flags array which can be used to disambiguate, but old */ - /* fonts will not have them. */ - /* */ - /* http://partners.adobe.com/asn/developer/opentype/glyf.html */ - /* http://fonts.apple.com/TTRefMan/RM06/Chap6glyf.html */ - /* */ -#undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED - - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** T Y P E 1 D R I V E R C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* T1_MAX_DICT_DEPTH is the maximal depth of nest dictionaries and */ - /* arrays in the Type 1 stream (see t1load.c). A minimum of 4 is */ - /* required. */ - /* */ -#define T1_MAX_DICT_DEPTH 5 - - - /*************************************************************************/ - /* */ - /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */ - /* calls during glyph loading. */ - /* */ -#define T1_MAX_SUBRS_CALLS 16 - - - /*************************************************************************/ - /* */ - /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */ - /* minimum of 16 is required. */ - /* */ - /* The Chinese font MingTiEG-Medium (CNS 11643 character set) needs 256. */ - /* */ -#define T1_MAX_CHARSTRINGS_OPERANDS 256 - - - /*************************************************************************/ - /* */ - /* Define this configuration macro if you want to prevent the */ - /* compilation of `t1afm', which is in charge of reading Type 1 AFM */ - /* files into an existing face. Note that if set, the T1 driver will be */ - /* unable to produce kerning distances. */ - /* */ -#undef T1_CONFIG_OPTION_NO_AFM - - - /*************************************************************************/ - /* */ - /* Define this configuration macro if you want to prevent the */ - /* compilation of the Multiple Masters font support in the Type 1 */ - /* driver. */ - /* */ -#undef T1_CONFIG_OPTION_NO_MM_SUPPORT - - /* */ - -/* - * The FT_CONFIG_OPTION_CHESTER_XXXX macros are used to toggle some recent - * improvements to the auto-hinter contributed by David Chester. They will - * most likely disappear completely in the next release. For now, you - * should always keep them defined. - * - */ -#define FT_CONFIG_OPTION_CHESTER_HINTS - -#ifdef FT_CONFIG_OPTION_CHESTER_HINTS - -#define FT_CONFIG_CHESTER_SMALL_F -#define FT_CONFIG_CHESTER_ASCENDER -#define FT_CONFIG_CHESTER_SERIF -#define FT_CONFIG_CHESTER_STEM -#define FT_CONFIG_CHESTER_BLUE_SCALE - -#endif /* FT_CONFIG_OPTION_CHESTER_HINTS */ - -FT_END_HEADER - - -#endif /* __FTOPTION_H__ */ - - -/* END */ diff --git a/nx-X11/lib/font/FreeType/module/ftstdlib.h b/nx-X11/lib/font/FreeType/module/ftstdlib.h deleted file mode 100644 index 3d5b7fc76..000000000 --- a/nx-X11/lib/font/FreeType/module/ftstdlib.h +++ /dev/null @@ -1,113 +0,0 @@ -/* ftstdlib.h -- modified for XFree86. */ -/* $XFree86: xc/lib/font/FreeType/ftstdlib.h,v 1.5 2003/02/22 06:00:36 dawes Exp $ */ - -#ifndef __FTSTDLIB_H__ -#define __FTSTDLIB_H__ - -#ifndef FONTMODULE - -#include <limits.h> - -#define FT_UINT_MAX UINT_MAX -#define FT_ULONG_MAX ULONG_MAX - -#include <ctype.h> - -#define ft_isalnum isalnum -#define ft_isupper isupper -#define ft_islower islower -#define ft_isdigit isdigit -#define ft_isxdigit isxdigit - - -#include <string.h> - -#define ft_strlen strlen -#define ft_strcat strcat -#define ft_strcmp strcmp -#define ft_strncmp strncmp -#define ft_memcpy memcpy -#define ft_strcpy strcpy -#define ft_strncpy strncpy -#define ft_memset memset -#define ft_memmove memmove -#define ft_memcmp memcmp - -#include <stdio.h> - -#define ft_sprintf sprintf - -#include <stdlib.h> - -#define ft_qsort qsort -#define ft_exit exit - -#define ft_atoi atoi - -#include <setjmp.h> - -#define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */ - /* jmp_buf is defined as a macro */ - /* on certain platforms */ - -#define ft_setjmp setjmp /* same thing here */ -#define ft_longjmp longjmp /* " */ - - -#else - -#include "Xmd.h" -#define _XTYPEDEF_BOOL -#include "Xdefs.h" -#define DONT_DEFINE_WRAPPERS -#define DEFINE_SETJMP_WRAPPERS -#include "xf86_ansic.h" -#undef DONT_DEFINE_WRAPPERS - -#ifndef offsetof -#define offsetof(TYPE, MEMBER) ((xf86size_t)&((TYPE*)0)->MEMBER) -#endif - -#define FT_UINT_MAX 4294967295U -#ifdef LONG64 -#define FT_ULONG_MAX 18446744073709551615UL -#else -#define FT_ULONG_MAX 4294967295UL -#endif - -#define ft_isalnum xf86isalnum -#define ft_isupper xf86isupper -#define ft_islower xf86islower -#define ft_xdigit xf86isxdigit - -#define ft_strlen xf86strlen -#define ft_strcmp xf86strcmp -#define ft_strncmp xf86strncmp -#define ft_memcpy xf86memcpy -#define ft_strcpy xf86strcpy -#define ft_strncpy xf86strncpy -#define ft_memset xf86memset -#define ft_memmove xf86memmove -#define ft_memcmp xf86memcmp - -#define ft_sprintf xf86sprintf - -#define ft_qsort xf86qsort -#define ft_exit xf86exit - -#define ft_atoi xf86atoi - -#define ft_jmp_buf jmp_buf -#define ft_setjmp setjmp -#define ft_longjmp longjmp - -#endif /* FONTMODULE */ - - -#include <stdarg.h> - - -#endif /* __FTSTDLIB_H__ */ - - -/* END */ diff --git a/nx-X11/lib/font/FreeType/module/fttypes.h b/nx-X11/lib/font/FreeType/module/fttypes.h deleted file mode 100644 index 82bb273e4..000000000 --- a/nx-X11/lib/font/FreeType/module/fttypes.h +++ /dev/null @@ -1,571 +0,0 @@ -/***************************************************************************/ -/* */ -/* fttypes.h */ -/* */ -/* FreeType simple types definitions (specification only). */ -/* */ -/* Copyright 1996-2001 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* Modified for XFree86. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ -/* $XFree86: xc/lib/font/FreeType/fttypes.h,v 1.4 2003/05/29 03:05:08 dawes Exp $ */ - -#ifndef __FTTYPES_H__ -#define __FTTYPES_H__ - - -#include <ft2build.h> -#include FT_CONFIG_CONFIG_H -#include FT_SYSTEM_H -#include FT_IMAGE_H - -#ifndef FONTMODULE -#include <stddef.h> -#else -#include "Xmd.h" -#define _XTYPEDEF_BOOL -#include "Xdefs.h" -#include "xf86_ansic.h" -#ifndef size_t -#define DONT_DEFINE_WRAPPERS -#define size_t xf86size_t -#undef DONT_DEFINE_WRAPPERS -#endif -#endif - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* basic_types */ - /* */ - /* <Title> */ - /* Basic Data Types */ - /* */ - /* <Abstract> */ - /* The basic data types defined by the library. */ - /* */ - /* <Description> */ - /* This section contains the basic data types defined by FreeType 2, */ - /* ranging from simple scalar types to bitmap descriptors. More */ - /* font-specific structures are defined in a different section. */ - /* */ - /* <Order> */ - /* FT_Byte */ - /* FT_Char */ - /* FT_Int */ - /* FT_UInt */ - /* FT_Short */ - /* FT_UShort */ - /* FT_Long */ - /* FT_ULong */ - /* FT_Bool */ - /* FT_Offset */ - /* FT_PtrDist */ - /* FT_String */ - /* FT_Error */ - /* FT_Fixed */ - /* FT_Pointer */ - /* FT_Pos */ - /* FT_Vector */ - /* FT_BBox */ - /* FT_Matrix */ - /* FT_FWord */ - /* FT_UFWord */ - /* FT_F2Dot14 */ - /* FT_UnitVector */ - /* FT_F26Dot6 */ - /* */ - /* */ - /* FT_Generic */ - /* FT_Generic_Finalizer */ - /* */ - /* FT_Bitmap */ - /* FT_Pixel_Mode */ - /* FT_Palette_Mode */ - /* FT_Glyph_Format */ - /* FT_IMAGE_TAG */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Bool */ - /* */ - /* <Description> */ - /* A typedef of unsigned char, used for simple booleans. */ - /* */ - typedef unsigned char FT_Bool; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_FWord */ - /* */ - /* <Description> */ - /* A signed 16-bit integer used to store a distance in original font */ - /* units. */ - /* */ - typedef signed short FT_FWord; /* distance in FUnits */ - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_UFWord */ - /* */ - /* <Description> */ - /* An unsigned 16-bit integer used to store a distance in original */ - /* font units. */ - /* */ - typedef unsigned short FT_UFWord; /* unsigned distance */ - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Char */ - /* */ - /* <Description> */ - /* A simple typedef for the _signed_ char type. */ - /* */ - typedef signed char FT_Char; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Byte */ - /* */ - /* <Description> */ - /* A simple typedef for the _unsigned_ char type. */ - /* */ - typedef unsigned char FT_Byte; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_String */ - /* */ - /* <Description> */ - /* A simple typedef for the char type, usually used for strings. */ - /* */ - typedef char FT_String; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Short */ - /* */ - /* <Description> */ - /* A typedef for signed short. */ - /* */ - typedef signed short FT_Short; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_UShort */ - /* */ - /* <Description> */ - /* A typedef for unsigned short. */ - /* */ - typedef unsigned short FT_UShort; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Int */ - /* */ - /* <Description> */ - /* A typedef for the int type. */ - /* */ - typedef int FT_Int; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_UInt */ - /* */ - /* <Description> */ - /* A typedef for the unsigned int type. */ - /* */ - typedef unsigned int FT_UInt; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Long */ - /* */ - /* <Description> */ - /* A typedef for signed long. */ - /* */ - typedef signed long FT_Long; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_ULong */ - /* */ - /* <Description> */ - /* A typedef for unsigned long. */ - /* */ - typedef unsigned long FT_ULong; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_F2Dot14 */ - /* */ - /* <Description> */ - /* A signed 2.14 fixed float type used for unit vectors. */ - /* */ - typedef signed short FT_F2Dot14; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_F26Dot6 */ - /* */ - /* <Description> */ - /* A signed 26.6 fixed float type used for vectorial pixel */ - /* coordinates. */ - /* */ - typedef signed long FT_F26Dot6; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Fixed */ - /* */ - /* <Description> */ - /* This type is used to store 16.16 fixed float values, like scales */ - /* or matrix coefficients. */ - /* */ - typedef signed long FT_Fixed; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Error */ - /* */ - /* <Description> */ - /* The FreeType error code type. A value of 0 is always interpreted */ - /* as a successful operation. */ - /* */ - typedef int FT_Error; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Pointer */ - /* */ - /* <Description> */ - /* A simple typedef for a typeless pointer. */ - /* */ - typedef void* FT_Pointer; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Offset */ - /* */ - /* <Description> */ - /* This is equivalent to the ANSI C `size_t' type, i.e. the largest */ - /* _unsigned_ integer type used to express a file size or position, */ - /* or a memory block size. */ - /* */ - typedef size_t FT_Offset; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_PtrDist */ - /* */ - /* <Description> */ - /* This is equivalent to the ANSI C `ptrdiff_t' type, i.e. the */ - /* largest _signed_ integer type used to express the distance */ - /* between two pointers. */ - /* */ - typedef size_t FT_PtrDist; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_UnitVector */ - /* */ - /* <Description> */ - /* A simple structure used to store a 2D vector unit vector. Uses */ - /* FT_F2Dot14 types. */ - /* */ - /* <Fields> */ - /* x :: Horizontal coordinate. */ - /* */ - /* y :: Vertical coordinate. */ - /* */ - typedef struct FT_UnitVector_ - { - FT_F2Dot14 x; - FT_F2Dot14 y; - - } FT_UnitVector; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Matrix */ - /* */ - /* <Description> */ - /* A simple structure used to store a 2x2 matrix. Coefficients are */ - /* in 16.16 fixed float format. The computation performed is: */ - /* */ - /* { */ - /* x' = x*xx + y*xy */ - /* y' = x*yx + y*yy */ - /* } */ - /* */ - /* <Fields> */ - /* xx :: Matrix coefficient. */ - /* */ - /* xy :: Matrix coefficient. */ - /* */ - /* yx :: Matrix coefficient. */ - /* */ - /* yy :: Matrix coefficient. */ - /* */ - typedef struct FT_Matrix_ - { - FT_Fixed xx, xy; - FT_Fixed yx, yy; - - } FT_Matrix; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Data */ - /* */ - /* <Description> */ - /* Read-only binary data represented as a pointer and a length. */ - /* */ - /* <Fields> */ - /* pointer :: The data. */ - /* */ - /* length :: The length of the data in bytes. */ - /* */ - typedef struct FT_Data_ - { - const FT_Byte* pointer; - FT_Int length; - - } FT_Data; - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Generic_Finalizer */ - /* */ - /* <Description> */ - /* Describes a function used to destroy the `client' data of any */ - /* FreeType object. See the description of the FT_Generic type for */ - /* details of usage. */ - /* */ - /* <Input> */ - /* The address of the FreeType object which is under finalization. */ - /* Its client data is accessed through its `generic' field. */ - /* */ - typedef void (*FT_Generic_Finalizer)(void* object); - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Generic */ - /* */ - /* <Description> */ - /* Client applications often need to associate their own data to a */ - /* variety of FreeType core objects. For example, a text layout API */ - /* might want to associate a glyph cache to a given size object. */ - /* */ - /* Most FreeType object contains a `generic' field, of type */ - /* FT_Generic, which usage is left to client applications and font */ - /* servers. */ - /* */ - /* It can be used to store a pointer to client-specific data, as well */ - /* as the address of a `finalizer' function, which will be called by */ - /* FreeType when the object is destroyed (for example, the previous */ - /* client example would put the address of the glyph cache destructor */ - /* in the `finalizer' field). */ - /* */ - /* <Fields> */ - /* data :: A typeless pointer to any client-specified data. This */ - /* field is completely ignored by the FreeType library. */ - /* */ - /* finalizer :: A pointer to a `generic finalizer' function, which */ - /* will be called when the object is destroyed. If this */ - /* field is set to NULL, no code will be called. */ - /* */ - typedef struct FT_Generic_ - { - void* data; - FT_Generic_Finalizer finalizer; - - } FT_Generic; - - - /*************************************************************************/ - /* */ - /* <Macro> */ - /* FT_MAKE_TAG */ - /* */ - /* <Description> */ - /* This macro converts four letter tags which are used to label */ - /* TrueType tables into an unsigned long to be used within FreeType. */ - /* */ - /* <Note> */ - /* The produced values *must* be 32bit integers. Don't redefine this */ - /* macro. */ - /* */ -#define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \ - ( ( (FT_ULong)_x1 << 24 ) | \ - ( (FT_ULong)_x2 << 16 ) | \ - ( (FT_ULong)_x3 << 8 ) | \ - (FT_ULong)_x4 ) - - - /*************************************************************************/ - /*************************************************************************/ - /* */ - /* L I S T M A N A G E M E N T */ - /* */ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Section> */ - /* list_processing */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_ListNode */ - /* */ - /* <Description> */ - /* Many elements and objects in FreeType are listed through a */ - /* FT_List record (see FT_ListRec). As its name suggests, a */ - /* FT_ListNode is a handle to a single list element. */ - /* */ - typedef struct FT_ListNodeRec_* FT_ListNode; - - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_List */ - /* */ - /* <Description> */ - /* A handle to a list record (see FT_ListRec). */ - /* */ - typedef struct FT_ListRec_* FT_List; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_ListNodeRec */ - /* */ - /* <Description> */ - /* A structure used to hold a single list element. */ - /* */ - /* <Fields> */ - /* prev :: The previous element in the list. NULL if first. */ - /* */ - /* next :: The next element in the list. NULL if last. */ - /* */ - /* data :: A typeless pointer to the listed object. */ - /* */ - typedef struct FT_ListNodeRec_ - { - FT_ListNode prev; - FT_ListNode next; - void* data; - - } FT_ListNodeRec; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_ListRec */ - /* */ - /* <Description> */ - /* A structure used to hold a simple doubly-linked list. These are */ - /* used in many parts of FreeType. */ - /* */ - /* <Fields> */ - /* head :: The head (first element) of doubly-linked list. */ - /* */ - /* tail :: The tail (last element) of doubly-linked list. */ - /* */ - typedef struct FT_ListRec_ - { - FT_ListNode head; - FT_ListNode tail; - - } FT_ListRec; - - - /* */ - -#define FT_IS_EMPTY( list ) ( (list).head == 0 ) - - /* return base error code (without module-specific prefix) */ -#define FT_ERROR_BASE( x ) ( (x) & 0xFF ) - - /* return module error code */ -#define FT_ERROR_MODULE( x ) ( (x) & 0xFF00U ) - -#define FT_BOOL( x ) ( (FT_Bool)( x ) ) - -FT_END_HEADER - -#endif /* __FTTYPES_H__ */ - - -/* END */ diff --git a/nx-X11/lib/font/FreeType/module/myftstdlib.h b/nx-X11/lib/font/FreeType/module/myftstdlib.h deleted file mode 100644 index dc9f8658f..000000000 --- a/nx-X11/lib/font/FreeType/module/myftstdlib.h +++ /dev/null @@ -1,82 +0,0 @@ -/* ftstdlib.h -- modified for XFree86. */ -/* $XFree86: xc/lib/font/FreeType/ftstdlib.h,v 1.5 2003/02/22 06:00:36 dawes Exp $ */ -#ifndef __MYFTSTDLIB_H__ -#define __MYFTSTDLIB_H__ - - -#ifndef FONTMODULE - -# include <ftstdlib.h> -# ifndef ft_isdigit -# define ft_isdigit isdigit -# endif - -#else - -#ifndef __FTSTDLIB_H__ -#define __FTSTDLIB_H__ -/* we don't include limits.h */ -#define CHAR_BIT 8 - -#include "Xmd.h" -#define _XTYPEDEF_BOOL -#include "Xdefs.h" -#define DONT_DEFINE_WRAPPERS -#define DEFINE_SETJMP_WRAPPERS -#include "xf86_ansic.h" -#undef DONT_DEFINE_WRAPPERS - -#ifndef offsetof -#define offsetof(TYPE, MEMBER) ((xf86size_t)&((TYPE*)0)->MEMBER) -#endif - -#define FT_UINT_MAX 4294967295U -#ifdef LONG64 -#define FT_ULONG_MAX 18446744073709551615UL -#else -#define FT_ULONG_MAX 4294967295UL -#endif - -#define ft_isalnum xf86isalnum -#define ft_isupper xf86isupper -#define ft_islower xf86islower -#define ft_isxdigit xf86isxdigit -/* works around a bug in freetype 2.1.8 */ -#ifndef isdigit -#define isdigit xf86isdigit -#endif -#define ft_isdigit xf86isdigit - -#define ft_strlen xf86strlen -#define ft_strcat xf86strcat -#define ft_strrchr xf86strrchr -#define ft_strcmp xf86strcmp -#define ft_strncmp xf86strncmp -#define ft_memcpy xf86memcpy -#define ft_strcpy xf86strcpy -#define ft_strncpy xf86strncpy -#define ft_memset xf86memset -#define ft_memmove xf86memmove -#define ft_memcmp xf86memcmp - -#define ft_sprintf xf86sprintf - -#define ft_qsort xf86qsort -#define ft_exit xf86exit - -#define ft_atoi xf86atoi - -#define ft_jmp_buf jmp_buf -#define ft_setjmp setjmp -#define ft_longjmp longjmp - -#endif /* __FTSTDLIB_H__ */ -#endif /* FONTMODULE */ - - -#include <stdarg.h> - -#endif /* __MYFTSTDLIB_H__ */ - - -/* END */ diff --git a/nx-X11/lib/font/FreeType/xttcap.c b/nx-X11/lib/font/FreeType/xttcap.c deleted file mode 100644 index 2040c1612..000000000 --- a/nx-X11/lib/font/FreeType/xttcap.c +++ /dev/null @@ -1,809 +0,0 @@ -/* ===EmacsMode: -*- Mode: C; tab-width:4; c-basic-offset: 4; -*- === */ -/* ===FileName: === - Copyright (c) 1998 Takuya SHIOZAKI, All Rights reserved. - Copyright (c) 1998 X-TrueType Server Project, All rights reserved. - Copyright (c) 2003 After X-TT Project, All rights reserved. - -===Notice - 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. - - Major Release ID: X-TrueType Server Version 1.4 [Charles's Wain Release 0] - -Notice=== - */ -/* $XFree86: xc/lib/font/FreeType/xttcap.c,v 1.1 2003/10/19 18:53:50 dawes Exp $ */ - -/* -#include "xttversion.h" - -static char const * const releaseID = - _XTT_RELEASE_NAME; -*/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <X11/fonts/fontmisc.h> -#ifndef FONTMODULE -#include <string.h> -#include <ctype.h> -#include <math.h> -#else -#include "Xmd.h" -#include "Xdefs.h" -#include "xf86_ansic.h" -#endif -/* -#include <X11/X.h> -#include <X11/Xmd.h> -#include <X11/Xfuncproto.h> -#include "xf86Module.h" -#include "xf86_ansic.h" -*/ - -#ifndef True -#define True (-1) -#endif /* True */ -#ifndef False -#define False (0) -#endif /* False */ - -#include "xttcap.h" - -#if 0 -/* - Prototypes for obsoleted OS (e.g. SunOS4) - */ - -#if (defined(sun) && !(defined(SVR4) || defined(__SVR4))) -double strtod(char *str, char **ptr); -double strtol(char *str, char **ptr, int base); -#endif -#endif - - -/************************************************************************** - Private Data Types - */ - -/* Property Record List */ -/* List Node */ -typedef struct TagSPropRecValListNodeP -{ - SPropRecValContainerEntityP containerE; - struct TagSPropRecValListNodeP *nextNode; -} SPropRecValListNodeP; - - -/************************************************************************** - Tables - */ - -/* valid record field */ -static SPropertyRecord const validRecords[] = -{ - { "FontFile", eRecTypeString }, - { "FaceNumber", eRecTypeString }, - { "AutoItalic", eRecTypeDouble }, - { "DoubleStrike", eRecTypeString }, - { "FontProperties", eRecTypeBool }, - { "ForceSpacing", eRecTypeString }, - { "ScaleBBoxWidth", eRecTypeString }, - { "ScaleWidth", eRecTypeDouble }, - { "EncodingOptions", eRecTypeString }, - { "Hinting", eRecTypeBool }, - { "VeryLazyMetrics", eRecTypeBool }, - { "CodeRange", eRecTypeString }, - { "EmbeddedBitmap", eRecTypeString }, - { "VeryLazyBitmapWidthScale", eRecTypeDouble }, - { "ForceConstantSpacingCodeRange", eRecTypeString }, - { "ForceConstantSpacingMetrics", eRecTypeString }, - { "Dummy", eRecTypeVoid } -}; -static int const -numOfValidRecords = sizeof(validRecords)/sizeof(validRecords[0]); - -/* correspondence between record name and cap variable name */ -static struct { - char const * capVariable; - char const * recordName; -} const correspondRelations[] = { - { "fn", "FaceNumber" }, - { "ai", "AutoItalic" }, - { "ds", "DoubleStrike" }, - { "fp", "FontProperties" }, - { "fs", "ForceSpacing" }, - { "bw", "ScaleBBoxWidth" }, - { "sw", "ScaleWidth" }, - { "eo", "EncodingOptions" }, - { "vl", "VeryLazyMetrics" }, - { "bs", "VeryLazyBitmapWidthScale" }, - { "cr", "CodeRange" }, - { "eb", "EmbeddedBitmap" }, - { "hi", "Hinting" }, - { "fc", "ForceConstantSpacingCodeRange" }, - { "fm", "ForceConstantSpacingMetrics" } -}; -static int const -numOfCorrespondRelations -= sizeof(correspondRelations)/sizeof(correspondRelations[0]); - -/************************************************************************** - Functions - */ - -#ifdef USE_TTP_FILE - -#ifndef LEN_LINEBUF -#define LEN_LINEBUF 2048 -#endif /* !def LEN_LINEBUF */ - -/* get one line */ -static Bool /* True == Error, False == Success */ -get_one_line(FILE *is, char *buf) -{ - Bool result = False; - int count = 0; - Bool flHead = True; - Bool flSpace = False; - Bool flInSingleQuote = False; - Bool flInDoubleQuote = False; - Bool flBackSlash = False; - Bool flFirstElement = True; - - *buf = '\0'; - for (;;) { - int c = fgetc(is); - - if (ferror(is)) { - fprintf(stderr, "truetype font property file : read error.\n"); - result = True; - break; - } - - if (EOF == c) { - if (flInSingleQuote || flInDoubleQuote) { - fprintf(stderr, - "truetype font property file : unmatched quote.\n"); - result = True; - } - break; - } - if (flInSingleQuote) { - if ('\'' == c) { - /* end of single quoted string */ - flInSingleQuote = False; - c = -1; /* NOT extract to buffer. */ - } else - /* others, extract all character to buffer unconditionally. */ - ; - goto trans; - } - if (flBackSlash) { - /* escape --- when just before character is backslash, - next character is escaped. */ - flBackSlash = False; - if ('n' == c) - /* newline */ - c = '\n'; - if ('\n' == c) - /* ignore newline */ - c = -1; - else - /* others, extract all character to buffer unconditionally. */ - ; - goto trans; - } - if ('\\' == c) { - /* set flag to escape next character. */ - flBackSlash = True; - c = -1; /* NOT extract to buffer. */ - goto trans; - } - if (flInDoubleQuote) { - if ('"' == c) { - /* end of double quoted string */ - flInDoubleQuote = False; - c = -1; /* NOT extract to buffer. */ - } else - /* others, extract all character to buffer unconditionally. */ - ; - goto trans; - } - if ('#' == c) { - /* skip comment till end of line. */ - while ('\n' != c) { - c = fgetc(is); - if (ferror(is)) { - fprintf(stderr, - "truetype font property file : read error.\n"); - result = True; - break; - } - if (EOF == c) { - break; - } - } - break; - } - if ('\'' == c) { - /* into single quoted string */ - flInSingleQuote = True; - c = -1; /* NOT extract to buffer. */ - goto trans; - } - if ('"' == c) { - /* into double quoted string */ - flInDoubleQuote = True; - c = -1; /* NOT extract to buffer. */ - goto trans; - } - if ('\n' == c) - /* End of Line */ - break; - if (isspace(c)) { - /* convine multiple spaces */ - if (!flHead) - /* except space at the head of line */ - flSpace = True; - continue; - } - trans: - /* set flHead to False, since current character is not white space - when reaches here. */ - flHead = False; - do { - if (count>=LEN_LINEBUF-1) { - /* overflow */ - fprintf(stderr, - "truetype font property file : too long line.\n"); - result = True; - goto quit; - } - if (flSpace) { - /* just before characters is white space, but - current character is not WS. */ - if (flFirstElement) { - /* this spaces is the first cell(?) of white spaces. */ - flFirstElement = False; - /* separate record name and record value */ - *buf = (char)0xff; - } else - *buf = ' '; - flSpace = False; - } else - if (-1 != c) { - *buf = c; - c = -1; /* invalidate */ - } else - /* skip */ - buf--; - buf++; - } while (-1 != c); /* when 'c' is not -1, it means - that 'c' contains an untreated character. */ - } - *buf = '\0'; - - quit: - return result; -} - -/* parse one line */ -static Bool /* True == Error, False == Success */ -parse_one_line(SDynPropRecValList *pThisList, FILE *is) -{ - Bool result = False; - char *buf = NULL; - char *recordHead, *valueHead = NULL; - - if (NULL == (buf = xalloc(LEN_LINEBUF))) { - fprintf(stderr, - "truetype font property file : cannot allocate memory.\n"); - result = True; - goto abort; - } - { - recordHead = buf; -/* refRecordValue->refRecordType = NULL;*/ - do { - if (get_one_line(is, buf)) { - result = True; - goto quit; - } - if (feof(is)) { - if ('\0' == *buf) - goto quit; - break; - } - } while ('\0' == *buf); - - if (NULL != (valueHead = strchr(buf, 0xff))) { - *valueHead = '\0'; - valueHead++; - } else - valueHead = buf+strlen(buf); -#if 0 - fprintf(stderr, - "truetype font property file : \n" - "recName:\"%s\"\nvalue:\"%s\"\n", - recordHead, valueHead); -#endif - result = SPropRecValList_add_record(pThisList, recordHead, valueHead); - } - quit: - xfree(buf); - abort: - return result; -} - -/* Read Property File */ -Bool /* True == Error, False == Success */ -SPropRecValList_read_prop_file(SDynPropRecValList *pThisList, - char const * const strFileName) -{ - Bool result = False; - FILE *is; - -#if 1 - if (!strcmp(strFileName, "-")) - is = stdin; - else -#endif - is = fopen(strFileName, "r"); - if (NULL == is) { - fprintf(stderr, "truetype font property : cannot open file %s.\n", - strFileName); - result = True; - goto abort; - } - { - for (;;) { - if (False != (result = parse_one_line(pThisList, is))) - goto quit; - if (feof(is)) - break; - } - } - quit: -#if 1 - if (strcmp(strFileName, "-")) -#endif - fclose(is); - abort: - return result; -} -#endif /* USE_TTP_FILE */ - -/* get property record type by record name */ -static Bool /* True == Found, False == Not Found */ -get_record_type_by_name(SPropertyRecord const ** const refRefRecord, /*result*/ - char const *strName) -{ - Bool result = False; - int i; - - *refRefRecord = NULL; - for (i=0; i<numOfValidRecords; i++) { - if (!mystrcasecmp(validRecords[i].strRecordName, strName)) { - result = True; - *refRefRecord = &validRecords[i]; - break; - } - } - - return result; -} - -/* Constructor for Container Node */ -Bool /* True == Error, False == Success */ -SPropRecValList_new(SDynPropRecValList *pThisList) -{ - Bool result = False; - - pThisList->headNode = NULL; - - return result; -} - -/* Destructor for Container List */ -Bool /* True == Error, False == Success */ -SPropRecValList_delete(SDynPropRecValList *pThisList) -{ - Bool result = False; - SPropRecValListNodeP *p, *np; - - for (p=pThisList->headNode; NULL!=p; p=np) { - np = p->nextNode; - switch (p->containerE.refRecordType->recordType) { - case eRecTypeInteger: - break; - case eRecTypeDouble: - break; - case eRecTypeBool: - break; - case eRecTypeString: - if (SPropContainer_value_str(&p->containerE)) - xfree((void*)SPropContainer_value_str(&p->containerE)); - break; - case eRecTypeVoid: - break; - } - xfree(p); - } - - pThisList->headNode = NULL; - - return result; -} - -#ifdef DUMP -void -SPropRecValList_dump(SRefPropRecValList *pThisList) -{ - SPropRecValListNodeP *p; - for (p=pThisList->headNode; NULL!=p; p=p->nextNode) { - switch (p->containerE.refRecordType->recordType) { - case eRecTypeInteger: - fprintf(stderr, "%s = %d\n", - p->containerE.refRecordType->strRecordName, - p->containerE.uValue.integerValue); - break; - case eRecTypeDouble: - fprintf(stderr, "%s = %f\n", - p->containerE.refRecordType->strRecordName, - p->containerE.uValue.doubleValue); - break; - case eRecTypeBool: - fprintf(stderr, "%s = %s\n", - p->containerE.refRecordType->strRecordName, - p->containerE.uValue.boolValue - ? "True":"False"); - break; - case eRecTypeString: - fprintf(stderr, "%s = \"%s\"\n", - p->containerE.refRecordType->strRecordName, - p->containerE.uValue.dynStringValue); - break; - case eRecTypeVoid: - fprintf(stderr, "%s = void\n", - p->containerE.refRecordType->strRecordName); - break; - } - } -} -#endif - -/* Add Property Record Value */ -extern Bool /* True == Error, False == Success */ -SPropRecValList_add_record(SDynPropRecValList *pThisList, - char const * const recordName, - char const * const strValue) -{ - Bool result = False; - SPropRecValContainerEntityP tmpContainerE; - - if (get_record_type_by_name(&tmpContainerE.refRecordType, recordName)) { - switch (tmpContainerE.refRecordType->recordType) { - case eRecTypeInteger: - { - int val; - char *endPtr; - - val = strtol(strValue, &endPtr, 0); - if ('\0' != *endPtr) { - fprintf(stderr, - "truetype font property : " - "%s record needs integer value.\n", - recordName); - result = True; - goto quit; - } - SPropContainer_value_int(&tmpContainerE) = val; - } - break; - case eRecTypeDouble: - { - double val; - char *endPtr; - - val = strtod(strValue, &endPtr); - if ('\0' != *endPtr) { - fprintf(stderr, - "truetype font property : " - "%s record needs floating point value.\n", - recordName); - result = True; - goto quit; - } - SPropContainer_value_dbl(&tmpContainerE) = val; - } - break; - case eRecTypeBool: - { - Bool val; - - if (!mystrcasecmp(strValue, "yes")) - val = True; - else if (!mystrcasecmp(strValue, "y")) - val = True; - else if (!mystrcasecmp(strValue, "on")) - val = True; - else if (!mystrcasecmp(strValue, "true")) - val = True; - else if (!mystrcasecmp(strValue, "t")) - val = True; - else if (!mystrcasecmp(strValue, "ok")) - val = True; - else if (!mystrcasecmp(strValue, "no")) - val = False; - else if (!mystrcasecmp(strValue, "n")) - val = False; - else if (!mystrcasecmp(strValue, "off")) - val = False; - else if (!mystrcasecmp(strValue, "false")) - val = False; - else if (!mystrcasecmp(strValue, "f")) - val = False; - else if (!mystrcasecmp(strValue, "bad")) - val = False; - else { - fprintf(stderr, - "truetype font property : " - "%s record needs boolean value.\n", - recordName); - result = True; - goto quit; - } - SPropContainer_value_bool(&tmpContainerE) = val; - } - break; - case eRecTypeString: - { - char *p; - - if (NULL == (p = (char *)xalloc(strlen(strValue)+1))) { - fprintf(stderr, - "truetype font property : " - "cannot allocate memory.\n"); - result = True; - goto quit; - } - strcpy(p, strValue); - SPropContainer_value_str(&tmpContainerE) = p; - } - break; - case eRecTypeVoid: - if ('\0' != *strValue) { - fprintf(stderr, - "truetype font property : " - "%s record needs void.\n", recordName); - result = True; - } - break; - } - { - /* add to list */ - SPropRecValListNodeP *newNode; - - if (NULL == (newNode = - (SPropRecValListNodeP *)xalloc(sizeof(*newNode)))) { - fprintf(stderr, - "truetype font property : " - "cannot allocate memory.\n"); - result = True; - goto quit; - } - newNode->nextNode = pThisList->headNode; - newNode->containerE = tmpContainerE; - tmpContainerE.refRecordType = NULL; /* invalidate -- - disown value handle. */ - pThisList->headNode = newNode; - } - } else { - /* invalid record name */ - fprintf(stderr, - "truetype font : " - "invalid record name \"%s.\"\n", recordName); - result = True; - } - - quit: - return result; -} - - -/* Search Property Record */ -Bool /* True == Hit, False == Miss */ -SPropRecValList_search_record(SRefPropRecValList *pThisList, - SPropRecValContainer *refRecValue, - char const * const recordName) -{ - Bool result = False; - SPropRecValListNodeP *p; - - *refRecValue = NULL; - for (p=pThisList->headNode; NULL!=p; p=p->nextNode) { - if (!mystrcasecmp(p->containerE.refRecordType->strRecordName, - recordName)) { - *refRecValue = &p->containerE; - result = True; - break; - } - } - - return result; -} - - -/* Parse TTCap */ -Bool /* True == Error, False == Success */ -SPropRecValList_add_by_font_cap(SDynPropRecValList *pThisList, - char const *strCapHead) -{ - Bool result = False; - /* SPropertyRecord const *refRecordType; */ - char const *term; - - if (NULL == (term = strrchr(strCapHead, ':'))) - goto abort; - - { - /* for xfsft compatible */ - char const *p; - for (p=term-1; p>=strCapHead; p--) { - if ( ':'==*p ) { - /* - * :num:filename - * ^p ^term - */ - if ( p!=term ) { - int len = term-p-1; - char *value; - - len = term-p-1; - value=(char *)xalloc(len+1); - memcpy(value, p+1, len); - value[len]='\0'; - SPropRecValList_add_record(pThisList, - "FaceNumber", - value); - xfree(value); - term=p; - } - break; - } - if ( !isdigit(*p) ) - break; - } - } - - while (strCapHead<term) { - int i; - char const *nextColon = strchr(strCapHead, ':'); - if (0<nextColon-strCapHead) { - char *duplicated = (char *)xalloc((nextColon-strCapHead)+1); - { - char *value; - - memcpy(duplicated, strCapHead, nextColon-strCapHead); - duplicated[nextColon-strCapHead] = '\0'; - if (NULL != (value=strchr(duplicated, '='))) { - *value = '\0'; - value++; - } else - value = &duplicated[nextColon-strCapHead]; - - for (i=0; i<numOfCorrespondRelations; i++) { - if (!mystrcasecmp(correspondRelations[i].capVariable, - duplicated)) { - if (SPropRecValList_add_record(pThisList, - correspondRelations[i] - .recordName, - value)) - break; - goto next; - } - } - fprintf(stderr, "truetype font : Illegal Font Cap.\n"); - result = True; - break; - next: - ; - } - xfree(duplicated); - } - strCapHead = nextColon+1; - } - - /* quit: */ - abort: - return result; -} - - -/************************************************************************** - Functions (xttmisc) - */ - -/* compare strings, ignoring case */ -Bool /* False == equal, True == not equal */ -mystrcasecmp(char const *s1, char const *s2) -{ - Bool result = True; - -#if (defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) ||\ - defined(__bsdi__)) && !defined(FONTMODULE) - /* 4.4BSD has strcasecmp function. */ - result = strcasecmp(s1, s2) != 0; -#else - { - unsigned int len1 = strlen(s1); - - if (len1 == strlen(s2)) { - int i; - for (i=0; i<len1; i++) { - if (toupper(*s1++) != toupper(*s2++)) - goto quit; - } - result = False; - } else - /* len1 != len2 -> not equal*/ - ; - } - quit: - ; -#endif - - return result; -} - - -/* strdup clone with using the allocator of X server */ -char * -XttXstrdup(char const *str) -{ - char *result; - - result = (char *)xalloc(strlen(str)+1); - - if (result) - strcpy(result, str); - - return result; -} - - -#if 0 -int main() -{ - SDynPropRecValList list; - - SPropRecValList_new(&list); - SPropRecValList_read_prop_file(&list, "-"); - SPropRecValList_dump(&list); - SPropRecValList_delete(&list); - - return 0; -} -#endif - -/* end of file */ diff --git a/nx-X11/lib/font/FreeType/xttcap.h b/nx-X11/lib/font/FreeType/xttcap.h deleted file mode 100644 index 33c224f90..000000000 --- a/nx-X11/lib/font/FreeType/xttcap.h +++ /dev/null @@ -1,140 +0,0 @@ -/* ===EmacsMode: -*- Mode: C; tab-width:4; c-basic-offset: 4; -*- === */ -/* ===FileName: === - Copyright (c) 1998 Takuya SHIOZAKI, All Rights reserved. - Copyright (c) 1998 X-TrueType Server Project, All rights reserved. - Copyright (c) 2003 After X-TT Project, All rights reserved. - -===Notice - 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. - - Major Release ID: X-TrueType Server Version 1.3 [Aoi MATSUBARA Release 3] - -Notice=== - */ -/* $XFree86: xc/extras/X-TrueType/xttcap.h,v 1.2 2001/08/01 00:44:33 tsi Exp $ */ - -#ifndef _XTTCAP_H_ -#define _XTTCAP_H_ (1) - -#include <X11/Xdefs.h> - -/******************************************************************* - Data Types - */ - -/* Record Type */ -typedef enum -{ - eRecTypeInteger, - eRecTypeDouble, - eRecTypeBool, - eRecTypeString, - eRecTypeVoid=-1 -} ERecType; - -/* Record Name vs Record Type */ -typedef struct -{ - char const *strRecordName; - ERecType const recordType; -} SPropertyRecord; - -/* Record Value Container */ -typedef struct -{ - SPropertyRecord const *refRecordType; - union { - int integerValue; - double doubleValue; - Bool boolValue; - char *dynStringValue; - } uValue; -} SPropRecValContainerEntityP, *SPropRecValContainer; - -/* Record Value List */ -typedef struct TagSPropRecValListNodeP SPropRecValListNode; -typedef struct -{ - SPropRecValListNode *headNode; -} SDynPropRecValList; -typedef SDynPropRecValList const SRefPropRecValList; - - -/******************************************************************* - Functions - */ - -/* Constructor for Rec Val List */ -extern Bool /* True == Error, False == Success */ -SPropRecValList_new(SDynPropRecValList *pThisList); -/* Destructor for Rec Val List */ -extern Bool /* True == Error, False == Success */ -SPropRecValList_delete(SDynPropRecValList *pThisList); -/* Read Property File */ -extern Bool /* True == Error, False == Success */ -SPropRecValList_read_prop_file(SDynPropRecValList *pThisList, - char const * const strFileName); -/* Add Property Record Value */ -extern Bool /* True == Error, False == Success */ -SPropRecValList_add_record(SDynPropRecValList *pThisList, - char const * const recordName, - char const * const strValue); -/* Search Property Record */ -extern Bool /* True == Hit, False == Miss */ -SPropRecValList_search_record(SRefPropRecValList *pThisList, - SPropRecValContainer *refContRecVal, - char const * const recordName); -/* Add by Font Cap */ -extern Bool /* True == Error, False == Success */ -SPropRecValList_add_by_font_cap(SDynPropRecValList *pThisList, - char const *strCapHead); - -#ifdef DUMP -void -SPropRecValList_dump(SRefPropRecValList *refList); -#endif - -#define SPropContainer_value_int(contRecVal)\ - ((contRecVal)->uValue.integerValue) -#define SPropContainer_value_dbl(contRecVal)\ - ((contRecVal)->uValue.doubleValue) -#define SPropContainer_value_bool(contRecVal)\ - ((contRecVal)->uValue.boolValue) -#define SPropContainer_value_str(contRecVal)\ - ((contRecVal)->uValue.dynStringValue) - -/****************************************************** - Prototypes (xttmisc) - */ - -/* compare strings with ignoring case */ - /* False == equal, True == not equal */ -Bool mystrcasecmp(char const *s1, char const *s2); - -/* strdup clone */ -char * XttXstrdup(char const *str); -#undef xstrdup -#define xstrdup(s) XttXstrdup((char const*)s) - -#endif /* !def _XTTCAP_H_ */ - -/* end of file */ diff --git a/nx-X11/lib/font/include/fontenc.h b/nx-X11/lib/font/include/fontenc.h deleted file mode 100644 index 09472cfc5..000000000 --- a/nx-X11/lib/font/include/fontenc.h +++ /dev/null @@ -1,124 +0,0 @@ -/* -Copyright (c) 1998-2001 by Juliusz Chroboczek - -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 -AUTHORS OR 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. -*/ - -/* $XFree86: xc/lib/font/include/fontenc.h,v 1.7 2000/11/14 16:54:45 dawes Exp $ */ - -/* Header for backend-independent encoding code */ - -/* An encoding is identified with a name. An encoding contains some - global encoding data, such as its size, and a set of mappings. - Mappings are identified by their type and two integers, known as - pid and eid, the interpretation of which is type dependent. */ - -#ifndef _FONTENC_H -#define _FONTENC_H - -/* Encoding types. For future extensions, clients should be prepared - to ignore unknown encoding types. */ - -/* 0 is treated specially. */ - -#define FONT_ENCODING_UNICODE 1 -#define FONT_ENCODING_TRUETYPE 2 -#define FONT_ENCODING_POSTSCRIPT 3 - -/* This structure represents a mapping, either from numeric codes from - numeric codes, or from numeric codes to strings. */ - -/* It is expected that only one of `recode' and `name' will actually - be present. However, having both fields simplifies the interface - somewhat. */ - -typedef struct _FontMap { - int type; /* the type of the mapping */ - int pid, eid; /* the identification of the mapping */ - unsigned (*recode)(unsigned, void*); /* mapping function */ - char *(*name)(unsigned, void*); /* function returning glyph names */ - void *client_data; /* second parameter of the two above */ - struct _FontMap *next; /* link to next element in list */ - /* The following was added for version 0.3 of the font interface. */ - /* It should be kept at the end to preserve binary compatibility. */ - struct _FontEnc *encoding; -} FontMapRec, *FontMapPtr; - -/* This is the structure that holds all the info for one encoding. It - consists of a charset name, its size, and a linked list of mappings - like above. */ - -typedef struct _FontEnc { - char *name; /* the name of the encoding */ - char **aliases; /* its aliases, null terminated */ - int size; /* its size, either in bytes or rows */ - int row_size; /* the size of a row, or 0 if bytes */ - FontMapPtr mappings; /* linked list of mappings */ - struct _FontEnc *next; /* link to next element */ - /* the following two were added in version 0.2 of the font interface */ - /* they should be kept at the end to preserve binary compatibility */ - int first; /* first byte or row */ - int first_col; /* first column in each row */ -} FontEncRec, *FontEncPtr; - -typedef struct _FontMapReverse { - unsigned int (*reverse)(unsigned, void*); - void *data; -} FontMapReverseRec, *FontMapReversePtr; - - -/* Function prototypes */ - -/* extract an encoding name from an XLFD name. Returns a pointer to a - *static* buffer, or NULL */ -char *FontEncFromXLFD(const char*, int); - -/* find the encoding data for a given encoding name; second parameter - is the filename of the font for which the encoding is needed. - Returns NULL on failure. */ -FontEncPtr FontEncFind(const char*, const char*); - -/* Find a given mapping for an encoding. This is only a convenience - function, as clients are allowed to scavenge the data structures - themselves (as the TrueType backend does). */ - -FontMapPtr FontMapFind(FontEncPtr, int, int, int); - -/* Do both in a single step */ -FontMapPtr FontEncMapFind(const char *, int, int, int, const char *); - -/* Recode a code. Always succeeds. */ -unsigned FontEncRecode(unsigned, FontMapPtr); - -/* Return a name for a code. Returns a string or NULL. */ -char *FontEncName(unsigned, FontMapPtr); - -/* Return a pointer to the name of the system encodings directory. */ -/* This string is static and should not be modified. */ -char* FontEncDirectory(void); - -/* Identify an encoding file. If fileName doesn't exist, or is not an - encoding file, return NULL, otherwise returns a NULL-terminated - array of strings. */ -char **FontEncIdentify(const char *fileName); - -FontMapReversePtr FontMapReverse(FontMapPtr); - -void FontMapReverseFree(FontMapReversePtr); -#endif diff --git a/nx-X11/lib/fontconfig/Imakefile b/nx-X11/lib/fontconfig/Imakefile deleted file mode 100644 index 938bc3e71..000000000 --- a/nx-X11/lib/fontconfig/Imakefile +++ /dev/null @@ -1,464 +0,0 @@ -XCOMM $XdotOrg: xc/lib/fontconfig/Imakefile,v 1.6 2005/11/08 06:33:26 jkj Exp $ -XCOMM $XFree86: xc/lib/fontconfig/Imakefile,v 1.17 2003/11/19 20:57:37 dawes Exp $ - -#define DoNormalLib NormalLibFontconfig -#define DoSharedLib SharedLibFontconfig -#define DoExtraLib SharedLibFontconfig -#define DoDebugLib DebugLibFontconfig -#define DoProfileLib ProfileLibFontconfig -#define HasSharedData YES -#define LibName fontconfig -#define SoRev SOFONTCONFIGREV -#define LibInstall InstallFontconfigLibrary -#define LibHeaders InstallFontconfigLibrary - -#define IncSubdir fontconfig - -HEADERS=fcfreetype.h fcprivate.h fontconfig.h - -BuildIncludes($(HEADERS),IncSubdir,..) -#if InstallFontconfigLibrary -InstallMultipleFlags($(HEADERS),$(INCDIR)/IncSubdir,$(INSTINCFLAGS)) -#endif - -#include <Threads.tmpl> - -XCOMM Assume FreeType is at least version 2.1.8 or later -FREETYPE_DEFINES=-DHAVE_FT_GET_BDF_PROPERTY -DHAVE_FT_GET_NEXT_CHAR \ - -DHAVE_FT_GET_PS_FONT_INFO -DHAVE_FT_GET_X11_FONT_FORMAT \ - -DHAVE_FT_HAS_PS_GLYPH_NAMES - -FONTCONFIGSRC=$(TOP)/extras/fontconfig - -INCLUDES= $(EXPATINCLUDES) $(FREETYPE2INCLUDES) -I$(FONTCONFIGSRC)/src \ - -I$(FONTCONFIGSRC) -I$(XBUILDINCDIR) - -#if HasMkstemp -MKSTEMP_DEFINES=-DHAVE_MKSTEMP -#endif - -#if !defined(Win32Architecture) && !defined(OS2Architecture) -LINK_DEFINES=-DHAVE_LINK -GETUID_DEFINES=-DHAVE_GETUID -DHAVE_GETEUID -#endif - -DEFINES=-DFC_DEFAULT_FONTS='"$(FC_DEFAULT_FONTS)"' -DHAVE_EXPAT -DXFREE86_FT2 \ - -DFONTCONFIG_PATH='"$(FONTCONFIGFONTSCONFDIR)"' \ - $(MKSTEMP_DEFINES) $(FREETYPE_DEFINES) $(LINK_DEFINES) $(GETUID_DEFINES) - -REQUIREDLIBS=$(LDPRELIBS) $(FREETYPE2LIB) $(EXPATLIB) - -SRCS=fcatomic.c fcblanks.c fccache.c fccfg.c fccharset.c fcdbg.c \ - fcdefault.c fcdir.c fcfreetype.c fcfs.c fcinit.c fclang.c fclist.c \ - fcmatch.c fcmatrix.c fcname.c fcpat.c fcstr.c fcxml.c - -OBJS=fcatomic.o fcblanks.o fccache.o fccfg.o fccharset.o fcdbg.o \ - fcdefault.o fcdir.o fcfreetype.o fcfs.o fcinit.o fclang.o fclist.o \ - fcmatch.o fcmatrix.o fcname.o fcpat.o fcstr.o fcxml.o - -#include <Library.tmpl> - -#if DoSharedLib && SharedDataSeparation -SpecialCObjectRule(sharedlib,NullParameter,$(SHLIBDEF)) -#endif - -DependTarget() - -FONTCONFIG_VERSION=2.2.2 - -#ifndef FontconfigFontsConfDir -#if NothingOutsideProjectRoot -#define FontconfigFontsConfDir $(PROJECTROOT)/etc/fonts -#else -#define FontconfigFontsConfDir /etc/fonts -#endif -#endif - -FONTCONFIGFONTSCONFDIR=FontconfigFontsConfDir - -#ifdef DarwinArchitecture -MACFONTDIRS = ~/Library/Fonts /Library/Fonts /Network/Library/Fonts \ - /System/Library/Fonts -#endif - -#if NothingOutsideProjectRoot -FONTDIRS=$(FONTDIR) -#else -DEFAULTFONTDIRS=/usr/share/fonts -FONTDIRS=$(FONTDIR) $(MACFONTDIRS) -#endif - -RPATH_CFLAG = HardCodeLibdirFlag - -SUBSTVARS=prefix=$(PROJECTROOT) \ - exec_prefix=$(BINDIR) \ - libdir=$(USRLIBDIR) \ - hardcode_libdir_flag_spec=$(RPATH_CFLAG) \ - includedir=$(INCROOT) \ - VERSION=$(FONTCONFIG_VERSION) - -CONFIG_SUBST_PROG=sh ./config-subst - -#if !(HasGnuMake) -#if (defined(SunArchitecture) && defined(SVR4Architecture)) || \ - defined(SCOArchitecture) || defined(USLArchitecture) || \ - defined(UnixWareArchitecture) - XCOMM Required for the config-subst rules to work with Solaris make - SHELL=/bin/ksh -#endif -#endif - -#if InstallFontconfigLibrary -# ifndef InstallNamedTargetBackup -# define InstallNamedTargetBackup(step,srcname,flags,dest,dstname) @@\ -step:: srcname @@\ - MakeDir($(DESTDIR)dest) @@\ - MoveToBakFile($(DESTDIR)dest/dstname) @@\ - $(INSTALL) $(INSTALLFLAGS) flags srcname $(DESTDIR)dest/dstname -# endif /* InstallNamedTargetBackup */ - -# ifndef InstallNonExecFileBackup -# define InstallNonExecFileBackup(file,dest) @@\ -InstallNamedTargetBackup(install,file,$(INSTDATFLAGS),dest,file) -# endif /* InstallNonExecFileBackup */ - -InstallNonExecFileBackup(fonts.conf,$(FONTCONFIGFONTSCONFDIR)) -InstallNonExecFile(fonts.dtd,$(FONTCONFIGFONTSCONFDIR)) -#endif - -all:: fonts.conf - -fonts.conf: fonts.conf.in - RemoveFile($@) - DEFAULTFONTDIR=FC_DEFAULT_FONTS=$(DEFAULTFONTDIRS); \ - FONTDIR=FC_FONTPATH=`for i in $(FONTDIRS); \ - do echo -n '<dir>'$$i'</dir> '; done;`; \ - FONTDIRDATE=FC_FONTDATE=`date;`;\ - $(CONFIG_SUBST_PROG) "$$DEFAULTFONTDIR" "$$FONTDIR" "$$FONTDIRDATE" \ - < fonts.conf.in > $@; - -clean:: - RemoveFile(fonts.conf) - -#if SharedLibFontconfig -# if defined(Win32Architecture) || defined(OS2Architecture) -all:: fontconfig-def.cpp - -fontconfig-def.cpp: fontconfig.def.in - RemoveFile($@) - MAJ=`expr "$(SOFONTCONFIGREV)" : "\([^\.]*\)\..*"`; \ - MIN=`expr "$(SOFONTCONFIGREV)" : "[^\.]*\.\([^\.]*\)\.*.*"` || true;\ - TEEN=`expr "$(SOFONTCONFIGREV)" : "[^\.]*\.[^\.]*\.*\(.*\)"` || true;\ - CUR=LT_CURRENT=`expr $$MAJ + $$MIN`;\ - REV=LT_REVISION=$$TEEN;\ - $(CONFIG_SUBST_PROG) $$CUR $$REV < fontconfig.def.in > $@ - -clean:: - RemoveFile(fontconfig-def.cpp) -# endif -#endif - -all:: fontconfig.pc - -fontconfig.pc: fontconfig.pc.in - RemoveFile($@) - $(CONFIG_SUBST_PROG) $(SUBSTVARS) < fontconfig.pc.in > $@ - -#if InstallFontconfigLibrary -InstallNonExecFile(fontconfig.pc,$(USRLIBDIR)/pkgconfig) -#endif - -clean:: - RemoveFile(fontconfig.pc) - -/* config stuff */ -LinkSourceFile(fontconfig.pc.in,$(FONTCONFIGSRC)) -LinkSourceFile(fonts.conf.in,$(FONTCONFIGSRC)) -LinkSourceFile(fonts.dtd,$(FONTCONFIGSRC)) - -/* Source */ -LinkSourceFile(fcatomic.c,$(FONTCONFIGSRC)/src) -LinkSourceFile(fcblanks.c,$(FONTCONFIGSRC)/src) -LinkSourceFile(fccache.c,$(FONTCONFIGSRC)/src) -LinkSourceFile(fccfg.c,$(FONTCONFIGSRC)/src) -LinkSourceFile(fccharset.c,$(FONTCONFIGSRC)/src) -LinkSourceFile(fcdbg.c,$(FONTCONFIGSRC)/src) -LinkSourceFile(fcdefault.c,$(FONTCONFIGSRC)/src) -LinkSourceFile(fcdir.c,$(FONTCONFIGSRC)/src) -/* LinkSourceFile(fcfreetype.c,$(FONTCONFIGSRC)/src) - use custom copy for now */ -LinkSourceFile(fcfs.c,$(FONTCONFIGSRC)/src) -LinkSourceFile(fcinit.c,$(FONTCONFIGSRC)/src) -LinkSourceFile(fclang.c,$(FONTCONFIGSRC)/src) -LinkSourceFile(fclist.c,$(FONTCONFIGSRC)/src) -LinkSourceFile(fcmatch.c,$(FONTCONFIGSRC)/src) -LinkSourceFile(fcmatrix.c,$(FONTCONFIGSRC)/src) -LinkSourceFile(fcname.c,$(FONTCONFIGSRC)/src) -LinkSourceFile(fcpat.c,$(FONTCONFIGSRC)/src) -LinkSourceFile(fcstr.c,$(FONTCONFIGSRC)/src) -LinkSourceFile(fcxml.c,$(FONTCONFIGSRC)/src) -LinkSourceFile(fontconfig.def.in,$(FONTCONFIGSRC)/src) - -/* Public headers */ -LinkSourceFile(fcfreetype.h,$(FONTCONFIGSRC)/fontconfig) -LinkSourceFile(fcprivate.h,$(FONTCONFIGSRC)/fontconfig) -LinkSourceFile(fontconfig.h,$(FONTCONFIGSRC)/fontconfig) - -/* Man pages */ -LinkFile(FcAtomicCreate.man,$(FONTCONFIGSRC)/doc/FcAtomicCreate.3) -InstallGenManPage(FcAtomicCreate,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcAtomicDeleteNew.man,$(FONTCONFIGSRC)/doc/FcAtomicDeleteNew.3) -InstallGenManPage(FcAtomicDeleteNew,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcAtomicDestroy.man,$(FONTCONFIGSRC)/doc/FcAtomicDestroy.3) -InstallGenManPage(FcAtomicDestroy,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcAtomicLock.man,$(FONTCONFIGSRC)/doc/FcAtomicLock.3) -InstallGenManPage(FcAtomicLock,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcAtomicNewFile.man,$(FONTCONFIGSRC)/doc/FcAtomicNewFile.3) -InstallGenManPage(FcAtomicNewFile,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcAtomicOrigFile.man,$(FONTCONFIGSRC)/doc/FcAtomicOrigFile.3) -InstallGenManPage(FcAtomicOrigFile,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcAtomicReplaceOrig.man,$(FONTCONFIGSRC)/doc/FcAtomicReplaceOrig.3) -InstallGenManPage(FcAtomicReplaceOrig,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcAtomicUnlock.man,$(FONTCONFIGSRC)/doc/FcAtomicUnlock.3) -InstallGenManPage(FcAtomicUnlock,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcBlanksAdd.man,$(FONTCONFIGSRC)/doc/FcBlanksAdd.3) -InstallGenManPage(FcBlanksAdd,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcBlanksCreate.man,$(FONTCONFIGSRC)/doc/FcBlanksCreate.3) -InstallGenManPage(FcBlanksCreate,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcBlanksDestroy.man,$(FONTCONFIGSRC)/doc/FcBlanksDestroy.3) -InstallGenManPage(FcBlanksDestroy,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcBlanksIsMember.man,$(FONTCONFIGSRC)/doc/FcBlanksIsMember.3) -InstallGenManPage(FcBlanksIsMember,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcCharSetAddChar.man,$(FONTCONFIGSRC)/doc/FcCharSetAddChar.3) -InstallGenManPage(FcCharSetAddChar,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcCharSetCopy.man,$(FONTCONFIGSRC)/doc/FcCharSetCopy.3) -InstallGenManPage(FcCharSetCopy,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcCharSetCount.man,$(FONTCONFIGSRC)/doc/FcCharSetCount.3) -InstallGenManPage(FcCharSetCount,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcCharSetCreate.man,$(FONTCONFIGSRC)/doc/FcCharSetCreate.3) -InstallGenManPage(FcCharSetCreate,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcCharSetDestroy.man,$(FONTCONFIGSRC)/doc/FcCharSetDestroy.3) -InstallGenManPage(FcCharSetDestroy,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcCharSetEqual.man,$(FONTCONFIGSRC)/doc/FcCharSetEqual.3) -InstallGenManPage(FcCharSetEqual,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcCharSetFirstPage.man,$(FONTCONFIGSRC)/doc/FcCharSetFirstPage.3) -InstallGenManPage(FcCharSetFirstPage,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcCharSetHasChar.man,$(FONTCONFIGSRC)/doc/FcCharSetHasChar.3) -InstallGenManPage(FcCharSetHasChar,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcCharSetIntersect.man,$(FONTCONFIGSRC)/doc/FcCharSetIntersect.3) -InstallGenManPage(FcCharSetIntersect,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcCharSetIntersectCount.man,$(FONTCONFIGSRC)/doc/FcCharSetIntersectCount.3) -InstallGenManPage(FcCharSetIntersectCount,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcCharSetIsSubset.man,$(FONTCONFIGSRC)/doc/FcCharSetIsSubset.3) -InstallGenManPage(FcCharSetIsSubset,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcCharSetNextPage.man,$(FONTCONFIGSRC)/doc/FcCharSetNextPage.3) -InstallGenManPage(FcCharSetNextPage,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcCharSetSubtract.man,$(FONTCONFIGSRC)/doc/FcCharSetSubtract.3) -InstallGenManPage(FcCharSetSubtract,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcCharSetSubtractCount.man,$(FONTCONFIGSRC)/doc/FcCharSetSubtractCount.3) -InstallGenManPage(FcCharSetSubtractCount,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcCharSetUnion.man,$(FONTCONFIGSRC)/doc/FcCharSetUnion.3) -InstallGenManPage(FcCharSetUnion,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcConfigAppFontAddDir.man,$(FONTCONFIGSRC)/doc/FcConfigAppFontAddDir.3) -InstallGenManPage(FcConfigAppFontAddDir,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcConfigAppFontAddFile.man,$(FONTCONFIGSRC)/doc/FcConfigAppFontAddFile.3) -InstallGenManPage(FcConfigAppFontAddFile,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcConfigAppFontClear.man,$(FONTCONFIGSRC)/doc/FcConfigAppFontClear.3) -InstallGenManPage(FcConfigAppFontClear,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcConfigBuildFonts.man,$(FONTCONFIGSRC)/doc/FcConfigBuildFonts.3) -InstallGenManPage(FcConfigBuildFonts,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcConfigCreate.man,$(FONTCONFIGSRC)/doc/FcConfigCreate.3) -InstallGenManPage(FcConfigCreate,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcConfigDestroy.man,$(FONTCONFIGSRC)/doc/FcConfigDestroy.3) -InstallGenManPage(FcConfigDestroy,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcConfigFilename.man,$(FONTCONFIGSRC)/doc/FcConfigFilename.3) -InstallGenManPage(FcConfigFilename,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcConfigGetBlanks.man,$(FONTCONFIGSRC)/doc/FcConfigGetBlanks.3) -InstallGenManPage(FcConfigGetBlanks,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcConfigGetCache.man,$(FONTCONFIGSRC)/doc/FcConfigGetCache.3) -InstallGenManPage(FcConfigGetCache,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcConfigGetConfigDirs.man,$(FONTCONFIGSRC)/doc/FcConfigGetConfigDirs.3) -InstallGenManPage(FcConfigGetConfigDirs,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcConfigGetConfigFiles.man,$(FONTCONFIGSRC)/doc/FcConfigGetConfigFiles.3) -InstallGenManPage(FcConfigGetConfigFiles,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcConfigGetCurrent.man,$(FONTCONFIGSRC)/doc/FcConfigGetCurrent.3) -InstallGenManPage(FcConfigGetCurrent,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcConfigGetFontDirs.man,$(FONTCONFIGSRC)/doc/FcConfigGetFontDirs.3) -InstallGenManPage(FcConfigGetFontDirs,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcConfigGetFonts.man,$(FONTCONFIGSRC)/doc/FcConfigGetFonts.3) -InstallGenManPage(FcConfigGetFonts,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcConfigGetRescanInverval.man,$(FONTCONFIGSRC)/doc/FcConfigGetRescanInverval.3) -InstallGenManPage(FcConfigGetRescanInverval,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcConfigParseAndLoad.man,$(FONTCONFIGSRC)/doc/FcConfigParseAndLoad.3) -InstallGenManPage(FcConfigParseAndLoad,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcConfigSetCurrent.man,$(FONTCONFIGSRC)/doc/FcConfigSetCurrent.3) -InstallGenManPage(FcConfigSetCurrent,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcConfigSetRescanInverval.man,$(FONTCONFIGSRC)/doc/FcConfigSetRescanInverval.3) -InstallGenManPage(FcConfigSetRescanInverval,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcConfigSubstitute.man,$(FONTCONFIGSRC)/doc/FcConfigSubstitute.3) -InstallGenManPage(FcConfigSubstitute,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcConfigSubstituteWithPat.man,$(FONTCONFIGSRC)/doc/FcConfigSubstituteWithPat.3) -InstallGenManPage(FcConfigSubstituteWithPat,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcConfigUptoDate.man,$(FONTCONFIGSRC)/doc/FcConfigUptoDate.3) -InstallGenManPage(FcConfigUptoDate,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcDefaultSubstitute.man,$(FONTCONFIGSRC)/doc/FcDefaultSubstitute.3) -InstallGenManPage(FcDefaultSubstitute,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcDirCacheValid.man,$(FONTCONFIGSRC)/doc/FcDirCacheValid.3) -InstallGenManPage(FcDirCacheValid,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcDirSave.man,$(FONTCONFIGSRC)/doc/FcDirSave.3) -InstallGenManPage(FcDirSave,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcDirScan.man,$(FONTCONFIGSRC)/doc/FcDirScan.3) -InstallGenManPage(FcDirScan,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcFileScan.man,$(FONTCONFIGSRC)/doc/FcFileScan.3) -InstallGenManPage(FcFileScan,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcFini.man,$(FONTCONFIGSRC)/doc/FcFini.3) -InstallGenManPage(FcFini,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcFontList.man,$(FONTCONFIGSRC)/doc/FcFontList.3) -InstallGenManPage(FcFontList,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcFontMatch.man,$(FONTCONFIGSRC)/doc/FcFontMatch.3) -InstallGenManPage(FcFontMatch,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcFontRenderPrepare.man,$(FONTCONFIGSRC)/doc/FcFontRenderPrepare.3) -InstallGenManPage(FcFontRenderPrepare,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcFontSetAdd.man,$(FONTCONFIGSRC)/doc/FcFontSetAdd.3) -InstallGenManPage(FcFontSetAdd,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcFontSetCreate.man,$(FONTCONFIGSRC)/doc/FcFontSetCreate.3) -InstallGenManPage(FcFontSetCreate,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcFontSetDestroy.man,$(FONTCONFIGSRC)/doc/FcFontSetDestroy.3) -InstallGenManPage(FcFontSetDestroy,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcFontSort.man,$(FONTCONFIGSRC)/doc/FcFontSort.3) -InstallGenManPage(FcFontSort,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcFreeTypeCharIndex.man,$(FONTCONFIGSRC)/doc/FcFreeTypeCharIndex.3) -InstallGenManPage(FcFreeTypeCharIndex,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcFreeTypeCharSet.man,$(FONTCONFIGSRC)/doc/FcFreeTypeCharSet.3) -InstallGenManPage(FcFreeTypeCharSet,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcFreeTypeQuery.man,$(FONTCONFIGSRC)/doc/FcFreeTypeQuery.3) -InstallGenManPage(FcFreeTypeQuery,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcGetVersion.man,$(FONTCONFIGSRC)/doc/FcGetVersion.3) -InstallGenManPage(FcGetVersion,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcInit.man,$(FONTCONFIGSRC)/doc/FcInit.3) -InstallGenManPage(FcInit,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcInitBringUptoDate.man,$(FONTCONFIGSRC)/doc/FcInitBringUptoDate.3) -InstallGenManPage(FcInitBringUptoDate,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcInitLoadConfig.man,$(FONTCONFIGSRC)/doc/FcInitLoadConfig.3) -InstallGenManPage(FcInitLoadConfig,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcInitLoadConfigAndFonts.man,$(FONTCONFIGSRC)/doc/FcInitLoadConfigAndFonts.3) -InstallGenManPage(FcInitLoadConfigAndFonts,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcInitReinitialize.man,$(FONTCONFIGSRC)/doc/FcInitReinitialize.3) -InstallGenManPage(FcInitReinitialize,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcMatrixCopy.man,$(FONTCONFIGSRC)/doc/FcMatrixCopy.3) -InstallGenManPage(FcMatrixCopy,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcMatrixEqual.man,$(FONTCONFIGSRC)/doc/FcMatrixEqual.3) -InstallGenManPage(FcMatrixEqual,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcMatrixInit.man,$(FONTCONFIGSRC)/doc/FcMatrixInit.3) -InstallGenManPage(FcMatrixInit,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcMatrixMultiply.man,$(FONTCONFIGSRC)/doc/FcMatrixMultiply.3) -InstallGenManPage(FcMatrixMultiply,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcMatrixRotate.man,$(FONTCONFIGSRC)/doc/FcMatrixRotate.3) -InstallGenManPage(FcMatrixRotate,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcMatrixScale.man,$(FONTCONFIGSRC)/doc/FcMatrixScale.3) -InstallGenManPage(FcMatrixScale,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcMatrixShear.man,$(FONTCONFIGSRC)/doc/FcMatrixShear.3) -InstallGenManPage(FcMatrixShear,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcNameConstant.man,$(FONTCONFIGSRC)/doc/FcNameConstant.3) -InstallGenManPage(FcNameConstant,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcNameGetConstant.man,$(FONTCONFIGSRC)/doc/FcNameGetConstant.3) -InstallGenManPage(FcNameGetConstant,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcNameGetObjectType.man,$(FONTCONFIGSRC)/doc/FcNameGetObjectType.3) -InstallGenManPage(FcNameGetObjectType,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcNameParse.man,$(FONTCONFIGSRC)/doc/FcNameParse.3) -InstallGenManPage(FcNameParse,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcNameRegisterConstants.man,$(FONTCONFIGSRC)/doc/FcNameRegisterConstants.3) -InstallGenManPage(FcNameRegisterConstants,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcNameRegisterObjectTypes.man,$(FONTCONFIGSRC)/doc/FcNameRegisterObjectTypes.3) -InstallGenManPage(FcNameRegisterObjectTypes,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcNameUnparse.man,$(FONTCONFIGSRC)/doc/FcNameUnparse.3) -InstallGenManPage(FcNameUnparse,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcNameUnregisterConstants.man,$(FONTCONFIGSRC)/doc/FcNameUnregisterConstants.3) -InstallGenManPage(FcNameUnregisterConstants,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcNameUnregisterObjectTypes.man,$(FONTCONFIGSRC)/doc/FcNameUnregisterObjectTypes.3) -InstallGenManPage(FcNameUnregisterObjectTypes,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcObjectSetAdd.man,$(FONTCONFIGSRC)/doc/FcObjectSetAdd.3) -InstallGenManPage(FcObjectSetAdd,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcObjectSetBuild.man,$(FONTCONFIGSRC)/doc/FcObjectSetBuild.3) -InstallGenManPage(FcObjectSetBuild,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcObjectSetCreate.man,$(FONTCONFIGSRC)/doc/FcObjectSetCreate.3) -InstallGenManPage(FcObjectSetCreate,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcObjectSetDestroy.man,$(FONTCONFIGSRC)/doc/FcObjectSetDestroy.3) -InstallGenManPage(FcObjectSetDestroy,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcPatternAdd-Type.man,$(FONTCONFIGSRC)/doc/FcPatternAdd-Type.3) -InstallGenManPage(FcPatternAdd-Type,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcPatternAdd.man,$(FONTCONFIGSRC)/doc/FcPatternAdd.3) -InstallGenManPage(FcPatternAdd,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcPatternAddWeak.man,$(FONTCONFIGSRC)/doc/FcPatternAddWeak.3) -InstallGenManPage(FcPatternAddWeak,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcPatternBuild.man,$(FONTCONFIGSRC)/doc/FcPatternBuild.3) -InstallGenManPage(FcPatternBuild,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcPatternCreate.man,$(FONTCONFIGSRC)/doc/FcPatternCreate.3) -InstallGenManPage(FcPatternCreate,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcPatternDel.man,$(FONTCONFIGSRC)/doc/FcPatternDel.3) -InstallGenManPage(FcPatternDel,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcPatternDestroy.man,$(FONTCONFIGSRC)/doc/FcPatternDestroy.3) -InstallGenManPage(FcPatternDestroy,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcPatternEqual.man,$(FONTCONFIGSRC)/doc/FcPatternEqual.3) -InstallGenManPage(FcPatternEqual,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcPatternEqualSubset.man,$(FONTCONFIGSRC)/doc/FcPatternEqualSubset.3) -InstallGenManPage(FcPatternEqualSubset,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcPatternGet-Type.man,$(FONTCONFIGSRC)/doc/FcPatternGet-Type.3) -InstallGenManPage(FcPatternGet-Type,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcPatternGet.man,$(FONTCONFIGSRC)/doc/FcPatternGet.3) -InstallGenManPage(FcPatternGet,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcPatternHash.man,$(FONTCONFIGSRC)/doc/FcPatternHash.3) -InstallGenManPage(FcPatternHash,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcPatternPrint.man,$(FONTCONFIGSRC)/doc/FcPatternPrint.3) -InstallGenManPage(FcPatternPrint,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcPatternRemove.man,$(FONTCONFIGSRC)/doc/FcPatternRemove.3) -InstallGenManPage(FcPatternRemove,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcStrBasename.man,$(FONTCONFIGSRC)/doc/FcStrBasename.3) -InstallGenManPage(FcStrBasename,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcStrCmpIgnoreCase.man,$(FONTCONFIGSRC)/doc/FcStrCmpIgnoreCase.3) -InstallGenManPage(FcStrCmpIgnoreCase,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcStrCopy.man,$(FONTCONFIGSRC)/doc/FcStrCopy.3) -InstallGenManPage(FcStrCopy,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcStrCopyFilename.man,$(FONTCONFIGSRC)/doc/FcStrCopyFilename.3) -InstallGenManPage(FcStrCopyFilename,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcStrDirname.man,$(FONTCONFIGSRC)/doc/FcStrDirname.3) -InstallGenManPage(FcStrDirname,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcStrDowncase.man,$(FONTCONFIGSRC)/doc/FcStrDowncase.3) -InstallGenManPage(FcStrDowncase,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcStrListCreate.man,$(FONTCONFIGSRC)/doc/FcStrListCreate.3) -InstallGenManPage(FcStrListCreate,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcStrListDone.man,$(FONTCONFIGSRC)/doc/FcStrListDone.3) -InstallGenManPage(FcStrListDone,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcStrListNext.man,$(FONTCONFIGSRC)/doc/FcStrListNext.3) -InstallGenManPage(FcStrListNext,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcStrSetAdd.man,$(FONTCONFIGSRC)/doc/FcStrSetAdd.3) -InstallGenManPage(FcStrSetAdd,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcStrSetAddFilename.man,$(FONTCONFIGSRC)/doc/FcStrSetAddFilename.3) -InstallGenManPage(FcStrSetAddFilename,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcStrSetCreate.man,$(FONTCONFIGSRC)/doc/FcStrSetCreate.3) -InstallGenManPage(FcStrSetCreate,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcStrSetDel.man,$(FONTCONFIGSRC)/doc/FcStrSetDel.3) -InstallGenManPage(FcStrSetDel,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcStrSetDestroy.man,$(FONTCONFIGSRC)/doc/FcStrSetDestroy.3) -InstallGenManPage(FcStrSetDestroy,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcStrSetMember.man,$(FONTCONFIGSRC)/doc/FcStrSetMember.3) -InstallGenManPage(FcStrSetMember,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcStrStr.man,$(FONTCONFIGSRC)/doc/FcStrStr.3) -InstallGenManPage(FcStrStr,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcStrStrIgnoreCase.man,$(FONTCONFIGSRC)/doc/FcStrStrIgnoreCase.3) -InstallGenManPage(FcStrStrIgnoreCase,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcUcs4ToUtf8.man,$(FONTCONFIGSRC)/doc/FcUcs4ToUtf8.3) -InstallGenManPage(FcUcs4ToUtf8,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcUtf16Len.man,$(FONTCONFIGSRC)/doc/FcUtf16Len.3) -InstallGenManPage(FcUtf16Len,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcUtf16ToUcs4.man,$(FONTCONFIGSRC)/doc/FcUtf16ToUcs4.3) -InstallGenManPage(FcUtf16ToUcs4,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcUtf8Len.man,$(FONTCONFIGSRC)/doc/FcUtf8Len.3) -InstallGenManPage(FcUtf8Len,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcUtf8ToUcs4.man,$(FONTCONFIGSRC)/doc/FcUtf8ToUcs4.3) -InstallGenManPage(FcUtf8ToUcs4,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcValueDestroy.man,$(FONTCONFIGSRC)/doc/FcValueDestroy.3) -InstallGenManPage(FcValueDestroy,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(FcValueSave.man,$(FONTCONFIGSRC)/doc/FcValueSave.3) -InstallGenManPage(FcValueSave,${LIBMANDIR},${LIBMANSUFFIX}) -LinkFile(fonts-conf.man,$(FONTCONFIGSRC)/doc/fonts-conf.5) -InstallGenManPage(fonts-conf,${FILEMANDIR},${FILEMANSUFFIX}) diff --git a/nx-X11/lib/fontconfig/config-subst b/nx-X11/lib/fontconfig/config-subst deleted file mode 100644 index 5907e0328..000000000 --- a/nx-X11/lib/fontconfig/config-subst +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -script=config-subst.$$ -trap "rm $script" 0 -rm -f $script -for i in ${1+"$@"}; do - var="`echo "$i" | sed 's/=.*$//'`" - val="`echo "$i" | sed 's/^[^=]*=//'`" - echo "s;@$var@;$val;" >> $script -done -sed -f $script diff --git a/nx-X11/lib/fontconfig/fcfreetype.c b/nx-X11/lib/fontconfig/fcfreetype.c deleted file mode 100644 index 2627f9753..000000000 --- a/nx-X11/lib/fontconfig/fcfreetype.c +++ /dev/null @@ -1,2847 +0,0 @@ -/* - * $RCSId: xc/lib/fontconfig/src/fcfreetype.c,v 1.11 2002/08/31 22:17:32 keithp Exp $ - * - * Copyright © 2001 Keith Packard - * - * 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. - */ - -/* - Copyright © 2002-2003 by Juliusz Chroboczek - - 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 - AUTHORS OR 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. -*/ - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include "fcint.h" -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_INTERNAL_OBJECTS_H -#include FT_TRUETYPE_TABLES_H -#include FT_SFNT_NAMES_H -#include FT_TRUETYPE_IDS_H -#include FT_TYPE1_TABLES_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_SFNT_H -#include FT_INTERNAL_TRUETYPE_TYPES_H -#if HAVE_FT_GET_X11_FONT_FORMAT -#include FT_XFREE86_H -#endif - -#if HAVE_FT_GET_BDF_PROPERTY -#include FT_BDF_H -#include FT_MODULE_H -#define HAS_BDF_PROPERTY(f) ((f) && (f)->driver && \ - (f)->driver->root.clazz->get_interface) -#define MY_Get_BDF_Property(f,n,p) (HAS_BDF_PROPERTY(f) ? \ - FT_Get_BDF_Property(f,n,p) : \ - FT_Err_Invalid_Argument) -#endif - -#if !HAVE_FT_GET_BDF_PROPERTY -#warning "No FT_Get_BDF_Property: Please install freetype 2.1.4 or later" -#endif - -#if !HAVE_FT_GET_PS_FONT_INFO -#warning "No FT_Get_PS_Font_Info: Please install freetype 2.1.1 or later" -#endif - -/* - * Keep Han languages separated by eliminating languages - * that the codePageRange bits says aren't supported - */ - -static const struct { - int bit; - const FcChar8 *lang; -} FcCodePageRange[] = { - { 17, (const FcChar8 *) "ja" }, - { 18, (const FcChar8 *) "zh-cn" }, - { 19, (const FcChar8 *) "ko" }, - { 20, (const FcChar8 *) "zh-tw" }, -}; - -#define NUM_CODE_PAGE_RANGE (sizeof FcCodePageRange / sizeof FcCodePageRange[0]) - -FcBool -FcFreeTypeIsExclusiveLang (const FcChar8 *lang) -{ - int i; - - for (i = 0; i < NUM_CODE_PAGE_RANGE; i++) - { - if (FcLangCompare (lang, FcCodePageRange[i].lang) != FcLangDifferentLang) - return FcTrue; - } - return FcFalse; -} - -typedef struct { - FT_UShort platform_id; - FT_UShort encoding_id; - char *fromcode; -} FcFtEncoding; - -#define TT_ENCODING_DONT_CARE 0xffff -#define FC_ENCODING_MAC_ROMAN "MACINTOSH" - -static const FcFtEncoding fcFtEncoding[] = { - { TT_PLATFORM_APPLE_UNICODE, TT_ENCODING_DONT_CARE, "UCS-2BE" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_ID_ROMAN, "MACINTOSH" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_ID_JAPANESE, "SJIS" }, - { TT_PLATFORM_MICROSOFT, TT_MS_ID_UNICODE_CS, "UTF-16BE" }, - { TT_PLATFORM_MICROSOFT, TT_MS_ID_SJIS, "SJIS-WIN" }, - { TT_PLATFORM_MICROSOFT, TT_MS_ID_GB2312, "GB3212" }, - { TT_PLATFORM_MICROSOFT, TT_MS_ID_BIG_5, "BIG-5" }, - { TT_PLATFORM_MICROSOFT, TT_MS_ID_WANSUNG, "Wansung" }, - { TT_PLATFORM_MICROSOFT, TT_MS_ID_JOHAB, "Johab" }, - { TT_PLATFORM_MICROSOFT, TT_MS_ID_UCS_4, "UCS4" }, - { TT_PLATFORM_ISO, TT_ISO_ID_7BIT_ASCII, "ASCII" }, - { TT_PLATFORM_ISO, TT_ISO_ID_10646, "UCS-2BE" }, - { TT_PLATFORM_ISO, TT_ISO_ID_8859_1, "ISO-8859-1" }, -}; - -#define NUM_FC_FT_ENCODING (sizeof (fcFtEncoding) / sizeof (fcFtEncoding[0])) - -typedef struct { - FT_UShort platform_id; - FT_UShort language_id; - char *lang; -} FcFtLanguage; - -#define TT_LANGUAGE_DONT_CARE 0xffff - -static const FcFtLanguage fcFtLanguage[] = { - { TT_PLATFORM_APPLE_UNICODE, TT_LANGUAGE_DONT_CARE, 0 }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ENGLISH, "en" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_FRENCH, "fr" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GERMAN, "de" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ITALIAN, "it" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_DUTCH, "nl" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SWEDISH, "sv" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SPANISH, "es" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_DANISH, "da" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_PORTUGUESE, "pt" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_NORWEGIAN, "no" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_HEBREW, "he" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_JAPANESE, "ja" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ARABIC, "ar" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_FINNISH, "fi" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GREEK, "el" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ICELANDIC, "is" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MALTESE, "mt" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TURKISH, "tr" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_CROATIAN, "hr" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_CHINESE_TRADITIONAL, "zh-tw" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_URDU, "ur" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_HINDI, "hi" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_THAI, "th" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_KOREAN, "ko" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_LITHUANIAN, "lt" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_POLISH, "pl" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_HUNGARIAN, "hu" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ESTONIAN, "et" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_LETTISH, "lv" }, -/* { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SAAMISK, ??? */ - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_FAEROESE, "fo" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_FARSI, "fa" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_RUSSIAN, "ru" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_CHINESE_SIMPLIFIED, "zh-cn" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_FLEMISH, "nl" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_IRISH, "ga" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ALBANIAN, "sq" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ROMANIAN, "ro" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_CZECH, "cs" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SLOVAK, "sk" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SLOVENIAN, "sl" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_YIDDISH, "yi" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SERBIAN, "sr" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MACEDONIAN, "mk" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_BULGARIAN, "bg" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_UKRAINIAN, "uk" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_BYELORUSSIAN, "be" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_UZBEK, "uz" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_KAZAKH, "kk" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_AZERBAIJANI, "az" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_AZERBAIJANI_CYRILLIC_SCRIPT, "az" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_AZERBAIJANI_ARABIC_SCRIPT, "ar" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ARMENIAN, "hy" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GEORGIAN, "ka" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MOLDAVIAN, "mo" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_KIRGHIZ, "ky" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TAJIKI, "tg" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TURKMEN, "tk" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MONGOLIAN, "mo" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MONGOLIAN_MONGOLIAN_SCRIPT,"mo" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MONGOLIAN_CYRILLIC_SCRIPT, "mo" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_PASHTO, "ps" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_KURDISH, "ku" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_KASHMIRI, "ks" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SINDHI, "sd" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TIBETAN, "bo" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_NEPALI, "ne" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SANSKRIT, "sa" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MARATHI, "mr" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_BENGALI, "bn" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ASSAMESE, "as" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GUJARATI, "gu" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_PUNJABI, "pa" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ORIYA, "or" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MALAYALAM, "ml" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_KANNADA, "kn" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TAMIL, "ta" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TELUGU, "te" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SINHALESE, "si" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_BURMESE, "my" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_KHMER, "km" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_LAO, "lo" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_VIETNAMESE, "vi" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_INDONESIAN, "id" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TAGALOG, "tl" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MALAY_ROMAN_SCRIPT, "ms" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MALAY_ARABIC_SCRIPT, "ms" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_AMHARIC, "am" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TIGRINYA, "ti" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GALLA, "om" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SOMALI, "so" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SWAHILI, "sw" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_RUANDA, "rw" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_RUNDI, "rn" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_CHEWA, "ny" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MALAGASY, "mg" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ESPERANTO, "eo" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_WELSH, "cy" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_BASQUE, "eu" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_CATALAN, "ca" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_LATIN, "la" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_QUECHUA, "qu" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GUARANI, "gn" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_AYMARA, "ay" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TATAR, "tt" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_UIGHUR, "ug" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_DZONGKHA, "dz" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_JAVANESE, "jw" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SUNDANESE, "su" }, - -#if 0 /* these seem to be errors that have been dropped */ - - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SCOTTISH_GAELIC }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_IRISH_GAELIC }, - -#endif - - /* The following codes are new as of 2000-03-10 */ - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GALICIAN, "gl" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_AFRIKAANS, "af" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_BRETON, "br" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_INUKTITUT, "iu" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SCOTTISH_GAELIC, "gd" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MANX_GAELIC, "gv" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_IRISH_GAELIC, "ga" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TONGAN, "to" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GREEK_POLYTONIC, "el" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GREELANDIC, "ik" }, - { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_AZERBAIJANI_ROMAN_SCRIPT,"az" }, - - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_SAUDI_ARABIA, "ar" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_IRAQ, "ar" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_EGYPT, "ar" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_LIBYA, "ar" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_ALGERIA, "ar" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_MOROCCO, "ar" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_TUNISIA, "ar" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_OMAN, "ar" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_YEMEN, "ar" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_SYRIA, "ar" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_JORDAN, "ar" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_LEBANON, "ar" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_KUWAIT, "ar" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_UAE, "ar" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_BAHRAIN, "ar" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_QATAR, "ar" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_BULGARIAN_BULGARIA, "bg" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CATALAN_SPAIN, "ca" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CHINESE_TAIWAN, "zh-tw" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CHINESE_PRC, "zh-cn" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CHINESE_HONG_KONG, "zh-hk" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CHINESE_SINGAPORE, "zh-sg" }, - - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CHINESE_MACAU, "zh-mo" }, - - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CZECH_CZECH_REPUBLIC, "cs" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_DANISH_DENMARK, "da" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GERMAN_GERMANY, "de" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GERMAN_SWITZERLAND, "de" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GERMAN_AUSTRIA, "de" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GERMAN_LUXEMBOURG, "de" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GERMAN_LIECHTENSTEI, "de" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GREEK_GREECE, "el" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_UNITED_STATES, "en" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_UNITED_KINGDOM, "en" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_AUSTRALIA, "en" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_CANADA, "en" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_NEW_ZEALAND, "en" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_IRELAND, "en" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_SOUTH_AFRICA, "en" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_JAMAICA, "en" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_CARIBBEAN, "en" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_BELIZE, "en" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_TRINIDAD, "en" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_ZIMBABWE, "en" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_PHILIPPINES, "en" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_SPAIN_TRADITIONAL_SORT,"es" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_MEXICO, "es" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_SPAIN_INTERNATIONAL_SORT,"es" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_GUATEMALA, "es" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_COSTA_RICA, "es" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_PANAMA, "es" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_DOMINICAN_REPUBLIC,"es" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_VENEZUELA, "es" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_COLOMBIA, "es" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_PERU, "es" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_ARGENTINA, "es" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_ECUADOR, "es" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_CHILE, "es" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_URUGUAY, "es" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_PARAGUAY, "es" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_BOLIVIA, "es" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_EL_SALVADOR, "es" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_HONDURAS, "es" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_NICARAGUA, "es" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_PUERTO_RICO, "es" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FINNISH_FINLAND, "fi" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_FRANCE, "fr" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_BELGIUM, "fr" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_CANADA, "fr" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_SWITZERLAND, "fr" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_LUXEMBOURG, "fr" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_MONACO, "fr" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_HEBREW_ISRAEL, "he" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_HUNGARIAN_HUNGARY, "hu" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ICELANDIC_ICELAND, "is" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ITALIAN_ITALY, "it" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ITALIAN_SWITZERLAND, "it" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_JAPANESE_JAPAN, "ja" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KOREAN_EXTENDED_WANSUNG_KOREA,"ko" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KOREAN_JOHAB_KOREA, "ko" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_DUTCH_NETHERLANDS, "nl" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_DUTCH_BELGIUM, "nl" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_NORWEGIAN_NORWAY_BOKMAL, "no" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_NORWEGIAN_NORWAY_NYNORSK, "nn" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_POLISH_POLAND, "pl" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_PORTUGUESE_BRAZIL, "pt" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_PORTUGUESE_PORTUGAL, "pt" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_RHAETO_ROMANIC_SWITZERLAND,"rm" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ROMANIAN_ROMANIA, "ro" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MOLDAVIAN_MOLDAVIA, "mo" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_RUSSIAN_RUSSIA, "ru" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_RUSSIAN_MOLDAVIA, "ru" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CROATIAN_CROATIA, "hr" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SERBIAN_SERBIA_LATIN, "sr" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SERBIAN_SERBIA_CYRILLIC, "sr" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SLOVAK_SLOVAKIA, "sk" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ALBANIAN_ALBANIA, "sq" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SWEDISH_SWEDEN, "sv" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SWEDISH_FINLAND, "sv" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_THAI_THAILAND, "th" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TURKISH_TURKEY, "tr" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_URDU_PAKISTAN, "ur" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_INDONESIAN_INDONESIA, "id" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_UKRAINIAN_UKRAINE, "uk" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_BELARUSIAN_BELARUS, "be" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SLOVENE_SLOVENIA, "sl" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ESTONIAN_ESTONIA, "et" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_LATVIAN_LATVIA, "lv" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_LITHUANIAN_LITHUANIA, "lt" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CLASSIC_LITHUANIAN_LITHUANIA,"lt" }, - -#ifdef TT_MS_LANGID_MAORI_NEW_ZELAND - /* this seems to be an error that have been dropped */ - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MAORI_NEW_ZEALAND, "mi" }, -#endif - - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FARSI_IRAN, "fa" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_VIETNAMESE_VIET_NAM, "vi" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARMENIAN_ARMENIA, "hy" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_AZERI_AZERBAIJAN_LATIN, "az" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_AZERI_AZERBAIJAN_CYRILLIC, "az" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_BASQUE_SPAIN, "eu" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SORBIAN_GERMANY, "wen" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MACEDONIAN_MACEDONIA, "mk" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SUTU_SOUTH_AFRICA, "st" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TSONGA_SOUTH_AFRICA, "ts" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TSWANA_SOUTH_AFRICA, "tn" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_VENDA_SOUTH_AFRICA, "ven" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_XHOSA_SOUTH_AFRICA, "xh" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ZULU_SOUTH_AFRICA, "zu" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_AFRIKAANS_SOUTH_AFRICA, "af" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GEORGIAN_GEORGIA, "ka" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FAEROESE_FAEROE_ISLANDS, "fo" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_HINDI_INDIA, "hi" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MALTESE_MALTA, "mt" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SAAMI_LAPONIA, "se" }, - - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM,"gd" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_IRISH_GAELIC_IRELAND, "ga" }, - - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MALAY_MALAYSIA, "ms" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MALAY_BRUNEI_DARUSSALAM, "ms" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KAZAK_KAZAKSTAN, "kk" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SWAHILI_KENYA, "sw" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_UZBEK_UZBEKISTAN_LATIN, "uz" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_UZBEK_UZBEKISTAN_CYRILLIC, "uz" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TATAR_TATARSTAN, "tt" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_BENGALI_INDIA, "bn" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_PUNJABI_INDIA, "pa" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GUJARATI_INDIA, "gu" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ORIYA_INDIA, "or" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TAMIL_INDIA, "ta" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TELUGU_INDIA, "te" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KANNADA_INDIA, "kn" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MALAYALAM_INDIA, "ml" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ASSAMESE_INDIA, "as" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MARATHI_INDIA, "mr" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SANSKRIT_INDIA, "sa" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KONKANI_INDIA, "kok" }, - - /* new as of 2001-01-01 */ - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_GENERAL, "ar" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CHINESE_GENERAL, "zh" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_GENERAL, "en" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_WEST_INDIES, "fr" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_REUNION, "fr" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_CONGO, "fr" }, - - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_SENEGAL, "fr" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_CAMEROON, "fr" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_COTE_D_IVOIRE, "fr" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_MALI, "fr" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA,"bs" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_URDU_INDIA, "ur" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TAJIK_TAJIKISTAN, "tg" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_YIDDISH_GERMANY, "yi" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN, "ky" }, - - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TURKMEN_TURKMENISTAN, "tk" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MONGOLIAN_MONGOLIA, "mn" }, - - /* the following seems to be inconsistent; - here is the current "official" way: */ - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TIBETAN_BHUTAN, "bo" }, - /* and here is what is used by Passport SDK */ - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TIBETAN_CHINA, "bo" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_DZONGHKA_BHUTAN, "dz" }, - /* end of inconsistency */ - - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_WELSH_WALES, "cy" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KHMER_CAMBODIA, "km" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_LAO_LAOS, "lo" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_BURMESE_MYANMAR, "my" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GALICIAN_SPAIN, "gl" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MANIPURI_INDIA, "mni" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SINDHI_INDIA, "sd" }, - /* the following one is only encountered in Microsoft RTF specification */ - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KASHMIRI_PAKISTAN, "ks" }, - /* the following one is not in the Passport list, looks like an omission */ - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KASHMIRI_INDIA, "ks" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_NEPALI_NEPAL, "ne" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_NEPALI_INDIA, "ne" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRISIAN_NETHERLANDS, "fy" }, - - /* new as of 2001-03-01 (from Office Xp) */ - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_HONG_KONG, "en" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_INDIA, "en" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_MALAYSIA, "en" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_SINGAPORE, "en" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SYRIAC_SYRIA, "syr" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SINHALESE_SRI_LANKA, "si" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CHEROKEE_UNITED_STATES, "chr" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_INUKTITUT_CANADA, "iu" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_AMHARIC_ETHIOPIA, "am" }, -#if 0 - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TAMAZIGHT_MOROCCO }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TAMAZIGHT_MOROCCO_LATIN }, -#endif - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_PASHTO_AFGHANISTAN, "ps" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FILIPINO_PHILIPPINES, "phi" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_DHIVEHI_MALDIVES, "div" }, - - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_OROMO_ETHIOPIA, "om" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TIGRIGNA_ETHIOPIA, "ti" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TIGRIGNA_ERYTHREA, "ti" }, - - /* New additions from Windows Xp/Passport SDK 2001-11-10. */ - - /* don't ask what this one means... It is commented out currently. */ -#if 0 - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GREEK_GREECE2 }, -#endif - - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_UNITED_STATES, "es" }, - /* The following two IDs blatantly violate MS specs by using a */ - /* sublanguage >,. */ - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_LATIN_AMERICA, "es" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_NORTH_AFRICA, "fr" }, - - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_MOROCCO, "fr" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_HAITI, "fr" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_BENGALI_BANGLADESH, "bn" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_PUNJABI_ARABIC_PAKISTAN, "ar" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN,"mn" }, -#if 0 - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_EDO_NIGERIA }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FULFULDE_NIGERIA }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_IBIBIO_NIGERIA }, -#endif - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_HAUSA_NIGERIA, "ha" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_YORUBA_NIGERIA, "yo" }, - /* language codes from, to, are (still) unknown. */ - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_IGBO_NIGERIA, "ibo" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KANURI_NIGERIA, "kau" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GUARANI_PARAGUAY, "gn" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_HAWAIIAN_UNITED_STATES, "haw" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_LATIN, "la" }, - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SOMALI_SOMALIA, "so" }, -#if 0 - /* Note: Yi does not have a (proper) ISO 639-2 code, since it is mostly */ - /* not written (but OTOH the peculiar writing system is worth */ - /* studying). */ - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_YI_CHINA }, -#endif - { TT_PLATFORM_MICROSOFT, TT_MS_LANGID_PAPIAMENTU_NETHERLANDS_ANTILLES,"pap" }, -}; - -#define NUM_FC_FT_LANGUAGE (sizeof (fcFtLanguage) / sizeof (fcFtLanguage[0])) - -typedef struct { - FT_UShort language_id; - char *fromcode; -} FcMacRomanFake; - -static const FcMacRomanFake fcMacRomanFake[] = { - { TT_MS_LANGID_JAPANESE_JAPAN, "SJIS-WIN" }, - { TT_MS_LANGID_ENGLISH_UNITED_STATES, "ASCII" }, -}; - -static FcChar8 * -FcFontCapabilities(FT_Face face); - -#define NUM_FC_MAC_ROMAN_FAKE (sizeof (fcMacRomanFake) / sizeof (fcMacRomanFake[0])) - -#if HAVE_ICONV && HAVE_ICONV_H -#define USE_ICONV 1 -#include <iconv.h> -#endif - -static FcChar8 * -FcSfntNameTranscode (FT_SfntName *sname) -{ - int i; - char *fromcode; -#if USE_ICONV - iconv_t cd; -#endif - FcChar8 *utf8; - - for (i = 0; i < NUM_FC_FT_ENCODING; i++) - if (fcFtEncoding[i].platform_id == sname->platform_id && - (fcFtEncoding[i].encoding_id == TT_ENCODING_DONT_CARE || - fcFtEncoding[i].encoding_id == sname->encoding_id)) - break; - if (i == NUM_FC_FT_ENCODING) - return 0; - fromcode = fcFtEncoding[i].fromcode; - - /* - * "real" Mac language IDs are all less than 150. - * Names using one of the MS language IDs are assumed - * to use an associated encoding (Yes, this is a kludge) - */ - if (!strcmp (fromcode, FC_ENCODING_MAC_ROMAN) && - sname->language_id >= 0x100) - { - int f; - - fromcode = 0; - for (f = 0; f < NUM_FC_MAC_ROMAN_FAKE; f++) - if (fcMacRomanFake[f].language_id == sname->language_id) - { - fromcode = fcMacRomanFake[f].fromcode; - break; - } - if (!fromcode) - return 0; - } - if (!strcmp (fromcode, "UCS-2BE") || !strcmp (fromcode, "UTF-16BE")) - { - FcChar8 *src = sname->string; - int src_len = sname->string_len; - int len; - int wchar; - int ilen, olen; - FcChar8 *u8; - FcChar32 ucs4; - - /* - * Convert Utf16 to Utf8 - */ - - if (!FcUtf16Len (src, FcEndianBig, src_len, &len, &wchar)) - return 0; - - /* - * Allocate plenty of space. Freed below - */ - utf8 = malloc (len * FC_UTF8_MAX_LEN + 1); - if (!utf8) - return 0; - - u8 = utf8; - - while ((ilen = FcUtf16ToUcs4 (src, FcEndianBig, &ucs4, src_len)) > 0) - { - src_len -= ilen; - src += ilen; - olen = FcUcs4ToUtf8 (ucs4, u8); - u8 += olen; - } - *u8 = '\0'; - goto done; - } - if (!strcmp (fromcode, "ASCII") || !strcmp (fromcode, "ISO-8859-1")) - { - FcChar8 *src = sname->string; - int src_len = sname->string_len; - int olen; - FcChar8 *u8; - FcChar32 ucs4; - - /* - * Convert Latin1 to Utf8. Freed below - */ - utf8 = malloc (src_len * 2 + 1); - if (!utf8) - return 0; - - u8 = utf8; - while (src_len > 0) - { - ucs4 = *src++; - src_len--; - olen = FcUcs4ToUtf8 (ucs4, u8); - u8 += olen; - } - *u8 = '\0'; - goto done; - } - if (!strcmp (fromcode, FC_ENCODING_MAC_ROMAN)) - { - FcChar8 *u8; - const FcCharMap *map = FcFreeTypeGetPrivateMap (ft_encoding_apple_roman); - FcChar8 *src = (FcChar8 *) sname->string; - int src_len = sname->string_len; - - /* - * Convert AppleRoman to Utf8 - */ - if (!map) - return 0; - - utf8 = malloc (sname->string_len * 3 + 1); - if (!utf8) - return 0; - - u8 = utf8; - while (src_len > 0) - { - FcChar32 ucs4 = FcFreeTypePrivateToUcs4 (*src++, map); - int olen = FcUcs4ToUtf8 (ucs4, u8); - src_len--; - u8 += olen; - } - *u8 = '\0'; - goto done; - } -#if USE_ICONV - cd = iconv_open ("UTF-8", fromcode); - if (cd && cd != (iconv_t) (-1)) - { - size_t in_bytes_left = sname->string_len; - size_t out_bytes_left = sname->string_len * FC_UTF8_MAX_LEN; - char *inbuf, *outbuf; - - utf8 = malloc (out_bytes_left + 1); - if (!utf8) - { - iconv_close (cd); - return 0; - } - - outbuf = (char *) utf8; - inbuf = (char *) sname->string; - - while (in_bytes_left) - { - size_t did = iconv (cd, - &inbuf, &in_bytes_left, - &outbuf, &out_bytes_left); - if (did == (size_t) (-1)) - { - iconv_close (cd); - free (utf8); - return 0; - } - } - iconv_close (cd); - *outbuf = '\0'; - goto done; - } -#endif - return 0; -done: - if (FcStrCmpIgnoreBlanksAndCase (utf8, "") == 0) - { - free (utf8); - return 0; - } - return utf8; -} - -static FcChar8 * -FcSfntNameLanguage (FT_SfntName *sname) -{ - int i; - for (i = 0; i < NUM_FC_FT_LANGUAGE; i++) - if (fcFtLanguage[i].platform_id == sname->platform_id && - (fcFtLanguage[i].language_id == TT_LANGUAGE_DONT_CARE || - fcFtLanguage[i].language_id == sname->language_id)) - return fcFtLanguage[i].lang; - return 0; -} - -/* Order is significant. For example, some B&H fonts are hinted by - URW++, and both strings appear in the notice. */ - -static const struct { - const FT_String *notice; - const FcChar8 *foundry; -} FcNoticeFoundries[] = { - { (const FT_String *) "Bigelow", (const FcChar8 *) "b&h" }, - { (const FT_String *) "Adobe", (const FcChar8 *) "adobe" }, - { (const FT_String *) "Bitstream", (const FcChar8 *) "bitstream" }, - { (const FT_String *) "Monotype", (const FcChar8 *) "monotype" }, - { (const FT_String *) "Linotype", (const FcChar8 *) "linotype" }, - { (const FT_String *) "LINOTYPE-HELL", - (const FcChar8 *) "linotype" }, - { (const FT_String *) "IBM", (const FcChar8 *) "ibm" }, - { (const FT_String *) "URW", (const FcChar8 *) "urw" }, - { (const FT_String *) "International Typeface Corporation", - (const FcChar8 *) "itc" }, - { (const FT_String *) "Tiro Typeworks", - (const FcChar8 *) "tiro" }, - { (const FT_String *) "XFree86", (const FcChar8 *) "xfree86" }, - { (const FT_String *) "Microsoft", (const FcChar8 *) "microsoft" }, - { (const FT_String *) "Omega", (const FcChar8 *) "omega" }, - { (const FT_String *) "Font21", (const FcChar8 *) "hwan" }, - { (const FT_String *) "HanYang System", - (const FcChar8 *) "hanyang" } -}; - -#define NUM_NOTICE_FOUNDRIES (sizeof (FcNoticeFoundries) / sizeof (FcNoticeFoundries[0])) - -static const FcChar8 * -FcNoticeFoundry(const FT_String *notice) -{ - int i; - - if (notice) - for(i = 0; i < NUM_NOTICE_FOUNDRIES; i++) - if (strstr ((const char *) notice, (const char *) FcNoticeFoundries[i].notice)) - return FcNoticeFoundries[i].foundry; - return 0; -} - -static FcBool -FcVendorMatch(const FT_Char vendor[4], const FT_Char *vendor_string) -{ - /* vendor is not necessarily NUL-terminated. */ - int i, len; - - len = strlen(vendor_string); - if (memcmp(vendor, vendor_string, len) != 0) - return FcFalse; - for (i = len; i < 4; i++) - if (vendor[i] != ' ' && vendor[i] != '\0') - return FcFalse; - return FcTrue; -} - -/* This table is partly taken from ttmkfdir by Joerg Pommnitz. */ - -/* It should not contain useless entries (such as UNKN) nor duplicate - entries for padding both with spaces and NULs. */ - -static const struct { - const FT_Char *vendor; - const FcChar8 *foundry; -} FcVendorFoundries[] = { - { (const FT_Char *) "ADBE", (const FcChar8 *) "adobe"}, - { (const FT_Char *) "AGFA", (const FcChar8 *) "agfa"}, - { (const FT_Char *) "ALTS", (const FcChar8 *) "altsys"}, - { (const FT_Char *) "APPL", (const FcChar8 *) "apple"}, - { (const FT_Char *) "ARPH", (const FcChar8 *) "arphic"}, - { (const FT_Char *) "ATEC", (const FcChar8 *) "alltype"}, - { (const FT_Char *) "B&H", (const FcChar8 *) "b&h"}, - { (const FT_Char *) "BITS", (const FcChar8 *) "bitstream"}, - { (const FT_Char *) "CANO", (const FcChar8 *) "cannon"}, - { (const FT_Char *) "DYNA", (const FcChar8 *) "dynalab"}, - { (const FT_Char *) "EPSN", (const FcChar8 *) "epson"}, - { (const FT_Char *) "FJ", (const FcChar8 *) "fujitsu"}, - { (const FT_Char *) "IBM", (const FcChar8 *) "ibm"}, - { (const FT_Char *) "ITC", (const FcChar8 *) "itc"}, - { (const FT_Char *) "IMPR", (const FcChar8 *) "impress"}, - { (const FT_Char *) "LARA", (const FcChar8 *) "larabiefonts"}, - { (const FT_Char *) "LEAF", (const FcChar8 *) "interleaf"}, - { (const FT_Char *) "LETR", (const FcChar8 *) "letraset"}, - { (const FT_Char *) "LINO", (const FcChar8 *) "linotype"}, - { (const FT_Char *) "MACR", (const FcChar8 *) "macromedia"}, - { (const FT_Char *) "MONO", (const FcChar8 *) "monotype"}, - { (const FT_Char *) "MS", (const FcChar8 *) "microsoft"}, - { (const FT_Char *) "MT", (const FcChar8 *) "monotype"}, - { (const FT_Char *) "NEC", (const FcChar8 *) "nec"}, - { (const FT_Char *) "PARA", (const FcChar8 *) "paratype"}, - { (const FT_Char *) "QMSI", (const FcChar8 *) "qms"}, - { (const FT_Char *) "RICO", (const FcChar8 *) "ricoh"}, - { (const FT_Char *) "URW", (const FcChar8 *) "urw"}, - { (const FT_Char *) "Y&Y", (const FcChar8 *) "y&y"} -}; - -#define NUM_VENDOR_FOUNDRIES (sizeof (FcVendorFoundries) / sizeof (FcVendorFoundries[0])) - -static const FcChar8 * -FcVendorFoundry(const FT_Char vendor[4]) -{ - int i; - - if (vendor) - for(i = 0; i < NUM_VENDOR_FOUNDRIES; i++) - if (FcVendorMatch (vendor, FcVendorFoundries[i].vendor)) - return FcVendorFoundries[i].foundry; - return 0; -} - -typedef struct _FcStringConst { - const FcChar8 *name; - int value; -} FcStringConst; - -static int -FcStringIsConst (const FcChar8 *string, - const FcStringConst *c, - int nc) -{ - int i; - - for (i = 0; i < nc; i++) - if (FcStrCmpIgnoreBlanksAndCase (string, c[i].name) == 0) - return c[i].value; - return -1; -} - -static int -FcStringContainsConst (const FcChar8 *string, - const FcStringConst *c, - int nc) -{ - int i; - - for (i = 0; i < nc; i++) - if (FcStrContainsIgnoreBlanksAndCase (string, c[i].name)) - return c[i].value; - return -1; -} - -static const FcStringConst weightConsts[] = { - { "thin", FC_WEIGHT_THIN }, - { "extralight", FC_WEIGHT_EXTRALIGHT }, - { "ultralight", FC_WEIGHT_ULTRALIGHT }, - { "light", FC_WEIGHT_LIGHT }, - { "book", FC_WEIGHT_BOOK }, - { "regular", FC_WEIGHT_REGULAR }, - { "normal", FC_WEIGHT_NORMAL }, - { "medium", FC_WEIGHT_MEDIUM }, - { "demibold", FC_WEIGHT_DEMIBOLD }, - { "demi", FC_WEIGHT_DEMIBOLD }, - { "semibold", FC_WEIGHT_SEMIBOLD }, - { "bold", FC_WEIGHT_BOLD }, - { "extrabold", FC_WEIGHT_EXTRABOLD }, - { "ultrabold", FC_WEIGHT_ULTRABOLD }, - { "black", FC_WEIGHT_BLACK }, - { "heavy", FC_WEIGHT_HEAVY }, -}; - -#define NUM_WEIGHT_CONSTS (sizeof (weightConsts) / sizeof (weightConsts[0])) - -#define FcIsWeight(s) FcStringIsConst(s,weightConsts,NUM_WEIGHT_CONSTS) -#define FcContainsWeight(s) FcStringContainsConst (s,weightConsts,NUM_WEIGHT_CONSTS) - -static const FcStringConst widthConsts[] = { - { "ultracondensed", FC_WIDTH_ULTRACONDENSED }, - { "extracondensed", FC_WIDTH_EXTRACONDENSED }, - { "semicondensed", FC_WIDTH_SEMICONDENSED }, - { "condensed", FC_WIDTH_CONDENSED }, /* must be after *condensed */ - { "normal", FC_WIDTH_NORMAL }, - { "semiexpanded", FC_WIDTH_SEMIEXPANDED }, - { "extraexpanded", FC_WIDTH_EXTRAEXPANDED }, - { "ultraexpanded", FC_WIDTH_ULTRAEXPANDED }, - { "expanded", FC_WIDTH_EXPANDED }, /* must be after *expanded */ -}; - -#define NUM_WIDTH_CONSTS (sizeof (widthConsts) / sizeof (widthConsts[0])) - -#define FcIsWidth(s) FcStringIsConst(s,widthConsts,NUM_WIDTH_CONSTS) -#define FcContainsWidth(s) FcStringContainsConst (s,widthConsts,NUM_WIDTH_CONSTS) - -static const FcStringConst slantConsts[] = { - { "italic", FC_SLANT_ITALIC }, - { "oblique", FC_SLANT_OBLIQUE }, -}; - -#define NUM_SLANT_CONSTS (sizeof (slantConsts) / sizeof (slantConsts[0])) - -#define FcIsSlant(s) FcStringIsConst(s,slantConsts,NUM_SLANT_CONSTS) -#define FcContainsSlant(s) FcStringContainsConst (s,slantConsts,NUM_SLANT_CONSTS) - -static double -FcGetPixelSize (FT_Face face, int i) -{ -#if HAVE_FT_GET_BDF_PROPERTY - if (face->num_fixed_sizes == 1) - { - BDF_PropertyRec prop; - int rc; - - rc = MY_Get_BDF_Property (face, "PIXEL_SIZE", &prop); - if (rc == 0 && prop.type == BDF_PROPERTY_TYPE_INTEGER) - return (double) prop.u.integer; - } -#endif -#if HAVE_FT_BITMAP_SIZE_Y_PPEM - return (double) face->available_sizes[i].y_ppem / 64.0; -#else - return (double) face->available_sizes[i].height; -#endif -} - -static FcBool -FcStringInPatternElement (FcPattern *pat, char *elt, FcChar8 *string) -{ - int e; - FcChar8 *old; - for (e = 0; FcPatternGetString (pat, elt, e, &old) == FcResultMatch; e++) - if (!FcStrCmpIgnoreBlanksAndCase (old, string)) - { - return FcTrue; - break; - } - return FcFalse; -} - -FcPattern * -FcFreeTypeQuery (const FcChar8 *file, - int id, - FcBlanks *blanks, - int *count) -{ - FT_Face face; - FcPattern *pat; - int slant = -1; - int weight = -1; - int width = -1; - int i; - FcCharSet *cs; - FcLangSet *ls; - FT_Library ftLibrary; -#if 0 - FcChar8 *family = 0; -#endif - FcChar8 *complex; - const FcChar8 *foundry = 0; - int spacing; - TT_OS2 *os2; -#if HAVE_FT_GET_PS_FONT_INFO - PS_FontInfoRec psfontinfo; -#endif -#if HAVE_FT_GET_BDF_PROPERTY - BDF_PropertyRec prop; -#endif - TT_Header *head; - const FcChar8 *exclusiveLang = 0; - FT_SfntName sname; - FT_UInt snamei, snamec; - - int nfamily = 0; - int nfamily_lang = 0; - int nstyle = 0; - int nstyle_lang = 0; - int nfullname = 0; - int nfullname_lang = 0; - - FcChar8 *style = 0; - int st; - - if (FT_Init_FreeType (&ftLibrary)) - return 0; - - if (FT_New_Face (ftLibrary, (char *) file, id, &face)) - goto bail; - - *count = face->num_faces; - - pat = FcPatternCreate (); - if (!pat) - goto bail0; - - if (!FcPatternAddBool (pat, FC_OUTLINE, - (face->face_flags & FT_FACE_FLAG_SCALABLE) != 0)) - goto bail1; - - if (!FcPatternAddBool (pat, FC_SCALABLE, - (face->face_flags & FT_FACE_FLAG_SCALABLE) != 0)) - goto bail1; - - - /* - * Get the OS/2 table - */ - os2 = (TT_OS2 *) FT_Get_Sfnt_Table (face, ft_sfnt_os2); - - /* - * Look first in the OS/2 table for the foundry, if - * not found here, the various notices will be searched for - * that information, either from the sfnt name tables or - * the Postscript FontInfo dictionary. Finally, the - * BDF properties will queried. - */ - - if (os2 && os2->version >= 0x0001 && os2->version != 0xffff) - foundry = FcVendorFoundry(os2->achVendID); - - if (FcDebug () & FC_DBG_SCANV) - printf ("\n"); - /* - * Grub through the name table looking for family - * and style names. FreeType makes quite a hash - * of them - */ - snamec = FT_Get_Sfnt_Name_Count (face); - for (snamei = 0; snamei < snamec; snamei++) - { - FcChar8 *utf8; - FcChar8 *lang; - char *elt = 0, *eltlang = 0; - int *np = 0, *nlangp = 0; - - if (FT_Get_Sfnt_Name (face, snamei, &sname) != 0) - continue; - - utf8 = FcSfntNameTranscode (&sname); - lang = FcSfntNameLanguage (&sname); - - if (!utf8) - continue; - - switch (sname.name_id) { - case TT_NAME_ID_FONT_FAMILY: -#if 0 - case TT_NAME_ID_PS_NAME: - case TT_NAME_ID_UNIQUE_ID: -#endif - if (FcDebug () & FC_DBG_SCANV) - printf ("found family (n %2d p %d e %d l 0x%04x) %s\n", - sname.name_id, sname.platform_id, - sname.encoding_id, sname.language_id, - utf8); - - elt = FC_FAMILY; - eltlang = FC_FAMILYLANG; - np = &nfamily; - nlangp = &nfamily_lang; - break; - case TT_NAME_ID_FULL_NAME: - case TT_NAME_ID_MAC_FULL_NAME: - if (FcDebug () & FC_DBG_SCANV) - printf ("found full (n %2d p %d e %d l 0x%04x) %s\n", - sname.name_id, sname.platform_id, - sname.encoding_id, sname.language_id, - utf8); - - elt = FC_FULLNAME; - eltlang = FC_FULLNAMELANG; - np = &nfullname; - nlangp = &nfullname_lang; - break; - case TT_NAME_ID_FONT_SUBFAMILY: - if (FcDebug () & FC_DBG_SCANV) - printf ("found style (n %2d p %d e %d l 0x%04x) %s\n", - sname.name_id, sname.platform_id, - sname.encoding_id, sname.language_id, - utf8); - - elt = FC_STYLE; - eltlang = FC_STYLELANG; - np = &nstyle; - nlangp = &nstyle_lang; - break; - case TT_NAME_ID_TRADEMARK: - case TT_NAME_ID_MANUFACTURER: - /* If the foundry wasn't found in the OS/2 table, look here */ - if(!foundry) - foundry = FcNoticeFoundry((FT_String *) utf8); - break; - } - if (elt) - { - if (FcStringInPatternElement (pat, elt, utf8)) - { - free (utf8); - continue; - } - - /* add new element */ - if (!FcPatternAddString (pat, elt, utf8)) - { - free (utf8); - goto bail1; - } - free (utf8); - if (lang) - { - /* pad lang list with 'xx' to line up with elt */ - while (*nlangp < *np) - { - if (!FcPatternAddString (pat, eltlang, "xx")) - goto bail1; - ++*nlangp; - } - if (!FcPatternAddString (pat, eltlang, lang)) - goto bail1; - ++*nlangp; - } - ++*np; - } - else - free (utf8); - } - - if (!nfamily && face->family_name && - FcStrCmpIgnoreBlanksAndCase (face->family_name, "") != 0) - { - if (FcDebug () & FC_DBG_SCANV) - printf ("using FreeType family \"%s\"\n", face->family_name); - if (!FcPatternAddString (pat, FC_FAMILY, face->family_name)) - goto bail1; - ++nfamily; - } - - if (!nstyle && face->style_name && - FcStrCmpIgnoreBlanksAndCase (face->style_name, "") != 0) - { - if (FcDebug () & FC_DBG_SCANV) - printf ("using FreeType style \"%s\"\n", face->style_name); - if (!FcPatternAddString (pat, FC_STYLE, face->style_name)) - goto bail1; - ++nstyle; - } - - if (!nfamily) - { - FcChar8 *start, *end; - FcChar8 *family; - - start = (FcChar8 *) strrchr ((char *) file, '/'); - if (start) - start++; - else - start = (FcChar8 *) file; - end = (FcChar8 *) strrchr ((char *) start, '.'); - if (!end) - end = start + strlen ((char *) start); - /* freed below */ - family = malloc (end - start + 1); - strncpy ((char *) family, (char *) start, end - start); - family[end - start] = '\0'; - if (FcDebug () & FC_DBG_SCANV) - printf ("using filename for family %s\n", family); - if (!FcPatternAddString (pat, FC_FAMILY, family)) - { - free (family); - goto bail1; - } - free (family); - ++nfamily; - } - - /* - * Walk through FC_FULLNAME entries eliding those in FC_FAMILY - * or which are simply a FC_FAMILY and FC_STYLE glued together - */ - { - int fn, fa, st; - FcChar8 *full; - FcChar8 *fam; - FcChar8 *style; - - for (fn = 0; FcPatternGetString (pat, FC_FULLNAME, fn, &full) == FcResultMatch; fn++) - { - FcBool remove = FcFalse; - /* - * Check each family - */ - for (fa = 0; !remove && - FcPatternGetString (pat, FC_FAMILY, - fa, &fam) == FcResultMatch; - fa++) - { - /* - * for exact match - */ - if (!FcStrCmpIgnoreBlanksAndCase (full, fam)) - { - remove = FcTrue; - break; - } - /* - * If the family is in the full name, check the - * combination of this family with every style - */ - if (!FcStrContainsIgnoreBlanksAndCase (full, fam)) - continue; - for (st = 0; !remove && - FcPatternGetString (pat, FC_STYLE, - st, &style) == FcResultMatch; - st++) - { - FcChar8 *both = FcStrPlus (fam, style); - - if (both) - { - if (FcStrCmpIgnoreBlanksAndCase (full, both) == 0) - remove = FcTrue; - free (both); - } - } - } - if (remove) - { - FcPatternRemove (pat, FC_FULLNAME, fn); - FcPatternRemove (pat, FC_FULLNAMELANG, fn); - fn--; - nfullname--; - nfullname_lang--; - } - } - if (FcDebug () & FC_DBG_SCANV) - for (fn = 0; FcPatternGetString (pat, FC_FULLNAME, fn, &full) == FcResultMatch; fn++) - printf ("Saving unique fullname %s\n", full); - } - - if (!FcPatternAddString (pat, FC_FILE, file)) - goto bail1; - - if (!FcPatternAddInteger (pat, FC_INDEX, id)) - goto bail1; - -#if 0 - /* - * don't even try this -- CJK 'monospace' fonts are really - * dual width, and most other fonts don't bother to set - * the attribute. Sigh. - */ - if ((face->face_flags & FT_FACE_FLAG_FIXED_WIDTH) != 0) - if (!FcPatternAddInteger (pat, FC_SPACING, FC_MONO)) - goto bail1; -#endif - - /* - * Find the font revision (if available) - */ - head = (TT_Header *) FT_Get_Sfnt_Table (face, ft_sfnt_head); - if (head) - { - if (!FcPatternAddInteger (pat, FC_FONTVERSION, head->Font_Revision)) - goto bail1; - } - else - { - if (!FcPatternAddInteger (pat, FC_FONTVERSION, 0)) - goto bail1; - } - - if (os2 && os2->version >= 0x0001 && os2->version != 0xffff) - { - for (i = 0; i < NUM_CODE_PAGE_RANGE; i++) - { - FT_ULong bits; - int bit; - if (FcCodePageRange[i].bit < 32) - { - bits = os2->ulCodePageRange1; - bit = FcCodePageRange[i].bit; - } - else - { - bits = os2->ulCodePageRange2; - bit = FcCodePageRange[i].bit - 32; - } - if (bits & (1 << bit)) - { - /* - * If the font advertises support for multiple - * "exclusive" languages, then include support - * for any language found to have coverage - */ - if (exclusiveLang) - { - exclusiveLang = 0; - break; - } - exclusiveLang = FcCodePageRange[i].lang; - } - } - } - - if (os2 && os2->version != 0xffff) - { - if (os2->usWeightClass == 0) - ; - else if (os2->usWeightClass < 150) - weight = FC_WEIGHT_THIN; - else if (os2->usWeightClass < 250) - weight = FC_WEIGHT_EXTRALIGHT; - else if (os2->usWeightClass < 350) - weight = FC_WEIGHT_LIGHT; - else if (os2->usWeightClass < 450) - weight = FC_WEIGHT_REGULAR; - else if (os2->usWeightClass < 550) - weight = FC_WEIGHT_MEDIUM; - else if (os2->usWeightClass < 650) - weight = FC_WEIGHT_SEMIBOLD; - else if (os2->usWeightClass < 750) - weight = FC_WEIGHT_BOLD; - else if (os2->usWeightClass < 850) - weight = FC_WEIGHT_EXTRABOLD; - else if (os2->usWeightClass < 950) - weight = FC_WEIGHT_BLACK; - - switch (os2->usWidthClass) { - case 1: width = FC_WIDTH_ULTRACONDENSED; break; - case 2: width = FC_WIDTH_EXTRACONDENSED; break; - case 3: width = FC_WIDTH_CONDENSED; break; - case 4: width = FC_WIDTH_SEMICONDENSED; break; - case 5: width = FC_WIDTH_NORMAL; break; - case 6: width = FC_WIDTH_SEMIEXPANDED; break; - case 7: width = FC_WIDTH_EXPANDED; break; - case 8: width = FC_WIDTH_EXTRAEXPANDED; break; - case 9: width = FC_WIDTH_ULTRAEXPANDED; break; - } - } - if (os2 && (complex = FcFontCapabilities(face))) - { - if (!FcPatternAddString (pat, FC_CAPABILITY, complex)) - { - free (complex); - goto bail1; - } - free (complex); - } - - /* - * Type 1: Check for FontInfo dictionary information - * Code from g2@magestudios.net (Gerard Escalante) - */ - -#if HAVE_FT_GET_PS_FONT_INFO - if (FT_Get_PS_Font_Info(face, &psfontinfo) == 0) - { - if (weight == -1 && psfontinfo.weight) - { - weight = FcIsWeight (psfontinfo.weight); - if (FcDebug() & FC_DBG_SCANV) - printf ("\tType1 weight %s maps to %d\n", - psfontinfo.weight, weight); - } - -#if 0 - /* - * Don't bother with italic_angle; FreeType already extracts that - * information for us and sticks it into style_flags - */ - if (psfontinfo.italic_angle) - slant = FC_SLANT_ITALIC; - else - slant = FC_SLANT_ROMAN; -#endif - - if(!foundry) - foundry = FcNoticeFoundry(psfontinfo.notice); - } -#endif /* HAVE_FT_GET_PS_FONT_INFO */ - -#if HAVE_FT_GET_BDF_PROPERTY - /* - * Finally, look for a FOUNDRY BDF property if no other - * mechanism has managed to locate a foundry - */ - - if (!foundry) - { - int rc; - BDF_PropertyRec prop; - rc = MY_Get_BDF_Property(face, "FOUNDRY", &prop); - if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_ATOM) - foundry = prop.u.atom; - } - - if (width == -1) - { - if (MY_Get_BDF_Property(face, "RELATIVE_SETWIDTH", &prop) == 0 && - (prop.type == BDF_PROPERTY_TYPE_INTEGER || - prop.type == BDF_PROPERTY_TYPE_CARDINAL)) - { - FT_Int32 value; - - if (prop.type == BDF_PROPERTY_TYPE_INTEGER) - value = prop.u.integer; - else - value = (FT_Int32) prop.u.cardinal; - switch ((value + 5) / 10) { - case 1: width = FC_WIDTH_ULTRACONDENSED; break; - case 2: width = FC_WIDTH_EXTRACONDENSED; break; - case 3: width = FC_WIDTH_CONDENSED; break; - case 4: width = FC_WIDTH_SEMICONDENSED; break; - case 5: width = FC_WIDTH_NORMAL; break; - case 6: width = FC_WIDTH_SEMIEXPANDED; break; - case 7: width = FC_WIDTH_EXPANDED; break; - case 8: width = FC_WIDTH_EXTRAEXPANDED; break; - case 9: width = FC_WIDTH_ULTRAEXPANDED; break; - } - } - if (width == -1 && - MY_Get_BDF_Property (face, "SETWIDTH_NAME", &prop) == 0 && - prop.type == BDF_PROPERTY_TYPE_ATOM) - { - width = FcIsWidth (prop.u.atom); - if (FcDebug () & FC_DBG_SCANV) - printf ("\tsetwidth %s maps to %d\n", prop.u.atom, width); - } - } -#endif - - /* - * Look for weight, width and slant names in the style value - */ - for (st = 0; FcPatternGetString (pat, FC_STYLE, st, &style) == FcResultMatch; st++) - { - if (weight == -1) - { - weight = FcContainsWeight (style); - if (FcDebug() & FC_DBG_SCANV) - printf ("\tStyle %s maps to weight %d\n", style, weight); - } - if (width == -1) - { - width = FcContainsWidth (style); - if (FcDebug() & FC_DBG_SCANV) - printf ("\tStyle %s maps to width %d\n", style, width); - } - if (slant == -1) - { - slant = FcContainsSlant (style); - if (FcDebug() & FC_DBG_SCANV) - printf ("\tStyle %s maps to slant %d\n", style, slant); - } - } - /* - * Pull default values from the FreeType flags if more - * specific values not found above - */ - if (slant == -1) - { - slant = FC_SLANT_ROMAN; - if (face->style_flags & FT_STYLE_FLAG_ITALIC) - slant = FC_SLANT_ITALIC; - } - - if (weight == -1) - { - weight = FC_WEIGHT_MEDIUM; - if (face->style_flags & FT_STYLE_FLAG_BOLD) - weight = FC_WEIGHT_BOLD; - } - - if (width == -1) - width = FC_WIDTH_NORMAL; - - if (foundry == 0) - foundry = "unknown"; - - if (!FcPatternAddInteger (pat, FC_SLANT, slant)) - goto bail1; - - if (!FcPatternAddInteger (pat, FC_WEIGHT, weight)) - goto bail1; - - if (!FcPatternAddInteger (pat, FC_WIDTH, width)) - goto bail1; - - if (!FcPatternAddString (pat, FC_FOUNDRY, foundry)) - goto bail1; - - /* - * Compute the unicode coverage for the font - */ - cs = FcFreeTypeCharSetAndSpacing (face, blanks, &spacing); - if (!cs) - goto bail1; - -#if HAVE_FT_GET_BDF_PROPERTY - /* For PCF fonts, override the computed spacing with the one from - the property */ - if(MY_Get_BDF_Property(face, "SPACING", &prop) == 0 && - prop.type == BDF_PROPERTY_TYPE_ATOM) { - if(!strcmp(prop.u.atom, "c") || !strcmp(prop.u.atom, "C")) - spacing = FC_CHARCELL; - else if(!strcmp(prop.u.atom, "m") || !strcmp(prop.u.atom, "M")) - spacing = FC_MONO; - else if(!strcmp(prop.u.atom, "p") || !strcmp(prop.u.atom, "P")) - spacing = FC_PROPORTIONAL; - } -#endif - - /* - * Skip over PCF fonts that have no encoded characters; they're - * usually just Unicode fonts transcoded to some legacy encoding - */ - if (FcCharSetCount (cs) == 0) - { - if (!strcmp(FT_MODULE_CLASS(&face->driver->root)->module_name, "pcf")) - goto bail2; - } - - if (!FcPatternAddCharSet (pat, FC_CHARSET, cs)) - goto bail2; - - ls = FcFreeTypeLangSet (cs, exclusiveLang); - if (!ls) - goto bail2; - - if (!FcPatternAddLangSet (pat, FC_LANG, ls)) - { - FcLangSetDestroy (ls); - goto bail2; - } - - FcLangSetDestroy (ls); - - if (spacing != FC_PROPORTIONAL) - if (!FcPatternAddInteger (pat, FC_SPACING, spacing)) - goto bail2; - - if (!(face->face_flags & FT_FACE_FLAG_SCALABLE)) - { - for (i = 0; i < face->num_fixed_sizes; i++) - if (!FcPatternAddDouble (pat, FC_PIXEL_SIZE, - FcGetPixelSize (face, i))) - goto bail1; - if (!FcPatternAddBool (pat, FC_ANTIALIAS, FcFalse)) - goto bail1; -#if HAVE_FT_GET_BDF_PROPERTY - if(face->num_fixed_sizes == 1) { - int rc; - int value; - BDF_PropertyRec prop; - - rc = MY_Get_BDF_Property(face, "POINT_SIZE", &prop); - if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_INTEGER) - value = prop.u.integer; - else if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_CARDINAL) - value = prop.u.cardinal; - else - goto nevermind; - if(!FcPatternAddDouble(pat, FC_SIZE, value / 10.0)) - goto nevermind; - - rc = MY_Get_BDF_Property(face, "RESOLUTION_Y", &prop); - if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_INTEGER) - value = prop.u.integer; - else if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_CARDINAL) - value = prop.u.cardinal; - else - goto nevermind; - if(!FcPatternAddDouble(pat, FC_DPI, (double)value)) - goto nevermind; - - } - nevermind: - ; -#endif - } -#if HAVE_FT_GET_X11_FONT_FORMAT - /* - * Use the (not well documented or supported) X-specific function - * from FreeType to figure out the font format - */ - { - const char *font_format = FT_Get_X11_Font_Format (face); - if (font_format) - FcPatternAddString (pat, FC_FONTFORMAT, font_format); - } -#endif - - /* - * Drop our reference to the charset - */ - FcCharSetDestroy (cs); - - /* - * Deallocate family/style values - */ - - FT_Done_Face (face); - FT_Done_FreeType (ftLibrary); - return pat; - -bail2: - FcCharSetDestroy (cs); -bail1: - FcPatternDestroy (pat); -bail0: - FT_Done_Face (face); -bail: - FT_Done_FreeType (ftLibrary); - return 0; -} - - -/* - * For our purposes, this approximation is sufficient - */ -#if !HAVE_FT_GET_NEXT_CHAR -#define FT_Get_Next_Char(face, ucs4, gi) ((ucs4) >= 0xffffff ? \ - (*(gi) = 0), 0 : \ - (*(gi) = 1), (ucs4) + 1) -#warning "No FT_Get_Next_Char: Please install freetype version 2.1.0 or newer" -#endif - -typedef struct _FcCharEnt { - FcChar16 bmp; - unsigned char encode; -} FcCharEnt; - -struct _FcCharMap { - const FcCharEnt *ent; - int nent; -}; - -typedef struct _FcFontDecode { - FT_Encoding encoding; - const FcCharMap *map; - FcChar32 max; -} FcFontDecode; - -static const FcCharEnt AppleRomanEnt[] = { - { 0x0020, 0x20 }, /* SPACE */ - { 0x0021, 0x21 }, /* EXCLAMATION MARK */ - { 0x0022, 0x22 }, /* QUOTATION MARK */ - { 0x0023, 0x23 }, /* NUMBER SIGN */ - { 0x0024, 0x24 }, /* DOLLAR SIGN */ - { 0x0025, 0x25 }, /* PERCENT SIGN */ - { 0x0026, 0x26 }, /* AMPERSAND */ - { 0x0027, 0x27 }, /* APOSTROPHE */ - { 0x0028, 0x28 }, /* LEFT PARENTHESIS */ - { 0x0029, 0x29 }, /* RIGHT PARENTHESIS */ - { 0x002A, 0x2A }, /* ASTERISK */ - { 0x002B, 0x2B }, /* PLUS SIGN */ - { 0x002C, 0x2C }, /* COMMA */ - { 0x002D, 0x2D }, /* HYPHEN-MINUS */ - { 0x002E, 0x2E }, /* FULL STOP */ - { 0x002F, 0x2F }, /* SOLIDUS */ - { 0x0030, 0x30 }, /* DIGIT ZERO */ - { 0x0031, 0x31 }, /* DIGIT ONE */ - { 0x0032, 0x32 }, /* DIGIT TWO */ - { 0x0033, 0x33 }, /* DIGIT THREE */ - { 0x0034, 0x34 }, /* DIGIT FOUR */ - { 0x0035, 0x35 }, /* DIGIT FIVE */ - { 0x0036, 0x36 }, /* DIGIT SIX */ - { 0x0037, 0x37 }, /* DIGIT SEVEN */ - { 0x0038, 0x38 }, /* DIGIT EIGHT */ - { 0x0039, 0x39 }, /* DIGIT NINE */ - { 0x003A, 0x3A }, /* COLON */ - { 0x003B, 0x3B }, /* SEMICOLON */ - { 0x003C, 0x3C }, /* LESS-THAN SIGN */ - { 0x003D, 0x3D }, /* EQUALS SIGN */ - { 0x003E, 0x3E }, /* GREATER-THAN SIGN */ - { 0x003F, 0x3F }, /* QUESTION MARK */ - { 0x0040, 0x40 }, /* COMMERCIAL AT */ - { 0x0041, 0x41 }, /* LATIN CAPITAL LETTER A */ - { 0x0042, 0x42 }, /* LATIN CAPITAL LETTER B */ - { 0x0043, 0x43 }, /* LATIN CAPITAL LETTER C */ - { 0x0044, 0x44 }, /* LATIN CAPITAL LETTER D */ - { 0x0045, 0x45 }, /* LATIN CAPITAL LETTER E */ - { 0x0046, 0x46 }, /* LATIN CAPITAL LETTER F */ - { 0x0047, 0x47 }, /* LATIN CAPITAL LETTER G */ - { 0x0048, 0x48 }, /* LATIN CAPITAL LETTER H */ - { 0x0049, 0x49 }, /* LATIN CAPITAL LETTER I */ - { 0x004A, 0x4A }, /* LATIN CAPITAL LETTER J */ - { 0x004B, 0x4B }, /* LATIN CAPITAL LETTER K */ - { 0x004C, 0x4C }, /* LATIN CAPITAL LETTER L */ - { 0x004D, 0x4D }, /* LATIN CAPITAL LETTER M */ - { 0x004E, 0x4E }, /* LATIN CAPITAL LETTER N */ - { 0x004F, 0x4F }, /* LATIN CAPITAL LETTER O */ - { 0x0050, 0x50 }, /* LATIN CAPITAL LETTER P */ - { 0x0051, 0x51 }, /* LATIN CAPITAL LETTER Q */ - { 0x0052, 0x52 }, /* LATIN CAPITAL LETTER R */ - { 0x0053, 0x53 }, /* LATIN CAPITAL LETTER S */ - { 0x0054, 0x54 }, /* LATIN CAPITAL LETTER T */ - { 0x0055, 0x55 }, /* LATIN CAPITAL LETTER U */ - { 0x0056, 0x56 }, /* LATIN CAPITAL LETTER V */ - { 0x0057, 0x57 }, /* LATIN CAPITAL LETTER W */ - { 0x0058, 0x58 }, /* LATIN CAPITAL LETTER X */ - { 0x0059, 0x59 }, /* LATIN CAPITAL LETTER Y */ - { 0x005A, 0x5A }, /* LATIN CAPITAL LETTER Z */ - { 0x005B, 0x5B }, /* LEFT SQUARE BRACKET */ - { 0x005C, 0x5C }, /* REVERSE SOLIDUS */ - { 0x005D, 0x5D }, /* RIGHT SQUARE BRACKET */ - { 0x005E, 0x5E }, /* CIRCUMFLEX ACCENT */ - { 0x005F, 0x5F }, /* LOW LINE */ - { 0x0060, 0x60 }, /* GRAVE ACCENT */ - { 0x0061, 0x61 }, /* LATIN SMALL LETTER A */ - { 0x0062, 0x62 }, /* LATIN SMALL LETTER B */ - { 0x0063, 0x63 }, /* LATIN SMALL LETTER C */ - { 0x0064, 0x64 }, /* LATIN SMALL LETTER D */ - { 0x0065, 0x65 }, /* LATIN SMALL LETTER E */ - { 0x0066, 0x66 }, /* LATIN SMALL LETTER F */ - { 0x0067, 0x67 }, /* LATIN SMALL LETTER G */ - { 0x0068, 0x68 }, /* LATIN SMALL LETTER H */ - { 0x0069, 0x69 }, /* LATIN SMALL LETTER I */ - { 0x006A, 0x6A }, /* LATIN SMALL LETTER J */ - { 0x006B, 0x6B }, /* LATIN SMALL LETTER K */ - { 0x006C, 0x6C }, /* LATIN SMALL LETTER L */ - { 0x006D, 0x6D }, /* LATIN SMALL LETTER M */ - { 0x006E, 0x6E }, /* LATIN SMALL LETTER N */ - { 0x006F, 0x6F }, /* LATIN SMALL LETTER O */ - { 0x0070, 0x70 }, /* LATIN SMALL LETTER P */ - { 0x0071, 0x71 }, /* LATIN SMALL LETTER Q */ - { 0x0072, 0x72 }, /* LATIN SMALL LETTER R */ - { 0x0073, 0x73 }, /* LATIN SMALL LETTER S */ - { 0x0074, 0x74 }, /* LATIN SMALL LETTER T */ - { 0x0075, 0x75 }, /* LATIN SMALL LETTER U */ - { 0x0076, 0x76 }, /* LATIN SMALL LETTER V */ - { 0x0077, 0x77 }, /* LATIN SMALL LETTER W */ - { 0x0078, 0x78 }, /* LATIN SMALL LETTER X */ - { 0x0079, 0x79 }, /* LATIN SMALL LETTER Y */ - { 0x007A, 0x7A }, /* LATIN SMALL LETTER Z */ - { 0x007B, 0x7B }, /* LEFT CURLY BRACKET */ - { 0x007C, 0x7C }, /* VERTICAL LINE */ - { 0x007D, 0x7D }, /* RIGHT CURLY BRACKET */ - { 0x007E, 0x7E }, /* TILDE */ - { 0x00A0, 0xCA }, /* NO-BREAK SPACE */ - { 0x00A1, 0xC1 }, /* INVERTED EXCLAMATION MARK */ - { 0x00A2, 0xA2 }, /* CENT SIGN */ - { 0x00A3, 0xA3 }, /* POUND SIGN */ - { 0x00A5, 0xB4 }, /* YEN SIGN */ - { 0x00A7, 0xA4 }, /* SECTION SIGN */ - { 0x00A8, 0xAC }, /* DIAERESIS */ - { 0x00A9, 0xA9 }, /* COPYRIGHT SIGN */ - { 0x00AA, 0xBB }, /* FEMININE ORDINAL INDICATOR */ - { 0x00AB, 0xC7 }, /* LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */ - { 0x00AC, 0xC2 }, /* NOT SIGN */ - { 0x00AE, 0xA8 }, /* REGISTERED SIGN */ - { 0x00AF, 0xF8 }, /* MACRON */ - { 0x00B0, 0xA1 }, /* DEGREE SIGN */ - { 0x00B1, 0xB1 }, /* PLUS-MINUS SIGN */ - { 0x00B4, 0xAB }, /* ACUTE ACCENT */ - { 0x00B5, 0xB5 }, /* MICRO SIGN */ - { 0x00B6, 0xA6 }, /* PILCROW SIGN */ - { 0x00B7, 0xE1 }, /* MIDDLE DOT */ - { 0x00B8, 0xFC }, /* CEDILLA */ - { 0x00BA, 0xBC }, /* MASCULINE ORDINAL INDICATOR */ - { 0x00BB, 0xC8 }, /* RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */ - { 0x00BF, 0xC0 }, /* INVERTED QUESTION MARK */ - { 0x00C0, 0xCB }, /* LATIN CAPITAL LETTER A WITH GRAVE */ - { 0x00C1, 0xE7 }, /* LATIN CAPITAL LETTER A WITH ACUTE */ - { 0x00C2, 0xE5 }, /* LATIN CAPITAL LETTER A WITH CIRCUMFLEX */ - { 0x00C3, 0xCC }, /* LATIN CAPITAL LETTER A WITH TILDE */ - { 0x00C4, 0x80 }, /* LATIN CAPITAL LETTER A WITH DIAERESIS */ - { 0x00C5, 0x81 }, /* LATIN CAPITAL LETTER A WITH RING ABOVE */ - { 0x00C6, 0xAE }, /* LATIN CAPITAL LETTER AE */ - { 0x00C7, 0x82 }, /* LATIN CAPITAL LETTER C WITH CEDILLA */ - { 0x00C8, 0xE9 }, /* LATIN CAPITAL LETTER E WITH GRAVE */ - { 0x00C9, 0x83 }, /* LATIN CAPITAL LETTER E WITH ACUTE */ - { 0x00CA, 0xE6 }, /* LATIN CAPITAL LETTER E WITH CIRCUMFLEX */ - { 0x00CB, 0xE8 }, /* LATIN CAPITAL LETTER E WITH DIAERESIS */ - { 0x00CC, 0xED }, /* LATIN CAPITAL LETTER I WITH GRAVE */ - { 0x00CD, 0xEA }, /* LATIN CAPITAL LETTER I WITH ACUTE */ - { 0x00CE, 0xEB }, /* LATIN CAPITAL LETTER I WITH CIRCUMFLEX */ - { 0x00CF, 0xEC }, /* LATIN CAPITAL LETTER I WITH DIAERESIS */ - { 0x00D1, 0x84 }, /* LATIN CAPITAL LETTER N WITH TILDE */ - { 0x00D2, 0xF1 }, /* LATIN CAPITAL LETTER O WITH GRAVE */ - { 0x00D3, 0xEE }, /* LATIN CAPITAL LETTER O WITH ACUTE */ - { 0x00D4, 0xEF }, /* LATIN CAPITAL LETTER O WITH CIRCUMFLEX */ - { 0x00D5, 0xCD }, /* LATIN CAPITAL LETTER O WITH TILDE */ - { 0x00D6, 0x85 }, /* LATIN CAPITAL LETTER O WITH DIAERESIS */ - { 0x00D8, 0xAF }, /* LATIN CAPITAL LETTER O WITH STROKE */ - { 0x00D9, 0xF4 }, /* LATIN CAPITAL LETTER U WITH GRAVE */ - { 0x00DA, 0xF2 }, /* LATIN CAPITAL LETTER U WITH ACUTE */ - { 0x00DB, 0xF3 }, /* LATIN CAPITAL LETTER U WITH CIRCUMFLEX */ - { 0x00DC, 0x86 }, /* LATIN CAPITAL LETTER U WITH DIAERESIS */ - { 0x00DF, 0xA7 }, /* LATIN SMALL LETTER SHARP S */ - { 0x00E0, 0x88 }, /* LATIN SMALL LETTER A WITH GRAVE */ - { 0x00E1, 0x87 }, /* LATIN SMALL LETTER A WITH ACUTE */ - { 0x00E2, 0x89 }, /* LATIN SMALL LETTER A WITH CIRCUMFLEX */ - { 0x00E3, 0x8B }, /* LATIN SMALL LETTER A WITH TILDE */ - { 0x00E4, 0x8A }, /* LATIN SMALL LETTER A WITH DIAERESIS */ - { 0x00E5, 0x8C }, /* LATIN SMALL LETTER A WITH RING ABOVE */ - { 0x00E6, 0xBE }, /* LATIN SMALL LETTER AE */ - { 0x00E7, 0x8D }, /* LATIN SMALL LETTER C WITH CEDILLA */ - { 0x00E8, 0x8F }, /* LATIN SMALL LETTER E WITH GRAVE */ - { 0x00E9, 0x8E }, /* LATIN SMALL LETTER E WITH ACUTE */ - { 0x00EA, 0x90 }, /* LATIN SMALL LETTER E WITH CIRCUMFLEX */ - { 0x00EB, 0x91 }, /* LATIN SMALL LETTER E WITH DIAERESIS */ - { 0x00EC, 0x93 }, /* LATIN SMALL LETTER I WITH GRAVE */ - { 0x00ED, 0x92 }, /* LATIN SMALL LETTER I WITH ACUTE */ - { 0x00EE, 0x94 }, /* LATIN SMALL LETTER I WITH CIRCUMFLEX */ - { 0x00EF, 0x95 }, /* LATIN SMALL LETTER I WITH DIAERESIS */ - { 0x00F1, 0x96 }, /* LATIN SMALL LETTER N WITH TILDE */ - { 0x00F2, 0x98 }, /* LATIN SMALL LETTER O WITH GRAVE */ - { 0x00F3, 0x97 }, /* LATIN SMALL LETTER O WITH ACUTE */ - { 0x00F4, 0x99 }, /* LATIN SMALL LETTER O WITH CIRCUMFLEX */ - { 0x00F5, 0x9B }, /* LATIN SMALL LETTER O WITH TILDE */ - { 0x00F6, 0x9A }, /* LATIN SMALL LETTER O WITH DIAERESIS */ - { 0x00F7, 0xD6 }, /* DIVISION SIGN */ - { 0x00F8, 0xBF }, /* LATIN SMALL LETTER O WITH STROKE */ - { 0x00F9, 0x9D }, /* LATIN SMALL LETTER U WITH GRAVE */ - { 0x00FA, 0x9C }, /* LATIN SMALL LETTER U WITH ACUTE */ - { 0x00FB, 0x9E }, /* LATIN SMALL LETTER U WITH CIRCUMFLEX */ - { 0x00FC, 0x9F }, /* LATIN SMALL LETTER U WITH DIAERESIS */ - { 0x00FF, 0xD8 }, /* LATIN SMALL LETTER Y WITH DIAERESIS */ - { 0x0131, 0xF5 }, /* LATIN SMALL LETTER DOTLESS I */ - { 0x0152, 0xCE }, /* LATIN CAPITAL LIGATURE OE */ - { 0x0153, 0xCF }, /* LATIN SMALL LIGATURE OE */ - { 0x0178, 0xD9 }, /* LATIN CAPITAL LETTER Y WITH DIAERESIS */ - { 0x0192, 0xC4 }, /* LATIN SMALL LETTER F WITH HOOK */ - { 0x02C6, 0xF6 }, /* MODIFIER LETTER CIRCUMFLEX ACCENT */ - { 0x02C7, 0xFF }, /* CARON */ - { 0x02D8, 0xF9 }, /* BREVE */ - { 0x02D9, 0xFA }, /* DOT ABOVE */ - { 0x02DA, 0xFB }, /* RING ABOVE */ - { 0x02DB, 0xFE }, /* OGONEK */ - { 0x02DC, 0xF7 }, /* SMALL TILDE */ - { 0x02DD, 0xFD }, /* DOUBLE ACUTE ACCENT */ - { 0x03A9, 0xBD }, /* GREEK CAPITAL LETTER OMEGA */ - { 0x03C0, 0xB9 }, /* GREEK SMALL LETTER PI */ - { 0x2013, 0xD0 }, /* EN DASH */ - { 0x2014, 0xD1 }, /* EM DASH */ - { 0x2018, 0xD4 }, /* LEFT SINGLE QUOTATION MARK */ - { 0x2019, 0xD5 }, /* RIGHT SINGLE QUOTATION MARK */ - { 0x201A, 0xE2 }, /* SINGLE LOW-9 QUOTATION MARK */ - { 0x201C, 0xD2 }, /* LEFT DOUBLE QUOTATION MARK */ - { 0x201D, 0xD3 }, /* RIGHT DOUBLE QUOTATION MARK */ - { 0x201E, 0xE3 }, /* DOUBLE LOW-9 QUOTATION MARK */ - { 0x2020, 0xA0 }, /* DAGGER */ - { 0x2021, 0xE0 }, /* DOUBLE DAGGER */ - { 0x2022, 0xA5 }, /* BULLET */ - { 0x2026, 0xC9 }, /* HORIZONTAL ELLIPSIS */ - { 0x2030, 0xE4 }, /* PER MILLE SIGN */ - { 0x2039, 0xDC }, /* SINGLE LEFT-POINTING ANGLE QUOTATION MARK */ - { 0x203A, 0xDD }, /* SINGLE RIGHT-POINTING ANGLE QUOTATION MARK */ - { 0x2044, 0xDA }, /* FRACTION SLASH */ - { 0x20AC, 0xDB }, /* EURO SIGN */ - { 0x2122, 0xAA }, /* TRADE MARK SIGN */ - { 0x2202, 0xB6 }, /* PARTIAL DIFFERENTIAL */ - { 0x2206, 0xC6 }, /* INCREMENT */ - { 0x220F, 0xB8 }, /* N-ARY PRODUCT */ - { 0x2211, 0xB7 }, /* N-ARY SUMMATION */ - { 0x221A, 0xC3 }, /* SQUARE ROOT */ - { 0x221E, 0xB0 }, /* INFINITY */ - { 0x222B, 0xBA }, /* INTEGRAL */ - { 0x2248, 0xC5 }, /* ALMOST EQUAL TO */ - { 0x2260, 0xAD }, /* NOT EQUAL TO */ - { 0x2264, 0xB2 }, /* LESS-THAN OR EQUAL TO */ - { 0x2265, 0xB3 }, /* GREATER-THAN OR EQUAL TO */ - { 0x25CA, 0xD7 }, /* LOZENGE */ - { 0xF8FF, 0xF0 }, /* Apple logo */ - { 0xFB01, 0xDE }, /* LATIN SMALL LIGATURE FI */ - { 0xFB02, 0xDF }, /* LATIN SMALL LIGATURE FL */ -}; - -static const FcCharMap AppleRoman = { - AppleRomanEnt, - sizeof (AppleRomanEnt) / sizeof (AppleRomanEnt[0]) -}; - -static const FcCharEnt AdobeSymbolEnt[] = { - { 0x0020, 0x20 }, /* SPACE # space */ - { 0x0021, 0x21 }, /* EXCLAMATION MARK # exclam */ - { 0x0023, 0x23 }, /* NUMBER SIGN # numbersign */ - { 0x0025, 0x25 }, /* PERCENT SIGN # percent */ - { 0x0026, 0x26 }, /* AMPERSAND # ampersand */ - { 0x0028, 0x28 }, /* LEFT PARENTHESIS # parenleft */ - { 0x0029, 0x29 }, /* RIGHT PARENTHESIS # parenright */ - { 0x002B, 0x2B }, /* PLUS SIGN # plus */ - { 0x002C, 0x2C }, /* COMMA # comma */ - { 0x002E, 0x2E }, /* FULL STOP # period */ - { 0x002F, 0x2F }, /* SOLIDUS # slash */ - { 0x0030, 0x30 }, /* DIGIT ZERO # zero */ - { 0x0031, 0x31 }, /* DIGIT ONE # one */ - { 0x0032, 0x32 }, /* DIGIT TWO # two */ - { 0x0033, 0x33 }, /* DIGIT THREE # three */ - { 0x0034, 0x34 }, /* DIGIT FOUR # four */ - { 0x0035, 0x35 }, /* DIGIT FIVE # five */ - { 0x0036, 0x36 }, /* DIGIT SIX # six */ - { 0x0037, 0x37 }, /* DIGIT SEVEN # seven */ - { 0x0038, 0x38 }, /* DIGIT EIGHT # eight */ - { 0x0039, 0x39 }, /* DIGIT NINE # nine */ - { 0x003A, 0x3A }, /* COLON # colon */ - { 0x003B, 0x3B }, /* SEMICOLON # semicolon */ - { 0x003C, 0x3C }, /* LESS-THAN SIGN # less */ - { 0x003D, 0x3D }, /* EQUALS SIGN # equal */ - { 0x003E, 0x3E }, /* GREATER-THAN SIGN # greater */ - { 0x003F, 0x3F }, /* QUESTION MARK # question */ - { 0x005B, 0x5B }, /* LEFT SQUARE BRACKET # bracketleft */ - { 0x005D, 0x5D }, /* RIGHT SQUARE BRACKET # bracketright */ - { 0x005F, 0x5F }, /* LOW LINE # underscore */ - { 0x007B, 0x7B }, /* LEFT CURLY BRACKET # braceleft */ - { 0x007C, 0x7C }, /* VERTICAL LINE # bar */ - { 0x007D, 0x7D }, /* RIGHT CURLY BRACKET # braceright */ - { 0x00A0, 0x20 }, /* NO-BREAK SPACE # space */ - { 0x00AC, 0xD8 }, /* NOT SIGN # logicalnot */ - { 0x00B0, 0xB0 }, /* DEGREE SIGN # degree */ - { 0x00B1, 0xB1 }, /* PLUS-MINUS SIGN # plusminus */ - { 0x00B5, 0x6D }, /* MICRO SIGN # mu */ - { 0x00D7, 0xB4 }, /* MULTIPLICATION SIGN # multiply */ - { 0x00F7, 0xB8 }, /* DIVISION SIGN # divide */ - { 0x0192, 0xA6 }, /* LATIN SMALL LETTER F WITH HOOK # florin */ - { 0x0391, 0x41 }, /* GREEK CAPITAL LETTER ALPHA # Alpha */ - { 0x0392, 0x42 }, /* GREEK CAPITAL LETTER BETA # Beta */ - { 0x0393, 0x47 }, /* GREEK CAPITAL LETTER GAMMA # Gamma */ - { 0x0394, 0x44 }, /* GREEK CAPITAL LETTER DELTA # Delta */ - { 0x0395, 0x45 }, /* GREEK CAPITAL LETTER EPSILON # Epsilon */ - { 0x0396, 0x5A }, /* GREEK CAPITAL LETTER ZETA # Zeta */ - { 0x0397, 0x48 }, /* GREEK CAPITAL LETTER ETA # Eta */ - { 0x0398, 0x51 }, /* GREEK CAPITAL LETTER THETA # Theta */ - { 0x0399, 0x49 }, /* GREEK CAPITAL LETTER IOTA # Iota */ - { 0x039A, 0x4B }, /* GREEK CAPITAL LETTER KAPPA # Kappa */ - { 0x039B, 0x4C }, /* GREEK CAPITAL LETTER LAMDA # Lambda */ - { 0x039C, 0x4D }, /* GREEK CAPITAL LETTER MU # Mu */ - { 0x039D, 0x4E }, /* GREEK CAPITAL LETTER NU # Nu */ - { 0x039E, 0x58 }, /* GREEK CAPITAL LETTER XI # Xi */ - { 0x039F, 0x4F }, /* GREEK CAPITAL LETTER OMICRON # Omicron */ - { 0x03A0, 0x50 }, /* GREEK CAPITAL LETTER PI # Pi */ - { 0x03A1, 0x52 }, /* GREEK CAPITAL LETTER RHO # Rho */ - { 0x03A3, 0x53 }, /* GREEK CAPITAL LETTER SIGMA # Sigma */ - { 0x03A4, 0x54 }, /* GREEK CAPITAL LETTER TAU # Tau */ - { 0x03A5, 0x55 }, /* GREEK CAPITAL LETTER UPSILON # Upsilon */ - { 0x03A6, 0x46 }, /* GREEK CAPITAL LETTER PHI # Phi */ - { 0x03A7, 0x43 }, /* GREEK CAPITAL LETTER CHI # Chi */ - { 0x03A8, 0x59 }, /* GREEK CAPITAL LETTER PSI # Psi */ - { 0x03A9, 0x57 }, /* GREEK CAPITAL LETTER OMEGA # Omega */ - { 0x03B1, 0x61 }, /* GREEK SMALL LETTER ALPHA # alpha */ - { 0x03B2, 0x62 }, /* GREEK SMALL LETTER BETA # beta */ - { 0x03B3, 0x67 }, /* GREEK SMALL LETTER GAMMA # gamma */ - { 0x03B4, 0x64 }, /* GREEK SMALL LETTER DELTA # delta */ - { 0x03B5, 0x65 }, /* GREEK SMALL LETTER EPSILON # epsilon */ - { 0x03B6, 0x7A }, /* GREEK SMALL LETTER ZETA # zeta */ - { 0x03B7, 0x68 }, /* GREEK SMALL LETTER ETA # eta */ - { 0x03B8, 0x71 }, /* GREEK SMALL LETTER THETA # theta */ - { 0x03B9, 0x69 }, /* GREEK SMALL LETTER IOTA # iota */ - { 0x03BA, 0x6B }, /* GREEK SMALL LETTER KAPPA # kappa */ - { 0x03BB, 0x6C }, /* GREEK SMALL LETTER LAMDA # lambda */ - { 0x03BC, 0x6D }, /* GREEK SMALL LETTER MU # mu */ - { 0x03BD, 0x6E }, /* GREEK SMALL LETTER NU # nu */ - { 0x03BE, 0x78 }, /* GREEK SMALL LETTER XI # xi */ - { 0x03BF, 0x6F }, /* GREEK SMALL LETTER OMICRON # omicron */ - { 0x03C0, 0x70 }, /* GREEK SMALL LETTER PI # pi */ - { 0x03C1, 0x72 }, /* GREEK SMALL LETTER RHO # rho */ - { 0x03C2, 0x56 }, /* GREEK SMALL LETTER FINAL SIGMA # sigma1 */ - { 0x03C3, 0x73 }, /* GREEK SMALL LETTER SIGMA # sigma */ - { 0x03C4, 0x74 }, /* GREEK SMALL LETTER TAU # tau */ - { 0x03C5, 0x75 }, /* GREEK SMALL LETTER UPSILON # upsilon */ - { 0x03C6, 0x66 }, /* GREEK SMALL LETTER PHI # phi */ - { 0x03C7, 0x63 }, /* GREEK SMALL LETTER CHI # chi */ - { 0x03C8, 0x79 }, /* GREEK SMALL LETTER PSI # psi */ - { 0x03C9, 0x77 }, /* GREEK SMALL LETTER OMEGA # omega */ - { 0x03D1, 0x4A }, /* GREEK THETA SYMBOL # theta1 */ - { 0x03D2, 0xA1 }, /* GREEK UPSILON WITH HOOK SYMBOL # Upsilon1 */ - { 0x03D5, 0x6A }, /* GREEK PHI SYMBOL # phi1 */ - { 0x03D6, 0x76 }, /* GREEK PI SYMBOL # omega1 */ - { 0x2022, 0xB7 }, /* BULLET # bullet */ - { 0x2026, 0xBC }, /* HORIZONTAL ELLIPSIS # ellipsis */ - { 0x2032, 0xA2 }, /* PRIME # minute */ - { 0x2033, 0xB2 }, /* DOUBLE PRIME # second */ - { 0x2044, 0xA4 }, /* FRACTION SLASH # fraction */ - { 0x20AC, 0xA0 }, /* EURO SIGN # Euro */ - { 0x2111, 0xC1 }, /* BLACK-LETTER CAPITAL I # Ifraktur */ - { 0x2118, 0xC3 }, /* SCRIPT CAPITAL P # weierstrass */ - { 0x211C, 0xC2 }, /* BLACK-LETTER CAPITAL R # Rfraktur */ - { 0x2126, 0x57 }, /* OHM SIGN # Omega */ - { 0x2135, 0xC0 }, /* ALEF SYMBOL # aleph */ - { 0x2190, 0xAC }, /* LEFTWARDS ARROW # arrowleft */ - { 0x2191, 0xAD }, /* UPWARDS ARROW # arrowup */ - { 0x2192, 0xAE }, /* RIGHTWARDS ARROW # arrowright */ - { 0x2193, 0xAF }, /* DOWNWARDS ARROW # arrowdown */ - { 0x2194, 0xAB }, /* LEFT RIGHT ARROW # arrowboth */ - { 0x21B5, 0xBF }, /* DOWNWARDS ARROW WITH CORNER LEFTWARDS # carriagereturn */ - { 0x21D0, 0xDC }, /* LEFTWARDS DOUBLE ARROW # arrowdblleft */ - { 0x21D1, 0xDD }, /* UPWARDS DOUBLE ARROW # arrowdblup */ - { 0x21D2, 0xDE }, /* RIGHTWARDS DOUBLE ARROW # arrowdblright */ - { 0x21D3, 0xDF }, /* DOWNWARDS DOUBLE ARROW # arrowdbldown */ - { 0x21D4, 0xDB }, /* LEFT RIGHT DOUBLE ARROW # arrowdblboth */ - { 0x2200, 0x22 }, /* FOR ALL # universal */ - { 0x2202, 0xB6 }, /* PARTIAL DIFFERENTIAL # partialdiff */ - { 0x2203, 0x24 }, /* THERE EXISTS # existential */ - { 0x2205, 0xC6 }, /* EMPTY SET # emptyset */ - { 0x2206, 0x44 }, /* INCREMENT # Delta */ - { 0x2207, 0xD1 }, /* NABLA # gradient */ - { 0x2208, 0xCE }, /* ELEMENT OF # element */ - { 0x2209, 0xCF }, /* NOT AN ELEMENT OF # notelement */ - { 0x220B, 0x27 }, /* CONTAINS AS MEMBER # suchthat */ - { 0x220F, 0xD5 }, /* N-ARY PRODUCT # product */ - { 0x2211, 0xE5 }, /* N-ARY SUMMATION # summation */ - { 0x2212, 0x2D }, /* MINUS SIGN # minus */ - { 0x2215, 0xA4 }, /* DIVISION SLASH # fraction */ - { 0x2217, 0x2A }, /* ASTERISK OPERATOR # asteriskmath */ - { 0x221A, 0xD6 }, /* SQUARE ROOT # radical */ - { 0x221D, 0xB5 }, /* PROPORTIONAL TO # proportional */ - { 0x221E, 0xA5 }, /* INFINITY # infinity */ - { 0x2220, 0xD0 }, /* ANGLE # angle */ - { 0x2227, 0xD9 }, /* LOGICAL AND # logicaland */ - { 0x2228, 0xDA }, /* LOGICAL OR # logicalor */ - { 0x2229, 0xC7 }, /* INTERSECTION # intersection */ - { 0x222A, 0xC8 }, /* UNION # union */ - { 0x222B, 0xF2 }, /* INTEGRAL # integral */ - { 0x2234, 0x5C }, /* THEREFORE # therefore */ - { 0x223C, 0x7E }, /* TILDE OPERATOR # similar */ - { 0x2245, 0x40 }, /* APPROXIMATELY EQUAL TO # congruent */ - { 0x2248, 0xBB }, /* ALMOST EQUAL TO # approxequal */ - { 0x2260, 0xB9 }, /* NOT EQUAL TO # notequal */ - { 0x2261, 0xBA }, /* IDENTICAL TO # equivalence */ - { 0x2264, 0xA3 }, /* LESS-THAN OR EQUAL TO # lessequal */ - { 0x2265, 0xB3 }, /* GREATER-THAN OR EQUAL TO # greaterequal */ - { 0x2282, 0xCC }, /* SUBSET OF # propersubset */ - { 0x2283, 0xC9 }, /* SUPERSET OF # propersuperset */ - { 0x2284, 0xCB }, /* NOT A SUBSET OF # notsubset */ - { 0x2286, 0xCD }, /* SUBSET OF OR EQUAL TO # reflexsubset */ - { 0x2287, 0xCA }, /* SUPERSET OF OR EQUAL TO # reflexsuperset */ - { 0x2295, 0xC5 }, /* CIRCLED PLUS # circleplus */ - { 0x2297, 0xC4 }, /* CIRCLED TIMES # circlemultiply */ - { 0x22A5, 0x5E }, /* UP TACK # perpendicular */ - { 0x22C5, 0xD7 }, /* DOT OPERATOR # dotmath */ - { 0x2320, 0xF3 }, /* TOP HALF INTEGRAL # integraltp */ - { 0x2321, 0xF5 }, /* BOTTOM HALF INTEGRAL # integralbt */ - { 0x2329, 0xE1 }, /* LEFT-POINTING ANGLE BRACKET # angleleft */ - { 0x232A, 0xF1 }, /* RIGHT-POINTING ANGLE BRACKET # angleright */ - { 0x25CA, 0xE0 }, /* LOZENGE # lozenge */ - { 0x2660, 0xAA }, /* BLACK SPADE SUIT # spade */ - { 0x2663, 0xA7 }, /* BLACK CLUB SUIT # club */ - { 0x2665, 0xA9 }, /* BLACK HEART SUIT # heart */ - { 0x2666, 0xA8 }, /* BLACK DIAMOND SUIT # diamond */ - { 0xF6D9, 0xD3 }, /* COPYRIGHT SIGN SERIF # copyrightserif (CUS) */ - { 0xF6DA, 0xD2 }, /* REGISTERED SIGN SERIF # registerserif (CUS) */ - { 0xF6DB, 0xD4 }, /* TRADE MARK SIGN SERIF # trademarkserif (CUS) */ - { 0xF8E5, 0x60 }, /* RADICAL EXTENDER # radicalex (CUS) */ - { 0xF8E6, 0xBD }, /* VERTICAL ARROW EXTENDER # arrowvertex (CUS) */ - { 0xF8E7, 0xBE }, /* HORIZONTAL ARROW EXTENDER # arrowhorizex (CUS) */ - { 0xF8E8, 0xE2 }, /* REGISTERED SIGN SANS SERIF # registersans (CUS) */ - { 0xF8E9, 0xE3 }, /* COPYRIGHT SIGN SANS SERIF # copyrightsans (CUS) */ - { 0xF8EA, 0xE4 }, /* TRADE MARK SIGN SANS SERIF # trademarksans (CUS) */ - { 0xF8EB, 0xE6 }, /* LEFT PAREN TOP # parenlefttp (CUS) */ - { 0xF8EC, 0xE7 }, /* LEFT PAREN EXTENDER # parenleftex (CUS) */ - { 0xF8ED, 0xE8 }, /* LEFT PAREN BOTTOM # parenleftbt (CUS) */ - { 0xF8EE, 0xE9 }, /* LEFT SQUARE BRACKET TOP # bracketlefttp (CUS) */ - { 0xF8EF, 0xEA }, /* LEFT SQUARE BRACKET EXTENDER # bracketleftex (CUS) */ - { 0xF8F0, 0xEB }, /* LEFT SQUARE BRACKET BOTTOM # bracketleftbt (CUS) */ - { 0xF8F1, 0xEC }, /* LEFT CURLY BRACKET TOP # bracelefttp (CUS) */ - { 0xF8F2, 0xED }, /* LEFT CURLY BRACKET MID # braceleftmid (CUS) */ - { 0xF8F3, 0xEE }, /* LEFT CURLY BRACKET BOTTOM # braceleftbt (CUS) */ - { 0xF8F4, 0xEF }, /* CURLY BRACKET EXTENDER # braceex (CUS) */ - { 0xF8F5, 0xF4 }, /* INTEGRAL EXTENDER # integralex (CUS) */ - { 0xF8F6, 0xF6 }, /* RIGHT PAREN TOP # parenrighttp (CUS) */ - { 0xF8F7, 0xF7 }, /* RIGHT PAREN EXTENDER # parenrightex (CUS) */ - { 0xF8F8, 0xF8 }, /* RIGHT PAREN BOTTOM # parenrightbt (CUS) */ - { 0xF8F9, 0xF9 }, /* RIGHT SQUARE BRACKET TOP # bracketrighttp (CUS) */ - { 0xF8FA, 0xFA }, /* RIGHT SQUARE BRACKET EXTENDER # bracketrightex (CUS) */ - { 0xF8FB, 0xFB }, /* RIGHT SQUARE BRACKET BOTTOM # bracketrightbt (CUS) */ - { 0xF8FC, 0xFC }, /* RIGHT CURLY BRACKET TOP # bracerighttp (CUS) */ - { 0xF8FD, 0xFD }, /* RIGHT CURLY BRACKET MID # bracerightmid (CUS) */ - { 0xF8FE, 0xFE }, /* RIGHT CURLY BRACKET BOTTOM # bracerightbt (CUS) */ -}; - -static const FcCharMap AdobeSymbol = { - AdobeSymbolEnt, - sizeof (AdobeSymbolEnt) / sizeof (AdobeSymbolEnt[0]), -}; - -static const FcFontDecode fcFontDecoders[] = { - { ft_encoding_unicode, 0, (1 << 21) - 1 }, - { ft_encoding_symbol, &AdobeSymbol, (1 << 16) - 1 }, - { ft_encoding_apple_roman, &AppleRoman, (1 << 16) - 1 }, -}; - -#define NUM_DECODE (sizeof (fcFontDecoders) / sizeof (fcFontDecoders[0])) - -static const FcChar32 prefer_unicode[] = { - 0x20ac, /* EURO SIGN */ -}; - -#define NUM_PREFER_UNICODE (sizeof (prefer_unicode) / sizeof (prefer_unicode[0])) - -FcChar32 -FcFreeTypeUcs4ToPrivate (FcChar32 ucs4, const FcCharMap *map) -{ - int low, high, mid; - FcChar16 bmp; - - low = 0; - high = map->nent - 1; - if (ucs4 < map->ent[low].bmp || map->ent[high].bmp < ucs4) - return ~0; - while (low <= high) - { - mid = (high + low) >> 1; - bmp = map->ent[mid].bmp; - if (ucs4 == bmp) - return (FT_ULong) map->ent[mid].encode; - if (ucs4 < bmp) - high = mid - 1; - else - low = mid + 1; - } - return ~0; -} - -FcChar32 -FcFreeTypePrivateToUcs4 (FcChar32 private, const FcCharMap *map) -{ - int i; - - for (i = 0; i < map->nent; i++) - if (map->ent[i].encode == private) - return (FcChar32) map->ent[i].bmp; - return ~0; -} - -const FcCharMap * -FcFreeTypeGetPrivateMap (FT_Encoding encoding) -{ - int i; - - for (i = 0; i < NUM_DECODE; i++) - if (fcFontDecoders[i].encoding == encoding) - return fcFontDecoders[i].map; - return 0; -} - -#include "fc-glyphname/fcglyphname.h" - -static FcChar32 -FcHashGlyphName (const FcChar8 *name) -{ - FcChar32 h = 0; - FcChar8 c; - - while ((c = *name++)) - { - h = ((h << 1) | (h >> 31)) ^ c; - } - return h; -} - -#if HAVE_FT_HAS_PS_GLYPH_NAMES -/* - * Use Type1 glyph names for fonts which have reliable names - * and which export an Adobe Custom mapping - */ -static FcBool -FcFreeTypeUseNames (FT_Face face) -{ - FT_Int map; - - if (!FT_Has_PS_Glyph_Names (face)) - return FcFalse; - for (map = 0; map < face->num_charmaps; map++) - if (face->charmaps[map]->encoding == ft_encoding_adobe_custom) - return FcTrue; - return FcFalse; -} - -static FcChar8 * -FcUcs4ToGlyphName (FcChar32 ucs4) -{ - int i = (int) (ucs4 % FC_GLYPHNAME_HASH); - int r = 0; - FcGlyphName *gn; - - while ((gn = ucs_to_name[i])) - { - if (gn->ucs == ucs4) - return gn->name; - if (!r) - { - r = (int) (ucs4 % FC_GLYPHNAME_REHASH); - if (!r) - r = 1; - } - i += r; - if (i >= FC_GLYPHNAME_HASH) - i -= FC_GLYPHNAME_HASH; - } - return 0; -} - -static FcChar32 -FcGlyphNameToUcs4 (FcChar8 *name) -{ - FcChar32 h = FcHashGlyphName (name); - int i = (int) (h % FC_GLYPHNAME_HASH); - int r = 0; - FcGlyphName *gn; - - while ((gn = name_to_ucs[i])) - { - if (!strcmp ((char *) name, (char *) gn->name)) - return gn->ucs; - if (!r) - { - r = (int) (h % FC_GLYPHNAME_REHASH); - if (!r) - r = 1; - } - i += r; - if (i >= FC_GLYPHNAME_HASH) - i -= FC_GLYPHNAME_HASH; - } - return 0xffff; -} - -/* - * Search through a font for a glyph by name. This is - * currently a linear search as there doesn't appear to be - * any defined order within the font - */ -static FT_UInt -FcFreeTypeGlyphNameIndex (FT_Face face, FcChar8 *name) -{ - FT_UInt gindex; - FcChar8 name_buf[FC_GLYPHNAME_MAXLEN + 2]; - - for (gindex = 0; gindex < face->num_glyphs; gindex++) - { - if (FT_Get_Glyph_Name (face, gindex, name_buf, FC_GLYPHNAME_MAXLEN+1) == 0) - if (!strcmp ((char *) name, (char *) name_buf)) - return gindex; - } - return 0; -} -#endif - -/* - * Map a UCS4 glyph to a glyph index. Use all available encoding - * tables to try and find one that works. This information is expected - * to be cached by higher levels, so performance isn't critical - */ - -FT_UInt -FcFreeTypeCharIndex (FT_Face face, FcChar32 ucs4) -{ - int initial, offset, decode; - FT_UInt glyphindex; - FcChar32 charcode; - int p; - - initial = 0; - /* - * Find the current encoding - */ - if (face->charmap) - { - for (; initial < NUM_DECODE; initial++) - if (fcFontDecoders[initial].encoding == face->charmap->encoding) - break; - if (initial == NUM_DECODE) - initial = 0; - } - for (p = 0; p < NUM_PREFER_UNICODE; p++) - if (ucs4 == prefer_unicode[p]) - { - initial = 0; - break; - } - /* - * Check each encoding for the glyph, starting with the current one - */ - for (offset = 0; offset < NUM_DECODE; offset++) - { - decode = (initial + offset) % NUM_DECODE; - if (!face->charmap || face->charmap->encoding != fcFontDecoders[decode].encoding) - if (FT_Select_Charmap (face, fcFontDecoders[decode].encoding) != 0) - continue; - if (fcFontDecoders[decode].map) - { - charcode = FcFreeTypeUcs4ToPrivate (ucs4, fcFontDecoders[decode].map); - if (charcode == ~0) - continue; - } - else - charcode = ucs4; - glyphindex = FT_Get_Char_Index (face, (FT_ULong) charcode); - if (glyphindex) - return glyphindex; - } -#if HAVE_FT_HAS_PS_GLYPH_NAMES - /* - * Check postscript name table if present - */ - if (FcFreeTypeUseNames (face)) - { - FcChar8 *name = FcUcs4ToGlyphName (ucs4); - if (name) - { - glyphindex = FcFreeTypeGlyphNameIndex (face, name); - if (glyphindex) - return glyphindex; - } - } -#endif - return 0; -} - -static FcBool -FcFreeTypeCheckGlyph (FT_Face face, FcChar32 ucs4, - FT_UInt glyph, FcBlanks *blanks, - FT_Pos *advance) -{ - FT_Int load_flags = FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH | FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING; - FT_GlyphSlot slot; - - /* - * When using scalable fonts, only report those glyphs - * which can be scaled; otherwise those fonts will - * only be available at some sizes, and never when - * transformed. Avoid this by simply reporting bitmap-only - * glyphs as missing - */ - if (face->face_flags & FT_FACE_FLAG_SCALABLE) - load_flags |= FT_LOAD_NO_BITMAP; - - if (FT_Load_Glyph (face, glyph, load_flags)) - return FcFalse; - - slot = face->glyph; - if (!glyph) - return FcFalse; - - *advance = slot->metrics.horiAdvance; - - switch (slot->format) { - case ft_glyph_format_bitmap: - /* - * Bitmaps are assumed to be reasonable; if - * this proves to be a rash assumption, this - * code can be easily modified - */ - return FcTrue; - case ft_glyph_format_outline: - /* - * Glyphs with contours are always OK - */ - if (slot->outline.n_contours != 0) - return FcTrue; - /* - * Glyphs with no contours are only OK if - * they're members of the Blanks set specified - * in the configuration. If blanks isn't set, - * then allow any glyph to be blank - */ - if (!blanks || FcBlanksIsMember (blanks, ucs4)) - return FcTrue; - /* fall through ... */ - default: - break; - } - return FcFalse; -} - -#define FC_MIN(a,b) ((a) < (b) ? (a) : (b)) -#define FC_MAX(a,b) ((a) > (b) ? (a) : (b)) -#define FC_ABS(a) ((a) < 0 ? -(a) : (a)) -#define APPROXIMATELY_EQUAL(x,y) (FC_ABS ((x) - (y)) <= FC_MAX (FC_ABS (x), FC_ABS (y)) / 33) - -FcCharSet * -FcFreeTypeCharSetAndSpacing (FT_Face face, FcBlanks *blanks, int *spacing) -{ - FcChar32 page, off, max, ucs4; -#ifdef CHECK - FcChar32 font_max = 0; -#endif - FcCharSet *fcs; - FcCharLeaf *leaf; - const FcCharMap *map; - int o; - int i; - FT_UInt glyph; - FT_Pos advance, advance_one = 0, advance_two = 0; - FcBool has_advance = FcFalse, fixed_advance = FcTrue, dual_advance = FcFalse; - - fcs = FcCharSetCreate (); - if (!fcs) - goto bail0; - -#ifdef CHECK - printf ("Family %s style %s\n", face->family_name, face->style_name); -#endif - for (o = 0; o < NUM_DECODE; o++) - { - if (FT_Select_Charmap (face, fcFontDecoders[o].encoding) != 0) - continue; - map = fcFontDecoders[o].map; - if (map) - { - /* - * Non-Unicode tables are easy; there's a list of all possible - * characters - */ - for (i = 0; i < map->nent; i++) - { - ucs4 = map->ent[i].bmp; - glyph = FT_Get_Char_Index (face, map->ent[i].encode); - if (glyph && - FcFreeTypeCheckGlyph (face, ucs4, glyph, blanks, &advance)) - { - if (!has_advance) - { - has_advance = FcTrue; - advance_one = advance; - } - else if (!APPROXIMATELY_EQUAL (advance, advance_one)) - { - if (fixed_advance) - { - dual_advance = FcTrue; - fixed_advance = FcFalse; - advance_two = advance; - } - else if (!APPROXIMATELY_EQUAL (advance, advance_two)) - dual_advance = FcFalse; - } - - leaf = FcCharSetFindLeafCreate (fcs, ucs4); - if (!leaf) - goto bail1; - leaf->map[(ucs4 & 0xff) >> 5] |= (1 << (ucs4 & 0x1f)); -#ifdef CHECK - if (ucs4 > font_max) - font_max = ucs4; -#endif - } - } - } - else - { - FT_UInt gindex; - - max = fcFontDecoders[o].max; - /* - * Find the first encoded character in the font - */ - if (FT_Get_Char_Index (face, 0)) - { - ucs4 = 0; - gindex = 1; - } - else - { - ucs4 = FT_Get_Next_Char (face, 0, &gindex); - if (!ucs4) - gindex = 0; - } - - while (gindex) - { - page = ucs4 >> 8; - leaf = 0; - while ((ucs4 >> 8) == page) - { - glyph = FT_Get_Char_Index (face, ucs4); - if (glyph && FcFreeTypeCheckGlyph (face, ucs4, - glyph, blanks, &advance)) - { - if (!has_advance) - { - has_advance = FcTrue; - advance_one = advance; - } - else if (!APPROXIMATELY_EQUAL (advance, advance_one)) - { - if (fixed_advance) - { - dual_advance = FcTrue; - fixed_advance = FcFalse; - advance_two = advance; - } - else if (!APPROXIMATELY_EQUAL (advance, advance_two)) - dual_advance = FcFalse; - } - - if (!leaf) - { - leaf = FcCharSetFindLeafCreate (fcs, ucs4); - if (!leaf) - goto bail1; - } - off = ucs4 & 0xff; - leaf->map[off >> 5] |= (1 << (off & 0x1f)); -#ifdef CHECK - if (ucs4 > font_max) - font_max = ucs4; -#endif - } - ucs4++; - } - ucs4 = FT_Get_Next_Char (face, ucs4 - 1, &gindex); - if (!ucs4) - gindex = 0; - } -#ifdef CHECK - for (ucs4 = 0; ucs4 < 0x10000; ucs4++) - { - FcBool FT_Has, FC_Has; - - FT_Has = FT_Get_Char_Index (face, ucs4) != 0; - FC_Has = FcCharSetHasChar (fcs, ucs4); - if (FT_Has != FC_Has) - { - printf ("0x%08x FT says %d FC says %d\n", ucs4, FT_Has, FC_Has); - } - } -#endif - } - } -#if HAVE_FT_HAS_PS_GLYPH_NAMES - /* - * Add mapping from PS glyph names if available - */ - if (FcFreeTypeUseNames (face)) - { - FcChar8 name_buf[FC_GLYPHNAME_MAXLEN + 2]; - - for (glyph = 0; glyph < face->num_glyphs; glyph++) - { - if (FT_Get_Glyph_Name (face, glyph, name_buf, FC_GLYPHNAME_MAXLEN+1) == 0) - { - ucs4 = FcGlyphNameToUcs4 (name_buf); - if (ucs4 != 0xffff && - FcFreeTypeCheckGlyph (face, ucs4, glyph, blanks, &advance)) - { - if (!has_advance) - { - has_advance = FcTrue; - advance_one = advance; - } - else if (!APPROXIMATELY_EQUAL (advance, advance_one)) - { - if (fixed_advance) - { - dual_advance = FcTrue; - fixed_advance = FcFalse; - advance_two = advance; - } - else if (!APPROXIMATELY_EQUAL (advance, advance_two)) - dual_advance = FcFalse; - } - leaf = FcCharSetFindLeafCreate (fcs, ucs4); - if (!leaf) - goto bail1; - leaf->map[(ucs4 & 0xff) >> 5] |= (1 << (ucs4 & 0x1f)); -#ifdef CHECK - if (ucs4 > font_max) - font_max = ucs4; -#endif - } - } - } - } -#endif -#ifdef CHECK - printf ("%d glyphs %d encoded\n", (int) face->num_glyphs, FcCharSetCount (fcs)); - for (ucs4 = 0; ucs4 <= font_max; ucs4++) - { - FcBool has_char = (glyph = FcFreeTypeCharIndex (face, ucs4)) != 0; - FcBool has_bit = FcCharSetHasChar (fcs, ucs4); - - if (has_char && !has_bit) - { - if (!FcFreeTypeCheckGlyph (face, ucs4, glyph, blanks, &advance)) - printf ("Bitmap missing broken char 0x%x\n", ucs4); - else - printf ("Bitmap missing char 0x%x\n", ucs4); - } - else if (!has_char && has_bit) - printf ("Bitmap extra char 0x%x\n", ucs4); - } -#endif - if (fixed_advance) - *spacing = FC_MONO; - else if (dual_advance && APPROXIMATELY_EQUAL (2 * FC_MIN (advance_one, advance_two), FC_MAX (advance_one, advance_two))) - *spacing = FC_DUAL; - else - *spacing = FC_PROPORTIONAL; - return fcs; -bail1: - FcCharSetDestroy (fcs); -bail0: - return 0; -} - -FcCharSet * -FcFreeTypeCharSet (FT_Face face, FcBlanks *blanks) -{ - int spacing; - - return FcFreeTypeCharSetAndSpacing (face, blanks, &spacing); -} - - -#define TTAG_GPOS FT_MAKE_TAG( 'G', 'P', 'O', 'S' ) -#define TTAG_GSUB FT_MAKE_TAG( 'G', 'S', 'U', 'B' ) -#define TTAG_SILF FT_MAKE_TAG( 'S', 'i', 'l', 'f') -#define TT_Err_Ok FT_Err_Ok -#define TT_Err_Invalid_Face_Handle FT_Err_Invalid_Face_Handle -#define TTO_Err_Empty_Script 0x1005 -#define TTO_Err_Invalid_SubTable 0x1001 - -#define OTLAYOUT_HEAD "otlayout:" -#define OTLAYOUT_HEAD_LEN 9 -#define OTLAYOUT_ID_LEN 4 -/* space + head + id */ -#define OTLAYOUT_LEN (1 + OTLAYOUT_HEAD_LEN + OTLAYOUT_ID_LEN) - -/* - * This is a bit generous; the registry has only lower case and space - * except for 'DFLT'. - */ -#define FcIsSpace(x) (040 == (x)) -#define FcIsValidScript(x) (FcIsLower(x) || FcIsUpper (x) || FcIsSpace(x)) - -static void -addtag(FcChar8 *complex, FT_ULong tag) -{ - FcChar8 tagstring[OTLAYOUT_ID_LEN + 1]; - - tagstring[0] = (FcChar8)(tag >> 24), - tagstring[1] = (FcChar8)(tag >> 16), - tagstring[2] = (FcChar8)(tag >> 8), - tagstring[3] = (FcChar8)(tag); - tagstring[4] = '\0'; - - /* skip tags which aren't alphabetic, under the assumption that - * they're probably broken - */ - if (!FcIsValidScript(tagstring[0]) || - !FcIsValidScript(tagstring[1]) || - !FcIsValidScript(tagstring[2]) || - !FcIsValidScript(tagstring[3])) - return; - - if (*complex != '\0') - strcat (complex, " "); - strcat (complex, "otlayout:"); - strcat (complex, tagstring); -} - -static int -compareulong (const void *a, const void *b) -{ - const FT_ULong *ua = (const FT_ULong *) a; - const FT_ULong *ub = (const FT_ULong *) b; - return *ua - *ub; -} - - -static FT_Error -GetScriptTags(FT_Face face, FT_ULong tabletag, FT_ULong **stags, FT_UShort *script_count) -{ - FT_ULong cur_offset, new_offset, base_offset; - TT_Face tt_face = (TT_Face)face; - FT_Stream stream = face->stream; - FT_Error error; - FT_UShort n, p; - FT_Memory memory = stream->memory; - - if ( !stream ) - return TT_Err_Invalid_Face_Handle; - - if (( error = tt_face->goto_table( tt_face, tabletag, stream, 0 ) )) - return error; - - base_offset = FT_STREAM_POS(); - - /* skip version */ - - if ( FT_STREAM_SEEK( base_offset + 4L ) || FT_FRAME_ENTER( 2L ) ) - return error; - - new_offset = FT_GET_USHORT() + base_offset; - - FT_FRAME_EXIT(); - - cur_offset = FT_STREAM_POS(); - - if ( FT_STREAM_SEEK( new_offset ) != TT_Err_Ok ) - return error; - - base_offset = FT_STREAM_POS(); - - if ( FT_FRAME_ENTER( 2L ) ) - return error; - - *script_count = FT_GET_USHORT(); - - FT_FRAME_EXIT(); - - if ( FT_SET_ERROR (FT_MEM_ALLOC_ARRAY( *stags, *script_count, FT_ULong )) ) - return error; - - p = 0; - for ( n = 0; n < *script_count; n++ ) - { - if ( FT_FRAME_ENTER( 6L ) ) - goto Fail; - - (*stags)[p] = FT_GET_ULONG(); - new_offset = FT_GET_USHORT() + base_offset; - - FT_FRAME_EXIT(); - - cur_offset = FT_STREAM_POS(); - - if ( FT_STREAM_SEEK( new_offset ) ) - goto Fail; - - if ( error == TT_Err_Ok ) - p++; - else if ( error != TTO_Err_Empty_Script ) - goto Fail; - - (void)FT_STREAM_SEEK( cur_offset ); - } - - if (!p) - { - error = TTO_Err_Invalid_SubTable; - goto Fail; - } - - /* sort the tag list before returning it */ - qsort(*stags, *script_count, sizeof(FT_ULong), compareulong); - - return TT_Err_Ok; - -Fail: - *script_count = 0; - FT_FREE( *stags ); - return error; -} - -static FcChar8 * -FcFontCapabilities(FT_Face face) -{ - FcBool issilgraphitefont = 0; - FT_Error err; - FT_ULong len = 0; - FT_ULong *gsubtags=NULL, *gpostags=NULL; - FT_UShort gsub_count=0, gpos_count=0; - FT_ULong maxsize; - FT_Memory memory = face->stream->memory; - FcChar8 *complex = NULL; - int indx1 = 0, indx2 = 0; - - err = FT_Load_Sfnt_Table(face, TTAG_SILF, 0, 0, &len); - issilgraphitefont = ( err == FT_Err_Ok); - - if (GetScriptTags(face, TTAG_GPOS, &gpostags, &gpos_count) != FT_Err_Ok) - gpos_count = 0; - if (GetScriptTags(face, TTAG_GSUB, &gsubtags, &gsub_count) != FT_Err_Ok) - gsub_count = 0; - - if (!issilgraphitefont && !gsub_count && !gpos_count) - goto bail; - - maxsize = (((FT_ULong) gpos_count + (FT_ULong) gsub_count) * OTLAYOUT_LEN + - (issilgraphitefont ? 13 : 0)); - complex = malloc (sizeof (FcChar8) * maxsize); - if (!complex) - goto bail; - - complex[0] = '\0'; - if (issilgraphitefont) - strcpy(complex, "ttable:Silf "); - - while ((indx1 < gsub_count) || (indx2 < gpos_count)) { - if (indx1 == gsub_count) { - addtag(complex, gpostags[indx2]); - indx2++; - } else if ((indx2 == gpos_count) || (gsubtags[indx1] < gpostags[indx2])) { - addtag(complex, gsubtags[indx1]); - indx1++; - } else if (gsubtags[indx1] == gpostags[indx2]) { - addtag(complex, gsubtags[indx1]); - indx1++; - indx2++; - } else { - addtag(complex, gpostags[indx2]); - indx2++; - } - } - if (FcDebug () & FC_DBG_SCANV) - printf("complex features in this font: %s\n", complex); -bail: - FT_FREE(gsubtags); - FT_FREE(gpostags); - return complex; -} diff --git a/nx-X11/lib/fontenc/Imakefile b/nx-X11/lib/fontenc/Imakefile deleted file mode 100644 index 2bdb0564a..000000000 --- a/nx-X11/lib/fontenc/Imakefile +++ /dev/null @@ -1,36 +0,0 @@ -XCOMM $XFree86: xc/lib/fontenc/Imakefile,v 1.8 2003/11/17 15:30:11 tsi Exp $ - - INCLUDES = -I$(FONTINCSRC) -I$(FONTLIBSRC)/include -I$(FONTLIBSRC)/fontfile \ - -I$(INCLUDESRC) - -FONTENCDEFS = -DFONTENC_NO_LIBFONT \ - -DFONT_ENCODINGS_DIRECTORY=\"$(FONTDIR)/encodings/encodings.dir\" - - DEFINES = StrcasecmpDefines $(FONTENCDEFS) - - SRCS = fontenc.c encparse.c - OBJS = fontenc.o encparse.o - - HEADERS = fontenc.h - -#define DoNormalLib NormalLibFontEnc -#define DoSharedLib SharedLibFontEnc -#define DoDebugLib DebugLibFontEnc -#define DoProfileLib ProfileLibFontEnc -#define LibName fontenc -#define SoRev SOFONTENCREV -#define IncSubdir X11 -#define IncSubSubdir fonts - -#ifdef SharedFontencReqs - REQUIREDLIBS = SharedFontencReqs -#endif - -#include <Library.tmpl> - -LinkSourceFile(fontenc.c,$(FONTLIBSRC)/fontfile) -LinkSourceFile(encparse.c,$(FONTLIBSRC)/fontfile) -LinkSourceFile(fontenc.h,$(FONTLIBSRC)/include) - -DependTarget() - diff --git a/nx-X11/lib/fontenc/fontenc-def.cpp b/nx-X11/lib/fontenc/fontenc-def.cpp deleted file mode 100644 index 31743abb2..000000000 --- a/nx-X11/lib/fontenc/fontenc-def.cpp +++ /dev/null @@ -1,19 +0,0 @@ -/* $XFree86$ */ -LIBRARY fontenc -VERSION LIBRARY_VERSION -EXPORTS - FontEncDirectory - FontEncIdentify - FontEncReallyLoad - FontEncFind - FontEncFromXLFD - FontEncMapFind - FontEncName - FontEncRecode - FontEncSimpleName - FontEncSimpleRecode - FontEncUndefinedName - FontEncUndefinedRecode - FontMapFind - FontMapReverse - FontMapReverseFree diff --git a/nx-X11/lib/freetype2/Imakefile b/nx-X11/lib/freetype2/Imakefile deleted file mode 100644 index eed70ad23..000000000 --- a/nx-X11/lib/freetype2/Imakefile +++ /dev/null @@ -1,263 +0,0 @@ -XCOMM $XdotOrg: xc/lib/freetype2/Imakefile,v 1.4 2004/05/05 17:24:41 eich Exp $ -XCOMM $XFree86: xc/lib/freetype2/Imakefile,v 1.19 2003/11/21 02:33:22 dawes Exp $ - -#define IHaveSubdirs -#define PassCDebugFlags -#define NoLibSubdirs - -#define DoNormalLib NormalLibFreetype2 -#define DoSharedLib SharedLibFreetype2 -#define DoExtraLib SharedLibFreetype2 -#define DoDebugLib DebugLibFreetype2 -#define DoProfileLib ProfileLibFreetype2 -#define HasSharedData YES -#define LibName freetype -#define SoRev SOFREETYPE2REV -#ifdef SharedLibtoolFreetype2Rev -#define SharedLibtoolRev SharedLibtoolFreetype2Rev -#endif -#define LibHeaders NO - -#include <Threads.tmpl> - -FREETYPETOP = $(TOP)/extras/freetype2 -FREETYPESRC = $(FREETYPETOP)/src - - -#ifdef DarwinArchitecture -# if DarwinQuartzSupport -DARWINDEFINES = -DTARGET_API_MAC_CARBON=TRUE -REQUIREDLIBS = -framework CoreServices -framework ApplicationServices -# else -DARWINDEFINES = -DDARWIN_NO_CARBON -# endif -#endif - -DEFINES = $(DARWINDEFINES) Freetype2BuildDefines -DXFREE86_FT2 - -INCLUDES = -I -I.\ - -I$(FREETYPESRC)\ - -I$(FREETYPESRC)/base\ - -I$(FREETYPESRC)/autofit \ - -I$(FREETYPESRC)/autohint\ - -I$(FREETYPESRC)/bdf\ - -I$(FREETYPESRC)/cff\ - -I$(FREETYPESRC)/cid\ - -I$(FREETYPESRC)/gzip\ - -I$(FREETYPESRC)/lzw \ - -I$(FREETYPESRC)/pcf\ - -I$(FREETYPESRC)/pfr\ - -I$(FREETYPESRC)/psaux\ - -I$(FREETYPESRC)/pshinter\ - -I$(FREETYPESRC)/psnames\ - -I$(FREETYPESRC)/raster\ - -I$(FREETYPESRC)/sfnt\ - -I$(FREETYPESRC)/smooth\ - -I$(FREETYPESRC)/truetype\ - -I$(FREETYPESRC)/type1\ - -I$(FREETYPESRC)/type42\ - -I$(FREETYPESRC)/winfonts\ - $(FREETYPE2INCLUDES)\ - -I$(XBUILDINCDIR) - -SUBDIRS=freetype - -HEADERS=ft2build.h - -SRCS_BASE = ftapi.c \ - ftbase.c \ - ftbbox.c \ - ftbdf.c \ - ftdebug.c \ - ftglyph.c \ - ftinit.c \ - ftmm.c \ - ftpfr.c \ - ftstroke.c \ - ftsynth.c \ - ftsystem.c \ - fttype1.c \ - ftwinfnt.c \ - ftxf86.c - -OBJS_BASE = ftapi.o \ - ftbase.o \ - ftbbox.o \ - ftbdf.o \ - ftdebug.o \ - ftglyph.o \ - ftinit.o \ - ftmm.o \ - ftpfr.o \ - ftstroke.o \ - ftsynth.o \ - ftsystem.o \ - fttype1.o \ - ftwinfnt.o \ - ftxf86.o - -SRCS_AUTOFIT = autofit.c -OBJS_AUTOFIT = autofit.o - -SRCS_AUTOHINT = autohint.c -OBJS_AUTOHINT = autohint.o - -SRCS_BDF = bdf.c -OBJS_BDF = bdf.o - -SRCS_CFF = cff.c -OBJS_CFF = cff.o - -SRCS_CID = type1cid.c -OBJS_CID = type1cid.o - -SRCS_GZIP = ftgzip.c -OBJS_GZIP = ftgzip.o - -SRCS_LZW = ftlzw.c -OBJS_LZW = ftlzw.o - -SRCS_PCF = pcf.c -OBJS_PCF = pcf.o - -SRCS_PFR = pfr.c -OBJS_PFR = pfr.o - -SRCS_PSAUX = psaux.c -OBJS_PSAUX = psaux.o - -SRCS_PSHINTER = pshinter.c -OBJS_PSHINTER = pshinter.o - -SRCS_PSNAMES = psnames.c -OBJS_PSNAMES = psnames.o - -SRCS_RASTER = raster.c -OBJS_RASTER = raster.o - -SRCS_SFNT = sfnt.c -OBJS_SFNT = sfnt.o - -SRCS_SMOOTH = smooth.c -OBJS_SMOOTH = smooth.o - -SRCS_TRUETYPE = truetype.c -OBJS_TRUETYPE = truetype.o - -SRCS_TYPE1 = type1.c -OBJS_TYPE1 = type1.o - -SRCS_TYPE42 = type42.c -OBJS_TYPE42 = type42.o - -SRCS_WINFONTS = winfnt.c -OBJS_WINFONTS = winfnt.o - -SRCS = $(SRCS_BASE)\ - $(SRCS_AUTOFIT) \ - $(SRCS_AUTOHINT)\ - $(SRCS_BDF)\ - $(SRCS_CFF)\ - $(SRCS_CID)\ - $(SRCS_GZIP)\ - $(SRCS_LZW)\ - $(SRCS_PCF)\ - $(SRCS_PFR)\ - $(SRCS_PSAUX)\ - $(SRCS_PSHINTER)\ - $(SRCS_PSNAMES)\ - $(SRCS_RASTER)\ - $(SRCS_SFNT)\ - $(SRCS_SMOOTH)\ - $(SRCS_TRUETYPE)\ - $(SRCS_TYPE1)\ - $(SRCS_TYPE42)\ - $(SRCS_WINFONTS) - -OBJS = $(OBJS_BASE)\ - $(OBJS_AUTOFIT) \ - $(OBJS_AUTOHINT)\ - $(OBJS_BDF)\ - $(OBJS_CFF)\ - $(OBJS_CID)\ - $(OBJS_GZIP)\ - $(OBJS_LZW)\ - $(OBJS_PCF)\ - $(OBJS_PFR)\ - $(OBJS_PSAUX)\ - $(OBJS_PSHINTER)\ - $(OBJS_PSNAMES)\ - $(OBJS_RASTER)\ - $(OBJS_SFNT)\ - $(OBJS_SMOOTH)\ - $(OBJS_TRUETYPE)\ - $(OBJS_TYPE1)\ - $(OBJS_TYPE42)\ - $(OBJS_WINFONTS) - - -#include <Library.tmpl> - -#if DoSharedLib && SharedDataSeparation -SpecialCObjectRule(sharedlib,NullParameter,$(SHLIBDEF)) -#endif - -#if 0 -MANSUFFIX = $(LIBMANSUFFIX) -InstallManPage(Freetype,$(LIBMANDIR)) -#endif - -BuildIncludes($(HEADERS),.,.) -InstallMultipleFlags($(HEADERS),$(INCDIR),$(INSTINCFLAGS)) - -/* There might be an ft2build.h file in the wrong place. If so, remove it. */ -install:: - @if [ -f $(DESTDIR)$(INCDIR)/freetype2/ft2build.h ]; then \ - (set -x; $(RM) -f $(DESTDIR)$(INCDIR)/freetype2/ft2build.h) \ - fi - -LinkFile(ft2build.h,$(FREETYPETOP)/builds/unix/ft2unix.h) - -LinkSourceFile(ftapi.c,$(FREETYPESRC)/base) -LinkSourceFile(ftbase.c,$(FREETYPESRC)/base) -LinkSourceFile(ftbdf.c,$(FREETYPESRC)/base) -LinkSourceFile(ftbbox.c,$(FREETYPESRC)/base) -LinkSourceFile(ftdebug.c,$(FREETYPESRC)/base) -LinkSourceFile(ftglyph.c,$(FREETYPESRC)/base) -LinkSourceFile(ftinit.c,$(FREETYPESRC)/base) -LinkSourceFile(ftmm.c,$(FREETYPESRC)/base) -LinkSourceFile(ftpfr.c,$(FREETYPESRC)/base) -LinkSourceFile(ftstroke.c,$(FREETYPESRC)/base) -LinkSourceFile(ftsynth.c,$(FREETYPESRC)/base) -LinkSourceFile(ftsystem.c,$(FREETYPESRC)/base) -LinkSourceFile(fttype1.c,$(FREETYPESRC)/base) -LinkSourceFile(ftwinfnt.c,$(FREETYPESRC)/base) -LinkSourceFile(ftxf86.c,$(FREETYPESRC)/base) - -#if defined(DarwinArchitecture) && DarwinQuartzSupport -LinkSourceFile(ftmac.c,$(FREETYPESRC)/base) -#endif - -LinkSourceFile(autofit.c,$(FREETYPESRC)/autofit) -LinkSourceFile(autohint.c,$(FREETYPESRC)/autohint) -LinkSourceFile(bdf.c,$(FREETYPESRC)/bdf) -LinkSourceFile(cff.c,$(FREETYPESRC)/cff) -LinkSourceFile(ftgzip.c,$(FREETYPESRC)/gzip) -LinkSourceFile(ftlzw.c,$(FREETYPESRC)/lzw) -LinkSourceFile(type1cid.c,$(FREETYPESRC)/cid) -LinkSourceFile(pcf.c,$(FREETYPESRC)/pcf) -LinkSourceFile(pfr.c,$(FREETYPESRC)/pfr) -LinkSourceFile(psaux.c,$(FREETYPESRC)/psaux) -LinkSourceFile(pshinter.c,$(FREETYPESRC)/pshinter) -LinkSourceFile(psnames.c,$(FREETYPESRC)/psnames) -LinkSourceFile(raster.c,$(FREETYPESRC)/raster) -LinkSourceFile(sfnt.c,$(FREETYPESRC)/sfnt) -LinkSourceFile(smooth.c,$(FREETYPESRC)/smooth) -LinkSourceFile(truetype.c,$(FREETYPESRC)/truetype) -LinkSourceFile(type1.c,$(FREETYPESRC)/type1) -LinkSourceFile(type42.c,$(FREETYPESRC)/type42) -LinkSourceFile(winfnt.c,$(FREETYPESRC)/winfonts) - -DependTarget() - -DependSubdirs($(SUBDIRS)) diff --git a/nx-X11/lib/freetype2/freetype-def.cpp b/nx-X11/lib/freetype2/freetype-def.cpp deleted file mode 100644 index bfb1613ec..000000000 --- a/nx-X11/lib/freetype2/freetype-def.cpp +++ /dev/null @@ -1,211 +0,0 @@ -LIBRARY libfreetype -VERSION LIBRARY_VERSION - -EXPORTS -ah_arctan -autohint_module_class -;autohinter_interface -cff_driver_class -;FT_Access_Frame -#ifndef __UNIXOS2__ -FT_Add64 -#endif -FT_Add_Module -FT_Alloc -FT_Attach_File -FT_Attach_Stream -#ifndef __UNIXOS2__ -FT_Create_Extensions -FT_Destroy_Extensions -FT_Div64by32 -#endif -FT_DivFix -#ifndef __UNIXOS2__ -FT_Done_Extensions -#endif -FT_Done_Face -FT_Done_GlyphSlot -FT_Done_Library -FT_Done_Size -#ifndef __UNIXOS2__ -FT_Done_Stream -FT_Extract_Frame -FT_Forget_Frame -#endif -FT_Free -#ifndef __UNIXOS2__ -FT_Get_Char -#endif -FT_Get_Char_Index -#ifndef __UNIXOS2__ -FT_Get_Extension -#endif -FT_Get_Glyph_Name -FT_Get_Kerning -#ifndef __UNIXOS2__ -FT_Get_Long -FT_Get_LongLE -#endif -FT_Get_Module -FT_Get_Module_Interface -#ifndef __UNIXOS2__ -FT_Get_Offset -#endif -FT_Get_Renderer -FT_Get_Sfnt_Name -FT_Get_Sfnt_Name_Count -FT_Get_Sfnt_Table -#ifndef __UNIXOS2__ -FT_Get_Short -FT_Get_ShortLE -#endif -FT_GlyphLoader_Add -#ifndef __UNIXOS2__ -FT_GlyphLoader_Check_Points -FT_GlyphLoader_Check_Subglyphs -FT_GlyphLoader_Copy_Points -FT_GlyphLoader_Create_Extra -#endif -FT_GlyphLoader_Done -FT_GlyphLoader_New -FT_GlyphLoader_Prepare -FT_GlyphLoader_Reset -FT_GlyphLoader_Rewind -#ifndef __UNIXOS2__ -FT_Init_Extensions -#endif -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 -#ifndef __UNIXOS2__ -FT_MulTo64 -#endif -FT_New_Face -FT_New_GlyphSlot -FT_New_Library -FT_New_Memory_Face -#ifndef __UNIXOS2__ -FT_New_Memory_Stream -#endif -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 -#ifndef __UNIXOS2__ -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 -#endif -FT_Realloc -#ifndef __UNIXOS2__ -FT_Register_Extension -FT_Release_Frame -#endif -FT_Remove_Module -FT_Render_Glyph -FT_Render_Glyph_Internal -#ifndef __UNIXOS2__ -FT_Seek_Stream -#endif -FT_Select_Charmap -FT_Set_Char_Size -FT_Set_Charmap -FT_Set_Debug_Hook -FT_Set_Pixel_Sizes -FT_Set_Renderer -FT_Set_Transform -#ifndef __UNIXOS2__ -FT_Skip_Stream -FT_Sqrt64 -#endif -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 -#ifndef __UNIXOS2__ -FT_New_Stream -_cygwin_dll_entry@12 -_cygwin_noncygwin_dll_entry@12 -dll_main@12 -#endif -ps_table_funcs -psaux_module_class -t1_builder_funcs -t1_decoder_funcs -#ifndef __UNIXOS2__ -t1_parser_funcs -#endif -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 -#ifndef __UNIXOS2__ -TT_New_Context -TT_RunIns -tt_default_graphics_state -#endif -tt_driver_class -t1_driver_class -t1cid_driver_class -winfnt_driver_class -#ifdef __UNIXOS2__ -FT_Get_First_Char -FT_Get_Next_Char -FT_Get_PS_Font_Info -FT_Has_PS_Glyph_Names -FT_Get_Name_Index -FT_Get_BDF_Property -FT_Activate_Size -FT_Get_X11_Font_Format -FT_Get_BDF_Charset_ID -FT_Get_Postscript_Name -#endif - -/* $XFree86: xc/lib/freetype2/freetype-def.cpp,v 1.6 2003/11/06 03:25:41 dawes Exp $ */ diff --git a/nx-X11/lib/freetype2/freetype/Imakefile b/nx-X11/lib/freetype2/freetype/Imakefile deleted file mode 100644 index 246603fda..000000000 --- a/nx-X11/lib/freetype2/freetype/Imakefile +++ /dev/null @@ -1,90 +0,0 @@ -XCOMM $XFree86: xc/lib/freetype2/freetype/Imakefile,v 1.9 2003/05/29 03:05:09 dawes 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 \ - ftbdf.h \ - ftcache.h \ - ftchapters.h \ - fterrdef.h \ - fterrors.h \ - ftglyph.h \ - ftgzip.h \ - ftimage.h \ - ftincrem.h \ - ftlist.h \ - ftmac.h \ - ftmm.h \ - ftmoderr.h \ - ftmodapi.h \ - ftoutln.h \ - ftpfr.h \ - ftrender.h \ - ftsizes.h \ - ftsnames.h \ - ftstroke.h \ - ftsynth.h \ - ftsysio.h \ - ftsysmem.h \ - ftsystem.h \ - fttrigon.h \ - fttypes.h \ - ftwinfnt.h \ - ftxf86.h \ - t1tables.h \ - ftlzw.h \ - ttnameid.h \ - tttables.h \ - tttags.h \ - ttunpat.h - -BuildIncludes($(HEADERS),freetype2/freetype,../..) -InstallMultipleFlags($(HEADERS),$(INCDIR)/freetype2/freetype,$(INSTINCFLAGS)) - -LinkSourceFile(freetype.h,$(FREETYPEINC)) -LinkSourceFile(ftbbox.h,$(FREETYPEINC)) -LinkSourceFile(ftbdf.h,$(FREETYPEINC)) -LinkSourceFile(ftcache.h,$(FREETYPEINC)) -LinkSourceFile(ftchapters.h,$(FREETYPEINC)) -LinkSourceFile(fterrdef.h,$(FREETYPEINC)) -LinkSourceFile(fterrors.h,$(FREETYPEINC)) -LinkSourceFile(ftglyph.h,$(FREETYPEINC)) -LinkSourceFile(ftgzip.h,$(FREETYPEINC)) -LinkSourceFile(ftimage.h,$(FREETYPEINC)) -LinkSourceFile(ftincrem.h,$(FREETYPEINC)) -LinkSourceFile(ftlist.h,$(FREETYPEINC)) -LinkSourceFile(ftmac.h,$(FREETYPEINC)) -LinkSourceFile(ftmm.h,$(FREETYPEINC)) -LinkSourceFile(ftmoderr.h,$(FREETYPEINC)) -LinkSourceFile(ftmodapi.h,$(FREETYPEINC)) -LinkSourceFile(ftoutln.h,$(FREETYPEINC)) -LinkSourceFile(ftpfr.h,$(FREETYPEINC)) -LinkSourceFile(ftrender.h,$(FREETYPEINC)) -LinkSourceFile(ftsizes.h,$(FREETYPEINC)) -LinkSourceFile(ftsnames.h,$(FREETYPEINC)) -LinkSourceFile(ftstroke.h,$(FREETYPEINC)) -LinkSourceFile(ftsynth.h,$(FREETYPEINC)) -LinkSourceFile(ftsysio.h,$(FREETYPEINC)) -LinkSourceFile(ftsysmem.h,$(FREETYPEINC)) -LinkSourceFile(ftsystem.h,$(FREETYPEINC)) -LinkSourceFile(fttrigon.h,$(FREETYPEINC)) -LinkSourceFile(fttypes.h,$(FREETYPEINC)) -LinkSourceFile(ftwinfnt.h,$(FREETYPEINC)) -LinkSourceFile(ftxf86.h,$(FREETYPEINC)) -LinkSourceFile(t1tables.h,$(FREETYPEINC)) -LinkSourceFile(ftlzw.h,$(FREETYPEINC)) -LinkSourceFile(ttnameid.h,$(FREETYPEINC)) -LinkSourceFile(tttables.h,$(FREETYPEINC)) -LinkSourceFile(tttags.h,$(FREETYPEINC)) -LinkSourceFile(ttunpat.h,$(FREETYPEINC)) - -DependSubdirs($(SUBDIRS)) diff --git a/nx-X11/lib/freetype2/freetype/cache/Imakefile b/nx-X11/lib/freetype2/freetype/cache/Imakefile deleted file mode 100644 index 18ae1fed9..000000000 --- a/nx-X11/lib/freetype2/freetype/cache/Imakefile +++ /dev/null @@ -1,25 +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= \ - ftccache.h \ - ftccmap.h \ - ftcglyph.h \ - ftcimage.h \ - ftcmanag.h \ - ftcsbits.h \ - ftcmru.h - -BuildIncludes($(HEADERS),freetype2/freetype/cache,../../..) -InstallMultipleFlags($(HEADERS),$(INCDIR)/freetype2/freetype/cache,$(INSTINCFLAGS)) - -LinkSourceFile(ftccache.h,$(FREETYPEINC)/cache) -LinkSourceFile(ftccmap.h,$(FREETYPEINC)/cache) -LinkSourceFile(ftcglyph.h,$(FREETYPEINC)/cache) -LinkSourceFile(ftcimage.h,$(FREETYPEINC)/cache) -LinkSourceFile(ftcmanag.h,$(FREETYPEINC)/cache) -LinkSourceFile(ftcsbits.h,$(FREETYPEINC)/cache) -LinkSourceFile(ftcmru.h,$(FREETYPEINC)/cache) diff --git a/nx-X11/lib/freetype2/freetype/config/Imakefile b/nx-X11/lib/freetype2/freetype/config/Imakefile deleted file mode 100644 index c23911208..000000000 --- a/nx-X11/lib/freetype2/freetype/config/Imakefile +++ /dev/null @@ -1,52 +0,0 @@ -XCOMM $XdotOrg: xc/lib/freetype2/freetype/config/Imakefile,v 1.4 2005/10/10 01:25:40 alanc Exp $ -XCOMM $XFree86: xc/lib/freetype2/freetype/config/Imakefile,v 1.12 2003/10/24 16:21:17 tsi Exp $ - -FREETYPETOP = $(TOP)/extras/freetype2 -FREETYPESRC = $(FREETYPETOP)/src -FREETYPEINC = $(FREETYPETOP)/include/freetype - -HEADERS= \ - ftconfig.h \ - ftheader.h \ - ftmodule.h \ - ftoption.h \ - ftstdlib.h - -BuildIncludes($(HEADERS),freetype2/freetype/config,../../..) -InstallMultipleFlags($(HEADERS),$(INCDIR)/freetype2/freetype/config,$(INSTINCFLAGS)) - -LinkSourceFile(ftconfig.h,$(FREETYPEINC)/config) -LinkSourceFile(ftheader.h,$(FREETYPEINC)/config) -LinkSourceFile(ftmodule.h,$(FREETYPEINC)/config) -LinkSourceFile(ftoption.h,$(FREETYPEINC)/config) -LinkSourceFile(ftstdlib.h,$(FREETYPEINC)/config) - -XCOMM Build and install a configure-compatible freetype-config - -LinkSourceFile(freetype-config.in,$(FREETYPETOP)/builds/unix) -LinkSourceFile(freetype2.in,$(FREETYPETOP)/builds/unix) - -FREETYPE_VERSION=Freetype2Version - -RPATH_CFLAG = HardCodeLibdirFlag - -CONFIG_SUBST = \ - sed -e s%@prefix@%$(PROJECTROOT)% -e s%@exec_prefix@%$(PROJECTROOT)% \ - -e s%@libdir@%$(USRLIBDIR)%g -e s%@includedir@%$(INCDIR)% \ - -e s%@ft_version@%$(FREETYPE_VERSION)% -e s%@LIBZ@%% \ - -e s%@hardcode_libdir_flag_spec@%$(RPATH_CFLAG)% -e s%@wl@%% - -freetype-config: freetype-config.in - $(CONFIG_SUBST) < freetype-config.in > $@ - -freetype2.pc: freetype2.in - $(CONFIG_SUBST) < freetype2.in > $@ - -includes:: freetype-config freetype2.pc - -InstallNamedProg(freetype-config,freetype-config,$(BINDIR)) -InstallNonExecFile(freetype2.pc,$(USRLIBDIR)/pkgconfig) - -clean:: - RemoveFile(freetype-config) - RemoveFile(freetype2.pc) diff --git a/nx-X11/lib/freetype2/freetype/internal/Imakefile b/nx-X11/lib/freetype2/freetype/internal/Imakefile deleted file mode 100644 index 2ec88abe9..000000000 --- a/nx-X11/lib/freetype2/freetype/internal/Imakefile +++ /dev/null @@ -1,52 +0,0 @@ -XCOMM $XdotOrg: xc/lib/freetype2/freetype/internal/Imakefile,v 1.3 2004/04/28 10:39:09 gisburn Exp $ - -#define IHaveSubdirs -#define PassCDebugFlags - -SUBDIRS=services - -FREETYPETOP = $(TOP)/extras/freetype2 -FREETYPESRC = $(FREETYPETOP)/src -FREETYPEINC = $(FREETYPETOP)/include/freetype - -HEADERS= \ - autohint.h \ - ftcalc.h \ - ftdebug.h \ - ftdriver.h \ - ftgloadr.h \ - ftmemory.h \ - ftobjs.h \ - ftrfork.h \ - ftserv.h \ - ftstream.h \ - fttrace.h \ - internal.h \ - pcftypes.h \ - psaux.h \ - pshints.h \ - sfnt.h \ - t1types.h \ - tttypes.h - -BuildIncludes($(HEADERS),freetype2/freetype/internal,../../..) -InstallMultipleFlags($(HEADERS),$(INCDIR)/freetype2/freetype/internal,$(INSTINCFLAGS)) - -LinkSourceFile(autohint.h,$(FREETYPEINC)/internal) -LinkSourceFile(ftcalc.h,$(FREETYPEINC)/internal) -LinkSourceFile(ftdebug.h,$(FREETYPEINC)/internal) -LinkSourceFile(ftdriver.h,$(FREETYPEINC)/internal) -LinkSourceFile(ftgloadr.h,$(FREETYPEINC)/internal) -LinkSourceFile(ftmemory.h,$(FREETYPEINC)/internal) -LinkSourceFile(ftobjs.h,$(FREETYPEINC)/internal) -LinkSourceFile(ftrfork.h,$(FREETYPEINC)/internal) -LinkSourceFile(ftstream.h,$(FREETYPEINC)/internal) -LinkSourceFile(ftserv.h,$(FREETYPEINC)/internal) -LinkSourceFile(fttrace.h,$(FREETYPEINC)/internal) -LinkSourceFile(internal.h,$(FREETYPEINC)/internal) -LinkSourceFile(pcftypes.h,$(FREETYPEINC)/internal) -LinkSourceFile(psaux.h,$(FREETYPEINC)/internal) -LinkSourceFile(pshints.h,$(FREETYPEINC)/internal) -LinkSourceFile(sfnt.h,$(FREETYPEINC)/internal) -LinkSourceFile(t1types.h,$(FREETYPEINC)/internal) -LinkSourceFile(tttypes.h,$(FREETYPEINC)/internal) diff --git a/nx-X11/lib/freetype2/freetype/internal/services/Imakefile b/nx-X11/lib/freetype2/freetype/internal/services/Imakefile deleted file mode 100644 index 31e18cff8..000000000 --- a/nx-X11/lib/freetype2/freetype/internal/services/Imakefile +++ /dev/null @@ -1,31 +0,0 @@ -FREETYPETOP = $(TOP)/extras/freetype2 -FREETYPESRC = $(FREETYPETOP)/src -FREETYPEINC = $(FREETYPETOP)/include/freetype - -HEADERS= \ - svbdf.h \ - svmm.h \ - svpostnm.h \ - svpsinfo.h \ - svwinfnt.h \ - svgldict.h \ - svpfr.h \ - svpscmap.h \ - svsfnt.h \ - svttcmap.h \ - svxf86nm.h - -BuildIncludes($(HEADERS),freetype2/freetype/internal/services,../../../..) -InstallMultipleFlags($(HEADERS),$(INCDIR)/freetype2/freetype/internal/services,$(INSTINCFLAGS)) - -LinkSourceFile(svbdf.h,$(FREETYPEINC)/internal/services) -LinkSourceFile(svmm.h,$(FREETYPEINC)/internal/services) -LinkSourceFile(svpostnm.h,$(FREETYPEINC)/internal/services) -LinkSourceFile(svpsinfo.h,$(FREETYPEINC)/internal/services) -LinkSourceFile(svwinfnt.h,$(FREETYPEINC)/internal/services) -LinkSourceFile(svgldict.h,$(FREETYPEINC)/internal/services) -LinkSourceFile(svpfr.h,$(FREETYPEINC)/internal/services) -LinkSourceFile(svpscmap.h,$(FREETYPEINC)/internal/services) -LinkSourceFile(svsfnt.h,$(FREETYPEINC)/internal/services) -LinkSourceFile(svttcmap.h,$(FREETYPEINC)/internal/services) -LinkSourceFile(svxf86nm.h,$(FREETYPEINC)/internal/services) diff --git a/nx-X11/lib/lbxutil/Imakefile b/nx-X11/lib/lbxutil/Imakefile deleted file mode 100644 index d4f74e787..000000000 --- a/nx-X11/lib/lbxutil/Imakefile +++ /dev/null @@ -1,31 +0,0 @@ -XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:46:40 cpqbld Exp $ - - - - - -XCOMM $XFree86: xc/lib/lbxutil/Imakefile,v 1.7 1999/04/17 09:08:13 dawes Exp $ - -#include <Server.tmpl> - -#define IHaveSubdirs - -SUBDIRS = lbx_zlib delta image - -OBJS = lbx_zlib/?*.o delta/?*.o image/?*.o - -DONES = lbx_zlib/DONE delta/DONE image/DONE - -lbx_zlib/DONE: lbx_zlib -delta/DONE: delta -image/DONE: image - -#undef _LinkBuildLibrary -#define _LinkBuildLibrary(lib) LinkBuildLibrary(lib) - -NormalDepLibraryTarget(lbxutil,$(SUBDIRS) $(DONES),$(OBJS)) - -ForceSubdirs($(SUBDIRS)) - -DependSubdirs($(SUBDIRS)) - diff --git a/nx-X11/lib/lbxutil/delta/Imakefile b/nx-X11/lib/lbxutil/delta/Imakefile deleted file mode 100644 index cb94c8906..000000000 --- a/nx-X11/lib/lbxutil/delta/Imakefile +++ /dev/null @@ -1,17 +0,0 @@ -XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:46:40 cpqbld Exp $ - -#define IncSubdir X11 -#include <Library.tmpl> - -SRCS = lbxdelta.c - -OBJS = lbxdelta.o - -INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(SERVERSRC)/include -I../../../include/extensions - -SubdirLibraryRule($(OBJS)) -NormalLibraryObjectRule() -NormalLintTarget($(SRCS)) - -DependTarget() - diff --git a/nx-X11/lib/lbxutil/delta/lbxdelta.c b/nx-X11/lib/lbxutil/delta/lbxdelta.c deleted file mode 100644 index 5925a6a1b..000000000 --- a/nx-X11/lib/lbxutil/delta/lbxdelta.c +++ /dev/null @@ -1,255 +0,0 @@ -/* - * $NCDXorg: @(#)lbxdelta.c,v 1.2 1994/01/22 02:23:40 dct Exp $ - * $Xorg: lbxdelta.c,v 1.5 2000/08/17 19:46:40 cpqbld Exp $ - * $XdotOrg: xc/lib/lbxutil/delta/lbxdelta.c,v 1.7 2005/07/30 21:07:25 alanc Exp $ - * - * Copyright 1993 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 NCD. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. NCD. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD. - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER 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: Dale Tonogai, Network Computing Devices - */ -/* $XFree86: xc/lib/lbxutil/delta/lbxdelta.c,v 1.7 2001/07/25 15:04:57 dawes Exp $ */ - -#include <X11/X.h> -#include <X11/Xproto.h> -#define _XLBX_SERVER_ -#include <X11/extensions/lbxstr.h> -#include <X11/extensions/lbxdeltastr.h> - -#include <stddef.h> -#include <string.h> - -#ifdef LBXREQSTATS -#include "../lbx_zlib/reqstats.h" -extern int LbxWhoAmI; -extern struct ReqStats CoreRequestStats[128]; -extern struct ReqStats LbxRequestStats[LbxNumberReqs]; - -#define LBX_CODE 136 /* XXX - this should not be hardcoded - on todo list */ -#endif - -/* Copied from xc/programs/Xserver/include/xorg/os.h */ -#ifndef _HAVE_XALLOC_DECLS -#define _HAVE_XALLOC_DECLS -#include <X11/Xdefs.h> - -extern pointer Xalloc(unsigned long /*amount*/); -extern pointer Xcalloc(unsigned long /*amount*/); -extern pointer Xrealloc(pointer /*ptr*/, unsigned long /*amount*/); -extern void Xfree(pointer /*ptr*/); -#endif - -/* - * Allocate data structures needed for doing Delta compaction - */ -int -LBXInitDeltaCache(LBXDeltasPtr pcache, - int nDeltas, - int maxDeltasize) -{ - int i; - unsigned char *mem; - - if ((pcache->nDeltas = nDeltas)) { - pcache->maxDeltasize = maxDeltasize; - if ((pcache->deltas = (LBXDeltaElemPtr) - Xalloc(pcache->nDeltas * sizeof(LBXDeltaElemRec) + - pcache->nDeltas * pcache->maxDeltasize)) == NULL) { - return -1; - } - - mem = (unsigned char *) (pcache->deltas + pcache->nDeltas); - for (i = 0; i < pcache->nDeltas; i++) { - pcache->deltas[i].buf = mem; - mem += pcache->maxDeltasize; - } - } - else - pcache->maxDeltasize = 0; - - pcache->nextDelta = 0; - pcache->activeDeltas = 0; - return 0; -} - -/* - * Free data structures used for doing Delta compaction - */ -void -LBXFreeDeltaCache(LBXDeltasPtr pcache) -{ - if (pcache->nDeltas && pcache->deltas) - Xfree(pcache->deltas); -} - -static int -BytesDiff(unsigned char *ptr1, unsigned char *ptr2, - int n, - int maxn) -{ - int result = 0; - - while (n--) - if (*(ptr1++) != *(ptr2++)) - if (++result >= maxn) - break; - return (result); -} - -/* - * Find the message in the outgoing delta cache with the least number of - * differing bytes and return the number of differences. If all - * messages have greater than maxdiff differences, return -1. - */ -int -LBXDeltaMinDiffs(LBXDeltasPtr pcache, - unsigned char *inmsg, - int inmsglen, - int maxdiff, - int *pindex) -{ - int i, j, k = 0, l = maxdiff + 1; - int m; - LBXDeltaElemPtr dm; - - for (m = pcache->nextDelta-1, dm = &pcache->deltas[m], i = 0; - i < pcache->activeDeltas; - i++, m--, dm-- - ) { - if (m < 0) { - m = pcache->nDeltas - 1; - dm = &pcache->deltas[m]; - } - if (dm->length == inmsglen) { - j = BytesDiff(inmsg, dm->buf, inmsglen, l); - if (j < l) { - k = m; - l = j; - } - } - } - - if (l > maxdiff) - return -1; - else { - *pindex = k; - return l; - } -} - -/* - * Delta compact a given message - */ -void -LBXEncodeDelta(LBXDeltasPtr pcache, - unsigned char *inmsg, - int ndiff, - int index, - unsigned char *buf) -{ - int i, off, diff; - xLbxDiffItem *deltas = (xLbxDiffItem *)buf; - - for (off = i = 0; i < ndiff; off++) { - if ((diff = inmsg[off] - pcache->deltas[index].buf[off])) { - deltas[i].offset = off; - deltas[i++].diff = diff; - } - } -} - -/* - * Uncompact a message - */ -int -LBXDecodeDelta(LBXDeltasPtr pcache, - xLbxDiffItem *deltas, - int ndiff, - int index, - unsigned char **buf) -{ - int i; - int newindex = pcache->nextDelta; - int len = pcache->deltas[index].length; - unsigned char *p = pcache->deltas[newindex].buf; -#ifdef LBXREQSTATS - xReq *req; -#endif - - pcache->nextDelta = (pcache->nextDelta + 1) % pcache->nDeltas; - if (index != newindex) { - memcpy(p, pcache->deltas[index].buf, len); - pcache->deltas[newindex].length = len; - } - for (i = 0; i < ndiff; i++) - p[deltas[i].offset] += deltas[i].diff; - *buf = p; - -#ifdef LBXREQSTATS - req = (xReq *) p; - - if (LbxWhoAmI == 1) /* server */ - { - struct ReqStats *reqStat = NULL; - - if (req->reqType == LBX_CODE) - reqStat = &LbxRequestStats[req->data]; - else if (req->reqType < 128) - reqStat = &CoreRequestStats[req->reqType]; - - if (reqStat) - { - reqStat->delta_count++; - reqStat->pre_delta_bytes += (req->length << 2); - reqStat->post_delta_bytes += - (((sz_xLbxDeltaReq + sz_xLbxDiffItem * ndiff + 3) >> 2) << 2); - } - } -#endif - - return len; -} - -/* - * Add a message to the outgoing delta cache - */ -void -LBXAddDeltaOut(LBXDeltasPtr pcache, - unsigned char *inmsg, - int inmsglen) -{ - memcpy(pcache->deltas[pcache->nextDelta].buf, inmsg, inmsglen); - pcache->deltas[pcache->nextDelta].length = inmsglen; - pcache->nextDelta = (pcache->nextDelta + 1) % pcache->nDeltas; - if (pcache->activeDeltas < pcache->nDeltas) - pcache->activeDeltas++; -} - -/* - * Add a message to the incoming delta cache - */ -void -LBXAddDeltaIn(LBXDeltasPtr pcache, - unsigned char *inmsg, - int inmsglen) -{ - memcpy(pcache->deltas[pcache->nextDelta].buf, inmsg, inmsglen); - pcache->deltas[pcache->nextDelta].length = inmsglen; - pcache->nextDelta = (pcache->nextDelta + 1) % pcache->nDeltas; -} diff --git a/nx-X11/lib/lbxutil/image/Imakefile b/nx-X11/lib/lbxutil/image/Imakefile deleted file mode 100644 index fa7421615..000000000 --- a/nx-X11/lib/lbxutil/image/Imakefile +++ /dev/null @@ -1,45 +0,0 @@ -XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:46:40 cpqbld Exp $ - - - - -XCOMM $XFree86: xc/lib/lbxutil/image/Imakefile,v 1.3 2001/01/17 19:43:35 dawes Exp $ - -#define IncSubdir X11 -#include <Library.tmpl> - -SRCS = dfaxg42d.c dpackbits.c efaxg42d.c epackbits.c misc.c - -OBJS = dfaxg42d.o dpackbits.o efaxg42d.o epackbits.o misc.o - -INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(SERVERSRC)/include -I../../../include/extensions - -SubdirLibraryRule($(OBJS)) -NormalLibraryObjectRule() -NormalLintTarget($(SRCS)) - -MKG3STATES = ./mkg3states - -#if CrossCompiling -HOST_CFLAGS=$(TOP_INCLUDES) $(INCLUDES) $(BOOTSTRAPCFLAGS) \ - $(CROSSCOMPILEDEFINES) $(CROSSCOMPILEBOOTSTRAPDEFINES) -#else -HOST_CFLAGS=$(CFLAGS) -#endif - -g3states.h : mkg3states.c - RemoveFiles($@ HostProgramTargetName(mkg3states)) - -HostLinkRule(HostProgramTargetName(mkg3states), $(HOST_CFLAGS),mkg3states.c,$(LDLIBS)) - RunProgram(MKG3STATES,> g3_states_h) - $(MV) g3_states_h $@ - RemoveFiles(HostProgramTargetName(mkg3states) g3_states_h) - -includes:: g3states.h - -depend:: g3states.h - -clean:: - RemoveFiles(g3_states_h g3states.h HostProgramTargetName(mkg3states)) - -DependTarget() - diff --git a/nx-X11/lib/lbxutil/image/dfaxg42d.c b/nx-X11/lib/lbxutil/image/dfaxg42d.c deleted file mode 100644 index 609992d62..000000000 --- a/nx-X11/lib/lbxutil/image/dfaxg42d.c +++ /dev/null @@ -1,420 +0,0 @@ -/* $Xorg: dfaxg42d.c,v 1.3 2000/08/17 19:46:40 cpqbld Exp $ */ -/* - * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler - * Copyright (c) 1991, 1992 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the names of - * Sam Leffler and Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Sam Leffler and Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ -/* $XFree86: xc/lib/lbxutil/image/dfaxg42d.c,v 1.5 2001/01/17 19:43:35 dawes Exp $ */ - -#include <X11/Xos.h> -#include <X11/Xfuncproto.h> -#include <X11/Xfuncs.h> -#include <stdlib.h> -#include "g3states.h" -#include "lbxfax.h" -#include <X11/extensions/lbximage.h> - -/* - * ------------------------------------------------------------------------- - * FAX G42D decoding for 1 bit images - * ------------------------------------------------------------------------- - */ - -static short sp_data, sp_bit; - - -/* - * Fetch a byte from the input stream - */ - -static unsigned char -fetchByte (unsigned char **inbuf) - -{ - unsigned char byte = **inbuf; - (*inbuf)++; - return (byte); -} - - -/* - * Decode a run of white. - */ - -static int -decode_white_run (unsigned char **inbuf) - -{ - short state = sp_bit; - short action; - int runlen = 0; - - for (;;) - { - if (sp_bit == 0) - { - nextbyte: - sp_data = fetchByte (inbuf); - } - - action = TIFFFax1DAction[state][sp_data]; - state = TIFFFax1DNextState[state][sp_data]; - if (action == ACT_INCOMP) - goto nextbyte; - if (action == ACT_INVALID) - return (G3CODE_INVALID); - if (action == ACT_EOL) - return (G3CODE_EOL); - sp_bit = state; - action = RUNLENGTH(action - ACT_WRUNT); - runlen += action; - if (action < 64) - return (runlen); - } -} - - -/* - * Decode a run of black. - */ - -static int -decode_black_run (unsigned char **inbuf) - -{ - short state = sp_bit + 8; - short action; - int runlen = 0; - - for (;;) - { - if (sp_bit == 0) - { - nextbyte: - sp_data = fetchByte (inbuf); - } - - action = TIFFFax1DAction[state][sp_data]; - state = TIFFFax1DNextState[state][sp_data]; - if (action == ACT_INCOMP) - goto nextbyte; - if (action == ACT_INVALID) - return (G3CODE_INVALID); - if (action == ACT_EOL) - return (G3CODE_EOL); - sp_bit = state; - action = RUNLENGTH(action - ACT_BRUNT); - runlen += action; - if (action < 64) - return (runlen); - state += 8; - } -} - - -/* - * Return the next uncompressed mode code word. - */ - -static int -decode_uncomp_code (unsigned char **inbuf) - -{ - short code; - - do { - if (sp_bit == 0 || sp_bit > 7) - sp_data = fetchByte (inbuf); - - code = TIFFFaxUncompAction[sp_bit][sp_data]; - sp_bit = TIFFFaxUncompNextState[sp_bit][sp_data]; - } while (code == ACT_INCOMP); - - return (code); -} - - -/* - * Fill a span with ones. - */ - -static void -fillspan (char *cp, - int x, int count) - -{ - static unsigned char masks[] = - { 0, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff }; - - if (count <= 0) - return; - - cp += x>>3; - - if (x &= 7) - { - /* align to byte boundary */ - - if (count < 8 - x) { - *cp++ |= masks[count] >> x; - return; - } - - *cp++ |= 0xff >> x; - count -= 8 - x; - } - - while (count >= 8) - { - *cp++ = (char)0xff; - count -= 8; - } - - *cp |= masks[count]; -} - - -/* - * Return the next bit in the input stream. This is - * used to extract 2D tag values and the color tag - * at the end of a terminating uncompressed data code. - */ - -static int -nextbit (unsigned char **inbuf) - -{ - static unsigned char bitMask[8] = - { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; - int bit; - - if (sp_bit == 0) - sp_data = fetchByte (inbuf); - - bit = sp_data & bitMask[sp_bit]; - - if (++(sp_bit) > 7) - sp_bit = 0; - - return (bit); -} - - -static int -DecodeFaxG42D (unsigned char **inbuf, - unsigned char *refline, - int pixels_per_line, - unsigned char *outbuf) - -{ - int a0 = -1; - int b1, b2; - int run1, run2; /* for horizontal mode */ - short mode; - short color = 1; - - do { - if (sp_bit == 0 || sp_bit > 7) - sp_data = fetchByte (inbuf); - - mode = TIFFFax2DMode[sp_bit][sp_data]; - sp_bit = TIFFFax2DNextState[sp_bit][sp_data]; - - switch (mode) - { - case MODE_NULL: - break; - - case MODE_PASS: - b2 = LbxImageFindDiff (refline, a0, pixels_per_line, !color); - b1 = LbxImageFindDiff (refline, b2, pixels_per_line, color); - b2 = LbxImageFindDiff (refline, b1, pixels_per_line, !color); - - if (color) - { - if (a0 < 0) - a0 = 0; - fillspan ((char *) outbuf, a0, b2 - a0); - } - - a0 = b2; - break; - - case MODE_HORIZ: - if (color == 1) - { - run1 = decode_white_run (inbuf); - run2 = decode_black_run (inbuf); - } - else - { - run1 = decode_black_run (inbuf); - run2 = decode_white_run (inbuf); - } - - /* - * Do the appropriate fill. Note that we exit this logic with - * the same color that we enter with since we do 2 fills. This - * explains the somewhat obscure logic below. - */ - - if (a0 < 0) - a0 = 0; - if (a0 + run1 > pixels_per_line) - run1 = pixels_per_line - a0; - if (color) - fillspan ((char *) outbuf, a0, run1); - a0 += run1; - if (a0 + run2 > pixels_per_line) - run2 = pixels_per_line - a0; - if (!color) - fillspan ((char *) outbuf, a0, run2); - a0 += run2; - break; - - case MODE_VERT_V0: - case MODE_VERT_VR1: - case MODE_VERT_VR2: - case MODE_VERT_VR3: - case MODE_VERT_VL1: - case MODE_VERT_VL2: - case MODE_VERT_VL3: - b2 = LbxImageFindDiff (refline, a0, pixels_per_line, !color); - b1 = LbxImageFindDiff (refline, b2, pixels_per_line, color); - b1 += mode - MODE_VERT_V0; - - if (color) - { - if (a0 < 0) - a0 = 0; - fillspan ((char *) outbuf, a0, b1 - a0); - } - - color = !color; - a0 = b1; - break; - - case MODE_UNCOMP: - /* - * Uncompressed mode: select from the special set of code words. - */ - - if (a0 < 0) - a0 = 0; - do - { - mode = decode_uncomp_code (inbuf); - switch (mode) - { - case UNCOMP_RUN1: - case UNCOMP_RUN2: - case UNCOMP_RUN3: - case UNCOMP_RUN4: - case UNCOMP_RUN5: - run1 = mode - UNCOMP_RUN0; - fillspan ((char *) outbuf, a0+run1-1, 1); - a0 += run1; - break; - - case UNCOMP_RUN6: - a0 += 5; - break; - - case UNCOMP_TRUN0: - case UNCOMP_TRUN1: - case UNCOMP_TRUN2: - case UNCOMP_TRUN3: - case UNCOMP_TRUN4: - - run1 = mode - UNCOMP_TRUN0; - a0 += run1; - color = nextbit (inbuf) ? 0 : 1; - break; - - case UNCOMP_INVALID: - goto bad; - - case UNCOMP_EOF: - return (0); - } - } while (mode < UNCOMP_EXIT); - break; - - case MODE_ERROR_1: - /* fall thru... */ - case MODE_ERROR: - goto bad; - - default: - return (0); - } - - } while (a0 < pixels_per_line); - -bad: - return (a0 >= pixels_per_line); -} - - -int -LbxImageDecodeFaxG42D (unsigned char *inbuf, - unsigned char *outbuf, - int image_bytes, - int pixels_per_line, - int padded_bytes_per_scanline, - int reverse_bits) - -{ - int bytes_per_scanline = ROUNDUP8 (pixels_per_line); - unsigned char *refline, *refptr; - unsigned char *outbuf_start = outbuf; - int bytes_left = image_bytes; - int i; - - refline = (unsigned char *) malloc (bytes_per_scanline + 1); - refptr = refline + 1; - - for (i = 0; i < bytes_per_scanline + 1; i++) - refline[i] = 0xff; - - bzero (outbuf, image_bytes); - - sp_bit = 0; - sp_data = 0; - - while (bytes_left > 0) - { - if (!DecodeFaxG42D (&inbuf, refptr, pixels_per_line, outbuf)) - return (0); - - memcpy (refptr, outbuf, bytes_per_scanline); - - outbuf += padded_bytes_per_scanline; - bytes_left -= padded_bytes_per_scanline; - } - - free ((char *) refline); - - if (reverse_bits) - LbxReverseBits (outbuf_start, image_bytes); - - return (outbuf - outbuf_start); -} diff --git a/nx-X11/lib/lbxutil/image/dpackbits.c b/nx-X11/lib/lbxutil/image/dpackbits.c deleted file mode 100644 index f0f2058d0..000000000 --- a/nx-X11/lib/lbxutil/image/dpackbits.c +++ /dev/null @@ -1,100 +0,0 @@ -/* $Xorg: dpackbits.c,v 1.4 2000/08/17 19:46:40 cpqbld Exp $ */ -/* - * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler - * Copyright (c) 1991, 1992 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the names of - * Sam Leffler and Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Sam Leffler and Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ -/* $XFree86: xc/lib/lbxutil/image/dpackbits.c,v 1.3 2000/05/18 23:46:16 dawes Exp $ */ - -#include <X11/Xos.h> -#include <X11/Xfuncproto.h> -#include <X11/extensions/lbximage.h> - -/* - * ------------------------------------------------------------------------- - * PackBits decoding for 8 bit color images - * ------------------------------------------------------------------------- - */ - -static void -DecodePackBits (char **inbuf, - int numPixels, - char *outbuf) - -{ - register char *inptr = *inbuf; - register int n, b; - - while (numPixels > 0) - { - n = (int) *inptr++; - - /* Watch out for compilers that don't sign extend chars... */ - - if (n >= 128) - n -= 256; - - if (n < 0) - { - /* replicate next byte -n+1 times */ - - if (n == -128) /* nop */ - continue; - - n = -n + 1; - numPixels -= n; - for (b = *inptr++; n-- > 0;) - *outbuf++ = b; - } - else - { - /* copy next n+1 bytes literally */ - - memcpy (outbuf, inptr, ++n); - outbuf += n; numPixels -= n; - inptr += n; - } - } - - *inbuf = inptr; -} - - -int -LbxImageDecodePackBits (char *inbuf, - char *outbuf, - int num_scan_lines, - int scan_line_size) - -{ - char *outbuf_start = outbuf; - int padded_scan_line_size = (scan_line_size % 4) ? - scan_line_size + (4 - scan_line_size % 4) : scan_line_size; - - while (num_scan_lines > 0) - { - DecodePackBits (&inbuf, scan_line_size, outbuf); - outbuf += padded_scan_line_size; - num_scan_lines--; - } - - return (outbuf - outbuf_start); -} diff --git a/nx-X11/lib/lbxutil/image/efaxg42d.c b/nx-X11/lib/lbxutil/image/efaxg42d.c deleted file mode 100644 index a89b5e0d2..000000000 --- a/nx-X11/lib/lbxutil/image/efaxg42d.c +++ /dev/null @@ -1,328 +0,0 @@ -/* $Xorg: efaxg42d.c,v 1.3 2000/08/17 19:46:41 cpqbld Exp $ */ -/* - * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler - * Copyright (c) 1991, 1992 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the names of - * Sam Leffler and Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Sam Leffler and Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ -/* $XFree86: xc/lib/lbxutil/image/efaxg42d.c,v 1.4 2001/01/17 19:43:35 dawes Exp $ */ - -#include <X11/Xos.h> -#include <X11/Xfuncproto.h> -#include <stdlib.h> -#include "lbxfax.h" -#include <X11/extensions/lbximage.h> -#include "lbxbwcodes.h" - -/* - * ------------------------------------------------------------------------- - * FAX G42D encoding for 1 bit images - * ------------------------------------------------------------------------- - */ - -static short sp_data, sp_bit; - -static tableentry horizcode = - { 3, 0x1 }; /* 001 */ - -static tableentry passcode = - { 4, 0x1 }; /* 0001 */ - -static tableentry vcodes[7] = { - { 7, 0x03 }, /* 0000 011 */ - { 6, 0x03 }, /* 0000 11 */ - { 3, 0x03 }, /* 011 */ - { 1, 0x1 }, /* 1 */ - { 3, 0x2 }, /* 010 */ - { 6, 0x02 }, /* 0000 10 */ - { 7, 0x02 } /* 0000 010 */ -}; - -typedef struct { - unsigned char *bufStart; - unsigned char *bufPtr; - int bufSize; - int bytesLeft; -} Buffer; - - - -/* - * Flush bits to output buffer. - */ - -static int -flushbits (Buffer *outbuf) - -{ - if (outbuf->bytesLeft > 0) - { - *(outbuf->bufPtr++) = sp_data; - outbuf->bytesLeft--; - - sp_data = 0; - sp_bit = 8; - - return (1); - } - else - return (0); -} - - -/* - * Write a variable-length bit-value to the output stream. Values are - * assumed to be at most 16 bits. - */ - -static int -putbits (unsigned int bits, - unsigned int length, - Buffer *outbuf) - -{ - static int mask[9] = - {0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff}; - - while (length > sp_bit) - { - sp_data |= bits >> (length - sp_bit); - length -= sp_bit; - if (!flushbits (outbuf)) - return (0); - } - - sp_data |= (bits & mask[length]) << (sp_bit - length); - sp_bit -= length; - - if (sp_bit == 0) - { - if (!flushbits (outbuf)) - return (0); - } - - return (1); -} - - -/* - * Write a code to the output stream. - */ - -static int -putcode (tableentry *te, - Buffer *outbuf) - -{ - return (putbits (te->code, te->length, outbuf)); -} - - -/* - * Write the sequence of codes that describes the specified span of - * zero's or one's. The appropriate table that holds the make-up and - * terminating codes is supplied. - */ - -static int -putspan (int span, - tableentry *tab, - Buffer *outbuf) - -{ - while (span >= 2624) - { - tableentry *te = &tab[63 + (2560 >> 6)]; - if (!putcode (te, outbuf)) - return (0); - span -= te->runlen; - } - - if (span >= 64) - { - tableentry *te = &tab[63 + (span >> 6)]; - if (!putcode (te, outbuf)) - return (0); - span -= te->runlen; - } - - if (!putcode (&tab[span], outbuf)) - return (0); - - return (1); -} - - - -#define PIXEL(buf,ix) ((((buf)[(ix)>>3]) >> (7-((ix)&7))) & 1) - -static int -EncodeFaxG42D (unsigned char *inbuf, - unsigned char *refline, - int bits, - Buffer *outbuf) - -{ - short white = 1; - int a0 = 0; - int a1 = (PIXEL (inbuf, 0) != white ? - 0 : LbxImageFindDiff (inbuf, 0, bits, white)); - int b1 = (PIXEL (refline, 0) != white ? - 0 : LbxImageFindDiff (refline, 0, bits, white)); - int a2, b2; - - for (;;) - { - b2 = LbxImageFindDiff (refline, b1, bits, PIXEL (refline, b1)); - if (b2 >= a1) - { - int d = b1 - a1; - if (!(-3 <= d && d <= 3)) - { - /* horizontal mode */ - - a2 = LbxImageFindDiff (inbuf, a1, bits, PIXEL (inbuf, a1)); - if (!putcode (&horizcode, outbuf)) - return (0); - - if (a0 + a1 == 0 || PIXEL (inbuf, a0) == white) - { - if (!putspan(a1 - a0, TIFFFaxWhiteCodes, outbuf)) - return (0); - if (!putspan(a2 - a1, TIFFFaxBlackCodes, outbuf)) - return (0); - } - else - { - if (!putspan (a1 - a0, TIFFFaxBlackCodes, outbuf)) - return (0); - if (!putspan (a2 - a1, TIFFFaxWhiteCodes, outbuf)) - return (0); - } - - a0 = a2; - } - else - { - /* vertical mode */ - - if (!putcode (&vcodes[d+3], outbuf)) - return (0); - a0 = a1; - } - } - else - { - /* pass mode */ - - if (!putcode (&passcode, outbuf)) - return (0); - a0 = b2; - } - - if (a0 >= bits) - break; - - a1 = LbxImageFindDiff (inbuf, a0, bits, PIXEL (inbuf, a0)); - b1 = LbxImageFindDiff (refline, a0, bits, !PIXEL (inbuf, a0)); - b1 = LbxImageFindDiff (refline, b1, bits, PIXEL (inbuf, a0)); - } - - return (1); -} - - -int -LbxImageEncodeFaxG42D (unsigned char *inbuf, - unsigned char *outbuf, - int outbufSize, - int image_bytes, - int pixels_per_line, - int padded_bytes_per_scanline, - int reverse_bits, - int *bytesCompressed) - -{ - int bytes_per_scanline = ROUNDUP8 (pixels_per_line); - unsigned char *refline, *refptr; - unsigned char *save_inbuf = inbuf; - int bytes_left = image_bytes; - Buffer OutBuf; - int status, i; - - OutBuf.bufStart = OutBuf.bufPtr = outbuf; - OutBuf.bufSize = OutBuf.bytesLeft = outbufSize; - - if (!(refline = (unsigned char *) malloc (bytes_per_scanline + 1))) - return (LBX_IMAGE_COMPRESS_BAD_MALLOC); - - refptr = refline + 1; - - for (i = 0; i < bytes_per_scanline + 1; i++) - refline[i] = 0xff; - - if (reverse_bits) - LbxReverseBits (inbuf, image_bytes); - - sp_bit = 8; - sp_data = 0; - - while (bytes_left > 0) - { - if (!(status = EncodeFaxG42D (inbuf, refptr, - pixels_per_line, &OutBuf))) - { - goto bad; - } - - memcpy (refptr, inbuf, bytes_per_scanline); - - inbuf += padded_bytes_per_scanline; - bytes_left -= padded_bytes_per_scanline; - } - - status = putbits (EOL, 12, &OutBuf); - if (status) - status = putbits (EOL, 12, &OutBuf); - if (status && sp_bit != 8) - { - status = flushbits (&OutBuf); - } - - bad: - - free ((char *) refline); - - /* put the bits back the way they were */ - if (reverse_bits) - LbxReverseBits (save_inbuf, image_bytes); - - if (status) - { - *bytesCompressed = OutBuf.bufPtr - OutBuf.bufStart; - - if (OutBuf.bytesLeft > 0) - return (LBX_IMAGE_COMPRESS_SUCCESS); - else - return (LBX_IMAGE_COMPRESS_NOT_WORTH_IT); - } - else - return (LBX_IMAGE_COMPRESS_NOT_WORTH_IT); -} diff --git a/nx-X11/lib/lbxutil/image/epackbits.c b/nx-X11/lib/lbxutil/image/epackbits.c deleted file mode 100644 index 816fee57a..000000000 --- a/nx-X11/lib/lbxutil/image/epackbits.c +++ /dev/null @@ -1,202 +0,0 @@ -/* $Xorg: epackbits.c,v 1.4 2000/08/17 19:46:41 cpqbld Exp $ */ -/* - * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler - * Copyright (c) 1991, 1992 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the names of - * Sam Leffler and Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Sam Leffler and Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <X11/Xfuncproto.h> -#include <X11/extensions/lbximage.h> - -/* - * ------------------------------------------------------------------------- - * PackBits encoding for 8 bit color images - * ------------------------------------------------------------------------- - */ - -#define PutByte(byte,bufptr,bytesLeft) \ -{ \ - if (*bytesLeft < 1) {\ - *outbuf = outptr; \ - return (0); \ - } \ - *bufptr++ = byte; \ - (*bytesLeft)--; \ -} - - -static int -EncodePackBits (char *inbuf, - int numPixels, - char **outbuf, - int *bytesLeft) - -{ - register int pixelsLeft = numPixels; - register char *outptr = *outbuf; - register char *lastliteral; - register int n, b; - enum { BASE, LITERAL, RUN, LITERAL_RUN } state; - - state = BASE; - lastliteral = 0; - - while (pixelsLeft > 0) - { - /* - * Find the longest string of identical bytes. - */ - - b = *inbuf++, pixelsLeft--, n = 1; - for (; pixelsLeft > 0 && b == *inbuf; pixelsLeft--, inbuf++) - n++; - - again: - - switch (state) - { - case BASE: /* initial state, set run/literal */ - if (n > 1) - { - state = RUN; - - if (n > 128) - { - PutByte (-127, outptr, bytesLeft); - PutByte (b, outptr, bytesLeft); - n -= 128; - goto again; - } - - PutByte (-(n-1), outptr, bytesLeft); - PutByte (b, outptr, bytesLeft); - } - else - { - lastliteral = outptr; - PutByte (0, outptr, bytesLeft); - PutByte (b, outptr, bytesLeft); - state = LITERAL; - } - - break; - - case LITERAL: /* last object was literal string */ - if (n > 1) - { - state = LITERAL_RUN; - - if (n > 128) - { - PutByte (-127, outptr, bytesLeft); - PutByte (b, outptr, bytesLeft); - n -= 128; - goto again; - } - - PutByte (-(n-1), outptr, bytesLeft); /* encode run */ - PutByte (b, outptr, bytesLeft); - } - else - { /* extend literal */ - if (++(*lastliteral) == 127) - state = BASE; - PutByte (b, outptr, bytesLeft); - } - - break; - - case RUN: /* last object was run */ - if (n > 1) - { - if (n > 128) - { - PutByte (-127, outptr, bytesLeft); - PutByte (b, outptr, bytesLeft); - n -= 128; - goto again; - } - PutByte (-(n-1), outptr, bytesLeft); - PutByte (b, outptr, bytesLeft); - } - else - { - lastliteral = outptr; - PutByte (0, outptr, bytesLeft); - PutByte (b, outptr, bytesLeft); - state = LITERAL; - } - - break; - - case LITERAL_RUN: /* literal followed by a run */ - /* - * Check to see if previous run should - * be converted to a literal, in which - * case we convert literal-run-literal - * to a single literal. - */ - - if (n == 1 && outptr[-2] == (char)-1 && *lastliteral < 126) - { - state = (((*lastliteral) += 2) == 127 ? BASE : LITERAL); - outptr[-2] = outptr[-1]; /* replicate */ - } - else - state = RUN; - goto again; - } - } - - *outbuf = outptr; - - return (1); -} - - -int -LbxImageEncodePackBits (char *inbuf, - char *outbuf, - int outbufSize, - int format, - int depth, - int num_scan_lines, - int scan_line_size, - int *bytesCompressed) - -{ - char *outbuf_start = outbuf; - int padded_scan_line_size = (scan_line_size % 4) ? - scan_line_size + (4 - scan_line_size % 4) : scan_line_size; - int bytesLeft = outbufSize; - - while (num_scan_lines > 0) - { - if (!EncodePackBits (inbuf, scan_line_size, &outbuf, &bytesLeft)) - return (LBX_IMAGE_COMPRESS_NOT_WORTH_IT); - - inbuf += padded_scan_line_size; - num_scan_lines--; - } - - *bytesCompressed = outbuf - outbuf_start; - return (LBX_IMAGE_COMPRESS_SUCCESS); -} diff --git a/nx-X11/lib/lbxutil/image/lbxbwcodes.h b/nx-X11/lib/lbxutil/image/lbxbwcodes.h deleted file mode 100644 index e26e2864c..000000000 --- a/nx-X11/lib/lbxutil/image/lbxbwcodes.h +++ /dev/null @@ -1,269 +0,0 @@ -/* $Xorg: lbxbwcodes.h,v 1.3 2000/08/17 19:46:41 cpqbld Exp $ */ - -/* - * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler - * Copyright (c) 1991, 1992 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the names of - * Sam Leffler and Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Sam Leffler and Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ -/* $XFree86$ */ - -/* - * Note that these tables are ordered such that the - * index into the table is known to be either the - * run length, or (run length / 64) + a fixed offset. - * - * NB: The G3CODE_INVALID entries are only used - * during state generation (see mkg3states.c). - */ - -#ifdef __DARWIN__ -#ifndef TIFFaxWhiteCodes -#define TIFFFaxWhiteCodes Darwin_X_TIFFFaxWhiteCodes -#endif -#endif -tableentry TIFFFaxWhiteCodes[] = { - { 8, 0x35, 0 }, /* 0011 0101 */ - { 6, 0x7, 1 }, /* 0001 11 */ - { 4, 0x7, 2 }, /* 0111 */ - { 4, 0x8, 3 }, /* 1000 */ - { 4, 0xB, 4 }, /* 1011 */ - { 4, 0xC, 5 }, /* 1100 */ - { 4, 0xE, 6 }, /* 1110 */ - { 4, 0xF, 7 }, /* 1111 */ - { 5, 0x13, 8 }, /* 1001 1 */ - { 5, 0x14, 9 }, /* 1010 0 */ - { 5, 0x7, 10 }, /* 0011 1 */ - { 5, 0x8, 11 }, /* 0100 0 */ - { 6, 0x8, 12 }, /* 0010 00 */ - { 6, 0x3, 13 }, /* 0000 11 */ - { 6, 0x34, 14 }, /* 1101 00 */ - { 6, 0x35, 15 }, /* 1101 01 */ - { 6, 0x2A, 16 }, /* 1010 10 */ - { 6, 0x2B, 17 }, /* 1010 11 */ - { 7, 0x27, 18 }, /* 0100 111 */ - { 7, 0xC, 19 }, /* 0001 100 */ - { 7, 0x8, 20 }, /* 0001 000 */ - { 7, 0x17, 21 }, /* 0010 111 */ - { 7, 0x3, 22 }, /* 0000 011 */ - { 7, 0x4, 23 }, /* 0000 100 */ - { 7, 0x28, 24 }, /* 0101 000 */ - { 7, 0x2B, 25 }, /* 0101 011 */ - { 7, 0x13, 26 }, /* 0010 011 */ - { 7, 0x24, 27 }, /* 0100 100 */ - { 7, 0x18, 28 }, /* 0011 000 */ - { 8, 0x2, 29 }, /* 0000 0010 */ - { 8, 0x3, 30 }, /* 0000 0011 */ - { 8, 0x1A, 31 }, /* 0001 1010 */ - { 8, 0x1B, 32 }, /* 0001 1011 */ - { 8, 0x12, 33 }, /* 0001 0010 */ - { 8, 0x13, 34 }, /* 0001 0011 */ - { 8, 0x14, 35 }, /* 0001 0100 */ - { 8, 0x15, 36 }, /* 0001 0101 */ - { 8, 0x16, 37 }, /* 0001 0110 */ - { 8, 0x17, 38 }, /* 0001 0111 */ - { 8, 0x28, 39 }, /* 0010 1000 */ - { 8, 0x29, 40 }, /* 0010 1001 */ - { 8, 0x2A, 41 }, /* 0010 1010 */ - { 8, 0x2B, 42 }, /* 0010 1011 */ - { 8, 0x2C, 43 }, /* 0010 1100 */ - { 8, 0x2D, 44 }, /* 0010 1101 */ - { 8, 0x4, 45 }, /* 0000 0100 */ - { 8, 0x5, 46 }, /* 0000 0101 */ - { 8, 0xA, 47 }, /* 0000 1010 */ - { 8, 0xB, 48 }, /* 0000 1011 */ - { 8, 0x52, 49 }, /* 0101 0010 */ - { 8, 0x53, 50 }, /* 0101 0011 */ - { 8, 0x54, 51 }, /* 0101 0100 */ - { 8, 0x55, 52 }, /* 0101 0101 */ - { 8, 0x24, 53 }, /* 0010 0100 */ - { 8, 0x25, 54 }, /* 0010 0101 */ - { 8, 0x58, 55 }, /* 0101 1000 */ - { 8, 0x59, 56 }, /* 0101 1001 */ - { 8, 0x5A, 57 }, /* 0101 1010 */ - { 8, 0x5B, 58 }, /* 0101 1011 */ - { 8, 0x4A, 59 }, /* 0100 1010 */ - { 8, 0x4B, 60 }, /* 0100 1011 */ - { 8, 0x32, 61 }, /* 0011 0010 */ - { 8, 0x33, 62 }, /* 0011 0011 */ - { 8, 0x34, 63 }, /* 0011 0100 */ - { 5, 0x1B, 64 }, /* 1101 1 */ - { 5, 0x12, 128 }, /* 1001 0 */ - { 6, 0x17, 192 }, /* 0101 11 */ - { 7, 0x37, 256 }, /* 0110 111 */ - { 8, 0x36, 320 }, /* 0011 0110 */ - { 8, 0x37, 384 }, /* 0011 0111 */ - { 8, 0x64, 448 }, /* 0110 0100 */ - { 8, 0x65, 512 }, /* 0110 0101 */ - { 8, 0x68, 576 }, /* 0110 1000 */ - { 8, 0x67, 640 }, /* 0110 0111 */ - { 9, 0xCC, 704 }, /* 0110 0110 0 */ - { 9, 0xCD, 768 }, /* 0110 0110 1 */ - { 9, 0xD2, 832 }, /* 0110 1001 0 */ - { 9, 0xD3, 896 }, /* 0110 1001 1 */ - { 9, 0xD4, 960 }, /* 0110 1010 0 */ - { 9, 0xD5, 1024 }, /* 0110 1010 1 */ - { 9, 0xD6, 1088 }, /* 0110 1011 0 */ - { 9, 0xD7, 1152 }, /* 0110 1011 1 */ - { 9, 0xD8, 1216 }, /* 0110 1100 0 */ - { 9, 0xD9, 1280 }, /* 0110 1100 1 */ - { 9, 0xDA, 1344 }, /* 0110 1101 0 */ - { 9, 0xDB, 1408 }, /* 0110 1101 1 */ - { 9, 0x98, 1472 }, /* 0100 1100 0 */ - { 9, 0x99, 1536 }, /* 0100 1100 1 */ - { 9, 0x9A, 1600 }, /* 0100 1101 0 */ - { 6, 0x18, 1664 }, /* 0110 00 */ - { 9, 0x9B, 1728 }, /* 0100 1101 1 */ - { 11, 0x8, 1792 }, /* 0000 0001 000 */ - { 11, 0xC, 1856 }, /* 0000 0001 100 */ - { 11, 0xD, 1920 }, /* 0000 0001 101 */ - { 12, 0x12, 1984 }, /* 0000 0001 0010 */ - { 12, 0x13, 2048 }, /* 0000 0001 0011 */ - { 12, 0x14, 2112 }, /* 0000 0001 0100 */ - { 12, 0x15, 2176 }, /* 0000 0001 0101 */ - { 12, 0x16, 2240 }, /* 0000 0001 0110 */ - { 12, 0x17, 2304 }, /* 0000 0001 0111 */ - { 12, 0x1C, 2368 }, /* 0000 0001 1100 */ - { 12, 0x1D, 2432 }, /* 0000 0001 1101 */ - { 12, 0x1E, 2496 }, /* 0000 0001 1110 */ - { 12, 0x1F, 2560 }, /* 0000 0001 1111 */ - { 12, 0x1, G3CODE_EOL }, /* 0000 0000 0001 */ - { 9, 0x1, G3CODE_INVALID }, /* 0000 0000 1 */ - { 10, 0x1, G3CODE_INVALID }, /* 0000 0000 01 */ - { 11, 0x1, G3CODE_INVALID }, /* 0000 0000 001 */ - { 12, 0x0, G3CODE_INVALID }, /* 0000 0000 0000 */ -}; - -#ifdef __DARWIN__ -#ifndef TIFFaxBlackCodes -#define TIFFFaxBlackCodes Darwin_X_TIFFFaxBlackCodes -#endif -#endif -tableentry TIFFFaxBlackCodes[] = { - { 10, 0x37, 0 }, /* 0000 1101 11 */ - { 3, 0x2, 1 }, /* 010 */ - { 2, 0x3, 2 }, /* 11 */ - { 2, 0x2, 3 }, /* 10 */ - { 3, 0x3, 4 }, /* 011 */ - { 4, 0x3, 5 }, /* 0011 */ - { 4, 0x2, 6 }, /* 0010 */ - { 5, 0x3, 7 }, /* 0001 1 */ - { 6, 0x5, 8 }, /* 0001 01 */ - { 6, 0x4, 9 }, /* 0001 00 */ - { 7, 0x4, 10 }, /* 0000 100 */ - { 7, 0x5, 11 }, /* 0000 101 */ - { 7, 0x7, 12 }, /* 0000 111 */ - { 8, 0x4, 13 }, /* 0000 0100 */ - { 8, 0x7, 14 }, /* 0000 0111 */ - { 9, 0x18, 15 }, /* 0000 1100 0 */ - { 10, 0x17, 16 }, /* 0000 0101 11 */ - { 10, 0x18, 17 }, /* 0000 0110 00 */ - { 10, 0x8, 18 }, /* 0000 0010 00 */ - { 11, 0x67, 19 }, /* 0000 1100 111 */ - { 11, 0x68, 20 }, /* 0000 1101 000 */ - { 11, 0x6C, 21 }, /* 0000 1101 100 */ - { 11, 0x37, 22 }, /* 0000 0110 111 */ - { 11, 0x28, 23 }, /* 0000 0101 000 */ - { 11, 0x17, 24 }, /* 0000 0010 111 */ - { 11, 0x18, 25 }, /* 0000 0011 000 */ - { 12, 0xCA, 26 }, /* 0000 1100 1010 */ - { 12, 0xCB, 27 }, /* 0000 1100 1011 */ - { 12, 0xCC, 28 }, /* 0000 1100 1100 */ - { 12, 0xCD, 29 }, /* 0000 1100 1101 */ - { 12, 0x68, 30 }, /* 0000 0110 1000 */ - { 12, 0x69, 31 }, /* 0000 0110 1001 */ - { 12, 0x6A, 32 }, /* 0000 0110 1010 */ - { 12, 0x6B, 33 }, /* 0000 0110 1011 */ - { 12, 0xD2, 34 }, /* 0000 1101 0010 */ - { 12, 0xD3, 35 }, /* 0000 1101 0011 */ - { 12, 0xD4, 36 }, /* 0000 1101 0100 */ - { 12, 0xD5, 37 }, /* 0000 1101 0101 */ - { 12, 0xD6, 38 }, /* 0000 1101 0110 */ - { 12, 0xD7, 39 }, /* 0000 1101 0111 */ - { 12, 0x6C, 40 }, /* 0000 0110 1100 */ - { 12, 0x6D, 41 }, /* 0000 0110 1101 */ - { 12, 0xDA, 42 }, /* 0000 1101 1010 */ - { 12, 0xDB, 43 }, /* 0000 1101 1011 */ - { 12, 0x54, 44 }, /* 0000 0101 0100 */ - { 12, 0x55, 45 }, /* 0000 0101 0101 */ - { 12, 0x56, 46 }, /* 0000 0101 0110 */ - { 12, 0x57, 47 }, /* 0000 0101 0111 */ - { 12, 0x64, 48 }, /* 0000 0110 0100 */ - { 12, 0x65, 49 }, /* 0000 0110 0101 */ - { 12, 0x52, 50 }, /* 0000 0101 0010 */ - { 12, 0x53, 51 }, /* 0000 0101 0011 */ - { 12, 0x24, 52 }, /* 0000 0010 0100 */ - { 12, 0x37, 53 }, /* 0000 0011 0111 */ - { 12, 0x38, 54 }, /* 0000 0011 1000 */ - { 12, 0x27, 55 }, /* 0000 0010 0111 */ - { 12, 0x28, 56 }, /* 0000 0010 1000 */ - { 12, 0x58, 57 }, /* 0000 0101 1000 */ - { 12, 0x59, 58 }, /* 0000 0101 1001 */ - { 12, 0x2B, 59 }, /* 0000 0010 1011 */ - { 12, 0x2C, 60 }, /* 0000 0010 1100 */ - { 12, 0x5A, 61 }, /* 0000 0101 1010 */ - { 12, 0x66, 62 }, /* 0000 0110 0110 */ - { 12, 0x67, 63 }, /* 0000 0110 0111 */ - { 10, 0xF, 64 }, /* 0000 0011 11 */ - { 12, 0xC8, 128 }, /* 0000 1100 1000 */ - { 12, 0xC9, 192 }, /* 0000 1100 1001 */ - { 12, 0x5B, 256 }, /* 0000 0101 1011 */ - { 12, 0x33, 320 }, /* 0000 0011 0011 */ - { 12, 0x34, 384 }, /* 0000 0011 0100 */ - { 12, 0x35, 448 }, /* 0000 0011 0101 */ - { 13, 0x6C, 512 }, /* 0000 0011 0110 0 */ - { 13, 0x6D, 576 }, /* 0000 0011 0110 1 */ - { 13, 0x4A, 640 }, /* 0000 0010 0101 0 */ - { 13, 0x4B, 704 }, /* 0000 0010 0101 1 */ - { 13, 0x4C, 768 }, /* 0000 0010 0110 0 */ - { 13, 0x4D, 832 }, /* 0000 0010 0110 1 */ - { 13, 0x72, 896 }, /* 0000 0011 1001 0 */ - { 13, 0x73, 960 }, /* 0000 0011 1001 1 */ - { 13, 0x74, 1024 }, /* 0000 0011 1010 0 */ - { 13, 0x75, 1088 }, /* 0000 0011 1010 1 */ - { 13, 0x76, 1152 }, /* 0000 0011 1011 0 */ - { 13, 0x77, 1216 }, /* 0000 0011 1011 1 */ - { 13, 0x52, 1280 }, /* 0000 0010 1001 0 */ - { 13, 0x53, 1344 }, /* 0000 0010 1001 1 */ - { 13, 0x54, 1408 }, /* 0000 0010 1010 0 */ - { 13, 0x55, 1472 }, /* 0000 0010 1010 1 */ - { 13, 0x5A, 1536 }, /* 0000 0010 1101 0 */ - { 13, 0x5B, 1600 }, /* 0000 0010 1101 1 */ - { 13, 0x64, 1664 }, /* 0000 0011 0010 0 */ - { 13, 0x65, 1728 }, /* 0000 0011 0010 1 */ - { 11, 0x8, 1792 }, /* 0000 0001 000 */ - { 11, 0xC, 1856 }, /* 0000 0001 100 */ - { 11, 0xD, 1920 }, /* 0000 0001 101 */ - { 12, 0x12, 1984 }, /* 0000 0001 0010 */ - { 12, 0x13, 2048 }, /* 0000 0001 0011 */ - { 12, 0x14, 2112 }, /* 0000 0001 0100 */ - { 12, 0x15, 2176 }, /* 0000 0001 0101 */ - { 12, 0x16, 2240 }, /* 0000 0001 0110 */ - { 12, 0x17, 2304 }, /* 0000 0001 0111 */ - { 12, 0x1C, 2368 }, /* 0000 0001 1100 */ - { 12, 0x1D, 2432 }, /* 0000 0001 1101 */ - { 12, 0x1E, 2496 }, /* 0000 0001 1110 */ - { 12, 0x1F, 2560 }, /* 0000 0001 1111 */ - { 12, 0x1, G3CODE_EOL }, /* 0000 0000 0001 */ - { 9, 0x1, G3CODE_INVALID }, /* 0000 0000 1 */ - { 10, 0x1, G3CODE_INVALID }, /* 0000 0000 01 */ - { 11, 0x1, G3CODE_INVALID }, /* 0000 0000 001 */ - { 12, 0x0, G3CODE_INVALID }, /* 0000 0000 0000 */ -}; diff --git a/nx-X11/lib/lbxutil/image/lbxfax.h b/nx-X11/lib/lbxutil/image/lbxfax.h deleted file mode 100644 index beac228b7..000000000 --- a/nx-X11/lib/lbxutil/image/lbxfax.h +++ /dev/null @@ -1,60 +0,0 @@ -/* $Xorg: lbxfax.h,v 1.3 2000/08/17 19:46:41 cpqbld Exp $ */ -/* - * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler - * Copyright (c) 1991, 1992 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the names of - * Sam Leffler and Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Sam Leffler and Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ -/* $XFree86$ */ - -/* - * This header file contains various constants and tables needed - * for FAX G42D compression. - */ - -typedef struct tableentry { - unsigned short length; /* bit length of g3 code */ - unsigned short code; /* g3 code */ - short runlen; /* run length in bits */ -} tableentry; - -#define EOL 0x001 /* EOL code value - 0000 0000 0000 1 */ - -/* status values returned instead of a run length */ - -#define G3CODE_INVALID -1 -#define G3CODE_INCOMP -2 -#define G3CODE_EOL -3 -#define G3CODE_EOF -4 - -#define ROUNDUP8(x) ((x + 7) >> 3) - -#ifdef __DARWIN__ -#ifndef TIFFaxWhiteCodes -#define TIFFFaxWhiteCodes Darwin_X_TIFFFaxWhiteCodes -#define TIFFFaxBlackCodes Darwin_X_TIFFFaxBlackCodes -#endif -#endif -extern tableentry TIFFFaxWhiteCodes[]; -extern tableentry TIFFFaxBlackCodes[]; - -/* misc.c */ -extern int LbxImageFindDiff ( unsigned char *cp, int bs, int be, int color ); -extern void LbxReverseBits ( unsigned char *cp, int n ); diff --git a/nx-X11/lib/lbxutil/image/misc.c b/nx-X11/lib/lbxutil/image/misc.c deleted file mode 100644 index fd228624e..000000000 --- a/nx-X11/lib/lbxutil/image/misc.c +++ /dev/null @@ -1,213 +0,0 @@ -/* $Xorg: misc.c,v 1.3 2000/08/17 19:46:41 cpqbld Exp $ */ -/* - * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler - * Copyright (c) 1991, 1992 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the names of - * Sam Leffler and Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Sam Leffler and Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -/* - * This module contains utilities for image compression used - * by the LBX server and proxy. - */ - -#include "lbxfax.h" - -static unsigned char zeroruns[256] = { - 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, /* 0x00 - 0x0f */ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x10 - 0x1f */ - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x20 - 0x2f */ - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x30 - 0x3f */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x40 - 0x4f */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x50 - 0x5f */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x60 - 0x6f */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x70 - 0x7f */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 - 0x8f */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 - 0x9f */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xa0 - 0xaf */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xb0 - 0xbf */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xc0 - 0xcf */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xd0 - 0xdf */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xe0 - 0xef */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xf0 - 0xff */ -}; - -static unsigned char oneruns[256] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00 - 0x0f */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 - 0x1f */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 - 0x2f */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30 - 0x3f */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 - 0x4f */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 - 0x5f */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x6f */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 - 0x7f */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x80 - 0x8f */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x90 - 0x9f */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xa0 - 0xaf */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xb0 - 0xbf */ - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0xc0 - 0xcf */ - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0xd0 - 0xdf */ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xe0 - 0xef */ - 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 8, /* 0xf0 - 0xff */ -}; - - -static unsigned char BitRevTable[256] = { - 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, - 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, - 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, - 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, - 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, - 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, - 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, - 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, - 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, - 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, - 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, - 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, - 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, - 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, - 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, - 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, - 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, - 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, - 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, - 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, - 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, - 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, - 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, - 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, - 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, - 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, - 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, - 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, - 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, - 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, - 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, - 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff -}; - - -/* - * Find a span of ones or zeros using the supplied table. The byte-aligned - * start of the bit string is supplied along with the start+end bit indices. - * The table gives the number of consecutive ones or zeros starting from the - * msb and is indexed by byte value. - */ - -static int -findspan (unsigned char **bpp, - int bs, int be, - unsigned char *tab) - -{ - unsigned char *bp = *bpp; - int bits = be - bs; - int n, span; - - /* - * Check partial byte on lhs. - */ - - if (bits > 0 && (n = (bs & 7))) - { - span = tab[(*bp << n) & 0xff]; - - if (span > 8 - n) /* table value too generous */ - span = 8 - n; - if (span > bits) /* constrain span to bit range */ - span = bits; - if (n+span < 8) /* doesn't extend to edge of byte */ - goto done; - - bits -= span; - bp++; - } - else - span = 0; - - /* - * Scan full bytes for all 1's or all 0's. - */ - - while (bits >= 8) - { - n = tab[*bp]; - span += n; - bits -= n; - if (n < 8) /* end of run */ - goto done; - bp++; - } - - /* - * Check partial byte on rhs. - */ - - if (bits > 0) - { - n = tab[*bp]; - span += (n > bits ? bits : n); - } - -done: - - *bpp = bp; - return (span); -} - -/* - * Return the offset of the next bit in the range [bs..be] that is different - * from the specified color. The end, be, is returned if no such bit exists. - */ - -int -LbxImageFindDiff (unsigned char *cp, - int bs, int be, int color) - -{ - cp += bs >> 3; /* adjust byte offset */ - return (bs + findspan (&cp, bs, be, color ? oneruns : zeroruns)); -} - - - - -void -LbxReverseBits (unsigned char *cp, - int n) - -{ - for (; n > 8; n -= 8) - { - cp[0] = BitRevTable[cp[0]]; - cp[1] = BitRevTable[cp[1]]; - cp[2] = BitRevTable[cp[2]]; - cp[3] = BitRevTable[cp[3]]; - cp[4] = BitRevTable[cp[4]]; - cp[5] = BitRevTable[cp[5]]; - cp[6] = BitRevTable[cp[6]]; - cp[7] = BitRevTable[cp[7]]; - cp += 8; - } - - while (n-- > 0) - *cp = BitRevTable[*cp], cp++; -} diff --git a/nx-X11/lib/lbxutil/image/mkg3states.c b/nx-X11/lib/lbxutil/image/mkg3states.c deleted file mode 100644 index 0e8fe3613..000000000 --- a/nx-X11/lib/lbxutil/image/mkg3states.c +++ /dev/null @@ -1,761 +0,0 @@ -/* $Xorg: mkg3states.c,v 1.3 2000/08/17 19:46:41 cpqbld Exp $ */ -/* - * Copyright (c) 1991, 1992 Sam Leffler - * Copyright (c) 1991, 1992 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the names of - * Sam Leffler and Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Sam Leffler and Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ -/* $XFree86: xc/lib/lbxutil/image/mkg3states.c,v 1.3 1999/02/01 11:55:49 dawes Exp $ */ - -/* - * Program to construct Group 3 & Group 4 decoding tables. - * - * This code is derived from code by Michael P. Marking. In - * particular, the algorithms to generate the null_mode and - * horiz_mode state tables are his. See the comments below - * for more information. - * - * BEGIN (from the original source) - LEGAL - * Copyright 1989, 1990 Michael P. Marking, Post Office Box 8039, - * Scottsdale, Arizona 85252-8039. All rights reserved. - * - * License is granted by the copyright holder to distribute and use this - * code without payment of royalties or the necessity of notification as - * long as this notice (all the text under "LEGAL") is included. - * - * This program is offered without any warranty of any kind. It includes - * no warranty of merchantability or fitness for any purpose. Testing and - * suitability for any use are the sole responsibility of the user. - * - INFORMATION - * Although there is no support offered with this program, the author will - * endeavor to correct errors. Updates will also be made available from - * time to time. - * - * Contact: Michael P. Marking, Post Office Box 8039, Scottsdale, Arizona - * 85252-8039 USA. Replies are not guaranteed to be swift. Beginning - * July 1990, e-mail may be sent to uunet!ipel!marking. - * - * Also beginning in July 1990, this code will be archived at the - * ipel!phoenix BBS in file g3g4.zoo. The 24-hour telephone number - * for 300/1200/2400 is (602)274-0462. When logging in, specify user - * "public", system "bbs", and password "public". - * - * This code is also available from the C Users Group in volume 317. - * - * END (from the original source) - */ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#ifndef TRUE -#define TRUE 1 -#define FALSE 0 -#endif - -#define WHITE 0 -#define BLACK 1 - -/* - * G3 2D and G4 decoding modes. Note that - * the vertical modes are ordered so that - * (mode - MODE_VERT_V0) gives the vertical - * adjustment for the b1 parameter. - */ -#define MODE_NULL 0 -#define MODE_PASS 1 -#define MODE_HORIZ 2 -#define MODE_VERT_VL3 3 -#define MODE_VERT_VL2 4 -#define MODE_VERT_VL1 5 -#define MODE_VERT_V0 6 -#define MODE_VERT_VR1 7 -#define MODE_VERT_VR2 8 -#define MODE_VERT_VR3 9 -#define MODE_UNCOMP 10 -#define MODE_ERROR 11 -#define MODE_ERROR_1 12 - -unsigned long append_0 ( unsigned long prefix ); -unsigned long append_1 ( unsigned long prefix ); - -unsigned long append_0 (unsigned long prefix) -{ - return (prefix + (1L<<16)); -} - -unsigned long append_1 (unsigned long prefix) -{ - static unsigned short prefix_bit[16] = { - 0x8000, 0x4000, 0x2000, 0x1000, - 0x0800, 0x0400, 0x0200, 0x0100, - 0x0080, 0x0040, 0x0020, 0x0010, - 0x0008, 0x0004, 0x0002, 0x0001 - }; - unsigned char len = (prefix >> 16) & 0xf; - return (append_0(prefix) + prefix_bit[len]); -} - -#define G3CODES -#include "lbxfax.h" -#include "lbxbwcodes.h" - -short search_table ( unsigned long prefix, tableentry *tab, int n ); -short white_run_length ( unsigned long prefix ); -short black_run_length ( unsigned long prefix ); -short horiz_mode_code_black ( short runlen ); -short horiz_mode_code_white ( short runlen ); -void write_define ( FILE *fd, char *name, int value, char *comment ); -void write_preamble ( FILE *fd ); -void extern_table ( FILE *fd, char *name ); -void write_tables ( FILE *fd ); -short find_null_mode_prefix ( long prefix ); -short find_horiz_mode_prefix ( long prefix, int color ); -short find_uncomp_mode_prefix ( long prefix ); -short null_mode_type ( long prefix ); -short uncomp_mode_type ( long prefix ); -void build_null_mode_tables ( void ); -void build_horiz_mode_tables ( void ); -void build_uncomp_mode_tables ( void ); - -short search_table (unsigned long prefix, tableentry *tab, int n) -{ - unsigned short len = (prefix >> 16) & 0xf; - unsigned short code = (prefix & 0xffff) >> (16 - len); - - while (n-- > 0) { - if (tab->length == len && tab->code == code) - return ((short) tab->runlen); - tab++; - } - return (G3CODE_INCOMP); -} - -#define NCODES(a) (sizeof (a) / sizeof (a[0])) -short white_run_length (unsigned long prefix) -{ - return (search_table(prefix, TIFFFaxWhiteCodes, NCODES(TIFFFaxWhiteCodes))); -} - -short black_run_length (unsigned long prefix) -{ - return (search_table(prefix, TIFFFaxBlackCodes, NCODES(TIFFFaxBlackCodes))); -} -#undef NCODES - -#define MAX_NULLPREFIX 200 /* max # of null-mode prefixes */ -typedef unsigned char NullModeTable[MAX_NULLPREFIX][256]; -#define MAX_HORIZPREFIX 250 /* max # of incomplete 1-D prefixes */ -typedef unsigned char HorizModeTable[MAX_HORIZPREFIX][256]; - - /* the bit string corresponding to this row of the decoding table */ -long null_mode_prefix[MAX_NULLPREFIX]; -NullModeTable null_mode; /* MODE_*, indexed by bit and byte */ -NullModeTable null_mode_next_state; /* next row of decoding tables to use */ - /* number of prefixes or rows in the G4 decoding tables */ -short null_mode_prefix_count = 0; - -void write_null_mode_table ( FILE *fd, NullModeTable table, char *name ); -void write_horiz_mode_table ( FILE *fd, HorizModeTable table, char *name ); - -/* - * 2D uncompressed mode codes. Note - * that two groups of codes are arranged - * so that the decoder can caluclate the - * length of the run by subtracting the - * code from a known base value. - */ -#define UNCOMP_INCOMP 0 -/* runs of [0]*1 */ -#define UNCOMP_RUN0 1 -#define UNCOMP_RUN1 2 -#define UNCOMP_RUN2 3 -#define UNCOMP_RUN3 4 -#define UNCOMP_RUN4 5 -#define UNCOMP_RUN5 6 -#define UNCOMP_RUN6 7 -/* runs of [0]* w/ terminating color */ -#define UNCOMP_TRUN0 8 -#define UNCOMP_TRUN1 9 -#define UNCOMP_TRUN2 10 -#define UNCOMP_TRUN3 11 -#define UNCOMP_TRUN4 12 -/* special code for unexpected EOF */ -#define UNCOMP_EOF 13 -/* invalid code encountered */ -#define UNCOMP_INVALID 14 - -long uncomp_mode_prefix[MAX_NULLPREFIX]; -NullModeTable uncomp_mode; -NullModeTable uncomp_mode_next_state; -short uncomp_mode_prefix_count = 0; - -/* - * Decoding action values for horiz_mode. - */ -#define ACT_INCOMP 0 /* incompletely decoded code */ -#define ACT_INVALID 1 /* invalide code */ -#define ACT_WRUNT 2 /* terminating white run code */ -#define ACT_WRUN 65 /* non-terminating white run code */ -#define ACT_BRUNT 106 /* terminating black run code */ -#define ACT_BRUN 169 /* non-terminating black run code */ -#define ACT_EOL 210 /* end-of-line code */ -HorizModeTable horiz_mode; - -short horiz_mode_code_black (short runlen) -{ - return (runlen < 64 ? runlen + ACT_BRUNT : (runlen / 64) + ACT_BRUN); -} - -short horiz_mode_code_white (short runlen) -{ - return (runlen < 64 ? runlen + ACT_WRUNT : (runlen / 64) + ACT_WRUN); -} - -/* - * If the corresponding horiz_mode entry is ACT_INCOMP - * this entry is a row number for decoding the next byte; - * otherwise, it is the bit number with which to continue - * decoding the next codeword. - */ -HorizModeTable horiz_mode_next_state; - /* prefixes corresponding to the rows of the decoding table */ -long horiz_mode_prefix[MAX_HORIZPREFIX]; - /* color of next run, BLACK or WHITE */ -char horiz_mode_color[MAX_HORIZPREFIX]; -short horiz_mode_prefix_count = 0; - -static unsigned char bit_mask[8] = - { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; - - -int verbose = FALSE; -char *storage_class = ""; - -int -main (int argc, char *argv[]) -{ - while (argc > 1 && argv[1][0] == '-') { - if (strcmp(argv[1], "-v") == 0) { - verbose = TRUE; - argc--, argv++; - } else if (strcmp(argv[1], "-c") == 0) { - storage_class = "const "; - argc--, argv++; - } - } - build_null_mode_tables(); /* null mode decoding tables */ - if (verbose) { - fprintf(stderr, "%d null mode prefixes defined\n", - (int) null_mode_prefix_count); - fprintf(stderr, "building uncompressed mode scripts...\n"); - } - build_uncomp_mode_tables(); /* uncompressed mode decoding tables */ - if (verbose) { - fprintf(stderr, "%d uncompressed mode prefixes defined\n", - (int) uncomp_mode_prefix_count); - fprintf(stderr, "building 1D scripts...\n"); - } - build_horiz_mode_tables(); /* 1D decoding tables */ - if (verbose) - fprintf(stderr, "%d incomplete prefixes defined\n", - (int) horiz_mode_prefix_count); - write_tables(stdout); - exit(0); -} - -void write_null_mode_table (fd, table, name) -FILE *fd; -NullModeTable table; -char *name; -{ - int i, j; - char* outersep; - char* sep; - - fprintf(fd, "%sunsigned char\t%s[%d][256] = {", storage_class, - name, (int) null_mode_prefix_count); - outersep = ""; - for (i = 0; i < null_mode_prefix_count; i++) { - fprintf(fd, "%s\n/* prefix %d */ {\n", outersep, i); - sep = " "; - for (j = 0; j < 256; j++) { - fprintf(fd, "%s%2d", sep, (int) table[i][j]); - if (((j+1) % 16) == 0) { - fprintf(fd, ", /* %3d-%3d */\n", j-15, j); - sep = " "; - } else - sep = ","; - } - fprintf(fd, "}"); - outersep = ","; - } - fprintf(fd, "\n};\n"); -} - -void -write_horiz_mode_table (FILE *fd, HorizModeTable table, char *name) -{ - int i, j; - char* outersep; - char* sep; - - fprintf(fd, "%s unsigned char\t%s[%d][256] = {", storage_class, - name, (int) horiz_mode_prefix_count); - outersep = ""; - for (i = 0; i < horiz_mode_prefix_count; i++) { - fprintf(fd, "%s\n/* prefix %d */ {\n", outersep, i); - sep = " "; - for (j = 0; j < 256; j++) { - fprintf(fd, "%s%3d", sep, (int) table[i][j]); - if (((j+1) % 14) == 0) { - fprintf(fd, ", /* %3d-%3d */\n", j-13, j); - sep = " "; - } else - sep = ","; - } - fprintf(fd, "\n}"); - outersep = ","; - } - fprintf(fd, "\n};\n"); -} - -void -write_define(FILE *fd, char *name, int value, char *comment) -{ - fprintf(fd, "#define\t%s\t%d", name, value); - if (comment) - fprintf(fd, "\t/* %s */", comment); - fprintf(fd, "\n"); -} - -void -write_preamble(FILE *fd) -{ - fprintf(fd, "%s\n", -"/* DO NOT EDIT THIS FILE, IT WAS AUTOMATICALLY CREATED BY mkg3state */"); - write_define(fd, "ACT_INCOMP", ACT_INCOMP, "incompletely decoded code"); - write_define(fd, "ACT_INVALID", ACT_INVALID, "invalide code"); - write_define(fd, "ACT_WRUNT", ACT_WRUNT, "terminating white run code"); - write_define(fd, "ACT_WRUN", ACT_WRUN, "non-terminating white run code"); - write_define(fd, "ACT_BRUNT", ACT_BRUNT, "terminating black run code"); - write_define(fd, "ACT_BRUN", ACT_BRUN, "non-terminating black run code"); - write_define(fd, "ACT_EOL", ACT_EOL, "end-of-line code"); - fprintf(fd, "\n"); - fprintf(fd, "/* modes that the decoder can be in */\n"); - write_define(fd, "MODE_NULL", MODE_NULL, NULL); - write_define(fd, "MODE_PASS", MODE_PASS, NULL); - write_define(fd, "MODE_HORIZ", MODE_HORIZ, NULL); - write_define(fd, "MODE_VERT_V0", MODE_VERT_V0, NULL); - write_define(fd, "MODE_VERT_VR1", MODE_VERT_VR1, NULL); - write_define(fd, "MODE_VERT_VR2", MODE_VERT_VR2, NULL); - write_define(fd, "MODE_VERT_VR3", MODE_VERT_VR3, NULL); - write_define(fd, "MODE_VERT_VL1", MODE_VERT_VL1, NULL); - write_define(fd, "MODE_VERT_VL2", MODE_VERT_VL2, NULL); - write_define(fd, "MODE_VERT_VL3", MODE_VERT_VL3, NULL); - write_define(fd, "MODE_UNCOMP", MODE_UNCOMP, NULL); - write_define(fd, "MODE_ERROR", MODE_ERROR, NULL); - write_define(fd, "MODE_ERROR_1", MODE_ERROR_1, NULL); - fprintf(fd, "\n"); - fprintf(fd, "#define\tRUNLENGTH(ix) (TIFFFaxWhiteCodes[ix].runlen)\n"); - fprintf(fd, "\n"); - write_define(fd, "UNCOMP_INCOMP", UNCOMP_INCOMP, NULL); - fprintf(fd, "/* runs of [0]*1 */\n"); - write_define(fd, "UNCOMP_RUN0", UNCOMP_RUN0, NULL); - write_define(fd, "UNCOMP_RUN1", UNCOMP_RUN1, NULL); - write_define(fd, "UNCOMP_RUN2", UNCOMP_RUN2, NULL); - write_define(fd, "UNCOMP_RUN3", UNCOMP_RUN3, NULL); - write_define(fd, "UNCOMP_RUN4", UNCOMP_RUN4, NULL); - write_define(fd, "UNCOMP_RUN5", UNCOMP_RUN5, NULL); - write_define(fd, "UNCOMP_RUN6", UNCOMP_RUN6, NULL); - fprintf(fd, "/* runs of [0]* w/ terminating color */\n"); - write_define(fd, "UNCOMP_TRUN0", UNCOMP_TRUN0, NULL); - write_define(fd, "UNCOMP_TRUN1", UNCOMP_TRUN1, NULL); - write_define(fd, "UNCOMP_TRUN2", UNCOMP_TRUN2, NULL); - write_define(fd, "UNCOMP_TRUN3", UNCOMP_TRUN3, NULL); - write_define(fd, "UNCOMP_TRUN4", UNCOMP_TRUN4, NULL); - fprintf(fd, "/* special code for unexpected EOF */\n"); - write_define(fd, "UNCOMP_EOF", UNCOMP_EOF, NULL); - fprintf(fd, "/* invalid code encountered */\n"); - write_define(fd, "UNCOMP_INVALID", UNCOMP_INVALID, NULL); - fprintf(fd, "/* codes >= terminate uncompress mode */\n"); - fprintf(fd, "#define\tUNCOMP_EXIT UNCOMP_TRUN0\n"); - fprintf(fd, "\n"); -} - -void -extern_table(FILE *fd, char *name) -{ - fprintf(fd, "extern\t%sunsigned char %s[][256];\n", storage_class, name); -} - -void -write_tables(FILE *fd) -{ - write_preamble(fd); - write_null_mode_table(fd, null_mode, "TIFFFax2DMode"); - write_null_mode_table(fd, null_mode_next_state, "TIFFFax2DNextState"); - write_null_mode_table(fd, uncomp_mode, "TIFFFaxUncompAction"); - write_null_mode_table(fd, uncomp_mode_next_state, "TIFFFaxUncompNextState"); - write_horiz_mode_table(fd, horiz_mode, "TIFFFax1DAction"); - write_horiz_mode_table(fd, horiz_mode_next_state, "TIFFFax1DNextState"); -} - -short -find_null_mode_prefix (long prefix) -{ - short j1; - - if (prefix == 0L) - return (0); - for (j1 = 8; j1 < null_mode_prefix_count; j1++) - if (prefix == null_mode_prefix[j1]) - return (j1); - if (null_mode_prefix_count == MAX_NULLPREFIX) { - fprintf(stderr, "ERROR: null mode prefix table overflow\n"); - exit(1); - } - if (verbose) - fprintf(stderr, "adding null mode prefix[%d] 0x%lx\n", - (int) null_mode_prefix_count, prefix); - null_mode_prefix[null_mode_prefix_count++] = prefix; - return (null_mode_prefix_count-1); -} - -short -find_horiz_mode_prefix (long prefix, int color) -{ - short j1; - - for (j1 = 0; j1 < horiz_mode_prefix_count; j1++) - if (prefix == horiz_mode_prefix[j1] && horiz_mode_color[j1] == color) - return (j1); - /* - * It wasn't found, so add it to the tables, but first, is there room? - */ - if (horiz_mode_prefix_count == MAX_HORIZPREFIX) { - fprintf(stderr, "ERROR: 1D prefix table overflow\n"); - exit(1); - } - /* OK, there's room... */ - if (verbose) - fprintf(stderr, "\nhoriz mode prefix %d, color %c = 0x%lx ", - (int) horiz_mode_prefix_count, "WB"[color], prefix); - horiz_mode_prefix[horiz_mode_prefix_count] = prefix; - horiz_mode_color[horiz_mode_prefix_count] = color; - horiz_mode_prefix_count++; - return (horiz_mode_prefix_count - 1); -} - -short -find_uncomp_mode_prefix (long prefix) -{ - short j1; - - if (prefix == 0L) - return (0); - for (j1 = 8; j1 < uncomp_mode_prefix_count; j1++) - if (prefix == uncomp_mode_prefix[j1]) - return (j1); - if (uncomp_mode_prefix_count == MAX_NULLPREFIX) { - fprintf(stderr, "ERROR: uncomp mode prefix table overflow\n"); - exit(1); - } - if (verbose) - fprintf(stderr, "adding uncomp mode prefix[%d] 0x%lx\n", - (int) uncomp_mode_prefix_count, prefix); - uncomp_mode_prefix[uncomp_mode_prefix_count++] = prefix; - return (uncomp_mode_prefix_count-1); -} - -short -null_mode_type (long prefix) -{ - switch (prefix) { - case 0x18000L: return (MODE_VERT_V0); /* 1 */ - case 0x36000L: return (MODE_VERT_VR1); /* 011 */ - case 0x34000L: return (MODE_VERT_VL1); /* 010 */ - case 0x32000L: return (MODE_HORIZ); /* 001 */ - case 0x41000L: return (MODE_PASS); /* 0001 */ - case 0x60C00L: return (MODE_VERT_VR2); /* 0000 11 */ - case 0x60800L: return (MODE_VERT_VL2); /* 0000 10 */ - case 0x70600L: return (MODE_VERT_VR3); /* 0000 011 */ - case 0x70400L: return (MODE_VERT_VL3); /* 0000 010 */ - case 0x80200L: return (MODE_ERROR); /* 0000 0010 */ - case 0x90300L: return (MODE_ERROR); /* 0000 0011 0 */ - case 0xA0380L: return (MODE_ERROR); /* 0000 0011 10 */ - case 0xA03C0L: return (MODE_UNCOMP); /* 0000 0011 11 */ - /* - * Under the assumption that there are no - * errors in the file, then this bit string - * can only be the beginning of an EOL code. - */ - case 0x70000L: return (MODE_ERROR_1); /* 0000 000 */ - } - return (-1); -} - -short -uncomp_mode_type (long prefix) -{ - short code; - short len; - switch (prefix) { - case 0x18000L: return (UNCOMP_RUN1); /* 1 */ - case 0x24000L: return (UNCOMP_RUN2); /* 01 */ - case 0x32000L: return (UNCOMP_RUN3); /* 001 */ - case 0x41000L: return (UNCOMP_RUN4); /* 0001 */ - case 0x50800L: return (UNCOMP_RUN5); /* 0000 1 */ - case 0x60400L: return (UNCOMP_RUN6); /* 0000 01 */ - case 0x70200L: return (UNCOMP_TRUN0); /* 0000 001 */ - case 0x80100L: return (UNCOMP_TRUN1); /* 0000 0001 */ - case 0x90080L: return (UNCOMP_TRUN2); /* 0000 0000 1 */ - case 0xA0040L: return (UNCOMP_TRUN3); /* 0000 0000 01 */ - case 0xB0020L: return (UNCOMP_TRUN4); /* 0000 0000 001 */ - } - code = prefix & 0xffffL; - len = (prefix >> 16) & 0xf; - return ((code || len > 10) ? UNCOMP_INVALID : -1); -} - -#define BASESTATE(b) ((unsigned char) ((b) & 0x7)) - -void -build_null_mode_tables(void) -{ - short prefix; - - /* - * Note: the first eight entries correspond to - * a null prefix and starting bit numbers 0-7. - */ - null_mode_prefix_count = 8; - for (prefix = 0; prefix < null_mode_prefix_count; prefix++) { - short byte; - for (byte = 0; byte < 256; byte++) { - short firstbit; - short bit; - long curprefix; - char found_code = FALSE; - - if (prefix < 8) { - curprefix = 0L; - firstbit = prefix; - } else { - curprefix = null_mode_prefix[prefix]; - firstbit = 0; - } - for (bit = firstbit; bit < 8 && !found_code; bit++) { - short mode; - - if (bit_mask[bit] & byte) - curprefix = append_1(curprefix); - else - curprefix = append_0(curprefix); - switch (mode = null_mode_type(curprefix)) { - case MODE_PASS: - case MODE_HORIZ: - case MODE_VERT_V0: - case MODE_VERT_VR1: - case MODE_VERT_VR2: - case MODE_VERT_VR3: - case MODE_VERT_VL1: - case MODE_VERT_VL2: - case MODE_VERT_VL3: - case MODE_UNCOMP: - case MODE_ERROR: - case MODE_ERROR_1: - /* - * NOTE: if the bit number is 8, then the table - * entry will be zero, which indicates a new byte - * is to be fetched during the decoding process - */ - found_code = TRUE; - null_mode[prefix][byte] = (unsigned char) mode; - null_mode_next_state[prefix][byte] = BASESTATE(bit+1); - break; - } - } - if (!found_code) { - null_mode_next_state[prefix][byte] = (unsigned char) - find_null_mode_prefix(curprefix); - /* - * This indicates to the decoder that - * no valid code has yet been identified. - */ - null_mode[prefix][byte] = MODE_NULL; - } - } - } -} - -void -build_horiz_mode_tables(void) -{ - unsigned short byte; - short prefix; - - /* - * The first 8 are for white, - * the second 8 are for black, - * beginning with bits 0-7. - */ - horiz_mode_prefix_count = 16; - for (prefix = 0; prefix < horiz_mode_prefix_count; prefix++) - for (byte = 0; byte < 256; byte++) { - short bits_digested = 0; - short bit; - short firstbit; - char color; - unsigned long curprefix; - - if (prefix < 8) { - color = WHITE; - curprefix = 0L; - firstbit = prefix; - } else if (prefix < 16) { - color = BLACK; - curprefix = 0L; - firstbit = prefix - 8; - } else { - color = horiz_mode_color[prefix]; - curprefix = horiz_mode_prefix[prefix]; - firstbit = 0; - } - for (bit = firstbit; bit < 8 && !bits_digested; bit++) { - if (bit_mask[bit] & byte) - curprefix = append_1(curprefix); - else - curprefix = append_0(curprefix); - /* - * The following conversion allows for arbitrary strings of - * zeroes to precede the end-of-line code 0000 0000 0001. - * It assumes no errors in the data, and is based on - * the assumption that the code replaced (12 consecutive - * zeroes) can only be "legally" encountered before the - * end-of-line code. This assumption is valid only for - * a Group 3 image; the combination will never occur - * in horizontal mode in a proper Group 4 image. - */ - if (curprefix == 0xC0000L) - curprefix = 0xB0000L; - if (color == WHITE) { - short runlength = white_run_length(curprefix); - - if (runlength == G3CODE_INVALID) { - horiz_mode[prefix][byte] = (unsigned char) ACT_INVALID; - horiz_mode_next_state[prefix][byte] = (unsigned char) bit; - bits_digested = bit + 1; - } else if (runlength == G3CODE_EOL) { /* Group 3 only */ - horiz_mode[prefix][byte] = (unsigned char) ACT_EOL; - horiz_mode_next_state[prefix][byte] = BASESTATE(bit+1); - bits_digested = bit + 1; - } else if (runlength != G3CODE_INCOMP) { - horiz_mode[prefix][byte] = (unsigned char) - horiz_mode_code_white(runlength); - horiz_mode_next_state[prefix][byte] = BASESTATE(bit+1); - bits_digested = bit + 1; - } - } else { /* color == BLACK */ - short runlength = black_run_length(curprefix); - - if (runlength == G3CODE_INVALID) { - horiz_mode[prefix][byte] = (unsigned char) ACT_INVALID; - horiz_mode_next_state[prefix][byte] = (unsigned char) (bit+8); - bits_digested = bit + 1; - } else if (runlength == G3CODE_EOL) { /* Group 3 only */ - horiz_mode[prefix][byte] = (unsigned char) ACT_EOL; - horiz_mode_next_state[prefix][byte] = BASESTATE(bit+1); - bits_digested = bit + 1; - } else if (runlength != G3CODE_INCOMP) { - horiz_mode[prefix][byte] = (unsigned char) - horiz_mode_code_black(runlength); - horiz_mode_next_state[prefix][byte] = BASESTATE(bit+1); - bits_digested = bit + 1; - } - } - } - if (!bits_digested) { /* no codewords after examining byte */ - horiz_mode[prefix][byte] = (unsigned char) ACT_INCOMP; - horiz_mode_next_state[prefix][byte] = (unsigned char) - find_horiz_mode_prefix(curprefix, color); - } - } -} - -void -build_uncomp_mode_tables(void) -{ - short prefix; - - /* - * Note: the first eight entries correspond to - * a null prefix and starting bit numbers 0-7. - */ - uncomp_mode_prefix_count = 8; - for (prefix = 0; prefix < uncomp_mode_prefix_count; prefix++) { - short byte; - for (byte = 0; byte < 256; byte++) { - short firstbit; - short bit; - long curprefix; - char found_code = FALSE; - - if (prefix < 8) { - curprefix = 0L; - firstbit = prefix; - } else { - curprefix = uncomp_mode_prefix[prefix]; - firstbit = 0; - } - for (bit = firstbit; bit < 8 && !found_code; bit++) { - short mode; - - if (bit_mask[bit] & byte) - curprefix = append_1(curprefix); - else - curprefix = append_0(curprefix); - mode = uncomp_mode_type(curprefix); - if (mode != -1) { - /* - * NOTE: if the bit number is 8, then the table - * entry will be zero, which indicates a new byte - * is to be fetched during the decoding process - */ - found_code = TRUE; - uncomp_mode[prefix][byte] = (unsigned char) mode; - uncomp_mode_next_state[prefix][byte] = BASESTATE(bit+1); - break; - } - } - if (!found_code) { - uncomp_mode_next_state[prefix][byte] = (unsigned char) - find_uncomp_mode_prefix(curprefix); - /* - * This indicates to the decoder that - * no valid code has yet been identified. - */ - uncomp_mode[prefix][byte] = UNCOMP_INCOMP; - } - } - } -} diff --git a/nx-X11/lib/lbxutil/lbx_zlib/Imakefile b/nx-X11/lib/lbxutil/lbx_zlib/Imakefile deleted file mode 100644 index ddcecc6fd..000000000 --- a/nx-X11/lib/lbxutil/lbx_zlib/Imakefile +++ /dev/null @@ -1,22 +0,0 @@ -XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:46:41 cpqbld Exp $ -XCOMM $XdotOrg: xc/lib/lbxutil/lbx_zlib/Imakefile,v 1.3 2004/10/10 17:13:11 herrb Exp $ - -#include <Library.tmpl> - -SRCS = lbx_zlib.c lbx_zlib_io.c reqstats.c - -OBJS = lbx_zlib.o lbx_zlib_io.o reqstats.o - -#if !HasZlib -ZLIB_INCLUDES= -I../../zlib -#endif - -INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(SERVERSRC)/include \ - -I../../../include/extensions $(ZLIB_INCLUDES) - -SubdirLibraryRule($(OBJS)) -NormalLibraryObjectRule() -NormalLintTarget($(SRCS)) - -DependTarget() - diff --git a/nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib.c b/nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib.c deleted file mode 100644 index e7105a0c7..000000000 --- a/nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib.c +++ /dev/null @@ -1,543 +0,0 @@ -/* $Xorg: lbx_zlib.c,v 1.6 2001/02/09 02:04:05 xorgcvs Exp $ */ - -/* - -Copyright 1995, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -/* - * Copyright 1988, 1989, 1990, 1994 Network Computing Devices, 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 Network Computing Devices, Inc. not be - * used in advertising or publicity pertaining to distribution of this - * software without specific, written prior permission. - * - * THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC., - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT - * LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK - * COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA, - * OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF - * WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XFree86: xc/lib/lbxutil/lbx_zlib/lbx_zlib.c,v 1.9 2001/08/27 19:01:07 dawes Exp $ */ - -#ifdef WIN32 -#define _WILLWINSOCK_ -#endif -#define _BSD_SOURCE -#include <X11/Xos.h> -#include <X11/Xfuncs.h> -#include <stdio.h> -#include <errno.h> -#include <sys/types.h> -#if !defined(WIN32) && !defined(Lynx) -#include <sys/param.h> -#endif -#include <X11/extensions/lbxbufstr.h> -#include "lbx_zlib.h" -#include <X11/extensions/lbxzlib.h> - -unsigned long stream_out_compressed; -unsigned long stream_out_uncompressed; -unsigned long stream_out_plain; -unsigned long stream_in_compressed; -unsigned long stream_in_uncompressed; -unsigned long stream_in_plain; -#ifdef LBXREQSTATS -unsigned long stream_in_packet_header_bytes = 0; -extern int LbxWhoAmI; -#endif - -struct ZlibInfo { - struct compress_private compress_state; - struct compress_private decompress_state; - int fd; - int compress_off; - ZlibBuffer inbuf; - ZlibBuffer outbuf; - unsigned char header[ZLIB_PACKET_HDRLEN]; - struct iovec iovbuf[2]; -}; - -static int -init_compress(struct compress_private *priv,/* local pointer to private data */ - int level) /* compression level */ -{ - priv->cp_outputcount = 0; - - priv->cp_in_count = 0; /* length of input */ - priv->cp_bytes_out = 0; /* length of compressed output */ - priv->cp_inputbuf = priv->cp_inputbufend = NULL; - priv->cp_packet = NULL; - - priv->stream.zalloc = (alloc_func) 0; - priv->stream.zfree = (free_func) 0; - priv->stream.next_in = NULL; - priv->stream.next_out = NULL; - priv->stream.avail_in = priv->stream.avail_out = 0; - - priv->z_err = deflateInit (&(priv->stream), level); - - return (priv->compress_inited = (priv->z_err == Z_OK) ? 1 : 0); -} - -static int -init_decompress(struct compress_private *priv)/* local pointer to private data */ -{ - priv->cp_outputcount = 0; - - priv->cp_in_count = 0; /* length of input */ - priv->cp_bytes_out = 0; /* length of compressed output */ - priv->cp_inputbuf = priv->cp_inputbufend = NULL; - priv->cp_packet = NULL; - - priv->stream.zalloc = (alloc_func) 0; - priv->stream.zfree = (free_func) 0; - priv->stream.next_in = NULL; - priv->stream.next_out = NULL; - priv->stream.avail_in = priv->stream.avail_out = 0; - - priv->need_flush_decompress = 0; - - priv->z_err = inflateInit (&(priv->stream)); - -#ifdef LBXREQSTATS - priv->req_length = -1; - priv->req_compbytes_read = 0; - priv->req_uncompbytes_read = 0; - priv->x_header_bytes_read = 0; -#endif - - return (priv->decompress_inited = (priv->z_err == Z_OK) ? 1 : 0); -} - - -static void -do_compress (struct compress_private *priv, - int flush) - -{ - priv->stream.next_in = priv->cp_inputbuf; - priv->stream.avail_in = priv->cp_inputbufend - priv->cp_inputbuf; - - priv->stream.next_out = priv->cp_outputbuf; - priv->stream.avail_out = priv->cp_outputbufend - priv->cp_outputbuf; - - priv->z_err = deflate (&(priv->stream), flush); - - priv->cp_inputbuf = priv->stream.next_in; - priv->cp_outputbuf = priv->stream.next_out; -} - - -static void -do_decompress (struct compress_private *priv) - -{ - priv->stream.next_in = priv->cp_inputbuf; - priv->stream.avail_in = priv->cp_inputbufend - priv->cp_inputbuf; - - priv->stream.next_out = priv->cp_outputbuf; - priv->stream.avail_out = priv->cp_outputbufend - priv->cp_outputbuf; - - priv->z_err = inflate (&(priv->stream), Z_PARTIAL_FLUSH); - - priv->need_flush_decompress = (priv->stream.avail_out == 0); - - priv->cp_inputbuf = priv->stream.next_in; - priv->cp_outputbuf = priv->stream.next_out; -} - -static int -GetNewPacket(struct ZlibInfo *comp) -{ - register struct compress_private *priv = &comp->decompress_state; - int len; - int result; - - if (priv->cp_packet) { - /* Free up previous packet in input buffer */ - FreeInput(&comp->inbuf, priv->cp_inputbufend - priv->cp_packet); - priv->cp_packet = NULL; - } - - if ((result = GetInputPtr(comp->fd, - &comp->inbuf, - ZLIB_PACKET_HDRLEN, - &priv->cp_packet)) <= 0) - return result; - len = ZLIB_GET_DATALEN(priv->cp_packet); - if ((result = GetInputPtr(comp->fd, - &comp->inbuf, - len + ZLIB_PACKET_HDRLEN, - &priv->cp_packet)) <= 0) { - priv->cp_packet = NULL; - return result; - } - - return len; -} - -static int -NewPacketAvail(struct ZlibInfo *comp) -{ - register struct compress_private *priv = &comp->decompress_state; - char *pkt; - int len; - - if (priv->cp_packet) { - /* Free up previous packet in input buffer */ - FreeInput(&comp->inbuf, priv->cp_inputbufend - priv->cp_packet); - priv->cp_packet = NULL; - } - - if ((pkt = BYTES_AVAIL(&comp->inbuf, ZLIB_PACKET_HDRLEN))) { - len = ZLIB_GET_DATALEN(pkt); - if (BYTES_AVAIL(&comp->inbuf, len + ZLIB_PACKET_HDRLEN)) - return TRUE; - } - - return FALSE; -} - -static int -PlainWrite(struct ZlibInfo *comp, - unsigned char *buffer, - int buflen) -{ - int retval; - int lenleft = buflen; - - if ((retval = ZlibFlush(comp->fd)) == 0) { - register struct iovec *iov = comp->iovbuf; - while (lenleft) { - int outlen, written; - if ((outlen = iov[1].iov_len)) { - iov[1].iov_base = (caddr_t) buffer; - } - else { - outlen = MIN(lenleft, ZLIB_MAX_DATALEN); - ZLIB_PUT_PKTHDR(comp->header, outlen, FALSE); - iov[0].iov_base = (caddr_t) comp->header; - iov[0].iov_len = ZLIB_PACKET_HDRLEN; - iov[1].iov_base = (caddr_t) buffer; - iov[1].iov_len = outlen; - stream_out_uncompressed += ZLIB_PACKET_HDRLEN; - } - if ((retval = FlushIovBuf(comp->fd, iov)) < 0) - break; - written = outlen - retval; - lenleft -= written; - buffer += written; - stream_out_plain += written; - stream_out_uncompressed += written; - if (retval) - break; - } - if (lenleft == buflen) - return retval; - else - return buflen - lenleft; - } - - else if (retval > 0) { - retval = -1; - errno = EWOULDBLOCK; - } - - return retval; -} - -#define MAX_FDS 256 - -static struct ZlibInfo *per_fd[MAX_FDS]; - -/* - * Initialize ZLIB compressor - */ -void * -ZlibInit(int fd, - int level) /* compression level */ -{ - struct ZlibInfo *comp; - int ret1, ret2; - - if ((comp = (struct ZlibInfo *)Xalloc(sizeof(struct ZlibInfo))) == NULL) - return NULL; - - ret1 = InitZlibBuffer(&comp->inbuf, INBUFFER_SIZE); - ret2 = InitZlibBuffer(&comp->outbuf, OUTBUFFER_SIZE); - if (ret1 < 0 || ret2 < 0) { - ZlibFree(comp); - return NULL; - } - comp->compress_off = FALSE; - comp->iovbuf[1].iov_len = 0; - comp->fd = fd; - - if (!init_compress(&comp->compress_state, level) || - !init_decompress(&comp->decompress_state)) { - ZlibFree(comp); - return NULL; - } - - per_fd[fd] = comp; - -#ifdef LBXREQSTATS - InitLbxReqStats (); -#endif - - return (void *)comp; -} - -void -ZlibFree(struct ZlibInfo *comp) -{ - if (!comp) - return; - per_fd[comp->fd] = 0; - FreeZlibBuffer(&comp->inbuf); - FreeZlibBuffer(&comp->outbuf); - - if (comp->compress_state.compress_inited) - deflateEnd (&(comp->compress_state.stream)); - else if (comp->decompress_state.decompress_inited) - inflateEnd (&(comp->compress_state.stream)); - - Xfree(comp); -} - -int -ZlibFlush(int fd) -{ - struct ZlibInfo *comp = per_fd[fd]; - struct compress_private *priv = &comp->compress_state; - - if (priv->cp_in_count) { - int len; - do_compress (priv, Z_PARTIAL_FLUSH); - len = priv->cp_outputbuf - (priv->cp_packet + ZLIB_PACKET_HDRLEN); - ZLIB_PUT_PKTHDR(priv->cp_packet, len, TRUE); - stream_out_compressed += (len + ZLIB_PACKET_HDRLEN); - - CommitOutBuf(&comp->outbuf, len + ZLIB_PACKET_HDRLEN); - priv->cp_in_count = 0; - } - - return FlushOutBuf(comp->fd, &comp->outbuf); -} - -int -ZlibStuffInput(int fd, - unsigned char *buffer, - int buflen) -{ - struct ZlibInfo *comp = per_fd[fd]; - - if (StuffInput (&comp->inbuf, buffer, buflen) != buflen) - return 0; - return 1; -} - -void -ZlibCompressOn(int fd) -{ - per_fd[fd]->compress_off = FALSE; -} - -void -ZlibCompressOff(int fd) -{ - per_fd[fd]->compress_off = TRUE; -} - -int -ZlibWriteV(int fd, - struct iovec *iov, - int iovcnt) -{ - int i; - int total = 0; - int this_time; - - for (i = 0; i < iovcnt; i++) - { - this_time = ZlibWrite(fd, (unsigned char *)iov[i].iov_base, - iov[i].iov_len); - if (this_time > 0) - total += this_time; - if (this_time != iov[i].iov_len) - { - if (total) - return total; - return this_time; - } - } - return total; -} - -int -ZlibWrite(int fd, - unsigned char *buffer, - int buflen) -{ - struct ZlibInfo *comp = per_fd[fd]; - struct compress_private *priv = &comp->compress_state; - int len; - int lenleft = buflen; - unsigned char *p = buffer; - - if (comp->compress_off) { - return PlainWrite(comp, buffer, buflen); - } - - while (lenleft) { - if (priv->cp_in_count == 0) { - priv->cp_packet = (unsigned char *) ReserveOutBuf(&comp->outbuf, - ZLIB_PACKET_HDRLEN + ZLIB_MAX_OUTLEN); - if (!priv->cp_packet) { - errno = EWOULDBLOCK; - return -1; - } - priv->cp_outputbuf = priv->cp_packet + ZLIB_PACKET_HDRLEN; - priv->cp_outputbufend = priv->cp_outputbuf + ZLIB_MAX_OUTLEN; - } - - len = MIN(ZLIB_MAX_PLAIN - priv->cp_in_count, lenleft); - stream_out_plain += len; - - priv->cp_inputbuf = p; - priv->cp_inputbufend = p + len; - do_compress(priv, Z_NO_FLUSH); - - p += len; - lenleft -= len; - if ((priv->cp_in_count += len) == ZLIB_MAX_PLAIN) { - if (ZlibFlush(fd) < 0) { - if (lenleft == buflen) - return -1; - return buflen - lenleft; - } - } - } - - return buflen; -} - -int -ZlibRead(int fd, - unsigned char *buffer, - int buflen) -{ - struct ZlibInfo *comp = per_fd[fd]; - struct compress_private *priv = &comp->decompress_state; - unsigned char *p = buffer; - int lenleft = buflen; - int len; - int retval = -1; - - /* - * First check if there is any data Zlib decompressed already but - * didn't have output buffer space to store it in. - */ - - if (priv->need_flush_decompress) - { - priv->cp_outputbuf = p; - priv->cp_outputbufend = p + lenleft; - - do_decompress (priv); - - lenleft -= (priv->cp_outputbuf - p); - p = priv->cp_outputbuf; - } - - - /* - * Need to decompress some more data - */ - - priv->cp_outputbuf = p; - priv->cp_outputbufend = p + lenleft; - while (priv->cp_outputbuf != priv->cp_outputbufend) { - if (priv->cp_inputbuf == priv->cp_inputbufend) { - if ((retval = GetNewPacket(comp)) <= 0) - break; - priv->cp_inputbuf = priv->cp_packet + ZLIB_PACKET_HDRLEN; - priv->cp_inputbufend = priv->cp_inputbuf + retval; - if (ZLIB_COMPRESSED(priv->cp_packet)) - stream_in_compressed += (retval + ZLIB_PACKET_HDRLEN); - else - stream_in_uncompressed += (retval + ZLIB_PACKET_HDRLEN); -#ifdef LBXREQSTATS - stream_in_packet_header_bytes += ZLIB_PACKET_HDRLEN; -#endif - } - - if (ZLIB_COMPRESSED(priv->cp_packet)) -#ifdef LBXREQSTATS - if (LbxWhoAmI == 1) /* only support request stats for now */ - do_decompress_with_stats(priv); - else -#endif - do_decompress(priv); - - else { - len = MIN(priv->cp_inputbufend - priv->cp_inputbuf, - priv->cp_outputbufend - priv->cp_outputbuf); - memmove(priv->cp_outputbuf, priv->cp_inputbuf, len); - priv->cp_inputbuf += len; - priv->cp_outputbuf += len; - } - } - - if ((len = priv->cp_outputbuf - buffer) == 0) - return retval; - else { - stream_in_plain += len; - return len; - } -} - -int -ZlibInputAvail(int fd) -{ - struct ZlibInfo *comp = per_fd[fd]; - struct compress_private *priv = &comp->decompress_state; - - return ( - priv->need_flush_decompress || - priv->cp_inputbuf != priv->cp_inputbufend || - NewPacketAvail(comp) > 0); -} diff --git a/nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib.h b/nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib.h deleted file mode 100644 index 68b94f807..000000000 --- a/nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib.h +++ /dev/null @@ -1,136 +0,0 @@ -/* $Xorg: lbx_zlib.h,v 1.4 2001/02/09 02:04:05 xorgcvs Exp $ */ - -/* - -Copyright 1996 The Open Group - -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. - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -/* - * Copyright 1988, 1989, 1990, 1994 Network Computing Devices, 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 Network Computing Devices, Inc. not be - * used in advertising or publicity pertaining to distribution of this - * software without specific, written prior permission. - * - * THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC., - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT - * LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK - * COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA, - * OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF - * WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XFree86: xc/lib/lbxutil/lbx_zlib/lbx_zlib.h,v 1.9 2001/08/27 19:01:07 dawes Exp $ */ - -#include "zlib.h" -#include <X11/Xfuncproto.h> - -struct compress_private { - z_stream stream; - char compress_inited; - char decompress_inited; - int z_err; /* error code for last stream operation */ - unsigned char *cp_inputbuf; - unsigned char *cp_inputbufend; - unsigned char *cp_outputbuf; - unsigned char *cp_outputbufend; - unsigned char *cp_packet; - int cp_outputcount; - long int cp_in_count; /* length of input */ - long int cp_bytes_out; /* length of compressed output */ - int need_flush_decompress; -#ifdef LBXREQSTATS - int x_req_code; - int lbx_req_code; - int x_header_bytes_read; - char x_header_buf[4]; - int req_length; - int req_compbytes_read; - int req_uncompbytes_read; -#endif -}; - -#ifndef MIN -#define MIN(_a, _b) ( ((_a) < (_b)) ? (_a) : (_b)) -#endif - - -/* - * The following is taken from the xtrans code, it would be nice to share it - */ -#if defined(WIN32) || (defined(USG) && !defined(CRAY) && !defined(umips) && !defined(MOTOROLA) && !defined(uniosu) && !defined(__sxg__)) - -struct iovec { - caddr_t iov_base; - int iov_len; -}; - -#else -#ifndef Lynx -#include <sys/uio.h> -#else -#include <uio.h> -#endif -#endif - -#ifdef WIN32 -#define BOOL wBOOL -#undef Status -#define Status wStatus -#include <winsock.h> -#undef Status -#define Status int -#undef BOOL -#define EWOULDBLOCK WSAEWOULDBLOCK -#endif - - -/* lbx_zlib_io.c */ -extern int GetInputPtr ( int fd, ZlibBufferPtr inbuf, int reqlen, - unsigned char **ppkt ); -extern int StuffInput ( ZlibBufferPtr inbuf, unsigned char *pkt, int reqlen ); -extern void FreeInput ( ZlibBufferPtr inbuf, int len ); -extern void CommitOutBuf ( ZlibBufferPtr outbuf, int outlen ); -extern int FlushOutBuf ( int fd, ZlibBufferPtr outbuf ); -extern int FlushIovBuf ( int fd, struct iovec *iovbuf ); - -/* Copied from xc/programs/Xserver/include/xorg/os.h */ -#ifndef _HAVE_XALLOC_DECLS -#define _HAVE_XALLOC_DECLS -#include <X11/Xdefs.h> - -extern pointer Xalloc(unsigned long /*amount*/); -extern pointer Xcalloc(unsigned long /*amount*/); -extern pointer Xrealloc(pointer /*ptr*/, unsigned long /*amount*/); -extern void Xfree(pointer /*ptr*/); -#endif diff --git a/nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib_io.c b/nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib_io.c deleted file mode 100644 index 12b29a310..000000000 --- a/nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib_io.c +++ /dev/null @@ -1,275 +0,0 @@ -/* $Xorg: lbx_zlib_io.c,v 1.3 2000/08/17 19:46:41 cpqbld Exp $ */ - -/* - * Copyright 1993 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 NCD. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. NCD. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD. - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER 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: Dale Tonogai, Network Computing Devices - */ -/* $XFree86: xc/lib/lbxutil/lbx_zlib/lbx_zlib_io.c,v 1.11 2001/01/17 19:43:36 dawes Exp $ */ - -#ifdef WIN32 -#define _WILLWINSOCK_ -#endif -#include <X11/Xos.h> -#include <X11/Xfuncs.h> -#include <errno.h> -#if !defined(WIN32) && !defined(Lynx) -#include <sys/param.h> -#endif -#include <X11/extensions/lbxbufstr.h> -#include "lbx_zlib.h" - -#include <stddef.h> - - -/* - * The following is taken from the xtrans code, almost as is, - * it would be nice to share it... - */ -#if defined(WIN32) || defined(__sxg__) -static int -writev(int fildes, const struct iovec *iov, int iovcnt) -{ - int i, len, total; - char *base; - - ESET(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 = write(fildes, base, len); - if (nbytes < 0 && total == 0) return -1; - if (nbytes <= 0) return total; - ESET(0); - len -= nbytes; - total += nbytes; - base += nbytes; - } - } - return total; -} -#endif - -int -InitZlibBuffer(b, size) - ZlibBufferPtr b; - int size; -{ - if ((b->bufbase = (char *)Xalloc(size)) == NULL) - return -1; - b->bufend = b->bufbase + size; - b->bufptr = b->bufbase; - b->bufcnt = 0; - return 0; -} - -void -FreeZlibBuffer(b) - ZlibBufferPtr b; -{ - if (b->bufbase) { - Xfree(b->bufbase); - b->bufbase = NULL; - } -} - -/* - * Returns: - * 1 if desired amount of data available in input buffer - * 0 if eof - * -1 if error - */ -int -GetInputPtr(fd, inbuf, reqlen, ppkt) - int fd; - ZlibBufferPtr inbuf; - int reqlen; - unsigned char **ppkt; -{ - int readbytes; - int gotbytes; - - if (inbuf->bufcnt == 0) - inbuf->bufptr = inbuf->bufbase; - - if (reqlen <= inbuf->bufcnt) { - *ppkt = (unsigned char *)inbuf->bufptr; - return 1; - } - - if (reqlen > inbuf->bufend - inbuf->bufptr) { - memmove(inbuf->bufbase, inbuf->bufptr, inbuf->bufcnt); - inbuf->bufptr = inbuf->bufbase; - } - readbytes = (inbuf->bufend - inbuf->bufptr) - inbuf->bufcnt; - gotbytes = read(fd, inbuf->bufptr + inbuf->bufcnt, readbytes); - if (gotbytes > 0) { - if (reqlen <= (inbuf->bufcnt += gotbytes)) { - *ppkt = (unsigned char *)inbuf->bufptr; - return 1; - } - } - else - return gotbytes; - - errno = EWOULDBLOCK; - return -1; -} - -/* - * When ZLIB is started, we may well have read some data off of the - * wire somewhere. This sticks those bytes ahead of anything we might - * read in the future - */ - -int -StuffInput(inbuf, pkt, reqlen) - ZlibBufferPtr inbuf; - unsigned char *pkt; - int reqlen; -{ - int readbytes; - char *last; - - last = inbuf->bufptr + inbuf->bufcnt; - if (reqlen > inbuf->bufend - last) - { - memmove(inbuf->bufbase, inbuf->bufptr, inbuf->bufcnt); - inbuf->bufptr = inbuf->bufbase; - last = inbuf->bufptr + inbuf->bufcnt; - } - readbytes = MIN(reqlen, inbuf->bufend - last); - memmove(last, pkt, readbytes); - inbuf->bufcnt += readbytes; - return readbytes; -} - -void -FreeInput(inbuf, len) - ZlibBufferPtr inbuf; - int len; -{ - inbuf->bufptr += len; - if ((inbuf->bufcnt -= len) == 0) - inbuf->bufptr = inbuf->bufbase; -} - -/* - * Reserve outlen bytes in the output buffer. - */ -char * -ReserveOutBuf(outbuf, outlen) - ZlibBufferPtr outbuf; - int outlen; -{ - int left; - - left = (outbuf->bufend - outbuf->bufptr) - outbuf->bufcnt; - if (left < outlen) - return NULL; - else - return outbuf->bufptr + outbuf->bufcnt; -} - -/* - * Commit previously reserved space as real output - */ -void -CommitOutBuf(outbuf, outlen) - ZlibBufferPtr outbuf; - int outlen; -{ - outbuf->bufcnt += outlen; -} - -/* - * Write out as much as possible from the output buffer. - * Returns: >= 0 - amount left in buffer - * < 0 - write error - */ -int -FlushOutBuf(fd, outbuf) - int fd; - ZlibBufferPtr outbuf; -{ - int bytes; - - if (outbuf->bufcnt == 0) - return 0; - bytes = write(fd, outbuf->bufptr, outbuf->bufcnt); - if (bytes > 0) { - outbuf->bufptr += bytes; - if ((outbuf->bufcnt -= bytes) == 0) - outbuf->bufptr = outbuf->bufbase; - return outbuf->bufcnt; - } - else if (bytes == 0) { - errno = EWOULDBLOCK; - bytes = -1; - } - return bytes; -} - -/* - * Write out as much as possible from the iovec array (no more than - * two entries allowed). - * Returns: >= 0 - amount left in iovec[1] - * < 0 - write error - */ -int -FlushIovBuf(fd, iovbuf) - int fd; - struct iovec *iovbuf; -{ - int bytes; - int niov = 2; - struct iovec *iov = iovbuf; - - if (iov[0].iov_len == 0) { - ++iov; - --niov; - } - bytes = writev(fd, iov, niov); - if (bytes > 0) { - int i; - int len; - for (i = 0; i < niov; i++) { - len = MIN(bytes, iov[i].iov_len); - iov[i].iov_len -= len; - /* - * An explicit cast is necessary because silly SGI changed - * iov_base from a caddr_t to a void* in IRIX 6.x, and strictly - * speaking ANSI/ISO C doesn't allow the use of a cast in an - * lvalue, i.e. such as: '((char*)(iov[i].iov_base)) += len;' - */ - iov[i].iov_base = ((char*)(iov[i].iov_base)) + len; - if ((bytes -= len) == 0) - break; - } - return iovbuf[1].iov_len; - } - else if (bytes == 0) { - errno = EWOULDBLOCK; - bytes = -1; - } - return bytes; -} diff --git a/nx-X11/lib/lbxutil/lbx_zlib/reqstats.c b/nx-X11/lib/lbxutil/lbx_zlib/reqstats.c deleted file mode 100644 index 50545b8f6..000000000 --- a/nx-X11/lib/lbxutil/lbx_zlib/reqstats.c +++ /dev/null @@ -1,503 +0,0 @@ -/* $Xorg: reqstats.c,v 1.4 2001/02/09 02:04:05 xorgcvs Exp $ */ - -/* - -Copyright 1996 The Open Group - -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. - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be 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/lbxutil/lbx_zlib/reqstats.c,v 1.5 2001/08/27 19:01:07 dawes Exp $ */ - -#include "reqstats.h" - -#ifdef LBXREQSTATS - -#include <X11/Xfuncs.h> -#include <X11/Xproto.h> -#define _XLBX_SERVER_ -#include "XLbx.h" -#include "lbx_zlib.h" -#include <signal.h> -#include <stdio.h> - -#define LBX_CODE 136 /* XXX - this should not be hardcoded - on todo list */ - -extern unsigned long stream_in_compressed; -extern unsigned long stream_in_plain; -extern unsigned long stream_in_packet_header_bytes; -extern unsigned long stream_in_uncompressed_bytes; - -unsigned long check_sum_in_compressed; -unsigned long check_sum_in_plain; -int unknown_extension_bytes = 0; - -struct ReqStats CoreRequestStats[128]; -struct ReqStats LbxRequestStats[LbxNumberReqs]; - -static void LbxPrintReqStats (int); - -char *X_ReqNames[128] = { - 0, /* 0 */ - "CreateWindow", /* 1 */ - "ChangeWindowAttributes", /* 2 */ - "GetWindowAttributes", /* 3 */ - "DestroyWindow", /* 4 */ - "DestroySubwindows", /* 5 */ - "ChangeSaveSet", /* 6 */ - "ReparentWindow", /* 7 */ - "MapWindow", /* 8 */ - "MapSubwindows", /* 9 */ - "UnmapWindow", /* 10 */ - "UnmapSubwindows", /* 11 */ - "ConfigureWindow", /* 12 */ - "CirculateWindow", /* 13 */ - "GetGeometry", /* 14 */ - "QueryTree", /* 15 */ - "InternAtom", /* 16 */ - "GetAtomName", /* 17 */ - "ChangeProperty", /* 18 */ - "DeleteProperty", /* 19 */ - "GetProperty", /* 20 */ - "ListProperties", /* 21 */ - "SetSelectionOwner", /* 22 */ - "GetSelectionOwner", /* 23 */ - "ConvertSelection", /* 24 */ - "SendEvent", /* 25 */ - "GrabPointer", /* 26 */ - "UngrabPointer", /* 27 */ - "GrabButton", /* 28 */ - "UngrabButton", /* 29 */ - "ChangeActivePointerGrab", /* 30 */ - "GrabKeyboard", /* 31 */ - "UngrabKeyboard", /* 32 */ - "GrabKey", /* 33 */ - "UngrabKey", /* 34 */ - "AllowEvents", /* 35 */ - "GrabServer", /* 36 */ - "UngrabServer", /* 37 */ - "QueryPointer", /* 38 */ - "GetMotionEvents", /* 39 */ - "TranslateCoords", /* 40 */ - "WarpPointer", /* 41 */ - "SetInputFocus", /* 42 */ - "GetInputFocus", /* 43 */ - "QueryKeymap", /* 44 */ - "OpenFont", /* 45 */ - "CloseFont", /* 46 */ - "QueryFont", /* 47 */ - "QueryTextExtents", /* 48 */ - "ListFonts", /* 49 */ - "ListFontsWithInfo", /* 50 */ - "SetFontPath", /* 51 */ - "GetFontPath", /* 52 */ - "CreatePixmap", /* 53 */ - "FreePixmap", /* 54 */ - "CreateGC", /* 55 */ - "ChangeGC", /* 56 */ - "CopyGC", /* 57 */ - "SetDashes", /* 58 */ - "SetClipRectangles", /* 59 */ - "FreeGC", /* 60 */ - "ClearArea", /* 61 */ - "CopyArea", /* 62 */ - "CopyPlane", /* 63 */ - "PolyPoint", /* 64 */ - "PolyLine", /* 65 */ - "PolySegment", /* 66 */ - "PolyRectangle", /* 67 */ - "PolyArc", /* 68 */ - "FillPoly", /* 69 */ - "PolyFillRectangle", /* 70 */ - "PolyFillArc", /* 71 */ - "PutImage", /* 72 */ - "GetImage", /* 73 */ - "PolyText8", /* 74 */ - "PolyText16", /* 75 */ - "ImageText8", /* 76 */ - "ImageText16", /* 77 */ - "CreateColormap", /* 78 */ - "FreeColormap", /* 79 */ - "CopyColormapAndFree", /* 80 */ - "InstallColormap", /* 81 */ - "UninstallColormap", /* 82 */ - "ListInstalledColormaps", /* 83 */ - "AllocColor", /* 84 */ - "AllocNamedColor", /* 85 */ - "AllocColorCells", /* 86 */ - "AllocColorPlanes", /* 87 */ - "FreeColors", /* 88 */ - "StoreColors", /* 89 */ - "StoreNamedColor", /* 90 */ - "QueryColors", /* 91 */ - "LookupColor", /* 92 */ - "CreateCursor", /* 93 */ - "CreateGlyphCursor", /* 94 */ - "FreeCursor", /* 95 */ - "RecolorCursor", /* 96 */ - "QueryBestSize", /* 97 */ - "QueryExtension", /* 98 */ - "ListExtensions", /* 99 */ - "ChangeKeyboardMapping", /* 100 */ - "GetKeyboardMapping", /* 101 */ - "ChangeKeyboardControl", /* 102 */ - "GetKeyboardControl", /* 103 */ - "Bell", /* 104 */ - "ChangePointerControl", /* 105 */ - "GetPointerControl", /* 106 */ - "SetScreenSaver", /* 107 */ - "GetScreenSaver", /* 108 */ - "ChangeHosts", /* 109 */ - "ListHosts", /* 110 */ - "SetAccessControl", /* 111 */ - "SetCloseDownMode", /* 112 */ - "KillClient", /* 113 */ - "RotateProperties", /* 114 */ - "ForceScreenSaver", /* 115 */ - "SetPointerMapping", /* 116 */ - "GetPointerMapping", /* 117 */ - "SetModifierMapping", /* 118 */ - "GetModifierMapping", /* 119 */ - 0, /* 120 */ - 0, /* 121 */ - 0, /* 122 */ - 0, /* 123 */ - 0, /* 124 */ - 0, /* 125 */ - 0, /* 126 */ - "NoOperation" /* 127 */ -}; - - -char *LBX_ReqNames[LbxNumberReqs] = { - - "LbxQueryVersion", /* 0 */ - "LbxStartProxy", /* 1 */ - "LbxStopProxy", /* 2 */ - "LbxSwitch", /* 3 */ - "LbxNewClient", /* 4 */ - "LbxCloseClient", /* 5 */ - "LbxModifySequence", /* 6 */ - "LbxAllowMotion", /* 7 */ - "LbxIncrementPixel", /* 8 */ - "LbxDelta", /* 9 */ - "LbxGetModifierMapping", /* 10 */ - "LbxQueryTag", /* 11 */ - "LbxInvalidateTag", /* 12 */ - "LbxPolyPoint", /* 13 */ - "LbxPolyLine", /* 14 */ - "LbxPolySegment", /* 15 */ - "LbxPolyRectangle", /* 16 */ - "LbxPolyArc", /* 17 */ - "LbxFillPoly", /* 18 */ - "LbxPolyFillRectangle", /* 19 */ - "LbxPolyFillArc", /* 20 */ - "LbxGetKeyboardMapping", /* 21 */ - "LbxQueryFont", /* 22 */ - "LbxChangeProperty", /* 23 */ - "LbxGetProperty", /* 24 */ - "LbxTagData", /* 25 */ - "LbxCopyArea", /* 26 */ - "LbxCopyPlane", /* 27 */ - "LbxPolyText8", /* 28 */ - "LbxPolyText16", /* 29 */ - "LbxImageText8", /* 30 */ - "LbxImageText16", /* 31 */ - "LbxQueryExtension", /* 32 */ - "LbxPutImage", /* 33 */ - "LbxGetImage", /* 34 */ - "LbxBeginLargeRequest", /* 35 */ - "LbxLargeRequestData", /* 36 */ - "LbxEndLargeRequest" /* 37 */ -}; - - - -void -InitLbxReqStats (void) - -{ - bzero (CoreRequestStats, 128 * sizeof (struct ReqStats)); - bzero (LbxRequestStats, LbxNumberReqs * sizeof (struct ReqStats)); - - signal (SIGUSR1, LbxPrintReqStats); -} - - -static void -PrintStatsTable (struct ReqStats *table, - int count, - char **reqNames) - -{ - int i; - - fprintf (stderr, "U = uncompressed bytes\n"); - fprintf (stderr, "C = compressed bytes\n"); - fprintf (stderr, "%%C = percent compression\n"); - fprintf (stderr, "%%T = percent of total bytes in stream\n"); - fprintf (stderr, "\n"); - fprintf (stderr, "%-25s\tCount\tU\tC\t%%C\t\t%%T\n", "Request"); - fprintf (stderr, "-------------------------------------------------------------------------------\n"); - - for (i = 0; i < count; i++) - { - float compRatio, percentTot; - - if (table[i].uncomp_bytes == 0) - compRatio = 0.0; - else - compRatio = 100.0 * (1.0 - ((float) table[i].comp_bytes / - (float) table[i].uncomp_bytes)); - - if (stream_in_compressed - stream_in_packet_header_bytes == 0) - percentTot = 0.0; - else - percentTot = 100.0 * (float) table[i].comp_bytes / - (float) (stream_in_compressed - - stream_in_packet_header_bytes); - - if (reqNames[i]) - fprintf (stderr, "%-25s\t%d\t%d\t%d\t%.3f\t\t%.3f\n", - reqNames[i], - table[i].count, - table[i].uncomp_bytes, - table[i].comp_bytes, - compRatio, - percentTot); - - check_sum_in_plain += table[i].uncomp_bytes; - check_sum_in_compressed += table[i].comp_bytes; - } -} - -static void -PrintDeltaStats (struct ReqStats *table, - int count, - char **reqNames) - -{ - int i; - - for (i = 0; i < count; i++) - { - if (table[i].delta_count && reqNames[i]) - fprintf (stderr, "%-25s\t%d\t%d\t%d\n", - reqNames[i], - table[i].delta_count, - table[i].pre_delta_bytes, - table[i].post_delta_bytes); - } -} - - -static void -LbxPrintReqStats (int dummy) - -{ - unsigned long total; - - check_sum_in_plain = 0; - check_sum_in_compressed = 0; - - fprintf (stderr, "\n\n"); - fprintf (stderr, "Core X requests\n\n"); - PrintStatsTable (CoreRequestStats, 128, X_ReqNames); - - fprintf (stderr, "\n\n"); - fprintf (stderr, "LBX requests\n\n"); - PrintStatsTable (LbxRequestStats, LbxNumberReqs, LBX_ReqNames); - - fprintf (stderr, "\n\n\n"); - - fprintf (stderr, "The following requests were delta compressed:\n"); - fprintf (stderr, "\n"); - fprintf (stderr, "Pre = pre delta bytes\n"); - fprintf (stderr, "Post = post delta bytes\n"); - fprintf (stderr, "\n"); - fprintf (stderr, "%-25s\tCount\tPre\tPost\n", "Request"); - fprintf (stderr, "-------------------------------------------------------------------------------\n"); - PrintDeltaStats (CoreRequestStats, 128, X_ReqNames); - PrintDeltaStats (LbxRequestStats, LbxNumberReqs, LBX_ReqNames); - - fprintf (stderr, "\n\n\n"); - - fprintf (stderr, "overall stream compression = %f %%\n", - (check_sum_in_plain == 0) ? 0.0 : - (100.0 * (1.0 - ((float) check_sum_in_compressed / - (float) check_sum_in_plain)))); - - fprintf (stderr, "\n\n\n"); - - total = check_sum_in_plain + unknown_extension_bytes + - stream_in_uncompressed_bytes; - - if (total == stream_in_plain) - fprintf (stderr, "Internal checksum succeeded!!!\n"); - else - { - fprintf (stderr, "Internal checksum failed!!!\n"); - fprintf (stderr, "actual checksum = %d\n", stream_in_plain); - fprintf (stderr, "computed checksum = %d\n", total); - } - - fprintf (stderr, "\n\n"); -} - - -void -do_decompress_with_stats (struct compress_private *priv) - -{ - int incount = priv->cp_inputbufend - priv->cp_inputbuf; - - priv->stream.next_in = priv->cp_inputbuf; - priv->stream.next_out = priv->cp_outputbuf; - priv->stream.avail_out = priv->cp_outputbufend - priv->cp_outputbuf; - - while (incount > 0) - { - char *save_out = (char *) priv->stream.next_out; - int outcount, outconsumed; - - priv->stream.avail_in = 1; - priv->z_err = inflate (&(priv->stream), Z_NO_FLUSH); - - priv->need_flush_decompress = (priv->stream.avail_out == 0 ); - - priv->req_compbytes_read++; - - outcount = (char *) priv->stream.next_out - save_out; - - priv->req_uncompbytes_read += outcount; - - while (outcount > 0) - { - if (priv->req_length == -1 && priv->x_header_bytes_read < 4) - { - int have = MIN (outcount, (4 - priv->x_header_bytes_read)); - memcpy (priv->x_header_buf + priv->x_header_bytes_read, - save_out, have); - priv->x_header_bytes_read += have; - - if (priv->x_header_bytes_read < 4 && ((outcount - have) == 0)) - break; - } - - if (priv->req_length == -1 && priv->x_header_bytes_read == 4) - { - xReq *req = (xReq *) priv->x_header_buf; - - priv->req_length = req->length << 2; - priv->x_req_code = req->reqType; - - if (priv->x_req_code == LBX_CODE) - priv->lbx_req_code = req->data; - } - - if (priv->req_length != -1) - { - if (priv->req_uncompbytes_read < priv->req_length) - break; - else - { - if (priv->x_req_code == LBX_CODE) - { - struct ReqStats *reqStat = - &LbxRequestStats[priv->lbx_req_code]; - - reqStat->count++; - reqStat->comp_bytes += priv->req_compbytes_read; - reqStat->uncomp_bytes += priv->req_length; - -#ifdef LBXREQLOG - fprintf (stderr, - "LBX opcode = %d, real len = %d, comp len = %d\n", - priv->lbx_req_code, priv->req_length, - priv->req_compbytes_read); -#endif - } - else if (priv->x_req_code < 128) - { - struct ReqStats *reqStat = - &CoreRequestStats[priv->x_req_code]; - - reqStat->count++; - reqStat->comp_bytes += priv->req_compbytes_read; - reqStat->uncomp_bytes += priv->req_length; - -#ifdef LBXREQLOG - fprintf (stderr, - "X opcode = %d, real len = %d, comp len = %d\n", - priv->x_req_code, priv->req_length, - priv->req_compbytes_read); -#endif - } - else - { -#ifdef LBXREQLOG - fprintf (stderr, - "Unknown opcode = %d, real len = %d, comp len = %d\n", - priv->x_req_code, priv->req_length, - priv->req_compbytes_read); -#endif - unknown_extension_bytes += priv->req_length; - } - - priv->req_uncompbytes_read -= priv->req_length; - - if (priv->req_uncompbytes_read > 0) - { - priv->req_compbytes_read = 1; - save_out += (outcount - priv->req_uncompbytes_read); - outcount = priv->req_uncompbytes_read; - } - else - { - priv->req_compbytes_read = 0; - outcount = 0; - } - - priv->req_length = -1; - priv->x_header_bytes_read = 0; - } - } - } - - incount--; - - if (priv->stream.avail_out == 0) - break; - } - - priv->cp_inputbuf = priv->stream.next_in; - priv->cp_outputbuf = priv->stream.next_out; -} - -#else - -void -InitLbxReqStats() -{} - -#endif /* LBXREQSTATS */ diff --git a/nx-X11/lib/lbxutil/lbx_zlib/reqstats.h b/nx-X11/lib/lbxutil/lbx_zlib/reqstats.h deleted file mode 100644 index eab64e94e..000000000 --- a/nx-X11/lib/lbxutil/lbx_zlib/reqstats.h +++ /dev/null @@ -1,43 +0,0 @@ -/* $Xorg: reqstats.h,v 1.4 2001/02/09 02:04:05 xorgcvs Exp $ */ - -/* - -Copyright 1996 The Open Group - -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. - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be 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/lbxutil/lbx_zlib/reqstats.h,v 1.2 2001/08/27 19:01:07 dawes Exp $ */ - -#ifdef LBXREQSTATS -struct ReqStats { - int count; - unsigned long comp_bytes; - unsigned long uncomp_bytes; - int delta_count; - unsigned long pre_delta_bytes; - unsigned long post_delta_bytes; -}; -#endif - -extern void InitLbxReqStats(void); diff --git a/nx-X11/lib/misc/snprintf.c b/nx-X11/lib/misc/snprintf.c deleted file mode 100644 index 6e9e2816f..000000000 --- a/nx-X11/lib/misc/snprintf.c +++ /dev/null @@ -1,714 +0,0 @@ -/* - * This version of snprintf() and vsnprintf() is based on Sprint from - * SIO by Panagiotis Tsirigotis, as included with xidentd-2.2.1. - * - * The modifications were made by The XFree86 Project, Inc and are - * Copyright 1999 by The XFree86 Project, Inc. These modifications - * consist of removing the support for writing to file streams, - * renaming some functions, ansification, and making some adjustments - * to achieve the semantics for snprintf and vsnprintf() as described - * in the relevant man page for FreeBSD 2.2.8. - * - * - * The original version carries the following notice: - * - * (c) Copyright 1992, 1993 by Panagiotis Tsirigotis - * - * The author (Panagiotis Tsirigotis) grants permission to use, copy, - * and distribute this software and its documentation for any purpose - * and without fee, provided that a) the above copyright notice extant in - * files in this distribution is not removed from files included in any - * redistribution, and b) this file is also included in any redistribution. - * - * Modifications to this software may be distributed, either by distributing - * the modified software or by distributing patches to the original software, - * under the following additional terms: - * - * 1. The version number will be modified as follows: - * a. The first 3 components of the version number - * (i.e. <number>.<number>.<number>) will remain unchanged. - * b. A new component will be appended to the version number to indicate - * the modification level. The form of this component is up to the - * author of the modifications. - * - * 2. The author of the modifications will include his/her name by appending - * it along with the new version number to this file and will be - * responsible for any wrong behavior of the modified software. - * - * The author makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without any express - * or implied warranty. - * - * Changes and modifications for: - * - * xinetd Version 2.1.4-bsdi - * xinetd Version 2.1.4-freebsd - * xinetd Version 2.1.4-linux - * - * are - * - * (c) Copyright 1995 by Charles Murcko - * All Rights Reserved - */ - -/* $XFree86$ */ - - -/* - * Assumption: systems that don't have snprintf and vsnprintf do have - * ecvt, fcvt and gcvt. - */ - -/* From: Id: sprint.c,v 1.5 1995/09/10 18:35:09 chuck Exp */ - -#include <ctype.h> -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <sys/types.h> - -#ifndef SCOPE -#define SCOPE /**/ -#endif - -#ifndef WIDE_INT -#define WIDE_INT long -#endif - -typedef WIDE_INT wide_int; -typedef unsigned WIDE_INT u_wide_int; -typedef int bool_int; - -#ifndef FALSE -#define FALSE 0 -#define TRUE 1 -#endif - -#define NUL '\0' - -#define S_NULL "(null)" -#define S_NULL_LEN 6 - -#define FLOAT_DIGITS 6 -#define EXPONENT_LENGTH 10 - -typedef enum { NO = 0, YES = 1 } boolean_e ; - -/* - * NUM_BUF_SIZE is the size of the buffer used for arithmetic conversions - * - * XXX: this is a magic number; do not decrease it - */ -#define NUM_BUF_SIZE 512 - -/* - * The INS_CHAR macro inserts a character in the buffer. - * It uses the char pointers sp and bep: - * sp points to the next available character in the buffer - * bep points to the end-of-buffer - * While using this macro, note that the nextb pointer is NOT updated. - * - * Excess characters are discarded if the string overflows. - * - * NOTE: Evaluation of the c argument should not have any side-effects - */ -#define INS_CHAR( c, sp, bep, cc ) \ - { \ - if ( sp != NULL && sp < bep ) \ - *sp++ = c ; \ - cc++ ; \ - } - -#define NUM( c ) ( c - '0' ) - -#define STR_TO_DEC( str, num ) \ - num = NUM( *str++ ) ; \ - while ( isdigit( *str ) ) { \ - num *= 10 ; \ - num += NUM( *str++ ) ; \ - } - -/* - * This macro does zero padding so that the precision - * requirement is satisfied. The padding is done by - * adding '0's to the left of the string that is going - * to be printed. - */ -#define FIX_PRECISION( adjust, precision, s, s_len ) \ - if ( adjust ) \ - while ( s_len < precision ) { \ - *--s = '0' ; \ - s_len++ ; \ - } - -/* - * Macro that does padding. The padding is done by printing - * the character ch. - */ -#define PAD( width, len, ch ) \ - do { \ - INS_CHAR( ch, sp, bep, cc ) ; \ - width-- ; \ - } while ( width > len ) - -/* - * Prefix the character ch to the string str - * Increase length - * Set the has_prefix flag - */ -#define PREFIX( str, length, ch ) \ - *--str = ch ; length++ ; has_prefix = YES - -static char *conv_10(wide_int num, bool_int is_unsigned, - bool_int * is_negative, char *buf_end, int *len); -SCOPE int vsnprintf(char *str, size_t size, const char *fmt, va_list ap); - -/* - * snprintf is based on SIO's Sprint. - * - * Sprint is the equivalent of printf for SIO. - * It returns the # of chars written - * Assumptions: - * - all floating point arguments are passed as doubles - */ -SCOPE int -snprintf(char *str, size_t size, const char *fmt, ...) -{ - int cc; - va_list ap; - - va_start(ap, fmt); - cc = vsnprintf(str, size, fmt, ap); - va_end(ap); - return cc; -} - -/* - * Convert a floating point number to a string formats 'f', 'e' or 'E'. - * The result is placed in buf, and len denotes the length of the string - * The sign is returned in the is_negative argument (and is not placed - * in buf). Always add decimal point if add_dp is YES. - */ -static char * -conv_fp(char format, double num, boolean_e add_dp, int precision, - bool_int *is_negative, char buf[], int *len) -{ - char *s = buf; - char *p; - int decimal_point; - - if (format == 'f') - p = fcvt(num, precision, &decimal_point, is_negative); - else /* either e or E format */ - p = ecvt(num, precision + 1, &decimal_point, is_negative); - - /* - * Check for Infinity and NaN - */ - if (isalpha(*p)) { - *len = strlen(strcpy(buf, p)); - *is_negative = FALSE; - return (buf); - } - if (format == 'f') - if (decimal_point <= 0) { - *s++ = '0'; - if (precision > 0) { - *s++ = '.'; - while (decimal_point++ < 0) - *s++ = '0'; - } else if (add_dp) - *s++ = '.'; - } else { - while (decimal_point-- > 0) - *s++ = *p++; - if (precision > 0 || add_dp) - *s++ = '.'; - } else { - *s++ = *p++; - if (precision > 0 || add_dp) - *s++ = '.'; - } - - /* - * copy the rest of p, the NUL is NOT copied - */ - while (*p) - *s++ = *p++; - - if (format != 'f') { - char temp[EXPONENT_LENGTH]; /* for exponent conversion */ - int t_len; - bool_int exponent_is_negative; - - *s++ = format; /* either e or E */ - decimal_point--; - if (decimal_point != 0) { - p = conv_10((wide_int) decimal_point, FALSE, &exponent_is_negative, - &temp[EXPONENT_LENGTH], &t_len); - *s++ = exponent_is_negative ? '-' : '+'; - - /* - * Make sure the exponent has at least 2 digits - */ - if (t_len == 1) - *s++ = '0'; - while (t_len--) - *s++ = *p++; - } else { - *s++ = '+'; - *s++ = '0'; - *s++ = '0'; - } - } - *len = s - buf; - return (buf); -} - -/* - * Convert num to a base X number where X is a power of 2. nbits determines X. - * For example, if nbits is 3, we do base 8 conversion - * Return value: - * a pointer to a string containing the number - * - * The caller provides a buffer for the string: that is the buf_end argument - * which is a pointer to the END of the buffer + 1 (i.e. if the buffer - * is declared as buf[ 100 ], buf_end should be &buf[ 100 ]) - */ -static char * -conv_p2(u_wide_int num, int nbits, char format, char *buf_end, int *len) -{ - int mask = (1 << nbits) - 1; - char *p = buf_end; - static char low_digits[] = "0123456789abcdef"; - static char upper_digits[] = "0123456789ABCDEF"; - char *digits = (format == 'X') ? upper_digits : low_digits; - - do { - *--p = digits[num & mask]; - num >>= nbits; - } - while (num); - - *len = buf_end - p; - return (p); -} - -/* - * Convert num to its decimal format. - * Return value: - * - a pointer to a string containing the number (no sign) - * - len contains the length of the string - * - is_negative is set to TRUE or FALSE depending on the sign - * of the number (always set to FALSE if is_unsigned is TRUE) - * - * The caller provides a buffer for the string: that is the buf_end argument - * which is a pointer to the END of the buffer + 1 (i.e. if the buffer - * is declared as buf[ 100 ], buf_end should be &buf[ 100 ]) - */ -static char * -conv_10(wide_int num, bool_int is_unsigned, bool_int *is_negative, - char *buf_end, int *len) -{ - char *p = buf_end; - u_wide_int magnitude; - - if (is_unsigned) { - magnitude = (u_wide_int) num; - *is_negative = FALSE; - } else { - *is_negative = (num < 0); - - /* - * On a 2's complement machine, negating the most negative integer - * results in a number that cannot be represented as a signed integer. - * Here is what we do to obtain the number's magnitude: - * a. add 1 to the number - * b. negate it (becomes positive) - * c. convert it to unsigned - * d. add 1 - */ - if (*is_negative) { - wide_int t = num + 1; - - magnitude = ((u_wide_int) - t) + 1; - } else - magnitude = (u_wide_int) num; - } - - /* - * We use a do-while loop so that we write at least 1 digit - */ - do { - register u_wide_int new_magnitude = magnitude / 10; - - *--p = magnitude - new_magnitude * 10 + '0'; - magnitude = new_magnitude; - } - while (magnitude); - - *len = buf_end - p; - return (p); -} - -/* - * Do format conversion. - */ -SCOPE int -#if (defined(__UNIXWARE__) || defined(__OPENSERVER)) && !defined(__GNUC__) -vsnprintf(char *str, size_t size, const char *fmt, _VA_LIST ap) -#else -vsnprintf(char *str, size_t size, const char *fmt, va_list ap) -#endif -{ - char *sp; - char *bep; - int cc = 0; - int i; - - char *s; - char *q; - int s_len; - - int min_width; - int precision; - enum { - LEFT, RIGHT - } adjust; - char pad_char; - char prefix_char; - - double fp_num; - wide_int i_num; - u_wide_int ui_num; - - char num_buf[NUM_BUF_SIZE]; - char char_buf[2]; /* for printing %% and %<unknown> */ - - /* - * Flag variables - */ - boolean_e is_long; - boolean_e alternate_form; - boolean_e print_sign; - boolean_e print_blank; - boolean_e adjust_precision; - boolean_e adjust_width; - bool_int is_negative; - - if (size == 0 && str != NULL) - return 0; - - sp = str; - bep = str + size - 1; - - while (*fmt) { - if (*fmt != '%') { - INS_CHAR(*fmt, sp, bep, cc); - } else { - /* - * Default variable settings - */ - adjust = RIGHT; - alternate_form = print_sign = print_blank = NO; - pad_char = ' '; - prefix_char = NUL; - - fmt++; - - /* - * Try to avoid checking for flags, width or precision - */ - if (isascii(*fmt) && !islower(*fmt)) { - /* - * Recognize flags: -, #, BLANK, + - */ - for (;; fmt++) { - if (*fmt == '-') - adjust = LEFT; - else if (*fmt == '+') - print_sign = YES; - else if (*fmt == '#') - alternate_form = YES; - else if (*fmt == ' ') - print_blank = YES; - else if (*fmt == '0') - pad_char = '0'; - else - break; - } - - /* - * Check if a width was specified - */ - if (isdigit(*fmt)) { - STR_TO_DEC(fmt, min_width); - adjust_width = YES; - } else if (*fmt == '*') { - min_width = va_arg(ap, int); - - fmt++; - adjust_width = YES; - if (min_width < 0) { - adjust = LEFT; - min_width = -min_width; - } - } else - adjust_width = NO; - - /* - * Check if a precision was specified - * - * XXX: an unreasonable amount of precision may be specified - * resulting in overflow of num_buf. Currently we - * ignore this possibility. - */ - if (*fmt == '.') { - adjust_precision = YES; - fmt++; - if (isdigit(*fmt)) { - STR_TO_DEC(fmt, precision); - } else if (*fmt == '*') { - precision = va_arg(ap, int); - - fmt++; - if (precision < 0) - precision = 0; - } else - precision = 0; - } else - adjust_precision = NO; - } else - adjust_precision = adjust_width = NO; - - /* - * Modifier check - */ - if (*fmt == 'l') { - is_long = YES; - fmt++; - } else - is_long = NO; - - /* - * Argument extraction and printing. - * First we determine the argument type. - * Then, we convert the argument to a string. - * On exit from the switch, s points to the string that - * must be printed, s_len has the length of the string - * The precision requirements, if any, are reflected in s_len. - * - * NOTE: pad_char may be set to '0' because of the 0 flag. - * It is reset to ' ' by non-numeric formats - */ - switch (*fmt) { - case 'd': - case 'i': - case 'u': - if (is_long) - i_num = va_arg(ap, wide_int); - else - i_num = (wide_int) va_arg(ap, int); - - s = conv_10(i_num, (*fmt) == 'u', &is_negative, - &num_buf[NUM_BUF_SIZE], &s_len); - FIX_PRECISION(adjust_precision, precision, s, s_len); - - if (*fmt != 'u') { - if (is_negative) - prefix_char = '-'; - else if (print_sign) - prefix_char = '+'; - else if (print_blank) - prefix_char = ' '; - } - break; - - case 'o': - if (is_long) - ui_num = va_arg(ap, u_wide_int); - else - ui_num = (u_wide_int) va_arg(ap, unsigned int); - - s = conv_p2(ui_num, 3, *fmt, - &num_buf[NUM_BUF_SIZE], &s_len); - FIX_PRECISION(adjust_precision, precision, s, s_len); - if (alternate_form && *s != '0') { - *--s = '0'; - s_len++; - } - break; - - case 'x': - case 'X': - if (is_long) - ui_num = (u_wide_int) va_arg(ap, u_wide_int); - else - ui_num = (u_wide_int) va_arg(ap, unsigned int); - - s = conv_p2(ui_num, 4, *fmt, - &num_buf[NUM_BUF_SIZE], &s_len); - FIX_PRECISION(adjust_precision, precision, s, s_len); - if (alternate_form && i_num != 0) { - *--s = *fmt; /* 'x' or 'X' */ - *--s = '0'; - s_len += 2; - } - break; - - case 's': - s = va_arg(ap, char *); - - if (s != NULL) { - s_len = strlen(s); - if (adjust_precision && precision < s_len) - s_len = precision; - } else { - s = S_NULL; - s_len = S_NULL_LEN; - } - pad_char = ' '; - break; - - case 'f': - case 'e': - case 'E': - fp_num = va_arg(ap, double); - - s = conv_fp(*fmt, fp_num, alternate_form, - (adjust_precision == NO) ? FLOAT_DIGITS : precision, - &is_negative, &num_buf[1], &s_len); - if (is_negative) - prefix_char = '-'; - else if (print_sign) - prefix_char = '+'; - else if (print_blank) - prefix_char = ' '; - break; - - case 'g': - case 'G': - if (adjust_precision == NO) - precision = FLOAT_DIGITS; - else if (precision == 0) - precision = 1; - /* - * We use &num_buf[ 1 ], so that we have room for the sign - */ - s = gcvt(va_arg(ap, double), precision, &num_buf[1]); - - if (*s == '-') - prefix_char = *s++; - else if (print_sign) - prefix_char = '+'; - else if (print_blank) - prefix_char = ' '; - - s_len = strlen(s); - - if (alternate_form && (q = strchr(s, '.')) == NULL) - s[s_len++] = '.'; - if (*fmt == 'G' && (q = strchr(s, 'e')) != NULL) - *q = 'E'; - break; - - case 'c': - char_buf[0] = (char)(va_arg(ap, int)); - - s = &char_buf[0]; - s_len = 1; - pad_char = ' '; - break; - - case '%': - char_buf[0] = '%'; - s = &char_buf[0]; - s_len = 1; - pad_char = ' '; - break; - - case 'n': - *(va_arg(ap, int *)) = cc; - - break; - - /* - * If the pointer size is equal to the size of an unsigned - * integer we convert the pointer to a hex number, otherwise - * we print "%p" to indicate that we don't handle "%p". - */ - case 'p': - ui_num = (u_wide_int) va_arg(ap, void *); - - if (sizeof(void *) <= sizeof(u_wide_int)) - s = conv_p2(ui_num, 4, 'x', - &num_buf[NUM_BUF_SIZE], &s_len); - - else { - s = "%p"; - s_len = 2; - } - pad_char = ' '; - break; - - case NUL: - /* - * The last character of the format string was %. - * We ignore it. - */ - continue; - - /* - * The default case is for unrecognized %'s. - * We print %<char> to help the user identify what - * option is not understood. - * This is also useful in case the user wants to pass - * the output of __sio_converter to another function - * that understands some other %<char> (like syslog). - * Note that we can't point s inside fmt because the - * unknown <char> could be preceded by width etc. - */ - default: - char_buf[0] = '%'; - char_buf[1] = *fmt; - s = char_buf; - s_len = 2; - pad_char = ' '; - break; - } - - if (prefix_char != NUL) { - *--s = prefix_char; - s_len++; - } - if (adjust_width && adjust == RIGHT && min_width > s_len) { - if (pad_char == '0' && prefix_char != NUL) { - INS_CHAR(*s, sp, bep, cc) - s++; - s_len--; - min_width--; - } - PAD(min_width, s_len, pad_char); - } - /* - * Print the string s. - */ - for (i = s_len; i != 0; i--) { - INS_CHAR(*s, sp, bep, cc); - s++; - } - - if (adjust_width && adjust == LEFT && min_width > s_len) - PAD(min_width, s_len, pad_char); - } - fmt++; - } - if (str != NULL) { - if (cc < size) - str[cc] = NUL; - else - str[size - 1] = NUL; - } - return cc; -} - diff --git a/nx-X11/lib/misc/snprintf.h b/nx-X11/lib/misc/snprintf.h deleted file mode 100644 index 481e67679..000000000 --- a/nx-X11/lib/misc/snprintf.h +++ /dev/null @@ -1,35 +0,0 @@ -/* $XFree86: xc/lib/misc/snprintf.h,v 3.1 1996/08/26 14:42:33 dawes Exp $ */ - -#ifndef SNPRINTF_H -#define SNPRINTF_H - -#ifdef HAS_SNPRINTF -#ifdef LIBXT -#define _XtSnprintf snprintf -#define _XtVsnprintf vsnprintf -#endif -#ifdef LIBX11 -#define _XSnprintf snprintf -#define _XVsnprintf vsnprintf -#endif -#else /* !HAS_SNPRINTF */ - -#ifdef LIBXT -#define snprintf _XtSnprintf -#define vsnprintf _XtVsnprintf -#endif -#ifdef LIBX11 -#define snprintf _XSnprintf -#define vsnprintf _XVsnprintf -#endif - -extern int snprintf (char *str, size_t count, const char *fmt, ...); -#if (defined(__UNIXWARE__) || defined(__OPENSERVER)) && !defined(__GNUC__) -extern int vsnprintf (char *str, size_t count, const char *fmt, _VA_LIST arg); -#else -extern int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); -#endif - -#endif /* HAS_SNPRINTF */ - -#endif /* SNPRINTF_H */ diff --git a/nx-X11/lib/psres/Imakefile b/nx-X11/lib/psres/Imakefile deleted file mode 100644 index 158cd116e..000000000 --- a/nx-X11/lib/psres/Imakefile +++ /dev/null @@ -1,34 +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 - -#ifdef SharedPSResReqs -REQUIREDLIBS = SharedPSResReqs -#endif - - 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/nx-X11/lib/psres/PSres.c b/nx-X11/lib/psres/PSres.c deleted file mode 100644 index b7fd4acba..000000000 --- a/nx-X11/lib/psres/PSres.c +++ /dev/null @@ -1,1661 +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 - */ -/* $XFree86: xc/lib/psres/PSres.c,v 1.4tsi Exp $ */ - -#include <stdio.h> -#include <stdlib.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 */ - -/* 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 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 void 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; - - 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/nx-X11/lib/psres/psres-def.cpp b/nx-X11/lib/psres/psres-def.cpp deleted file mode 100644 index 2107d1eab..000000000 --- a/nx-X11/lib/psres/psres-def.cpp +++ /dev/null @@ -1,11 +0,0 @@ -LIBRARY psres -VERSION LIBRARY_VERSION -EXPORTS -;TCheckPSResourceTime -EnumeratePSResourceFiles -InSavedList -ListPSResourceFiles -ListPSResourceTypes -SetPSResourcePolicy - -/* $XFree86$ */ diff --git a/nx-X11/lib/regex/Imakefile b/nx-X11/lib/regex/Imakefile deleted file mode 100644 index 434e8f645..000000000 --- a/nx-X11/lib/regex/Imakefile +++ /dev/null @@ -1,53 +0,0 @@ -XCOMM $XFree86$ - -#define DoNormalLib YES -#define DoSharedLib NO -#define DoExtraLib NO -#define DoDebugLib NO -#define DoProfileLib NO -#define HasSharedData NO -#define LibName regex -#define LibHeaders NO -#define LibInstall NO -#define LibInstallBuild YES - -SRCS = regcomp.c regerror.c regexec.c regfree.c engine.c -OBJS = regcomp.o regerror.o regexec.o regfree.o -IHEADERS = regcomp.ih regerror.ih regexec.ih regfree.ih engine.ih regex.h -HEADERS = regex.h - -DEFINES = -DPOSIX_MISTAKE - -REGEXSOURCEDIR = $(TOP)/extras/regex - -INCLUDES = -I. -I$(REGEXSOURCEDIR) - -#include <Library.tmpl> - -LinkSourceFile(regcomp.c,$(REGEXSOURCEDIR)) -LinkSourceFile(regerror.c,$(REGEXSOURCEDIR)) -LinkSourceFile(regexec.c,$(REGEXSOURCEDIR)) -LinkSourceFile(regfree.c,$(REGEXSOURCEDIR)) -LinkSourceFile(engine.c,$(REGEXSOURCEDIR)) - -.SUFFIXES: .ih .h -.c.ih: - RemoveFile($@) - $(SHELL) $(REGEXSOURCEDIR)/mkh -p $< >$@ - -REGEXHSRC = $(REGEXSOURCEDIR)/regex2.h $(SRCS) -regex.h: $(REGEXHSRC) - RemoveFile(regex.h) - $(SHELL) $(REGEXSOURCEDIR)/mkh -i _REGEX_H_ $(REGEXHSRC) > regex.h - -$(OBJS): $(IHEADERS) - -includes:: $(IHEADERS) - -clean:: - RemoveFiles($(IHEADERS)) - -BuildIncludesTop($(HEADERS)) - -DependTarget() - diff --git a/nx-X11/lib/windows/Imakefile b/nx-X11/lib/windows/Imakefile deleted file mode 100644 index 84e456ba6..000000000 --- a/nx-X11/lib/windows/Imakefile +++ /dev/null @@ -1,34 +0,0 @@ -#define DoNormalLib NormalLibWindowsWM -#define DoSharedLib SharedLibWindowsWM -#define DoDebugLib DebugLibWindowsWM -#define DoProfileLib ProfileLibWindowsWM -#define LibName WindowsWM -#define SoRev SOWINDOWSWMREV -#define IncSubdir X11 -#define IncSubSubdir extensions - -#include <Threads.tmpl> - -#ifdef SharedWindowsWMReqs -REQUIREDLIBS = SharedWindowsWMReqs -#endif - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - - DEFINES = $(ALLOC_DEFINES) - INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) - SRCS = windowswm.c - OBJS = windowswm.o - LINTLIBS = $(LINTXLIB) - -HEADERS = windowswm.h windowswmstr.h - -#include <Library.tmpl> - -MANSUFFIX = $(LIBMANSUFFIX) - -InstallManPage(WindowsWM,$(LIBMANDIR)) - -DependTarget() diff --git a/nx-X11/lib/windows/WindowsWM-def.cpp b/nx-X11/lib/windows/WindowsWM-def.cpp deleted file mode 100755 index e6a9e57a0..000000000 --- a/nx-X11/lib/windows/WindowsWM-def.cpp +++ /dev/null @@ -1,13 +0,0 @@ -LIBRARY windows -VERSION LIBRARY_VERSION -EXPORTS -XWindowsWMQueryExtension -XWindowsWMQueryVersion -XWindowsWMDisableUpdate -XWindowsWMReenableUpdate -XWindowsWMSelectInput -XWindowsWMSetFrontProcess -XWindowsWMFrameGetRect -XWindowsWMFrameHitTest -XWindowsWMFrameDraw -XWindowsWMFrameSetTitle diff --git a/nx-X11/lib/windows/WindowsWM.man b/nx-X11/lib/windows/WindowsWM.man deleted file mode 100644 index 7ca9e3c8f..000000000 --- a/nx-X11/lib/windows/WindowsWM.man +++ /dev/null @@ -1,340 +0,0 @@ -.\" -.\" $XFree86: xc/lib/apple/AppleWM.man,v 1.2 2003/09/16 00:36:08 torrey Exp $ -.\" -.\" Copyright (c) 2002 Apple Computer, Inc. All Rights Reserved. -.\" Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved. -.\" -.\" Permission is hereby granted, free of charge, to any person obtaining a -.\" copy of this software and associated documentation files (the -.\" "Software"), to deal in the Software without restriction, including -.\" without limitation the rights to use, copy, modify, merge, publish, -.\" distribute, sub license, and/or sell copies of the Software, and to -.\" permit persons to whom the Software is furnished to do so, subject to -.\" the following conditions: -.\" -.\" The above copyright notice and this permission notice (including the -.\" next paragraph) shall be included in all copies or substantial portions -.\" of the Software. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -.\" IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -.\" ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -.\" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -.\" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -.\" -.de TQ -.br -.ns -.TP \\$1 -.. -.TH APPLEWM 3 "Version 1.0" "XFree86" - -.SH NAME - AppleWM \- Apple rootless window management extension. -.SH SYNTAX -\&#include <X11/extensions/applewm.h> -.nf -.sp -Bool XAppleWMQueryExtension \^(\^Display *\fIdpy\fP, - int *\fIevent_basep\fP, int *\fIerror_basep\fP\^); -.sp -Status XAppleWMQueryVersion \^(\^Display *\fIdpy\fP, - int *\fImajor_versionp\fP, int *\fIminor_versionp\fP\^); -.sp -Bool XAppleWMDisableUpdate \^(\^Display *\fIdpy\fP, int \fIscreen\fP\^); -.sp -Bool XAppleWMReenableUpdate \^(\^Display *\fIdpy\fP, int \fIscreen\fP\^); -.sp -Bool XAppleWMSelectInput \^(\^Display *\fIdpy\fP, unsigned long \fImask\fP\^); -.sp -Bool XAppleWMSetWindowMenu \^(\^Display *\fIdpy\fP, int \fInitems\fP, - const char **\fIitems\fP\^); -.sp -Bool XAppleWMSetWindowMenuWithShortcuts \^(\^Display *\fIdpy\fP, - int \fInitems\fP, const char **\fIitems\fP, - const char *\fIshortcuts\fP\^); -.sp -Bool XAppleWMSetWindowMenuCheck \^(\^Display *\fIdpy\fP, int \fIindex\fP\^); -.sp -Bool XAppleWMSetFrontProcess \^(\^Display *\fIdpy\fP\^); -.sp -Bool XAppleWMSetWindowLevel \^(\^Display *\fIdpy\fP, Window \fIwindow\fP, - int \fIlevel\fP\^); -.sp -Bool XAppleWMSetCanQuit \^(\^Display *\fIdpy\fP, Bool \fIstate\fP\^); -.sp -Bool XAppleWMFrameGetRect \^(\^Display *\fIdpy\fP, - unsigned int \fIframe_class\fP, - unsigned int \fIframe_rect\fP, - short \fIinner_x\fP, short \fIinner_y\fP, - short \fIinner_w\fP, short \fIinner_h\fP, - short \fIouter_x\fP, short \fIouter_y\fP, - short \fIouter_w\fP, short \fIouter_h\fP, - short *\fIret_x\fP, short *\fIret_y\fP, - short *\fIret_w\fP, short *\fIret_h\fP\^); -.sp -unsigned int XAppleWMFrameHitTest \^(\^Display *\fIdpy\fP, - unsigned int \fIframe_class\fP, - short \fIpoint_x\fP, short \fIpoint_y\fP, - short \fIinner_x\fP, short \fIinner_y\fP, - short \fIinner_w\fP, short \fIinner_h\fP, - short \fIouter_x\fP, short \fIouter_y\fP, - short \fIouter_w\fP, short \fIouter_h\fP\^); -.sp -Bool XAppleWMFrameDraw \^(\^Display *\fIdpy\fP, int \fIscreen\fP, - Window \fIwindow\fP, - unsigned int \fIframe_class\fP, - unsigned int \fIframe_attr\fP, - short \fIinner_x\fP, short \fIinner_y\fP, - short \fIinner_w\fP, short \fIinner_h\fP, - short \fIouter_x\fP, short \fIouter_y\fP, - short \fIouter_w\fP, short \fIouter_h\fP, - unsigned int \fItitle_length\fP, - const unsigned char *\fItitle_bytes\fP); -.fi -.SH ARGUMENTS -.IP \fIdpy\fP 1i -Specifies the connection to the X server. -.IP \fIscreen\fP 1i -Specifies which screen. -.IP \fImask\fP 1i -Mask of event types the client is interested in. -.IP \fIwindow\fP 1i -Specifies which window. -.IP \fIlevel\fP 1i -Specifies the window level. -.IP \fIframe_class\fP 1i -Specifies the class of window frame decoration. -.IP \fIframe_rect\fP 1i -Specifies which rectangle to return from the window frame decoration. -.IP \fIframe_attr\fP 1i -A mask specifying the attributes of the window frame decoration. -.IP \fIinner_x\fP,\fIinner_y\fP,\fIinner_w\fP,\fIinner_h\fP 1i -Rectangle of the window content inside the window frame decoration. -.IP \fIouter_x\fP,\fIouter_y\fP,\fIouter_w\fP,\fIouter_h\fP 1i -Rectangle of the outer border of the window frame decoration. -.IP \fIpoint_x\fP,\fIpoint_y\fP 1i -Specifies the coordinates of the mouse up event. - -.SH DATATYPES - -.PP -.B Events -.nf -typedef struct { - int type; \/* of event *\/ - unsigned long serial; \/* # of last request processed by server *\/ - Bool send_event; \/* true if came from a SendEvent request *\/ - Display *display; \/* Display the event was read from *\/ - Window window; \/* window of event *\/ - Time time; \/* server timestamp when event happened *\/ - int kind; \/* subtype of event *\/ - int arg; -} XAppleWMNotifyEvent; -.fi -.B XAppleWMNotifyEvent -is sent to a client who has requested notification of AppleWM events with -\fBXAppleWMSelectInput\fP. - -.PP -Event types: -.nf -\&#define AppleWMControllerNotify 0 -\&#define AppleWMActivationNotify 1 -\&#define AppleWMPasteboardNotify 2 -.fi -.PP -Event masks: -.nf -\&#define AppleWMControllerNotifyMask (1L << 0) -\&#define AppleWMActivationNotifyMask (1L << 1) -\&#define AppleWMPasteboardNotifyMask (1L << 2) -.fi -.PP -Kinds of ControllerNotify events: -.nf -\&#define AppleWMMinimizeWindow 0 -\&#define AppleWMZoomWindow 1 -\&#define AppleWMCloseWindow 2 -\&#define AppleWMBringAllToFront 3 -\&#define AppleWMHideWindow 4 -\&#define AppleWMHideAll 5 -\&#define AppleWMShowAll 6 -\&#define AppleWMWindowMenuItem 9 -\&#define AppleWMWindowMenuNotify 10 -\&#define AppleWMNextWindow 11 -\&#define AppleWMPreviousWindow 12 -.fi -.PP -Kinds of ActivationNotify events: -.nf -\&#define AppleWMIsActive 0 -\&#define AppleWMIsInactive 1 -.fi -.PP -Kinds of PasteboardNotify events: -.nf -\&#define AppleWMCopyToPasteboard 0 -.sp -.fi -.PP -.B Window Parameters -.PP -Window level ids for \fBXAppleWMSetWindowLevel\fP: -.nf -\&#define AppleWMWindowLevelNormal 0 -\&#define AppleWMWindowLevelFloating 1 -\&#define AppleWMWindowLevelTornOff 2 -\&#define AppleWMWindowLevelDock 3 -\&#define AppleWMWindowLevelDesktop 4 -\&#define AppleWMNumWindowLevels 5 -.fi -.PP -Values for \fIframe_rect\fP argument to \fBXAppleWMFrameGetRect\fP: -.nf -\&#define AppleWMFrameRectTitleBar 1 -\&#define AppleWMFrameRectTracking 2 -\&#define AppleWMFrameRectGrowBox 3 -.fi -.PP -Window frame classes: -.nf -\&#define AppleWMFrameClassDocument 1 << 0 -\&#define AppleWMFrameClassDialog 1 << 1 -\&#define AppleWMFrameClassModalDialog 1 << 2 -\&#define AppleWMFrameClassSystemModalDialog 1 << 3 -\&#define AppleWMFrameClassUtility 1 << 4 -\&#define AppleWMFrameClassToolbar 1 << 5 -\&#define AppleWMFrameClassMenu 1 << 6 -\&#define AppleWMFrameClassSplash 1 << 7 -\&#define AppleWMFrameClassBorderless 1 << 8 -.fi -.PP -Window frame attributes: -.nf -\&#define AppleWMFrameActive 0x0001 -\&#define AppleWMFrameUrgent 0x0002 -\&#define AppleWMFrameTitle 0x0004 -\&#define AppleWMFramePrelight 0x0008 -\&#define AppleWMFrameShaded 0x0010 -\&#define AppleWMFrameCloseBox 0x0100 -\&#define AppleWMFrameCollapseBox 0x0200 -\&#define AppleWMFrameZoomBox 0x0400 -\&#define AppleWMFrameAnyBox 0x0700 -\&#define AppleWMFrameCloseBoxClicked 0x0800 -\&#define AppleWMFrameCollapseBoxClicked 0x1000 -\&#define AppleWMFrameZoomBoxClicked 0x2000 -\&#define AppleWMFrameAnyBoxClicked 0x3800 -\&#define AppleWMFrameGrowBox 0x4000 -.fi - -.SH DESCRIPTION -.B AppleWM -is a simple library designed to interface with the Apple-WM extension. -This extension allows X window managers to better interact with -the Mac OS X Aqua user interface when running X11 in a rootless mode. -.PP -A more complete description will be forthcoming eventually. - -.SH FUNCTIONS -.B XAppleWMDisableUpdate -causes any updates to the windows on the screen to be queued until updates -are reenabled with \fBXAppleWMReenableUpdate\fP. This is useful to avoid -intermediate redraws to the screen if a number of changes are going to be -made at once. Updates should only be disabled temporarily while drawing -to a window. These calls may be nested and each call to -\fBXAppleWMDisableUpdate\fP must be paired with a subsequent call to -\fBXAppleWMReenableUpdate\fP. Updating is not reenabled until the last -unnested call to \fBXAppleWMReenableUpdate\fP. Disabling updates applies -to window content; however, it is implementation dependent whether window -size and position changes are disabled as well. -.PP -.B XAppleWMSelectInput -is used to request that a client receive notification of the -.B AppleWM -events listed above. The event mask specifies the event types the client is -interested in receiving. Passing an event mask of 0 stops notification of -events. -.PP -.B XAppleWMSetWindowMenu -and -.B XAppleWMSetWindowMenuWithShortcuts -set the list of windows displayed in the X server's "Window" menu in the -Aqua menu bar. Other items may be listed in this menu by the X server, but -a part of this menu is set aside for use by the Apple-WM extension. This -is intended to be used to set a list of important top-level X11 windows. -.PP -One item of the X server's "Window" menu can have a checkmark beside it to -indicate it is the active or front most window. -.B XAppleWMSetWindowMenuCheck -can be used to set the item number to put a checkmark beside. -.PP -.B XAppleWMSetFrontProcess -directs the X server to make itself the front most application among all -the other Mac OS X applications. This causes X11 windows to move above -other applications' windows and for the X server to start receiving -keyboard and mouse events. -.PP -Windows can be placed into different Aqua window levels with -\fBXAppleWMSetWindowLevel\fP. The stacking of window levels takes precedence -over the stacking of windows within a level. Thus the bottom window in a level -will obscure even the top most window of a lower window level. By default all -windows are placed in the lowest window level, AppleWMWindowLevelNormal. When -a window is moved to a new level, it is ordered in front of all of its peers -at the new level. \fINote, X11 does not have the concept of window levels and -this function does not change the X11 window order. The result of trying to -reorder an X11 window above another window of higher level is undefined. -This should probably be changed.\fP -.PP -By default, the X server will ask for confirmation whenever the user requests -that it quit from the Aqua UI. -.B XAppleWMSetCanQuit -can be used to change this behavior. If a \fIstate\fP of TRUE is passed, the -X server will quit without confirmation when requested. If FALSE is passed, -the default behavior is used. -.PP -.B XAppleWMFrameDraw -can be used to decorate a top-level window with the standard Aqua window -frame and widgets. The \fIframe_class\fP controls the overall look of the -window frame and \fIframe_attr\fP specifies the details of how the various -UI elements should be drawn. The dimensions of the X11 window content are -passed as the \fIinner_*\fP rectangle and the dimensions of the Aqua window -frame are passed as the \fIouter_*\fP rectangle. -.B XAppleWMFrameGetRect -is used to calculate the size of the outer rectangle from the size of the -window content, which is being reparented. -.PP -.B XAppleWMFrameGetRect -returns a rectangle that encloses an element of the window frame decoration. -The \fIframe_rect\fP argument specifies the element of interest. The -\fIinner_*\fP and \fIouter_*\fP rectangles (as described above) specify the -window geometry. If AppleWMFrameRectTitleBar is passed for \fIframe_rect\fP, -the \fIinner_*\fP parameters are ignored. The returned rectangle has the -dimensions of the \fIouter_*\fP rectangle except that its height is equal -to the constant title bar height for the specified \fIframe_class\fP. The -proper outer rectangle for a given window content size is the union of inner -rectangle and the title bar rectangle. The AppleWMFrameRectTracking and -AppleWMFrameRectGrowBox rectangles are primarily intended to be used by the -window manager to determine the correct placement for child windows to -receive events. The tracking rectangle is the area of the window containing -the close, collapse and zoom boxes. Typically when the cursor is over this -area, the window manager will highlight the close, collapse, and zoom -buttons to conform to the standard Aqua interface. -.PP -If a mouse up or down event is received in the tracking rectangle, -.B XAppleWMFrameHitTest -is used to determine which button was clicked. -.B XAppleWMFrameHitTest -returns AppleWMFrameCloseBox, AppleWMFrameCollapseBox, or AppleWMFrameZoomBox -to indicate which button was clicked. If no button was clicked, 0 will be -returned. -.PP -Other functions include: \fBXAppleWMQueryExtension\fP, which returns the event -and error base codes and \fBXAppleWMQueryVersion\fP, which returns the current -version of the extension. (This information is cached by the library.) - -.SH RESTRICTIONS -.B AppleWM -is only intended to be used on Mac OS X when running a rootless X server. diff --git a/nx-X11/lib/windows/windowswm.c b/nx-X11/lib/windows/windowswm.c deleted file mode 100755 index 5d2a285ff..000000000 --- a/nx-X11/lib/windows/windowswm.c +++ /dev/null @@ -1,386 +0,0 @@ -/* - * WindowsWM extension is based on AppleWM extension - * Authors: Kensuke Matsuzaki - */ -/************************************************************************** - -Copyright (c) 2002 Apple Computer, 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, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* THIS IS NOT AN X CONSORTIUM STANDARD */ - -#define NEED_EVENTS -#define NEED_REPLIES -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <X11/Xlibint.h> -#include <X11/extensions/windowswmstr.h> -#include <X11/extensions/Xext.h> -#include <X11/extensions/extutil.h> -#include <stdio.h> - -static XExtensionInfo _windowswm_info_data; -static XExtensionInfo *windowswm_info = &_windowswm_info_data; -static char *windowswm_extension_name = WINDOWSWMNAME; - -#define WindowsWMCheckExtension(dpy,i,val) \ - XextCheckExtension (dpy, i, windowswm_extension_name, val) - -/***************************************************************************** - * * - * private utility routines * - * * - *****************************************************************************/ - -static int close_display (Display *dpy, XExtCodes *extCodes); -static Bool wire_to_event (); -static Status event_to_wire (); - -static /* const */ XExtensionHooks windowswm_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, windowswm_info, - windowswm_extension_name, - &windowswm_extension_hooks, - WindowsWMNumberEvents, NULL); - -static XEXT_GENERATE_CLOSE_DISPLAY (close_display, windowswm_info); - -static Bool -wire_to_event (Display *dpy, XEvent *re, xEvent *event) -{ - XExtDisplayInfo *info = find_display (dpy); - XWindowsWMNotifyEvent *se; - xWindowsWMNotifyEvent *sevent; - - WindowsWMCheckExtension (dpy, info, False); - - switch ((event->u.u.type & 0x7f) - info->codes->first_event) - { - case WindowsWMControllerNotify: - case WindowsWMActivationNotify: - se = (XWindowsWMNotifyEvent *) re; - sevent = (xWindowsWMNotifyEvent *) 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->time = sevent->time; - se->kind = sevent->kind; - se->arg = sevent->arg; - se->x = sevent->x; - se->y = sevent->y; - se->w = sevent->w; - se->h = sevent->h; - return True; - } - return False; -} - -static Status -event_to_wire (Display *dpy, XEvent *re, xEvent *event) -{ - XExtDisplayInfo *info = find_display (dpy); - XWindowsWMNotifyEvent *se; - xWindowsWMNotifyEvent *sevent; - - WindowsWMCheckExtension (dpy, info, False); - - switch ((re->type & 0x7f) - info->codes->first_event) - { - case WindowsWMControllerNotify: - case WindowsWMActivationNotify: - se = (XWindowsWMNotifyEvent *) re; - sevent = (xWindowsWMNotifyEvent *) event; - sevent->type = se->type | (se->send_event ? 0x80 : 0); - sevent->sequenceNumber = se->serial & 0xffff; - sevent->window = se->window; - sevent->kind = se->kind; - sevent->arg = se->arg; - sevent->time = se->time; - sevent->x = se->x; - sevent->y = se->y; - sevent->w = se->w; - sevent->h = se->h; - return 1; - } - return 0; -} - -/***************************************************************************** - * * - * public Windows-WM Extension routines * - * * - *****************************************************************************/ - -#if 0 -#include <stdio.h> -#define TRACE(msg) fprintf(stderr, "WindowsWM%s\n", msg); -#else -#define TRACE(msg) -#endif - - -Bool -XWindowsWMQueryExtension (Display *dpy, - int *event_basep, int *error_basep) -{ - XExtDisplayInfo *info = find_display (dpy); - - TRACE("QueryExtension..."); - if (XextHasExtension(info)) - { - *event_basep = info->codes->first_event; - *error_basep = info->codes->first_error; - TRACE("QueryExtension... return True"); - return True; - } - else - { - TRACE("QueryExtension... return False"); - return False; - } -} - -Bool -XWindowsWMQueryVersion (Display* dpy, int* majorVersion, - int* minorVersion, int* patchVersion) -{ - XExtDisplayInfo *info = find_display (dpy); - xWindowsWMQueryVersionReply rep; - xWindowsWMQueryVersionReq *req; - - TRACE("QueryVersion..."); - WindowsWMCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(WindowsWMQueryVersion, req); - req->reqType = info->codes->major_opcode; - req->wmReqType = X_WindowsWMQueryVersion; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) - { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("QueryVersion... return False"); - return False; - } - *majorVersion = rep.majorVersion; - *minorVersion = rep.minorVersion; - *patchVersion = rep.patchVersion; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("QueryVersion... return True"); - return True; -} - -Bool -XWindowsWMDisableUpdate (Display* dpy, int screen) -{ - XExtDisplayInfo *info = find_display (dpy); - xWindowsWMDisableUpdateReq *req; - - TRACE("DisableUpdate..."); - WindowsWMCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(WindowsWMDisableUpdate, req); - req->reqType = info->codes->major_opcode; - req->wmReqType = X_WindowsWMDisableUpdate; - req->screen = screen; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("DisableUpdate... return True"); - return True; -} - -Bool -XWindowsWMReenableUpdate (Display* dpy, int screen) -{ - XExtDisplayInfo *info = find_display (dpy); - xWindowsWMReenableUpdateReq *req; - - TRACE("ReenableUpdate..."); - WindowsWMCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(WindowsWMReenableUpdate, req); - req->reqType = info->codes->major_opcode; - req->wmReqType = X_WindowsWMReenableUpdate; - req->screen = screen; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("ReenableUpdate... return True"); - return True; -} - -Bool -XWindowsWMSelectInput (Display* dpy, unsigned long mask) -{ - XExtDisplayInfo *info = find_display (dpy); - xWindowsWMSelectInputReq *req; - - TRACE("SelectInput..."); - WindowsWMCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(WindowsWMSelectInput, req); - req->reqType = info->codes->major_opcode; - req->wmReqType = X_WindowsWMSelectInput; - req->mask = mask; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("SetlectInput... return True"); - return True; -} - - -Bool -XWindowsWMSetFrontProcess (Display* dpy) -{ - XExtDisplayInfo *info = find_display (dpy); - xWindowsWMSetFrontProcessReq *req; - - TRACE("SetFrontProcess..."); - WindowsWMCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(WindowsWMSetFrontProcess, req); - req->reqType = info->codes->major_opcode; - req->wmReqType = X_WindowsWMSetFrontProcess; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("SetFrontProcess... return True"); - return True; -} - -Bool -XWindowsWMFrameGetRect (Display* dpy, unsigned int frame_style, - unsigned int frame_style_ex, unsigned int frame_rect, - short ix, short iy, short iw, short ih, - short *rx, short *ry, short *rw, short *rh) -{ - XExtDisplayInfo *info = find_display (dpy); - xWindowsWMFrameGetRectReply rep; - xWindowsWMFrameGetRectReq *req; - - TRACE("FrameGetRect..."); - WindowsWMCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(WindowsWMFrameGetRect, req); - req->reqType = info->codes->major_opcode; - req->wmReqType = X_WindowsWMFrameGetRect; - req->frame_style = frame_style; - req->frame_style_ex = frame_style_ex; - req->frame_rect = frame_rect; - req->ix = ix; - req->iy = iy; - req->iw = iw; - req->ih = ih; - rep.x = rep.y = rep.w = rep.h = 0; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) - { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("FrameGetRect... return False"); - return False; - } - *rx = rep.x; *ry = rep.y; - *rw = rep.w; *rh = rep.h; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("FrameGetRect... return True"); - return True; -} - -Bool -XWindowsWMFrameDraw (Display* dpy, int screen, Window window, - unsigned int frame_style, unsigned int frame_style_ex, - short ix, short iy, short iw, short ih) -{ - XExtDisplayInfo *info = find_display (dpy); - xWindowsWMFrameDrawReq *req; - - TRACE("FrameDraw..."); - WindowsWMCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(WindowsWMFrameDraw, req); - req->reqType = info->codes->major_opcode; - req->wmReqType = X_WindowsWMFrameDraw; - req->screen = screen; - req->window = window; - req->frame_style = frame_style; - req->frame_style_ex = frame_style_ex; - req->ix = ix; - req->iy = iy; - req->iw = iw; - req->ih = ih; - - UnlockDisplay(dpy); - SyncHandle(); - TRACE("FrameDraw... return True"); - return True; -} - -Bool -XWindowsWMFrameSetTitle (Display* dpy, int screen, Window window, - unsigned int title_length, const char *title_bytes) -{ - XExtDisplayInfo *info = find_display (dpy); - xWindowsWMFrameSetTitleReq *req; - - TRACE("FrameSetTitle..."); - WindowsWMCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(WindowsWMFrameSetTitle, req); - req->reqType = info->codes->major_opcode; - req->wmReqType = X_WindowsWMFrameSetTitle; - req->screen = screen; - req->window = window; - req->title_length = title_length; - - req->length += (title_length + 3)>>2; - Data (dpy, title_bytes, title_length); - - UnlockDisplay(dpy); - SyncHandle(); - TRACE("FrameSetTitle... return True"); - return True; -} diff --git a/nx-X11/lib/windows/windowswm.h b/nx-X11/lib/windows/windowswm.h deleted file mode 100755 index 2c3379f6e..000000000 --- a/nx-X11/lib/windows/windowswm.h +++ /dev/null @@ -1,195 +0,0 @@ -/* - * WindowsWM extension is based on AppleWM extension - * Authors: Kensuke Matsuzaki - */ -/************************************************************************** - -Copyright (c) 2002 Apple Computer, 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, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -#ifndef _WINDOWSWM_H_ -#define _WINDOWSWM_H_ - -#include <X11/Xfuncproto.h> - -#define X_WindowsWMQueryVersion 0 -#define X_WindowsWMFrameGetRect 1 -#define X_WindowsWMFrameDraw 2 -#define X_WindowsWMFrameSetTitle 3 -#define X_WindowsWMDisableUpdate 4 -#define X_WindowsWMReenableUpdate 5 -#define X_WindowsWMSelectInput 6 -#define X_WindowsWMSetFrontProcess 7 - -/* Events */ -#define WindowsWMControllerNotify 0 -#define WindowsWMActivationNotify 1 -#define WindowsWMNumberEvents 2 - -#define WindowsWMControllerNotifyMask (1L << 0) -#define WindowsWMActivationNotifyMask (1L << 1) - -/* "Kinds" of ControllerNotify events */ -#define WindowsWMMinimizeWindow 0 -#define WindowsWMMaximizeWindow 1 -#define WindowsWMRestoreWindow 2 -#define WindowsWMCloseWindow 3 -#define WindowsWMBringAllToFront 4 -#define WindowsWMHideWindow 5 -#define WindowsWMMoveWindow 6 -#define WindowsWMResizeWindow 7 -#define WindowsWMActivateWindow 8 - -/* "Kinds" of ActivationNotify events */ -#define WindowsWMIsActive 0 -#define WindowsWMIsInactive 1 - -/* Errors */ -#define WindowsWMClientNotLocal 0 -#define WindowsWMOperationNotSupported 1 -#define WindowsWMNumberErrors (WindowsWMOperationNotSupported + 1) - -/* Possible value for frame_rect argument to XWindowsWMFrameGetRect() */ -#define WindowsWMFrameRectTitleBar 1 -#define WindowsWMFrameRectTracking 2 -#define WindowsWMFrameRectGrowBox 3 - -/* Window frame styles */ -#define WindowsWMFrameStyleBorder 0x800000 -#define WindowsWMFrameStyleCaption 0xc00000 -#define WindowsWMFrameStyleChild 0x40000000 -#define WindowsWMFrameStyleChildWindow 0x40000000 -#define WindowsWMFrameStyleClipChildren 0x2000000 -#define WindowsWMFrameStyleClipSiblings 0x4000000 -#define WindowsWMFrameStyleDisabled 0x8000000 -#define WindowsWMFrameStyleDlgFrame 0x400000 -#define WindowsWMFrameStyleGroup 0x20000 -#define WindowsWMFrameStyleHScroll 0x100000 -#define WindowsWMFrameStyleIconic 0x20000000 -#define WindowsWMFrameStyleMaximize 0x1000000 -#define WindowsWMFrameStyleMaximizeBox 0x10000 -#define WindowsWMFrameStyleMinimize 0x20000000 -#define WindowsWMFrameStyleMinimizeBox 0x20000 -#define WindowsWMFrameStyleOverlapped 0 -#define WindowsWMFrameStyleOverlappedWindow 0xcf0000 -#define WindowsWMFrameStylePopup 0x80000000 -#define WindowsWMFrameStylePopupWindow 0x80880000 -#define WindowsWMFrameStyleSizeBox 0x40000 -#define WindowsWMFrameStyleSysMenu 0x80000 -#define WindowsWMFrameStyleTabStop 0x10000 -#define WindowsWMFrameStyleThickFrame 0x40000 -#define WindowsWMFrameStyleTiled 0 -#define WindowsWMFrameStyleTiledWindow 0xcf0000 -#define WindowsWMFrameStyleVisible 0x10000000 -#define WindowsWMFrameStyleVScroll 0x200000 - -/* Window frame Ex-styles */ -#define WindowsWMFrameStyleExAcceptFiles 16 -#define WindowsWMFrameStyleExAppWindow 0x40000 -#define WindowsWMFrameStyleExClientEdge 512 -#define WindowsWMFrameStyleExComposited 0x2000000 -#define WindowsWMFrameStyleExContextHelp 0x400 -#define WindowsWMFrameStyleExControlParent 0x10000 -#define WindowsWMFrameStyleExDlgModalFrame 1 -#define WindowsWMFrameStyleExLayered 0x80000 -#define WindowsWMFrameStyleExLayoutRtl 0x400000 -#define WindowsWMFrameStyleExLeft 0 -#define WindowsWMFrameStyleExLeftScrollBar 0x4000 -#define WindowsWMFrameStyleExLtrReading 0 -#define WindowsWMFrameStyleExMDIChild 64 -#define WindowsWMFrameStyleExNoActivate 0x8000000 -#define WindowsWMFrameStyleExNoInheritLayout 0x100000 -#define WindowsWMFrameStyleExNoParentNotify 4 -#define WindowsWMFrameStyleExOverlappedWindow 0x300 -#define WindowsWMFrameStyleExPaletteWindow 0x188 -#define WindowsWMFrameStyleExRight 0x1000 -#define WindowsWMFrameStyleExRightScrollBar 0 -#define WindowsWMFrameStyleExRtlReading 0x2000 -#define WindowsWMFrameStyleExStaticEdge 0x20000 -#define WindowsWMFrameStyleExToolWindow 128 -#define WindowsWMFrameStyleExTopMost 8 -#define WindowsWMFrameStyleExTransparent 32 -#define WindowsWMFrameStyleExWindowEdge 256 - -#define WINDOWSWM_RAISE_ON_CLICK "_WINDOWSWM_RAISE_ON_CLICK" -#define WINDOWSWM_MOUSE_ACTIVATE "_WINDOWSWM_MOUSE_ACTIVATE" -#define WINDOWSWM_CLIENT_WINDOW "_WINDOWSWM_CLIENT_WINDOW" -#define WINDOWSWM_NATIVE_HWND "_WINDOWSWM_NATIVE_HWND" - -#ifndef _WINDOWSWM_SERVER_ - -typedef struct { - int type; /* of event */ - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came frome a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; /* window of event */ - Time time; /* server timestamp when event happened */ - int kind; /* subtype of event */ - int arg; - int x; - int y; - int w; - int h; -} XWindowsWMNotifyEvent; - -_XFUNCPROTOBEGIN - -Bool XWindowsWMQueryExtension (Display *dpy, int *event_base, int *error_base); - -Bool XWindowsWMQueryVersion (Display *dpy, int *majorVersion, - int *minorVersion, int *patchVersion); - -Bool XWindowsWMDisableUpdate (Display *dpy, int screen); - -Bool XWindowsWMReenableUpdate (Display *dpy, int screen); - -Bool XWindowsWMSelectInput (Display *dpy, unsigned long mask); - -Bool XWindowsWMSetFrontProcess (Display *dpy); - -Bool XWindowsWMFrameGetRect (Display *dpy, - unsigned int frame_style, - unsigned int frame_style_ex, - unsigned int frame_rect, - short inner_x, short inner_y, - short inner_w, short inner_h, - short *ret_x, short *ret_y, - short *ret_w, short *ret_h); - -Bool XWindowsWMFrameDraw (Display *dpy, int screen, Window window, - unsigned int frame_style, - unsigned int frame_style_ex, - short inner_x, short inner_y, - short inner_w, short inner_h); - -Bool XWindowsWMFrameSetTitle (Display *dpy, int screen, Window window, - unsigned int title_length, - const char * title_bytes); - -_XFUNCPROTOEND - -#endif /* _WINDOWSWM_SERVER_ */ -#endif /* _WINDOWSWM_H_ */ diff --git a/nx-X11/lib/windows/windowswmstr.h b/nx-X11/lib/windows/windowswmstr.h deleted file mode 100755 index 37ceb535a..000000000 --- a/nx-X11/lib/windows/windowswmstr.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - * WindowsWM extension is based on AppleWM extension - * Authors: Kensuke Matsuzaki - */ -/************************************************************************** - -Copyright (c) 2002 Apple Computer, 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, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -#ifndef _WINDOWSWMSTR_H_ -#define _WINDOWSWMSTR_H_ - -#include <X11/extensions/windowswm.h> -#include <X11/X.h> -#include <X11/Xmd.h> - -#define WINDOWSWMNAME "Windows-WM" - -#define WINDOWS_WM_MAJOR_VERSION 1 /* current version numbers */ -#define WINDOWS_WM_MINOR_VERSION 0 -#define WINDOWS_WM_PATCH_VERSION 0 - -typedef struct _WindowsWMQueryVersion { - CARD8 reqType; /* always WMReqCode */ - CARD8 wmReqType; /* always X_WMQueryVersion */ - CARD16 length B16; -} xWindowsWMQueryVersionReq; -#define sz_xWindowsWMQueryVersionReq 4 - -typedef struct { - BYTE type; /* X_Reply */ - BOOL pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD16 majorVersion B16; /* major version of WM protocol */ - CARD16 minorVersion B16; /* minor version of WM protocol */ - CARD32 patchVersion B32; /* patch version of WM protocol */ - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; -} xWindowsWMQueryVersionReply; -#define sz_xWindowsWMQueryVersionReply 32 - -typedef struct _WindowsWMDisableUpdate { - CARD8 reqType; /* always WMReqCode */ - CARD8 wmReqType; /* always X_WMDisableUpdate */ - CARD16 length B16; - CARD32 screen B32; -} xWindowsWMDisableUpdateReq; -#define sz_xWindowsWMDisableUpdateReq 8 - -typedef struct _WindowsWMReenableUpdate { - CARD8 reqType; /* always WMReqCode */ - CARD8 wmReqType; /* always X_WMReenableUpdate */ - CARD16 length B16; - CARD32 screen B32; -} xWindowsWMReenableUpdateReq; -#define sz_xWindowsWMReenableUpdateReq 8 - -typedef struct _WindowsWMSelectInput { - CARD8 reqType; /* always WMReqCode */ - CARD8 wmReqType; /* always X_WMSelectInput */ - CARD16 length B16; - CARD32 mask B32; -} xWindowsWMSelectInputReq; -#define sz_xWindowsWMSelectInputReq 8 - -typedef struct _WindowsWMNotify { - BYTE type; /* always eventBase + event type */ - BYTE kind; - CARD16 sequenceNumber B16; - Window window B32; - Time time B32; /* time of change */ - CARD16 pad1 B16; - CARD32 arg B32; - INT16 x B16; - INT16 y B16; - CARD16 w B16; - CARD16 h B16; -} xWindowsWMNotifyEvent; -#define sz_xWindowsWMNotifyEvent 28 - -typedef struct _WindowsWMSetFrontProcess { - CARD8 reqType; /* always WMReqCode */ - CARD8 wmReqType; /* always X_WMSetFrontProcess */ - CARD16 length B16; -} xWindowsWMSetFrontProcessReq; -#define sz_xWindowsWMSetFrontProcessReq 4 - -typedef struct _WindowsWMFrameGetRect { - CARD8 reqType; /* always WMReqCode */ - CARD8 wmReqType; /* always X_WMFrameGetRect */ - CARD16 length B16; - CARD32 frame_style B32; - CARD32 frame_style_ex B32; - CARD16 frame_rect B16; - INT16 ix B16; - INT16 iy B16; - CARD16 iw B16; - CARD16 ih B16; - CARD16 pad1 B16; -} xWindowsWMFrameGetRectReq; -#define sz_xWindowsWMFrameGetRectReq 24 - -typedef struct { - BYTE type; /* X_Reply */ - BOOL pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - INT16 x B16; - INT16 y B16; - CARD16 w B16; - CARD16 h B16; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; -} xWindowsWMFrameGetRectReply; -#define sz_xWindowsWMFrameGetRectReply 32 - -typedef struct _WindowsWMFrameDraw { - CARD8 reqType; /* always WMReqCode */ - CARD8 wmReqType; /* always X_WMFrameDraw */ - CARD16 length B16; - CARD32 screen B32; - CARD32 window B32; - CARD32 frame_style B32; - CARD32 frame_style_ex B32; - INT16 ix B16; - INT16 iy B16; - CARD16 iw B16; - CARD16 ih B16; -} xWindowsWMFrameDrawReq; -#define sz_xWindowsWMFrameDrawReq 28 - -typedef struct _WindowsWMFrameSetTitle { - CARD8 reqType; /* always WMReqCode */ - CARD8 wmReqType; /* always X_WMFrameSetTitle */ - CARD16 length B16; - CARD32 screen B32; - CARD32 window B32; - CARD32 title_length B32; -} xWindowsWMFrameSetTitleReq; -#define sz_xWindowsWMFrameSetTitleReq 16 - -#endif /* _WINDOWSWMSTR_H_ */ diff --git a/nx-X11/lib/zlib/Imakefile b/nx-X11/lib/zlib/Imakefile deleted file mode 100644 index d1293c950..000000000 --- a/nx-X11/lib/zlib/Imakefile +++ /dev/null @@ -1,56 +0,0 @@ -XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:46:46 cpqbld Exp $ - - - - - -XCOMM $XFree86: xc/lib/zlib/Imakefile,v 1.9tsi Exp $ - -#define DoNormalLib YES -#define DoSharedLib NO -#define DoExtraLib NO -#define DoDebugLib NO -#define DoProfileLib NO -#define HasSharedData NO -#define LibName z -#define SoRev SOZLIBREV - - ZLIBDIR = $(TOP)/extras/zlib -INCLUDES = -I$(ZLIBDIR) - -#if OsNeedZlibHeaders -#define LibHeaders YES -HEADERS = zconf.h zlib.h -#else -#define LibHeaders NO -#endif - -SRCS = adler32.c compress.c crc32.c gzio.c uncompr.c deflate.c \ - trees.c zutil.c inflate.c infblock.c inftrees.c \ - infcodes.c infutil.c inffast.c - -OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o \ - trees.o zutil.o inflate.o infblock.o inftrees.o \ - infcodes.o infutil.o inffast.o - -#include <Library.tmpl> - -LinkSourceFile(adler32.c,$(ZLIBDIR)) -LinkSourceFile(compress.c,$(ZLIBDIR)) -LinkSourceFile(crc32.c,$(ZLIBDIR)) -LinkSourceFile(gzio.c,$(ZLIBDIR)) -LinkSourceFile(uncompr.c,$(ZLIBDIR)) -LinkSourceFile(deflate.c,$(ZLIBDIR)) -LinkSourceFile(trees.c,$(ZLIBDIR)) -LinkSourceFile(zutil.c,$(ZLIBDIR)) -LinkSourceFile(inflate.c,$(ZLIBDIR)) -LinkSourceFile(infblock.c,$(ZLIBDIR)) -LinkSourceFile(inftrees.c,$(ZLIBDIR)) -LinkSourceFile(infcodes.c,$(ZLIBDIR)) -LinkSourceFile(infutil.c,$(ZLIBDIR)) -LinkSourceFile(inffast.c,$(ZLIBDIR)) - -LinkSourceFile(zconf.h,$(ZLIBDIR)) -LinkSourceFile(zlib.h,$(ZLIBDIR)) - -DependTarget() -- cgit v1.2.3