./PaxHeaders.1031/XmHTML-1.1.100000644000175000001440000000013112613377414013661 xustar000000000000000030 mtime=1445854988.703545634 29 atime=1445854990.04254561 30 ctime=1445854988.703545634 XmHTML-1.1.10/0000755000175000001440000000000012613377414013202 5ustar00chrisusers00000000000000XmHTML-1.1.10/PaxHeaders.1031/docs0000644000175000001440000000013212613377377014465 xustar000000000000000030 mtime=1445854975.085545877 30 atime=1445854991.786545578 30 ctime=1445854975.085545877 XmHTML-1.1.10/docs/0000755000175000001440000000000012613377377014142 5ustar00chrisusers00000000000000XmHTML-1.1.10/docs/PaxHeaders.1031/README.gifs0000644000175000001440000000013212613377377016351 xustar000000000000000030 mtime=1445854975.084545878 30 atime=1445854975.084545878 30 ctime=1445854975.084545878 XmHTML-1.1.10/docs/README.gifs0000644000175000001440000002661012613377377015756 0ustar00chrisusers00000000000000This file: README.gifs Not copyrighted by Koen D'Hondt, ------------------------------------------------------------------------------ The first part of this file contains a lot of disclaimers and warnings. They might seem (actually, they are) rather ridiculous, but let me tell you that Unisys *really* means business when it comes to using the LZW algorithm without a valid license. I sure as hell want to cover my behind (to put it nicely). This file wouldn't be here if it wasn't for Unisys's utterly mindboggling attitude towards the use of the LZW algorithm for decoding GIF images. I can tell you I had some very frustrating weeks when I negotiated with Unisys to obtain a LZW license. ------------------------------------------------------------------------------ First of all a very big disclaimer: THIS FILE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND. THE AUTHOR SHALL HAVE NO LIABILITY WITH RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS FILE OR ANY PART THEREOF. IN NO EVENT WILL THE AUTHOR BE LIABLE FOR ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL DAMAGES. IF YOU DECIDE TO USE THE INFORMATION CONTAINED IN THIS FILE TO CONSTRUCT AND USE THE LZW ALGORITHM YOU AGREE TO ACCEPT FULL RESPONSIBILITY WITH RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRECTS OR ANY PATENTS. IN NO EVENT WILL THE AUTHOR BE LIABLE FOR ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL DAMAGES, INCLUDING BUT NOT LIMITED TO ANY DAMAGES RESULTING FROM ANY ACTIONS IN A COURT OF LAW. And now an equally big warning: YOU ARE HEREBY WARNED THAT USE OF THE LZW ALGORITHM WITHOUT HAVING OBTAINED A PROPER LICENSE FROM UNISYS CONSTITUTES A VIOLATION OF APPLICABLE PATENT LAW. AS SUCH YOU WILL BE HELD LEGALLY RESPONSIBLE FOR ANY INFRINGEMENT OF THE UNISYS LZW PATENT. UNISYS REQUIRES YOU TO HAVE A LZW LICENSE FOR *EVERY* TASK IN WHICH THE LZW ALGORITHM IS BEING USED (WHICH INCLUDES DECODING THE LZW COMPRESSED RASTER DATA AS FOUND IN GIF IMAGES). THE FACT THAT YOUR APPLICATION MAY OR MAY NOT BE DISTRIBUTED AS FREEWARE IS OF NO CONCERN TO UNISYS. IF YOU RESIDE IN A COUNTRY WHERE SOFTWARE PATENT LAWS DO NOT APPLY, PLEASE BE WARNED THAT EXPORTING SOFTWARE CONTAINING THE LZW ALGORITHM TO COUNTRIES WHERE SOFTWARE PATENT LAW *DOES* APPLY WITHOUT A VALID LICENSE ALSO CONSTITUTES A VIOLATION OF PATENT LAW IN THE COUNTRY OF DESTINATION. All in all: If you want to use the LZW algorithm without a valid license from Unisys, you are on your own. ------------------------------------------------------------------------------ So far for all the legal stuff, now on to what this file is all about: implementing a LZW decoder in applications using XmHTML. As you might have read in the README file, XmHTML uses a workaround to decode GIF images instead of using a built-in LZW decoder. This ensures that neither you, users of your applications and I require a license from Unisys. This workaround is rather efficient for normal gifs and small animations and normally spoken you should not see a noticable slowdown. Large animations however generally cause a slightly noticable slowdown, and on very large animations the slowdown can be very visible. Unless you already have a license which grants you the use of an LZW decoder (or want to buy one), this is something you and I have to live with. However, you *can* replace the workaround with a true LZW decoder. I do not advise this at all, *unless* you (or the company you work for) already has obtained a LZW license from Unisys. If you really want to get a license from Unisys, be prepared to pay 1,000$ (april 1997) for the license and also be prepared to accept the totally frustrating restrictions set forth in the license (contact Unisys at lzw_info@unisys.com if you are certain you want get a license). Adding a true GIF LZW decoder to applications using XmHTML ---------------------------------------------------------- XmHTML widget's provide the XmNdecodeGIFProc resource which enables you to replace the internal GIF workaround with a true GIF LZW decoder. The interface definition for a GIF decoding procedure is as follows: typedef int (*XmImageGifProc)(XmHTMLGIFStream*); Where XmHTMLGIFStream is defined as follows: typedef struct _XmHTMLGIFStream{ /* read-only fields */ int state; /* decoder state */ int codesize; /* initial LZW codesize */ Boolean is_progressive; /* when used by a progressive loader */ unsigned char *next_in; /* next input byte */ Cardinal avail_in; /* number of bytes available at next_in. * Will never exceed 256 bytes */ Cardinal total_in; /* total nb of input bytes read so far */ /* fields to be updated by caller */ unsigned char *next_out; /* next output byte should be put there. * Allocated and updated by XmHTML. */ Cardinal avail_out; /* remaining free space at next_out */ Cardinal total_out; /* total nb of bytes output so far */ String msg; /* last error message, NULL if no error */ XtPointer external_state; /* room for decoder-specific data */ }XmHTMLGIFStream; The external decoder must return one of the following values: GIF_STREAM_OK successfully decoded the next chunk of data; GIF_STREAM_END end of gif data. XmHTML will also set this value in the state field of the above structure if it has detected the zero data block itself; GIF_STREAM_ERR an error occured in the decoder. You can set an appropriate error message in the msg field in the above structure which XmHTML will display. As you might have noticed, this structure strongly resembles the z_stream structure found in zlib 1.0.4. It provides a clean interface with little room for errors. The external decoder is only responsible for decoding the LZW compressed raster data, nothing else. XmHTML will take care of the actual image composition (palette allocation, interlaced gif handling, animated gif reading, etc..). The following section explains the different fields in the XmHTMLGIFStream structure and their allowable (or expected) values. int state; /* decoder state */ The state field can have any of the following values: GIF_STREAM_INIT set when the decoder is called for the first time on a gif file. This is the stage at which the decoder should initialize its internal structures. The only valid field at this stage is the state field itself. The decoder should return GIF_STREAM_OK when the initialization was successfully. Returning any other code will be considered an error. GIF_STREAM_FINAL set when either all data has been uncompressed or an error occured. The decoder should free the resources it has allocated. The return value is ignored. This field is set by XmHTML. int codesize; /* initial LZW codesize */ This is the initial GIF codesize as read from the raw image data. This value must be used to properly set up the decompressor tables. This field is set by XmHTML. Boolean is_progressive; /* when used by a progressive loader */ This field indicates if the current decoder is being used to decode an image that is being loaded progressively. This field is set by XmHTML. unsigned char *next_in; /* next input byte */ This field contains a pointer to the start of the next block of compressed image data. This is the data that should be decompressed. This field is set by XmHTML. Cardinal avail_in; /* number of bytes available at next_in. This field contains the number of bytes that next_in contains. As the block size of compressed gif raster data is limited to 256 bytes (see below) this number will never exceed 256, it will generally be smaller. This field is set by XmHTML. Cardinal total_in; /* total nb of input bytes read so far */ This field represents the total number of compressed data read so far. It is the sum of all successive avail_in counts. This field is set by XmHTML. unsigned char *next_out; /* next output byte should be put there. This field points to a buffer that will be receiving the decompressed raster data. It is allocated and maintained by XmHTML. Upon the first invokation of the external decoder, XmHTML will allocate the receiving buffer (which is given by the width and height of the final image). Upon each successive invokation XmHTML will update this field to point to the next available output byte. Cardinal avail_out; /* remaining free space at next_out */ This field contains the number of bytes that is still available at next_out. When the value of this field drops to zero all data has been decoded and the decoder should return GIF_STREAM_END. This field *must* be maintained by the caller. Cardinal total_out; /* total nb of bytes output so far */ This field contains the number of bytes decoded so far. XmHTML uses this field to offer an additional level of error detection: when it reaches the size of the output buffer while avail_out is non-zero the image data is corrupt. This field *must* be maintained by the caller. String msg; /* last error message, NULL if no error */ When the external decoder detects an error (corrupt image data) and it returns GIF_STREAM_ERR, XmHTML will display the text pointed to by msg. XmHTML assumes this is a ptr to a static memory area and will not free it. XtPointer external_state; /* room for decoder-specific data */ This field can be used to store data specific to the external decoder. It is not used by XmHTML in any way. The format of the LZW compressed raster data is as follows (see the GIF87a or GIF89a spec for the full definition): 7 6 5 4 3 2 1 0 +---------------+ | code size | +---------------+ ---+ |blok byte count| | +---------------+ | : : +-- Repeated as many times as necessary | data bytes | | : : | +---------------+ ---+ . . . . . . +---------------+ |0 0 0 0 0 0 0 0| zero byte count (terminates data stream) +---------------+ The block byte count defines how many bytes are contained within the following data bytes. As all fields are one byte long, the block byte count can never exceed 256. A great deal of public applications/libraries are capabable of decoding GIF images. A number of them are: - gif2png, Alexander Lehmann - Mosaic, various authors file gifread.c - netpbm, various authors - pbmplus, various authors file giftoppm.c - gd, the Gif Manipulating Library http://siva.cshl.org/gd/gd.html http://sunsite.unc.edu/boutell/index.html - libjpeg, Thomas G. Lane and The Independent JPEG Group. file rdgif.c (quite heavily modified though) - ImageMagick, John Cristy http://www.wizards.dupont.com/cristy/ImageMagick.html ftp://ftp.wizards.dupont.com/pub/ImageMagick/ ftp://ftp.x.org/contrib/applications/ImageMagick/ Look at compress.c, routine GIFDecodeImage. - xgif, John Bradley file xgifload.c - xv, John Bradley file xvgif.c - giftool, Mark Podliplec - gifmerge, Mark Podliplec There are literally hundreds of applications capable of reading gif images. Just pick the one that suits your needs. A totally free, uncopyrighted gifdecoder can be found in the contrib directory. It is from a contributor who whishes to stay anonymous (can you blame him?). That's all there is. Question? Suggestions? Mail me at ripley@xs4all.nl Koen D'Hondt. XmHTML-1.1.10/docs/PaxHeaders.1031/LocaleDB.PS0000644000175000001440000000013212613377377016413 xustar000000000000000030 mtime=1445854975.083545878 30 atime=1445854975.083545878 30 ctime=1445854975.083545878 XmHTML-1.1.10/docs/LocaleDB.PS0000644000175000001440000006475512613377377016034 0ustar00chrisusers00000000000000%!PS-Adobe-3.0 %%Creator: groff version 1.11 %%CreationDate: Mon Dec 15 09:40:53 1997 %%DocumentNeededResources: font Times-Roman %%+ font Times-Bold %%+ font Times-Italic %%DocumentSuppliedResources: procset grops 1.11 0 %%Pages: 8 %%PageOrder: Ascend %%Orientation: Portrait %%EndComments %%BeginProlog %%BeginResource: procset grops 1.11 0 /setpacking where{ pop currentpacking true setpacking }if /grops 120 dict dup begin /SC 32 def /A/show load def /B{0 SC 3 -1 roll widthshow}bind def /C{0 exch ashow}bind def /D{0 exch 0 SC 5 2 roll awidthshow}bind def /E{0 rmoveto show}bind def /F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def /G{0 rmoveto 0 exch ashow}bind def /H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /I{0 exch rmoveto show}bind def /J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def /K{0 exch rmoveto 0 exch ashow}bind def /L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /M{rmoveto show}bind def /N{rmoveto 0 SC 3 -1 roll widthshow}bind def /O{rmoveto 0 exch ashow}bind def /P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /Q{moveto show}bind def /R{moveto 0 SC 3 -1 roll widthshow}bind def /S{moveto 0 exch ashow}bind def /T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def /SF{ findfont exch [exch dup 0 exch 0 exch neg 0 0]makefont dup setfont [exch/setfont cvx]cvx bind def }bind def /MF{ findfont [5 2 roll 0 3 1 roll neg 0 0]makefont dup setfont [exch/setfont cvx]cvx bind def }bind def /level0 0 def /RES 0 def /PL 0 def /LS 0 def /MANUAL{ statusdict begin/manualfeed true store end }bind def /PLG{ gsave newpath clippath pathbbox grestore exch pop add exch pop }bind def /BP{ /level0 save def 1 setlinecap 1 setlinejoin 72 RES div dup scale LS{ 90 rotate }{ 0 PL translate }ifelse 1 -1 scale }bind def /EP{ level0 restore showpage }bind def /DA{ newpath arcn stroke }bind def /SN{ transform .25 sub exch .25 sub exch round .25 add exch round .25 add exch itransform }bind def /DL{ SN moveto SN lineto stroke }bind def /DC{ newpath 0 360 arc closepath }bind def /TM matrix def /DE{ TM currentmatrix pop translate scale newpath 0 0 .5 0 360 arc closepath TM setmatrix }bind def /RC/rcurveto load def /RL/rlineto load def /ST/stroke load def /MT/moveto load def /CL/closepath load def /FL{ currentgray exch setgray fill setgray }bind def /BL/fill load def /LW/setlinewidth load def /RE{ findfont dup maxlength 1 index/FontName known not{1 add}if dict begin { 1 index/FID ne{def}{pop pop}ifelse }forall /Encoding exch def dup/FontName exch def currentdict end definefont pop }bind def /DEFS 0 def /EBEGIN{ moveto DEFS begin }bind def /EEND/end load def /CNT 0 def /level1 0 def /PBEGIN{ /level1 save def translate div 3 1 roll div exch scale neg exch neg exch translate 0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin 10 setmiterlimit []0 setdash /setstrokeadjust where{ pop false setstrokeadjust }if /setoverprint where{ pop false setoverprint }if newpath /CNT countdictstack def userdict begin /showpage{}def }bind def /PEND{ clear countdictstack CNT sub{end}repeat level1 restore }bind def end def /setpacking where{ pop setpacking }if %%EndResource %%IncludeResource: font Times-Roman %%IncludeResource: font Times-Bold %%IncludeResource: font Times-Italic grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron /scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent /ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen /period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon /semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O /P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex /underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y /z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft /guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl /endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut /dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash /quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen /brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft /logicalnot/minus/registered/macron/degree/plusminus/twosuperior /threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior /ordmasculine/guilsinglright/onequarter/onehalf/threequarters /questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE /Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex /Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis /multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn /germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla /egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis /eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash /ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def /Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE /Times-Roman@0 ENC0/Times-Roman RE %%EndProlog %%Page: 1 1 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 15/Times-Bold@0 SF 3.75 (XL)194.46 132 S(ocale Database De\214nition)-3.75 E/F2 10 /Times-Italic@0 SF -.92(Yo)255.615 180 S(shio Horiuc).92 E(hi)-.15 E F0 (IBM Japan)265.92 198 Q EP %%Page: 2 2 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 9/Times-Roman@0 SF(Cop)72 123.6 Q(yright \251 IBM Corporation 1994)-.09 E(All Rights Reserv)72 139.2 Q(ed)-.135 E(License to use, cop)72 154.8 Q 1.17 -.585(y, m)-.09 H (odify).585 E 2.25(,a)-.585 G(nd distrib)-2.25 E(ute this softw)-.18 E (are and its documentation for an)-.09 E 2.25(yp)-.135 G (urpose and without fee is)-2.25 E(hereby granted, pro)72 166.8 Q (vided that the abo)-.135 E .27 -.135(ve c)-.135 H(op).135 E (yright notice appear in all copies and that both that cop)-.09 E (yright notice and this)-.09 E(permission notice appear in supporting d\ ocumentation, and that the name of IBM not be used in adv)72 178.8 Q (ertising or publicity)-.135 E(pertaining to distrib)72 190.8 Q (ution of the softw)-.18 E (are without speci\214c, written prior permission.)-.09 E (IBM DISCLAIMS ALL W)72 206.4 Q(ARRANTIES WITH REGARD T)-1.08 E 2.25(OT) -.162 G(HIS SOFTW)-2.25 E(ARE, INCLUDING ALL IMPLIED)-1.08 E -1.08(WA)72 218.4 S(RRANTIES OF MERCHANT)1.08 E(ABILITY)-.837 E 2.25(,F)-1.161 G (ITNESS, AND NONINFRINGEMENT OF THIRD P)-2.25 E(AR)-.828 E(TY RIGHTS,) -.54 E (IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQ)72 230.4 Q(UENTIAL D)-.09 E(AMA)-.36 E(GES)-.36 E(OR ANY D)72 242.4 Q(AMA) -.36 E(GES WHA)-.36 E(TSOEVER RESUL)-.999 E(TING FR)-.828 E (OM LOSS OF USE, D)-.36 E -1.089 -.999(AT A)-.36 H(OR PR)3.249 E (OFITS, WHETHER IN)-.36 E(AN A)72 254.4 Q(CTION OF CONTRA)-.36 E(CT)-.36 E 2.25(,N)-.666 G(EGLIGENCE OR O)-2.25 E(THER T)-.36 E(OR)-.162 E (TIOUS A)-.54 E(CTION, ARISING OUT OF OR IN CON-)-.36 E (NECTION WITH THE USE OR PERFORMANCE OF THIS SOFTW)72 266.4 Q(ARE.)-1.08 E(Cop)72 338.4 Q(yright \251 1994 X Consortium)-.09 E (Permission is hereby granted, free of char)72 354 Q(ge, to an)-.162 E 2.25(yp)-.135 G(erson obtaining a cop)-2.25 E 2.25(yo)-.09 G 2.25(ft) -2.25 G(his softw)-2.25 E(are and associated documenta-)-.09 E (tion \214les \(the `)72 366 Q(`Softw)-.666 E(are')-.09 E ('\), to deal in the Softw)-.666 E(are without restriction, including w\ ithout limitation the rights to use,)-.09 E(cop)72 378 Q 1.17 -.585 (y, m)-.09 H(odify).585 E 2.25(,m)-.585 G(er)-2.25 E (ge, publish, distrib)-.162 E (ute, sublicense, and/or sell copies of the Softw)-.18 E (are, and to permit persons to whom)-.09 E(the Softw)72 390 Q (are is furnished to do so, subject to the follo)-.09 E (wing conditions:)-.225 E(The abo)72 405.6 Q .27 -.135(ve c)-.135 H(op) .135 E(yright notice and this permission notice shall be included in al\ l copies or substantial portions of the Soft-)-.09 E -.09(wa)72 417.6 S (re.).09 E(THE SOFTW)72 433.2 Q(ARE IS PR)-1.08 E -.45(OV)-.36 G(IDED `) .45 E -.72(`A)-.666 G 2.25(SI).72 G(S')-2.25 E(', WITHOUT W)-.666 E (ARRANTY OF ANY KIND, EXPRESS OR IMPLIED,)-1.08 E(INCLUDING B)72 445.2 Q (UT NO)-.09 E 2.25(TL)-.36 G(IMITED T)-2.25 E 2.25(OT)-.162 G(HE W)-2.25 E(ARRANTIES OF MERCHANT)-1.08 E(ABILITY)-.837 E 2.25(,F)-1.161 G (ITNESS FOR A P)-2.25 E(AR)-.828 E(TIC-)-.54 E (ULAR PURPOSE AND NONINFRINGEMENT)72 457.2 Q 4.5(.I)-.666 G 2.25(NN)-4.5 G 2.25(OE)-2.25 G(VENT SHALL THE X CONSOR)-2.25 E(TIUM BE LIABLE FOR) -.54 E(ANY CLAIM, D)72 469.2 Q(AMA)-.36 E(GES OR O)-.36 E (THER LIABILITY)-.36 E 2.25(,W)-1.161 G(HETHER IN AN A)-2.25 E (CTION OF CONTRA)-.36 E(CT)-.36 E 2.25(,T)-.666 G(OR)-2.412 E 2.25(TO) -.54 G 2.25(RO)-2.25 G(TH-)-2.61 E(ER)72 481.2 Q(WISE, ARISING FR)-.495 E(OM, OUT OF OR IN CONNECTION WITH THE SOFTW)-.36 E(ARE OR THE USE OR O) -1.08 E(THER)-.36 E(DEALINGS IN THE SOFTW)72 493.2 Q(ARE.)-1.08 E(Excep\ t as contained in this notice, the name of the X Consortium shall not b\ e used in adv)72 508.8 Q(ertising or otherwise to pro-)-.135 E (mote the sale, use or other dealings in this Softw)72 520.8 Q (are without prior written authorization from the X Consortium.)-.09 E /F2 9/Times-Italic@0 SF 2.25(XW)72 568.8 S(indow System)-2.745 E F1 (is a trademark of X Consortium, Inc.)2.25 E EP %%Page: 1 3 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF 2.75 (1. General)72 84 R/F2 11/Times-Roman@0 SF (An X Locale Database contains the subset of a user')72 99.6 Q 2.75(se) -.605 G -.44(nv)-2.75 G(ironment that depends on language, in X).44 E -.44(Wi)72 111.6 S(ndo).44 E 2.75(wS)-.275 G 2.75(ystem. It)-2.75 F (is made up from one or more cate)2.75 E 2.75(gories. Each)-.165 F(cate) 2.75 E(gory consists of some)-.165 E(classes and sub-classes.)72 123.6 Q (It is pro)72 139.2 Q(vided as a plain ASCII te)-.165 E (xt \214le, so a user can change its contents easily)-.165 E 5.5(.I) -.715 G 2.75(ta)-5.5 G(llo)-2.75 E(ws a user)-.275 E (to customize the beha)72 151.2 Q(vior of internationalized portion of \ Xlib without changing Xlib itself.)-.22 E(This document describes;)72 166.8 Q(Database F)122 182.4 Q(ormat De\214nition)-.165 E (Contents of Database in sample implementation)122 198 Q(Since it is ha\ rd to de\214ne the set of required information for all platforms, only \ the \215e)72 213.6 Q(xible)-.165 E(database format is de\214ned.)72 225.6 Q(The a)5.5 E -.275(va)-.22 G (ilable entries in database are implementation dependent.).275 E F1 2.75 (2. Database)72 253.2 R -.275(Fo)2.75 G(rmat De\214nition).275 E F2 (The X Locale Database contains one or more cate)72 268.8 Q (gory de\214nitions.)-.165 E(This section describes the for)5.5 E(-)-.22 E(mat of each cate)72 280.8 Q(gory de\214nition.)-.165 E(The cate)72 296.4 Q(gory de\214nition consists of one or more class de\214nitions.) -.165 E(Each class de\214nition has a pair)5.5 E (of class name and class v)72 308.4 Q(alue, or has se)-.275 E -.165(ve) -.275 G(ral subclasses which are enclosed by the left brace \({\)).165 E (and the right brace \(}\).)72 320.4 Q (Comments can be placed by using the number sign character \(#\).)72 336 Q(Putting the number sign charac-)5.5 E (ter on the top of the line indicates that the entire line is comment.) 72 348 Q(Also, putting an)5.5 E 2.75(yw)-.165 G(hitespace)-2.75 E (character follo)72 360 Q(wed by the number sign character indicates th\ at a part of the line \(from the number)-.275 E (sign to the end of the line\) is comment.)72 372 Q 2.75(Al)5.5 G (ine can be continued by placing backslash \(\\\) charac-)-2.75 E (ter as the last character on the line;)72 384 Q (this continuation character will be discarded from the input.)5.5 E(Co\ mment lines cannot be continued on a subsequent line using an escaped n\ e)72 396 Q 2.75(wl)-.275 G(ine character)-2.75 E(.)-.605 E 2.75(XL)72 411.6 S(ocale Database only accepts XPCS, the X Portable Character Set.) -2.75 E(The reserv)5.5 E(ed symbols are;)-.165 E(the quotation mark\("\ \), the number sign \(#\), the semicolon\(;\), the backslash\(\\\), the\ left brace\({\))72 423.6 Q(and the right brace\(}\).)72 435.6 Q (The format of cate)72 451.2 Q(gory de\214nition is;)-.165 E(Cate)97 469.2 Q 13.75(goryDe\214nition ::= Cate)-.165 F(goryHeader Cate)-.165 E (gorySpec Cate)-.165 E(goryT)-.165 E(railer)-.385 E(Cate)97 481.2 Q 26.609(goryHeader ::=)-.165 F(Cate)16.5 E(goryName NL)-.165 E(Cate)97 493.2 Q 36.982(gorySpec ::=)-.165 F 2.75({C)16.5 G(lassSpec })-2.75 E (Cate)97 505.2 Q(goryT)-.165 E 28.82(railer ::=)-.385 F ("END" Delimiter Cate)16.5 E(goryName NL)-.165 E(Cate)97 517.2 Q 32.098 (goryName ::=)-.165 F(String)16.5 E 53.306(ClassSpec ::=)97 529.2 R (ClassName Delimiter ClassV)16.5 E(alue NL)-1.221 E 48.422 (ClassName ::=)97 541.2 R(String)16.5 E(ClassV)97 553.2 Q 49.643 (alue ::=)-1.221 F -1.221(Va)16.5 G(lueList | "{" NL { ClassSpec } "}") 1.221 E -1.221(Va)97 565.2 S 56.364(lueList ::=)1.221 F -1.221(Va)16.5 G (lue | V)1.221 E(alue ";" V)-1.221 E(alueList)-1.221 E -1.221(Va)97 577.2 S 73.48(lue ::=)1.221 F -1.221(Va)16.5 G(luePiece | V)1.221 E (aluePiece V)-1.221 E(alue)-1.221 E -1.221(Va)97 589.2 S 49.654 (luePiece ::=)1.221 F(String | QuotedString | NumericString)16.5 E 71.632(String ::=)97 601.2 R(Char { Char })16.5 E 39.248 (QuotedString ::=)97 613.2 R(""" QuotedChar { QuotedChar } """)16.5 E 33.143(NumericString ::=)97 625.2 R("\\\\o" OctDigit { OctDigit })16.5 E 16.5(|")208.397 637.2 S(\\\\d" DecDigit { DecDigit })-16.5 E 16.5(|") 208.397 649.2 S(\\\\x" He)-16.5 E(xDigit { He)-.165 E(xDigit })-.165 E 77.143(Char ::=)97 661.2 R()-.165 E 44.759 (QuotedChar ::=)97 673.2 R()-.165 E 60.027(OctDigit ::=)97 685.2 R() 16.5 E 58.201(DecDigit ::=)97 697.2 R ()16.5 E(He)97 709.2 Q 57.75 (xDigit ::=)-.165 F ()16.5 E F1 (1)285.25 768 Q EP %%Page: 2 4 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF 2.75 (XL)72 52 S(ocale Database De\214nition)-2.75 E(X11, Release 6.4)218.435 E/F2 11/Times-Roman@0 SF 56.364(Delimiter ::=)97 84 R(Space { Space }) 19.25 E 72.259(Space ::=)97 96 R( | )16.5 E 83.864(NL ::=)97 108 R()-.275 E (Elements separated by v)72 129.6 Q(ertical bar \(|\) are alternati) -.165 E -.165(ve)-.275 G 2.75(s. Curly).165 F (braces \({...}\) indicate zero or more)2.75 E (repetitions of the enclosed elements.)72 141.6 Q(Square brack)5.5 E (ets \([...]\) indicate that the enclosed element is)-.11 E (optional. Quotes \("..."\) are used around literal characters.)72 153.6 Q(The backslash, which is not the top character of the NumericString, i\ s recognized as an escape)72 169.2 Q(character)72 181.2 Q 2.75(,s)-.44 G 2.75(ot)-2.75 G(hat the ne)-2.75 E (xt one character is treated as a literal character)-.165 E 5.5(.F)-.605 G(or e)-5.665 E(xample, the tw)-.165 E(o-)-.11 E(character sequence, `) 72 193.2 Q(`\\"')-.814 E('\(the backslash follo)-.814 E (wed by the quotation mark\) is recognized and)-.275 E (replaced with a quotation mark character)72 205.2 Q 5.5(.A)-.605 G .33 -.165(ny w)-5.5 H(hitespace character).165 E 2.75(,t)-.44 G (hat is not the Delimiter)-2.75 E(,)-.44 E (unquoted and unescaped, is ignored.)72 217.2 Q F1 2.75(3. Contents)72 244.8 R(of Database)2.75 E F2(The a)72 260.4 Q -.275(va)-.22 G (ilable cate).275 E (gories and classes depend on implementation, because dif)-.165 E (ferent platform will)-.275 E(require dif)72 272.4 Q (ferent information set.)-.275 E -.165(Fo)5.5 G 2.75(re).165 G (xample, some platform ha)-2.915 E .33 -.165(ve s)-.22 H(ystem locale b) .165 E(ut some plat-)-.22 E(form don')72 284.4 Q 2.75(t. Furthermore,) -.198 F(there might be a dif)2.75 E(ference in functionality e)-.275 E -.165(ve)-.275 G 2.75(ni).165 G 2.75(ft)-2.75 G(he platform has sys-) -2.75 E(tem locale.)72 296.4 Q(In current sample implementation, cate)72 312 Q(gories listed belo)-.165 E 2.75(wa)-.275 G(re a)-2.75 E -.275(va) -.22 G(ilable.).275 E 16.797(XLC_FONTSET XF)97 330 R(ontSet relati)-.165 E .33 -.165(ve i)-.275 H(nformation).165 E 13.75(XLC_XLOCALE Character) 97 342 R(classi\214cation and con)2.75 E -.165(ve)-.44 G (rsion information).165 E F1 2.75(4. XLC_FONTSET)72 375.6 R(Category) 2.75 E F2(The XLC_FONTSET cate)72 391.2 Q(gory de\214nes the XF)-.165 E (ontSet relati)-.165 E .33 -.165(ve i)-.275 H 2.75(nformation. It).165 F (contains the)2.75 E(CHARSET_REGISTR)72 403.2 Q -1.221(Y-)-.715 G (CHARSET_ENCODING name and character mapping side \(GL, GR,)1.221 E (etc\), and is used in Output Method \(OM\).)72 415.2 Q .44 LW 97 425.95 97 425.95 DL F1 99.75(class super)97 441.2 R 10.681(class description) 2.75 F 97 451.95 97 451.95 DL F2 170.326(fsN Nth)97 467.2 R (fontset \(N=0,1,2, ...\))2.75 E 90.598(charset fsN)97 491.2 R (list of encoding name)48.576 E 104.029(font fsN)97 503.2 R (list of font encoding name)48.576 E 97 513.95 97 513.95 DL(fsN)72 536.4 Q(Includes an encoding information for Nth charset, where N is the inde) 97 548.4 Q 2.75(xn)-.165 G(umber \(0,1,2,...\).)-2.75 E (If there are 4 charsets a)97 560.4 Q -.275(va)-.22 G (ilable in current locale, 4 fontsets, fs0, fs1, fs2 and fs3, should be) .275 E 2.75(de\214ned. This)97 572.4 R(class has tw)2.75 E 2.75(os)-.11 G(ubclasses, `charset' and `font'.)-2.75 E(charset)72 588 Q(Speci\214es\ an encoding information to be used internally in Xlib for this fontset\ .)97 600 Q(The format)5.5 E(of v)97 612 Q(alue is;)-.275 E 21.692 (EncodingInfo ::=)122 630 R(EncodingName [ ":" EncodingSide ])16.5 E 13.75(EncodingName ::= CHARSET_REGISTR)122 642 R -1.221(Y-)-.715 G (CHARSET_ENCODING)1.221 E 20.46(EncodingSide ::=)122 654 R("GL" | "GR") 16.5 E -.165(Fo)97 672 S 2.75(rd).165 G (etail de\214nition of CHARSET_REGISTR)-2.75 E -1.221(Y-)-.715 G (CHARSET_ENCODING, refer "X Logical)1.221 E -.165(Fo)97 684 S (nt Descriptions" document.).165 E -.165(ex)97 699.6 S(ample:).165 E (ISO8859-1:GL)122 711.6 Q F1(2)285.25 768 Q EP %%Page: 3 5 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF 2.75 (XL)72 52 S(ocale Database De\214nition)-2.75 E(X11, Release 6.4)218.435 E/F2 11/Times-Roman@0 SF(font)72 84 Q(Speci\214es a list of encoding in\ formation which is used for searching appropriate font for this)97 96 Q 2.75(fontset. The)97 108 R(left most entry has highest priority)2.75 E (.)-.715 E F1 2.75(5. XLC_XLOCALE)72 135.6 R(Category)2.75 E F2 (The XLC_XLOCALE cate)72 151.2 Q (gory de\214nes character classi\214cation, con)-.165 E -.165(ve)-.44 G (rsion and other character).165 E(attrib)72 163.2 Q(utes.)-.22 E .44 LW 97 173.95 97 173.95 DL F1 99.75(class super)97 189.2 R 10.681 (class description)2.75 F 97 199.95 97 199.95 DL F2 116.558 (encoding_name codeset)97 215.2 R(name)2.75 E 128.163 (mb_cur_max MB_CUR_MAX)97 227.2 R 82.953(state_depend_encoding state)97 239.2 R(dependent or not)2.75 E 98.837(wc_encoding_mask for)97 251.2 R (parsing wc string)2.75 E 126.931(wc_shift_bits for)97 263.2 R(con)2.75 E -.165(ve)-.44 G(rsion between wc and mb).165 E 169.105(csN Nth)97 275.2 R(charset \(N=0,1,2,...\))2.75 E 104.029(side csN)97 299.2 R (mapping side \(GL, etc\))47.355 E 94.25(length csN)97 311.2 R (length of a character)47.355 E 61.866(mb_encoding csN)97 323.2 R (for parsing mb string)47.355 E 63.098(wc_encoding csN)97 335.2 R (for parsing wc string)47.355 E 67.982(ct_encoding csN)97 347.2 R (list of encoding name for ct)47.355 E 97 357.95 97 357.95 DL (encoding_name)72 380.4 Q(Speci\214es a codeset name of current locale.) 97 392.4 Q(mb_cur_max)72 408 Q(Speci\214es a maximum allo)97 420 Q -.11 (wa)-.275 G(ble number of bytes in a multi-byte character).11 E 5.5(.I) -.605 G 2.75(ti)-5.5 G 2.75(sc)-2.75 G(orrespond-)-2.75 E (ing to MB_CUR_MAX of "ISO/IEC 9899:1990 C Language Standard".)97 432 Q (state_depend_encoding)72 447.6 Q (Indicates a current locale is state dependent. The v)97 459.6 Q (alue should be speci\214ed "T)-.275 E(rue" or)-.385 E("F)97 471.6 Q (alse".)-.165 E(wc_encoding_mask)72 487.2 Q (Speci\214es a bit-mask for parsing wide-char string.)97 499.2 Q (Each wide character is applied bit-and)5.5 E(operation with this bit-m\ ask, then is classi\214ed into the unique charset, by using `wc_encod-) 97 511.2 Q(ing'.)97 523.2 Q(wc_shift_bits)72 538.8 Q (Speci\214es a number of bit to be shifted for con)97 550.8 Q -.165(ve) -.44 G(rting from a multi-byte character to a wide).165 E(character)97 562.8 Q 2.75(,a)-.44 G(nd vice-v)-2.75 E(ersa.)-.165 E(csN)72 578.4 Q(I\ ncludes a character set information for Nth charset, where N is the ind\ e)97 590.4 Q 2.75(xn)-.165 G(umber \(0,1,2,...\).)-2.75 E (If there are 4 charsets a)97 602.4 Q -.275(va)-.22 G (ilable in current locale, cs0, cs1, cs2 and cs3 should be de\214ned.) .275 E(This class has \214v)97 614.4 Q 2.75(es)-.165 G (ubclasses, `side', `length', `mb_encoding' `wc_encoding' and)-2.75 E (`ct_encoding'.)97 626.4 Q(side)72 642 Q (Speci\214es a mapping side of this charset. The format of this v)97 654 Q(alue is;)-.275 E 13.75(Side ::= EncodingSide)122 672 R([`)2.75 E (`:Def)-.814 E(ault')-.11 E('])-.814 E(The suf)97 690 Q(\214x ":Def) -.275 E(ault" can be speci\214ed.)-.11 E (It indicates that a character belongs to the speci\214ed)5.5 E (side is mapped to this charset in initial state.)97 702 Q(length)72 717.6 Q(Speci\214es a number of bytes of a multi-byte character of this\ charset.)97 729.6 Q(It should not contain)5.5 E F1(3)285.25 768 Q EP %%Page: 4 6 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF 2.75 (XL)72 52 S(ocale Database De\214nition)-2.75 E(X11, Release 6.4)218.435 E/F2 11/Times-Roman@0 SF(the length of an)97 84 Q 2.75(ys)-.165 G (ingle-shift sequence.)-2.75 E(mb_encoding)72 99.6 Q (Speci\214es a list of shift sequence for parsing multi-byte string.)97 111.6 Q(The format of this v)5.5 E(alue is;)-.275 E 21.67 (MBEncoding ::=)122 129.6 R(ShiftT)16.5 E(ype ShiftSequence)-.88 E 16.5 (|S)215.819 141.6 S(hiftT)-16.5 E(ype ShiftSequence ";" MBEncoding)-.88 E(ShiftT)122 153.6 Q 37.829(ype ::=)-.88 F("" | "" | "") 16.5 E 17.402(ShiftSequence ::=)122 165.6 R(SequenceV)16.5 E (alue | SequenceV)-1.221 E(alue ShiftSequence)-1.221 E(SequenceV)122 177.6 Q 13.75(alue ::= NumericString)-1.221 F(shift types:)122 201.6 Q 35.03( Indicates)143.279 213.6 R(single shift sequence)2.75 E 31.367 ( Indicates)139.616 225.6 R(locking shift left sequence)2.75 E 31.059( Indicates)139.308 237.6 R(locking shift right sequence)2.75 E -.165(ex)97 255.6 S(ample:).165 E ( \\x1b \\x28 \\x4a; \\x1b \\x28 \\x42)124.5 267.6 Q (wc_encoding)72 286.8 Q(Speci\214es an inte)97 298.8 Q(ger v)-.165 E (alue for parsing wide-char string.)-.275 E (It is used to determine the charset)5.5 E(for each wide character)97 310.8 Q 2.75(,a)-.44 G (fter applying bit-and operation using `wc_encoding_mask'.)-2.75 E(This) 5.5 E -.275(va)97 322.8 S(lue should be unique in all csN classes.).275 E(ct_encoding)72 338.4 Q(Speci\214es a list of encoding information tha\ t can be used for Compound T)97 350.4 Q -.165(ex)-.77 G(t.).165 E F1 2.75(6. Sample)72 378 R(of X Locale Database)2.75 E F2(The follo)72 393.6 Q(wing is sample X Locale Database \214le.)-.275 E 5.5(#$)97 421.2 S -.198(TO)-5.5 G(G: LocaleDB.ms /main/7 1997/11/04 18:03:16 kaleb $) .198 E 5.5(#X)97 433.2 S(Locale Database Sample for ja_JP)-5.5 E(.euc) -1.221 E(#)97 445.2 Q(#)97 469.2 Q 22(#X)97 481.2 S(LC_FONTSET cate)-22 E(gory)-.165 E(#)97 493.2 Q(XLC_FONTSET)97 505.2 Q 22(#f)97 517.2 S (s0 class \(7 bit ASCII\))-22 E 11.308(fs0 {)97 529.2 R 48.598 (charset ISO8859-1:GL)124.5 541.2 R 62.029(font ISO8859-1:GL;)124.5 553.2 R(JISX0201.1976-0:GL)2.75 E(})97 565.2 Q 22(#f)97 577.2 S (s1 class \(Kanji\))-22 E 11.308(fs1 {)97 589.2 R 48.598 (charset JISX0208.1983-0:GL)124.5 601.2 R 62.029 (font JISX0208.1983-0:GL)124.5 613.2 R(})97 625.2 Q 22(#f)97 637.2 S (s2 class \(Half Kana\))-22 E 11.308(fs2 {)97 649.2 R 48.598 (charset JISX0201.1976-0:GR)124.5 661.2 R 62.029 (font JISX0201.1976-0:GR)124.5 673.2 R(})97 685.2 Q 22(#f)97 697.2 S (s3 class \(User De\214ned Character\))-22 E 2.75(#f)97 709.2 S 3.058 (s3 {)-2.75 F 22(#c)97 721.2 S 48.598(harset JISX0212.1990-0:GL)-22 F F1 (4)285.25 768 Q EP %%Page: 5 7 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF 2.75 (XL)72 52 S(ocale Database De\214nition)-2.75 E(X11, Release 6.4)218.435 E/F2 11/Times-Roman@0 SF 22(#f)97 84 S 62.029(ont JISX0212.1990-0:GL)-22 F 2.75(#})97 96 S(END XLC_FONTSET)97 108 Q(#)97 132 Q 22(#X)97 144 S (LC_XLOCALE cate)-22 E(gory)-.165 E(#)97 156 Q(XLC_XLOCALE)97 168 Q 37.598(encoding_name ja.euc)97 192 R 49.203(mb_cur_max 3)97 204 R 3.993 (state_depend_encoding F)97 216 R(alse)-.165 E 19.877 (wc_encoding_mask \\x00008080)97 240 R 47.971(wc_shift_bits 8)97 252 R 22(#c)97 276 S(s0 class)-22 E 10.087(cs0 {)97 288 R 62.029(side GL:Def) 124.5 300 R(ault)-.11 E 52.25(length 1)124.5 312 R 21.098 (wc_encoding \\x00000000)124.5 324 R 25.982(ct_encoding ISO8859-1:GL;) 124.5 336 R(JISX0201.1976-0:GL)2.75 E(})97 348 Q 22(#c)97 360 S (s1 class)-22 E 10.087(cs1 {)97 372 R 62.029(side GR:Def)124.5 384 R (ault)-.11 E 52.25(length 2)124.5 396 R 21.098(wc_encoding \\x00008080) 124.5 420 R 25.982(ct_encoding JISX0208.1983-0:GL;)124.5 444 R (JISX0208.1983-0:GR;\\)2.75 E(JISX0208.1983-1:GL; JISX0208.1983-1:GR)207 456 Q(})97 468 Q 22(#c)97 492 S(s2 class)-22 E 10.087(cs2 {)97 504 R 62.029(side GR)124.5 516 R 52.25(length 1)124.5 528 R 19.866 (mb_encoding )124.5 540 R(\\x8e)2.75 E 21.098 (wc_encoding \\x00000080)124.5 564 R 25.982 (ct_encoding JISX0201.1976-0:GR)124.5 588 R(})97 600 Q 22(#c)97 624 S (s3 class)-22 E 2.75(#c)97 636 S 1.837(s3 {)-2.75 F 22(#s)97 648 S 62.029(ide GL)-22 F 22(#l)97 660 S 52.25(ength 2)-22 F 22(#m)97 672 S 19.866(b_encoding )-22 F(\\x8f)2.75 E 2.75(##)97 684 S (if HasWChar32)-2.75 E 22(#w)97 696 S 21.098(c_encoding \\x20000000)-22 F 2.75(##)97 708 S(else)-2.75 E 22(#w)97 720 S 21.098 (c_encoding \\x00008000)-22 F F1(5)285.25 768 Q EP %%Page: 6 8 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF 2.75 (XL)72 52 S(ocale Database De\214nition)-2.75 E(X11, Release 6.4)218.435 E/F2 11/Times-Roman@0 SF 2.75(##)97 84 S(endif)-2.75 E 22(#c)97 96 S -1.518(t_encoding JISX0212.1990-0:GL;)-22 F(JISX0212.1990-0:GR)2.75 E 2.75(#})97 108 S(END XLC_XLOCALE)97 132 Q F1 2.75(7. Refer)72 159.6 R (ence)-.198 E F2([1])72 178.8 Q/F3 11/Times-Italic@0 SF (ISO/IEC 9899:1990 C Langua)2.75 E .22 -.11(ge S)-.11 H(tandar).11 E(d) -.407 E F2([2])72 194.4 Q F3 2.75(XL)2.75 G -.11(og)-2.75 G(ical F).11 E (ont Descriptions)-1.155 E F1(6)285.25 768 Q F0 531.38(-- --)0 795 R EP %%Trailer end %%EOF XmHTML-1.1.10/docs/PaxHeaders.1031/README.gzf0000644000175000001440000000013212613377377016207 xustar000000000000000030 mtime=1445854975.084545878 30 atime=1445854975.084545878 30 ctime=1445854975.084545878 XmHTML-1.1.10/docs/README.gzf0000644000175000001440000005107112613377377015613 0ustar00chrisusers00000000000000This file: README for gzf Contents -------- 1. Introduction 2. Why an alternative GIF format? 3. GZF Compressed Raster Data 4. GIF -> GZF conversion 5. GIF LZW -> compress LZW Translation 6. Decoding GIF LZW raster data using the LZWStream package 7. Programming Example 8. Using the LZWStream package in your own applications 9. Using gif2gzf to convert gif images to gzf images 10. Reading GZF Images 11. License 12. Author, contact information and where to get it 1. Introduction --------------- GZF is a graphics format very similar to CompuServe's GIF graphics format. The Gif graphics format has been around since 1987, when CompuServe published the Graphics Interchange Format definition (also known as GIF87a). It defines an open standard for exchanging graphics, in which the image data is stored in a compressed raster format. The problem with the GIF specification lies in the compression method that is used to compress and decompress the image data. The Lempel-Ziv-Welch algorithm used for both compression *and* decompression is patented by Unisys under US patent no. 4,558,302. Unisys claims to only have found out of the use of LZW in the gif specification in 1993 (although there are strong indications they have known since 1989) and since then they are denying the use of LZW without a license in all types of both freeware and commercial software. Their point of view regarding the use of LZW in freeware is a totally outrageous one: it requires writers of freeware to obtain a license (at the price of 1,000$ in 1997) and to give Unisys $0.10 for every copy of their software that is used. The situation for commercial software doesn't differ much and is in some aspects even worse. If you are writing a commercial software library, you must obtain a 1,000$ license from Unisys before you can even begin to think about selling your product. And even if you have a license, you can *only* sell your product to other users when they have also obtained a license from Unisys at the same price... Clearly, Unisys doesn't know what it is doing. If they pursue this policy it will mean the end of GIF. The GZF format described in this document does not suffer from this decrepancy in the GIF specification, while keeping the required changes to the GIF format to a minimum. In fact, the only difference between GZF and GIF is the format of the compressed data. The GZF format stores the compressed raster data in the deflate format (as described in RFC 1951). This format is used in various public domain compression packages such as zlib, gzip and Info-Zip. We have chosen to use zlib as a way to achieve compression and decompression of the raster data, since zlib is the only library with the most open license. The zlib license allows usage of zlib in both freeware and commercial software without requiring any license or licensing fees. Both the gzip and Info-Zip license allow use of their algorithms in freeware without a license but restrict the use for commercial purposes. 2. Why an alternative GIF format? --------------------------------- Since the GIF controversy first surfaced, there have been several attempts to define a new GIF format, but all have been abandoned in favor of the PNG graphics format. This PNG format is superior to the GIF format, but it is not a replacement for the GIF format. Therefore a number of features of the GIF format are not supported by the PNG format. One of the most eye-catching features of the GIF specification which is not present in the current PNG specification is that a GIF image can contain multiple images in a single file. When these images are displayed sequentially, an animation results. Since Netscape introduced support for these GIF animations, they have come to become a widely used element on the World Wide Web, where they are used to flourish otherwise static HTML documents. While Netscape made a strong marketing move by adding animated GIF support to their browser, it has also prevented a rapid replacement of the GIF image format with the PNG image format. Netscape is probably a company which can afford a LZW license, but many software developers can not. The only way in which many software developers can still support GIF images while not required a LZW license is an alternative GIF format. The GZF format described in this document provides this alternative. The routines contained with the GZF code allow developers to create and read GZF images, and, more important, it also provides a way to read GIF images without requiring a LZW license. 3. GZF Compressed Raster Data ----------------------------- The raster data in the GZF image format is compressed into the ``deflate'' data format. This format is described in rfc1951.txt, of which the Abstract is shown below: This specification defines a lossless compressed data format that is compatible with the widely used GZIP utility. The format includes a cyclic redundancy check value for detecting data corruption. The format presently uses the DEFLATE method of compression but can be easily extended to use other compression methods. The format can be implemented readily in a manner not covered by patents. Especially the last sentence is of importance, it means that any software developer can write a deflate compressor/decompressor without having to fear a lawsuit. To remain compliant with the Gif specification, the compressed raster data is stored in blocks of 0 to 255 bytes preceeded with a character count. A block with a zero byte count terminates the raster data stream. 4. GIF -> GZF conversion ------------------------ To convert existing gif images to gzf images, the following conversion method is proposed: 1. Compare the first six bytes of the file to either GIF87a or GIF89a. Gif images are always identified by one of these magic numbers. If the file is a gif file, proceed and else terminate; 2. read and write the screen descriptor; 3. read and write a possibly global colormap; 4. read and write all extension blocks up to the first compressed raster data 5. read a compressed raster data block 6. convert the compressed raster data to a format understood by the standard Unix "compress" utility; 7. uncompress the converted, but still compressed, raster data by feeding it to the "compress" utility; 8. compress the uncompressed raster data using the zlib function compress and store the returned, compressed raster data in a temporary buffer; 9. repeat steps 4 till 8 until a block with a zero byte count is encountered; 10.write the temporary buffer in blocks of 256 bytes; 11.write the gif terminator character and terminate conversion. The "compress" utility mentioned in steps 6 and 7 uses a slightly modified version of the LZW algorithm, which is also patented. By converting the compressed data rather than uncompressing it using a LZW algorithm introduces a performance penalty, but it *ensures* that your application does not have to use the dreaded LZW algorithm but can instead rely on the presence of the "compress" utility. You are almost guarenteed of the presence of this utility since it is a standard tool on *every* Unix distribution. If for some reason, compress should not be present on your system, the public domain compress and gzip compression tools can mimic uncompress. See the Translation section below for more details. The gif2gzf source code implements the above method. 5. GIF LZW -> compress LZW Translation -------------------------------------- The translation process takes care of some minor differences between the GIF compressed data and the compress compressed data. The GIF LZW format uses dynamic clear code and end-of-data code whereas compress uses a static clear code and doesn't have an end-of-data code. The dynamic stream codes in GIF are determined by the value of the "code size". This code size is a value indicating the minimum number of bits required to represent the set of actual pixel values. The value of clear code is given by ^2, and the end-of-data code is defined as +1. The first available compression code value is +2. The main difference however concerns the minimum code size specification in compressed data. This number controls the generation of the LZW codes in the compressed data. While GIF images use anything between 3 to 12 bits, compress only works between 8 and 16 (maximum codeSize for compress, the minimum-maximum is 12). This means that the conversion process must make a distinction between the code size: anything below 8 and 8 or above. The latter case is quite easy: the gif LZW codes are simply copied to compress output with possible adjustment of the aforementioned codes. The first case involves a lot more work as the 2 to 7 bits LZW codes need to be transformed to 8 bit codes. This conversion process actually comes pretty close to violating the LZW patent, but since only the LZW codes are read, adjusted and packed again the gzf gif decoder is patent-safe. 6. Decoding GIF LZW raster data using the LZWStream package ----------------------------------------------------------- The gzf source code comes with a package that uncompresses the LZW compressed raster data in gif images by using the "compress" utility. Proper use of this package requires you to understand the GIF format (the Gif87a and Gif89a specification can be found in the docs directory). The LZWStream package only decodes gif raster data and does not provide a way to read an entire gif image. An LZWStream is created by using the LZWStreamCreate function: LZWStream *LZWStreamCreate(ib, zCmd) ImageBuffer *ib; char *zCmd; ImageBuffer is a memory object which is used to mimic file access but in memory, which can provide a substantial speedup. An ImageBuffer is created by using the ImageFileToBuffer(char *file) function, where "file" represents the file that is to be loaded. zCmd is the name of the "uncompress" program that is to be used. If NULL is specified, the LZWStream package will default to "uncompress". This argument can be used to specify an alternative LZW decoder, such as gzip. When LZWStreamCreate returns successfully, you need to set two read functions: readOK and getData. The proto's for these functions are: size_t (*readOK)(ImageBuffer*, unsigned char*, int); size_t (*getData)(ImageBuffer*, unsigned char*); The code in buffer.c offers two default functions: size_t ReadOK(ib, buf, len) ImageBuffer *ib; unsigned char *buf; int len; This function copies len characters from ib to buf and returns the number of characters copied. It returns 0 when the end of the current ImageBuffer is reached. size_t GifGetDataBlock(ib, buf) ImageBuffer *ib; unsigned char *buf; This function retrieves an the contents of an entire block of data found in a gif image. Gif data blocks consist of a single byte with a character count, followed by the specified number of bytes. The above function reads the character count and copies the requested number of bytes in the given destination buffer. An ImageBuffer is destroyed by using the FreeImageBuffer() macro. Feel free to replace these default functions with your own readers. When you have reached the point were you want to obtain the decompressed raster data, you *must* call the following function: int LZWStreamInit(lzw) LZWStream *lzw; lzw is the LZWStream returned by LZWStreamCreate. This function returns 1 when the stream was successfully initialized or something else when an error occurs. The next step is to convert the gif LZW compressed raster data to the LZW format used by "compress". This is done by the following function: void LZWStreamConvert(lzw) LZWStream *lzw; When this function returns, the data has been converted but not yet uncompressed. The LZWStream package offers two functions to do this: unsigned char *LZWStreamUncompress(lzw, len) LZWStream *lzw; int *len; int LZWStreamFillBuffer(lzw, data, size) LZWStream *lzw; unsigned char *data; int size; The first function decompress the converted data and returns it in an allocated buffer. "len" is the size of the uncompressed data. The second function also decompresses the converted data but allows you to read it in seperate chunks. "size" is the number of bytes that should be read and "data" is the destination buffer. You should make sure that the specified destination buffer is large enough to hold "size" bytes. This function returns the number of bytes copied into "data". The final step is to destroy the LZWStream: void LZWStreamDestroy(lzw) LZWStream *lzw; This function removes any temporary files that were created and cleans up the memory used by the given stream. It does not destroy the ImageBuffer contained in it. When this function returns, "lzw" is no longer valid. As a final note: the LZWStream structure contains a field called err_msg. This field contains an error message whenever an error occured. You can choose to display this message or ignore it. You may *not* free this message, it points to a static data space. 7. Programming Example ---------------------- The following example demonstrates a possible use of the ImageBuffer and LZWStream objects. #include "ImBuffer.h" /* ImageBuffer structure & functions */ #include "LZWStream.h" /* LZWStream functions */ unsigned char* readGifImage(char *file) { ImageBuffer *ib; LZWStream *lzw; unsigned char c, buf[280]; ib = ImageFileToBuffer(file); /* read and check gif magic */ ReadOK(ib, &buf, 6); { [ verify gif magic ] } /* read logical screen descriptor */ ReadOK(ib, buf, 7); [ pull out necessary image attributes ] [ read the global colormap using the current ImageBuffer ] while(1) { /* read block identifier */ ReadOK(ib, &c, 1); /* gif terminator */ if(c == ';') break; /* a gif extension block */ if(c == '!') { /* get extension type */ ReadOK(ib, &c, 1); [ deal with it ] continue; } if(c != ',') continue; /* not a valid start character */ /* read image descriptor */ ReadOK(ib, buf, 9); [ pull out necessary information ] [ read a possible local colormap, again using the ImageBuffer ] /* create a new stream object */ lzw = LZWStreamCreate(ib, NULL); /* initialize uncompression */ LZWStreamInit(lzw); /* set read functions */ lzw->readOK = readOK; lzw->getData = GifGetDataBlock; /* convert data */ LZWStreamConvert(lzw); /* get uncompressed data */ data = LZWStreamUncompress(lzw, &len); /* destroy stream */ LZWStreamDestroy(lzw); /* we have our image */ break; } /* free the ImageBuffer */ FreeImageBuffer(ib); /* and return the image data */ return(data); } The above is a very simple example which doesn't care about errors and interlaced images. Obvious enhancements would be to add error checking on every ReadOK call, dealing with multiple images and comparing the size of the uncompressed raster data with the dimensions of this image. See gif2gzf.c for a much more extensive example. 8. Using the LZWStream package in your own applications ------------------------------------------------------- To use the LZWStream package in your own application, you need the following files: - LZWStream.h: required typedefs and function prototypes - LZWStream.c: the LZW decompressor - ImBuffer.h : ImageBuffer typedefs and function prototypes - ImBuffer.c : ImageBuffer routines. Compile LZWStream.c with -DNO_XMHTML defined. Just add these files to your Makefile and you're done. 9. Using gif2gzf to convert gif images to gzf images ---------------------------------------------------- The gif2gzf utility converts a gif image to a gzf image. This tool is capable of converting GIF87a, GIF89a, multi-image GIF87a, multi-image GIF89a and multi-image GIF89a with the NETSCAPE2.0 loop extension. The syntax to gif2gzf is as follows: gif2gzf [-v -p] Where: giffile: name of giffile to convert gzffile: name of destination file -v: verify deflate compression by inflating the deflate compressed data -p: show progress count. Can be usefull when converting animated gifs. gif2gzf is not capable of doing batch conversion, but you can write a simple script that does just this. If you are using a shell which knows the ``foreach'' command, you can do batch conversion on the command line using the following sequence of commands: hobbes [87][13:10] [/home/newt/src/libs/gzf/pics] >foreach file ( gif/*gif ) foreach? ../gif2gzf $file $file:r.gzf foreach? end gif/emailed.gif -> gif/emailed.gzf Converted frame: 53 Size reduction: 29.72% gif/techsup.gif -> gif/techsup.gzf Converted frame: 0 Size reduction: 4.21% .... hobbes [88][13:10] [/home/newt/src/libs/gzf/pics] > That's about it. 10. Reading GZF Images ---------------------- Reading a GZF image is very similar to reading a GIF image. As was mentioned in the introduction, the only difference between these formats is the way in which the raster data is stored. The following piece of code is based on giftoppm and shows how to decompress and convert the GZF raster data to the actual image data. static unsigned char * ReadGZFImage(ImageBuffer *ib, int len, int height, int interlace) { int xpos = 0, ypos = 0, nread, foo; static unsigned char *image, *data; register unsigned char *dp, *dPtr; /* uncompress GZF image data */ data = UncompressGZFData(ib, len*height, &nread); /* sanity check */ if(data == NULL || nread == 0) return(NULL); dPtr = data; /* * interlaced image. Need to alternate uncompressed data to create the * actual image. */ if(interlace) { int pass = 0, step = 8; int pass = 0, step = 8; register int i; /* allocate image storage */ image = (unsigned char *)calloc(len * height, sizeof(char)); for(i = 0; i < height; i++) { if(ypos < height) { dp = &image[len * ypos]; for(xpos = 0; xpos < len; xpos++) *dp++ = *dPtr++; } if((ypos += step) >= height) { if (pass++ > 0) step /= 2; ypos = step / 2; } } /* no longer needed */ free(data); return(image); } /* uncompressed data is same as image data */ return(data); } The following routine does the actual decompression: /* * dsize is the size of the decompressed image data and nread will be * updated to reflect the actual no of bytes uncompressed. */ static unsigned char* UncompressData(ImageBuffer *ib, int dsize, int *nread) { static unsigned char *output_buf; unsigned char buf[256], c; z_stream stream; int err; *nread = 0; /* Skip code size, it's never used */ (void)ReadOK(ib, &c, 1); /* allocate output buffer */ output_buf = (unsigned char*)calloc(dsize+1, sizeof(char)); /* initialize inflate stuff */ stream.zalloc = Z_NULL; stream.zfree = Z_NULL; if((err = inflateInit(&stream)) != Z_OK) { fprintf(stderr, "inflateInit failed: %s\n", stream.msg); free(output_buf); return(NULL); } /* keep uncompressing until we reach the end of the compressed stream */ while(True) { /* next compressed block of data */ stream.avail_in = GifGetDataBlock(ib, buf); stream.next_in = buf; /* update output buffer */ stream.next_out = output_buf + stream.total_out; stream.avail_out = dsize - stream.total_out; /* uncompress it */ err = inflate(&stream, Z_PARTIAL_FLUSH); /* check return value */ if(err != Z_OK && err != Z_STREAM_END) { fprintf(stderr, "inflate failed: %s\n", stream.msg); free(output_buf); return(NULL); } /* and break if inflate has finished uncompressing our data. */ if(err == Z_STREAM_END) break; } /* * Skip remaining data. The deflate format signals the end of compressed * data itself, so we never reach the zero-data block in the above loop. */ while((GifGetDataBlock(ib, buf)) > 0); *nread = stream.total_out; /* successfull uncompress, return uncompressed image data */ return(output_buf); } 11. License ----------- Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. This software is provided "as is" without express or implied warranty. Copyright (C) 1994-1997 by Ripley Software Development All Rights Reserved 12. Author, contact information and where to get it. ---------------------------------------------------- The LZWStream package is written and maintained by Koen D'Hondt and is originally part of the XmHTML Widget, a LGPL'd Motif widget capable of displaying HTML 3.2 documents. This widget has built-in support for various types of images including gif and animated gif images. If you have any comments, encounter problems, suggestions or just want to tell us how great this package is ;-) feel free to contact me. ripley@xs4all.nl Koen D'Hondt Ripley Software Development. email: ripley@xs4all.nl URL : http://www.xs4all.nl/~ripley XmHTML-1.1.10/docs/PaxHeaders.1031/progressive.txt0000644000175000001440000000013212613377377017653 xustar000000000000000030 mtime=1445854975.085545877 30 atime=1445854975.085545877 30 ctime=1445854975.085545877 XmHTML-1.1.10/docs/progressive.txt0000644000175000001440000006113312613377377017257 0ustar00chrisusers00000000000000This file: progressive.txt This document describes the general guidelines for implementing progressive object loading in XmHTML. In particular it focuses on progressive image loading but contains a number of general ideas as well. The implementation itself is of a very asynchronous nature, so all routines *must* be fully re-entrant. Table Of Contents ----------------- 0. Terminology 1. Progressive Image Loading 2. User Function Description 2.1 The get_data() function 2.2 The end_data() function 3. Progressive Loader Context 4. XmHTML's Image API and Progressive Image Loading 5. Implementing Progressive Image Loading in XmHTML 6. Changes to XmHTML in general 7. Changes to the Decoders 8. Changes to the image composition routines 0. Terminology -------------- alpha channel: a series of pixel values in an image used to compute partial pixel transparency. Used to provide fade in/out effects. An alpha channel can be seen as viewing the actual image thru ``foggy'' glasses. clipmask: a ``window'' thru which the image is seen. A clipmask is used by XmHTML to make images appear transparent. colorspace: a term used to describe how colors in an image are composed. In the X window system, a color is composed of three components: red, green and blue (RGB). These components can be viewed as a cube where each of the principal axis's represent a component of a color (hence the term colorcube). A color is thus identified by its spatial position in this colorspace and is uniquely defined by its three components. This colorcube is the RGB colorspace. The indexed colorspace is a 1D representation of the RGB colorspace, in which each RGB triplet is assigned a unique number. As such it is actually nothing more than a lookup table. The grayscale colorspace is a colorcube in which all principal axis's coincide and thus forming a 1D colorspace. This 1D colorspace is not equal to the indexed colorspace since the components of a color in this one-dimensional colorspace all have the same value and hence the size of this colorspace is three times smaller than the indexed colorspace. histogram: a table representing the color usage in an image. Used to perform color reduction. interlaced: a way to store image data. An interlaced image is made up of a number of planes (which can be seen as venetian blinds), where each plane contains a portion of the final image. The final image is created by laying all planes on top of each other (closing the blinds). Interlacing is used to offer a preview of an image while it is being created (fancy image viewers can convert each interlaced plane to a full image by expanding pixels, giving the look of a blocky image which is refined with each pass. Other cool use of interlacing allows the storage of a background image which becomes visible on the last pass). scanline: a single line of image data. quantization: reduction of the number of colors in an image. Also known as dithering. 1. Progressive Image Loading ---------------------------- Progressive Image reading is supported for the following image types and colorspaces: - GIF and GZF (all types), all colorspaces; - JPEG, indexed & grayscale, RGB when using a fixed palette on direct-indexed displays (TrueColor/DirectColor); - PNG, indexed & grayscale, RGB when using a fixed palette on direct-indexed displays (TrueColor/DirectColor). It is not supported for the body image in a HTML document. Progressive image loading can only start when the colormap used by the image has been read *and* if it does not use more colors than allowed. In all other cases (except PNG images with a histogram chunk), progressive reading is impossible as in advance we do not know how many colors the image will be using and thus any attempt to perform color quantization is useless. The general outline is as follows: 1. Set up a function which is able to transfer a given amount of data from the image stream to the progressive loader. This function must return DATA_ABORT when it wants to abort progressive reading. It must return DATA_SUSPEND when at the time of call newly received data isn't sufficient to comply with the requested amount of data while it must return a positive number when the requested amount of data can be and is provided; (this function will be referred to as get_data()) 2. obtain required image information (width, height, no of colors, colormap, type of colorspace); 3. Check colorspace and size of colormap. When we have an RGB colorspace, set up a default colormap (with evenly spaced RGB components). If the image contains more than the allowed no of colors, switch to default processing here. For PNG images with a histogram present, switch libpng into dithering mode. Obtain the number of passes required if the image is interlaced. The number of scanlines equals the height of the image. 4. allocate destination memory and allocate all colors used by the image. Allocate an XImage which will receive the data while the image is being read. Allocate a destination drawable which is to receive the processed data. This destination drawable (useally a Pixmap for the X Window System) is initially initialized to reflect the current background setting. When the image is transparent, allocate a fully opaque clipmask. When the image contains an alpha channel, obtain the background color or the colormap used by the background image. Note on color allocation: for transparent images, all colors can be allocated before step 5 begins. For alpha channel images, colors can only be allocated when requested as proper alpha channel processing involves color manipulation at the component level. 5. Start progressive reading. In general this will be done by code along the following lines: Boolean done = False; while(pass < passes_required && !done) while(scanline < image_scanlines && !done) { switch(read_scanline(&data)) { case DATA_ABORT: done = True; break; case DATA_END: case DATA_SUSPEND: [set a status flag according to the return value of the read_scanline() function so XmHTML will known what to do when the scanline is to be read] break; default: transfer_scanline(data); [update status flag]; break; } } done; done; The read_scanline() function is an image-specific function which needs to be able to read both regular and interlaced images. For interlaced images, it must translate each scanline read to a scanline covering the entire width of the image (which possibly includes combining a previous scanline with the current scanline). When the image being processed is an RGB image and a fixed palette is present, it must also perform a mapping from RGB colorspace to indexed colorspace. When this function requires more data, it will call the get_data() function mentioned in step 1. The transfer_scanline() function transfers each scanline to the frame buffer. For all images, it must save each scanline for reuse when the image has been read. For transparent images, it must update the clipmask to reflect the transparent pixels in the scanline being processed. When the image contains an alpha channel, it must combine the background RGB values with the RGB values corresponding to each pixel in the scanline. When this has been performed, the corresponding pixel value is stored in the XImage. When the scanline has been processed, this routine transfers the updated portion of the XImage to the destination drawable. When the read_scanline() function returns DATA_ABORT, progressive reading is terminated and the image is possibly replaced with the "delayed image" icon (a boomerang). The actual implementation will be slightly more complicated as each loop will be performed by different functions which allow a breakdown of progressive image loading into different chunks at a time. This will become clear in the Progressive Loader Context description below. 6. Terminate progressive reading. The accumulated, decoded, image data stored by the transfer_scanline() function is promoted to the final image data. This final image data will then be available for reuse when the image needs to be recreated. Any allocated intermediate storage and structures are to be destroyed. During this step a user-installed function can also be called to signal the caller that the image has been processed (this function will be referred to as end_data()). It is advisable for the user to install such a function as this is the only way by which a user will be informed about the removal of this PLC, regardless of the current state of this PLC. 2. User Function Description ---------------------------- 2.1 The get_data() function This is a user-installed function used by a progressive loader to obtain an amount of data from a data stream. Proposed prototype: typedef int (*XmHTMLGetDataProc)(XmHTMLPLCStream, XtPointer); Where: XmHTMLPLCStream *stream: a structure containing data about the data stream from which data is requested. This structure should include at least the following information: - a user_data field so the user can identify this stream; - a count of the number of bytes received so far. This number should be used to compute the proper offset in the real data stream. It can be used for backtracking purposes as well - a minimum request size; - a maximum request size; XtPointer buffer: a pre-allocated destination buffer. Data requested by this function is to be placed in this buffer. The number of bytes copied into this buffer *must* lie between the minimum and maximum request size; Possible return values: STREAM_ABORT indicates progressive reading is to be aborted. Data copied into buffer is ignored. Depending on the amount of data received so far, the portion of the received image is either displayed or replaced by a "delayed image" icon. STREAM_SUSPEND indicates progressive reading should be suspended for the given context. Data copied into the buffer is ignored. When this value is returned, the progressive loader will call this function again at a later time. STREAM_END indicates no more data is available. This is *not* the same as returning STREAM_ABORT as in this case the progressive loader will consider the object loaded and act accordingly. the amount of bytes actually copied into buffer. This indicates that the requested amount of data was available and has been copied into the buffer. For obvious reasons, this value may *never* be larger than the maximum request size. Also it may not be smaller than the minimum request size. Please note that returning 0 is equivalent to returning STREAM_END. Proposed Resource: XmNprogressiveReadProc Note1: For performance reasons, the amount of bytes copied by this function should not differ too much from the requested amount of data. XmHTML will calculate an optimal length as to reduce the number of function calls (and data backtracking as well). This length is very likely to be the size of one or more scanlines at a time (how do we do this when the image data is compressed???). Note2: Although the term image is used frequently, this function will also be used by XmHTML for progressive loading of other data streams (such as a HTML document itself, which is the next logical step...). Therefore it's implementation should be independent on the type of object that is to being loaded. 2.2 The end_data() function This is a user-installed function, called when the entire object has been processed or when the get_data() function returns DATA_ABORT. Proposed prototype: typedef void (*XmHTMLEndDataProc)(XmHTMLPLCStream, XtPointer, int, Boolean) Where: XmHTMLPLCStream *stream: same structure as above; XtPointer object_data: information about the loaded object. This argument can be NULL. int object_type: a number identifying the type of object_data. Currently this can only be XmIMAGE, although other values are very well possible in the future. When this argument has the value XmIMAGE, the object_data argument represents a pointer to a structure of type XmImageInfo. This is a read-only structure and can be used by the caller for caching purposes. Boolean success: This argument indicates whether or not progressive loading has successfully completed. When it is False, progressive loading has been aborted by an internal error or it was aborted explicitly. If there are any outstanding PLCStreams when a new document is set into the widget, this function will be called for each of the remaining PLCStreams with success == False. It is the callers responsibility to remove all resources that were allocated to this PLCStream. Proposed Resource: XmNprogressiveEndProc Note: This function may not return a value. A convenience function for aborting progressive image loading should also be provided: XmHTMLImageAbortProgressiveLoading(Widget html); This function should terminate and remove any outstanding PLCStreams. Similar functions should be added for each PLC type supported, e.i., for progressive loading of documents, the following convenience function should be added: XmHTMLTextAbortProgressiveLoading(Widget html); 3. Progressive Loader Context ----------------------------- In order for progressive loading to work properly, the progressive loader must maintain information about the object that is being loaded. This information is grouped in a special structure, referred to as the Progressive Loader Context (or PLC for short). XmHTML needs to maintain a list of PLC's internally and activate each one in turn. The frequency with which XmHTML will check this list should be a user-adjustable time in milliseconds. A PLC is divided in two sections: object-specific data and PLC status information. For progressively loaded images, the object-specific data should be a pointer to a structure containing at least the following information: - an object identifier. This should be the first member for all object-specific structures stored in a PLC. - an identifier for the image being loaded (name or location); - the type of the image being loaded; - the type of colorspace for this image (COLOR_SPACE_INDEXED, COLOR_SPACE_GRAYSCALE, COLOR_SPACE_RGB); - transparency/alpha channel identified: TRANSPARENCY_NONE, TRANSPARENCY_BACKGROUND, TRANSPARENCY_ALPHA. - colormap used by this image and the number of colors in this image; - information on the current background setting; - width and height of this image; - depth of this image; - a buffer to contain all decoded image data (useally of size width*height); - a buffer to contain all image information mentioned in step 2; - for interlaced images, total number of passes required; - number of scanlines required on each pass; - an XImage; - a destination drawable; - if applicable, clipmask storage and drawable; - a field for containing gamma information; - for interlaced images, number of passes processed so far; - number of scanlines processed so far; - a to be defined number of fields specific for the image that is being loaded (used by the image-specific decoders). The second section should include at least the following information: - two pre-allocated buffers for use with the get_data() function: one is to be used for backtracking/row combining purposes while the other will be the destination buffer to the get_data() function; - number of bytes received so far; - number of bytes required; - information about the current status of this PLC: ACTIVE, SUSPENDED, ABORTED, COMPLETED; - a pointer to the user-installed get_data() function (provided by the new XmNprogressiveReadFunc resource); - last returned value of the get_data() function; - a pointer to the user-installed end_data() function (provided by the new XmNprogressiveEndFunc resource); - a field for storing user_data; The second section should also contain three pointers to image-specific functions. They are: - a pointer to a function for obtaining the image information mentioned in step 2 above; - a pointer for reading scanlines from an image; - a pointer to terminate/abort progressive image loading. It should also contain a pointer to the function that does the actual XImage composition. Finally it should also contain an identifier for the lastly activated function so XmHTML will known which function to call the next time a PLC is activated. Meaning of the status information flags: ACTIVE: indicates the PLC is active and that it should make a request for new data from the image stream the next time this PLC is activated; When the get_data() function is other than 0 or a positive number (reflecting the number of bytes copied into the buffer), the status of the PLC is changed to reflect the return value from this function (e.i., SUSPENDED when DATA_SUSPEND is received and ABORTED when DATA_ABORT is received). SUSPENDED: indicates the PLC has been suspended and that it should make the *same* request for new data from the image stream next time this PLC is activated; When the get_data() function returns DATA_OK, the status of the PLC is promoted to ACTIVE. ABORTED: indicates the PLC has been aborted and that it should either save the amount of data received so far or replace it with a "delayed image" icon. Calls the end_data() function. COMPLETED: indicates the PLC has received the entire image and that it should be terminated the next time this PLC is activated. When this happens, the image data stored in the PLC is transferred to corresponding internal XmHTML structures and the end_data() function is called. The last action performed by a PLC is to remove itself. 4. XmHTML's Image API and Progressive Image Loading --------------------------------------------------- To keep XmHTML's image API simple, progressive image loading can be achieved by adding one additional flag to the XmIMAGE option flags: XmIMAGE_PROGRESSIVE. A user_data field should also be added to the XmImageInfo structure. This allows a user to easily extend the function installed for the XmNimageProc resource to deal with both images already present locally and images that are being transferred from a remote site. An example implementation could be along the following lines: XmImageInfo *loadImage(Widget w, String image) { if(image in cache) return(cached image); if(image locally) return(XmHTMLImageDefaultProc(html, image, NULL, 0)); if(image remotely) { XmImageInfo *p_image; [set up a connection with the remote site and save its handle] p_image = (XmImageInfo*)calloc(1,sizeof(XmImageInfo)); p_image->url = strdup(image); p_image->options = XmIMAGE_PROGRESSIVE; p_image->user_data = (XtPointer)connection_handle; return(p_image); } [if we get here, the image is neither locally nor remotely, return either NULL or switch to delayed image loading if the connection is extremely slow]. } A corresponding get_data() function could be the following: int get_data(XmHTMLPLCStream *stream, XtPointer buffer) { int min_out, max_out, buf_pos; int length, bytes_avail; [obtain connection_handle from the context (user_data field). Probably involves getting a handle to the buffer used by the connection to store incoming data] if(connection broken) { [close connection and do other cleanup] return(XmPLC_STREAM_ABORT); } bytes_avail = [number of bytes received from connection so far] if(all data received from connection) { [close connection and do other cleanup] return(XmPLC_STREAM_END); } min_out = stream->min_out; /* minimum request size */ max_out = stream->max_out; /* maximum request size */ buf_pos = stream->total_in; /* bytes copied so far */ /* compute no of bytes to copy */ length = bytes_avail - buf_pos; /* more than min_size bytes available */ if(length > min_out) { /* check that we do not copy more than max_size bytes */ if(length > max_out) length = max_out; /* copy data from connection buffer to outgoing buffer */ memcpy(buffer, [connection buffer] + buf_pos, length); [possibly update the connection buffer to reflect the number of bytes copied as well] return(length); } else /* not enough data available yet */ return(XmPLC_STREAM_SUSPEND); } To prevent problems later on, none of the XmHTMLPLC context members may be used by the current PLC when this function returns. The only purpose of the XmHTMLPLCStream object is to keep the interface simple and to allow easy extension of the get_data() function without having the need to modify the get_data prototype. And a corresponding end_data() function could be: void end_data(XmHTMLPLCStream *stream, XtPointer object, int object_type, Boolean success) { [obtain connection_handle from the context, close this connection and do other cleanup] if(success == False) { [Progressive loading was aborted for whatever reason. Depending on the value of the stream->total_in value you can decide whether or not you want to keep the object data.] } if(object_type == XmIMAGE) { [either store object (which will be of type XmImageInfo) in a local cache or ignore it.] } [unknown/unsupported object_type, ignore] } As can be seen from the above example implementations it is very easy for a user to implement progressive image loading (apart from the connection routines involved). 5. Implementing Progressive Image Loading in XmHTML --------------------------------------------------- The implementation of progressive image loading in XmHTML requires a number of changes to the GIF, PNG and JPEG decoders and the image composition routines. Changes to the painter will not be required as a drawable will be present from the moment an image is to be loaded progressively. 6. Changes to XmHTML in general ------------------------------- Define the exact contents for a PLC and it's object data. Add routines to create, walk and destroy them. Walk the list of PLC's using a timer (with a user-adjustable interval?). All PLC's will be placed in a ringbuffer where the PLC walking routine calls the various functions in a PLC as they are necessary. 7. Changes to the Decoders -------------------------- These will be rather minimal: the GIF, GZF, PNG and JPEG decoders can already deal with interlaced images and already read their data a scanline at a time. they also contain seperate sections for obtaining the image information described in step 2 in the general outline. According to the PLC, the changes required are: - place the sections that are responsible for obtaining the image information in a seperate routine (if not already done). Determine if it is feasible to use these routines for both normal and progressive image loading. - place the scanline reading sections in seperate routines as well. Also determine the feasibility of using these routines for both normal and progressive image loading. - add routines that perform cleanup when progressive image loading is aborted or has ended. How this will work with the GIF workaround is a mystery at this moment. One way is to decode the GIF data using my workaround when a clearCode is received, but this will lead to a *considerable* delay when doing progressive image loading on fast connections. On slow connections it will not make that much difference. 8. Changes to the image composition routines -------------------------------------------- These will be rather large: actual image composition has to be split into seperate routines for several display depths (this is preferable for performance reasons?). - color allocation, XImage and drawable (and possibly clipmask as well) creation must be moved to the top instead of being one of the final stages; - set up routines to convert the image data to the format understood by an XImage. - vertical image scaling poses a problem. Horizontal is no problem as we are dealing with scanlines. Maybe vertical scaling should be used to compute an interval when performing the outerloop in step 5 of the general outline? - set up routines that copy the updated portion of the XImage to the destination drawable. It might be very wise to use the MIT-SHM extension if it's present. Also add code to update the screen directly (maybe use XPutImage directly on the display instead of XCopyArea from drawable to display?) - add a routine to perform cleanup when progressive image loading has been aborted. - add a routine to transform the data contained in a PLC to an XmHTMLImage structure and to update the information in the XmImageInfo structure representing the progressively loaded image. --- End of Document --- Author : Koen Date : Tue Jun 10 04:51:23 GMT+0100 1997 Revision : 1.1 Revision Date: Sat Jun 14 18:47:19 GMT+0100 1997 XmHTML-1.1.10/docs/PaxHeaders.1031/MACHINES0000644000175000001440000000013212613377377015654 xustar000000000000000030 mtime=1445854975.083545878 30 atime=1445854975.083545878 30 ctime=1445854975.083545878 XmHTML-1.1.10/docs/MACHINES0000644000175000001440000002026612613377377015262 0ustar00chrisusers00000000000000XmHTML has compiled and run successfully on the following systems: ----------------------------------------------------------- Linux hobbes 2.0.26 #3 Wed Nov 27 18:16:53 GMT+0100 1996 i586 XmHTML : 1.0.4, 1.0.5, 1.0.6 X version : X11R5 Motif ver. : 2.0.1 Compiler : gcc 2.7.2 CCopts : -g -funroll-loops -Wall -pipe -ansi defines : -D_BSD_SOURCE extra libs : -lXm -lXpm -lXmu -lXt -lXext -lX11 -lSM -lICE from : Koen D'Hondt (ripley@xs4all.nl) ----------------------------------------------------------- Unixware 2.1.1 XmHTML : 1.0.4 X version : X11R5 Motif ver. : 1.2.3 Compiler : gcc 2.7.2.1 CCopts : -g -funroll-loops -Wall -pipe -ansi defines : -DNEED_STRCASECMP -DSVR4 -DHAVE_MEMCPY extra libs : -lXm -lXpm -lXmu -lXt -lXext -lX11 -lsocket -lnsl from : Thanh Ma (tma@encore.com) ----------------------------------------------------------- HP-UX A.09.01 XmHTML : 1.0.4, 1.0.5 X version : X11R5 Motif ver. : 1.2.0 Compiler : c89, cc CCopts : -g -Aa defines : -D_HPUX_SOURCE -D_POSIX_SOURCE extra libs : -lXm -lXpm -lXmu -lXt -lXext -lX11 from : Koen D'Hondt (ripley@xs4all.nl) ----------------------------------------------------------- Linux hagbard 2.0.18 #3 Sat Nov 9 22:53:20 GMT 1996 i586 XmHTML : 1.0.4, 1.0.5, 1.0.6 X version : X11R6 Motif ver. : 2.0 Compiler : gcc 2.7.2 CCopts : -g -funroll-loops -Wall -pipe -ansi defines : -DDEBUG -D_BSD_SOURCE extra libs : -lXm -lXpm -lXmu -lXt -lXext -lX11 -lSM -lICE from : Dick Porter (dick@cymru.net) ----------------------------------------------------------- UnixWare 1.1.2 SVR4.2 XmHTML : 1.0.4 X version : X11R5 Motif ver. : 1.2.2 Compiler : cc CCopts : defines : extra libs : from : Valery Kravchuk (valera@itech.kiev.ua) ----------------------------------------------------------- UnixWare 1.1.2 SVR4.2 XmHTML : 1.0.6 X version : X11R5 Motif ver. : 1.2.2 Compiler : gcc 2.7.0 CCopts : -g -funroll-loops -Wall -pipe -ansi defines : -DDEBUG -DNEED_STRCASECMP -DSVR4 -DHAVE_MEMCPY extra libs : -lXm -lXmu -lXt -lXext -lX11 -lsocket -lgen -lnsl -z nodefs from : Valery Kravchuk (valera@itech.kiev.ua) ----------------------------------------------------------- IRIX morgaine 6.4-ALPHA-1263473920 12182304 IP22 XmHTML : 1.0.6 X version : X11R6 Motif ver. : 1.2.4 Compiler : cc 7.10 (Mongoose) CCopts : -woff 1048 Turn off warning about converting between pointer-to-object and pointer-to-function (format.c:501). defines : extra libs : -lXm -lXt -lXext -lX11 from : Richard Offer (offer@sgi.com) ----------------------------------------------------------- IRIX 5.3 IP22 XmHTML : 1.0.6 X version : X11R5 Motif ver. : 1.2 Compiler : gcc 2.7.0 CCopts : -g -funroll-loops -Wall -pipe -ansi defines : -DDEBUG -D_BSD_SOURCE extra libs : -lXm -lXpm -lXmu -lXt -lXext -lX11 -lSM -lIC from : Jacob Dreyer (jacob@smedtech.com) ----------------------------------------------------------- HP-UX B.10.20 9000/735 XmHTML : 1.0.6 X version : X11R5 Motif ver. : 1.2.2 Compiler : gcc 2.7.2 CCopts : -g -funroll-loops -Wall -pipe -ansi defines : extra libs : -lXm -lXpm -lXmu -lXt -lXext -lX11 from : Jean-Michel NOURRIT (jm.nourrit@univ-reims.fr) ----------------------------------------------------------- Linux nova.campus.luth.se 2.1.26 #2 Sun Feb 9 01:30:56 CET 1997 alpha XmHTML : 1.0.8 X version : X11R6 Motif ver. : Lesstif v0.55 Compiler : gcc 2.7.2 CCopts : -g -funroll-loops -Wall -pipe -ansi defines : -DDEBUG -D_BSD_SOURCE -DHAVE_JPEG -D_POSIX_SOURCE extra libs : -lXm -lXpm -lXmu -lXt -lXext -lX11 -lSM -lICE from : Dick Porter (dick@cymru.net) ----------------------------------------------------------- UnixWare 1.1.2 SVR4.2 XmHTML : 1.0.10 X version : X11R5 Motif ver. : 1.2.2 Compiler : cc CCopts : -O -Xt defines : -DDEBUG -DNEED_STRCASECMP -DSVR4 -DSYSV386 -DI18N -DHAVE_MEMCPY extra libs : -lXm -lXpm -lXmu -lXt -lXext -lX11 -lsocket -lgen -lnsl -z nodefs from : Valery Kravchuk (valera@itech.kiev.ua) ----------------------------------------------------------- HP-UX A.09.07 XmHTML : 1.0.6 X version : X11R5 Motif ver. : Motif1.24 Compiler : cc CCopts : -Aa defines : -D_HPUX_SOURCE extra libs : -lXm -lXpm -lXmu -lXt -lXext -lX11 from : Shin Yang(yang@hpw3.ymp.gov) ---------------------------------------------------------- FreeBSD roesel 2.1.0-RELEASE XmHTML : 1.0.10 X version : X11R6 Motif ver. : LessTif 0.77 !! Compiler : gcc 2.6.3 CCopts : -ansi (no change from Koen's version really) defines : -DHAVE_JPEG extra libs : -lXm -lXpm -lXmu -lXt -lXext -lX11 -lSM -lICE -ljpeg from : Danny Backx ---------------------------------------------------------- LynxOS 2.3.0 080695 i386 XmHTML : 1.0.11 X version : X11R5 Motif ver. : Metro Link 2.3.3 Compiler : Cygnus GNU gcc 2.6 CCOpts : -g -pipe -Wall -mthreads defines : -DNEED_STRCASECMP extra libs : -lnetinet from : Milburn Taylor (mwt@starbase.neosoft.com) ---------------------------------------------------------- SCO_SV 3.2 i386 XmHTML : 1.0.21 X version : X11R5 Motif ver. : 1.2.4 Compiler : cc CCopts : defines : -DNDEBUG -DANSI -DANSICPP -DNeedFunctionPrototypes extra libs : -lXm -lXmu -lXt -lXpm -lX11 -lPW -lintl -lsocket -lm -lc from : Robin Schoenwald (flux@berlin.snafu.de) ---------------------------------------------------------- SunOS 5.5 i86pc XmHTML : 1.0.21 X version : X11R5 Motif ver. : 1.2.4 Compiler : cc CCopts : defines : -DNDEBUG -DSUN -DX11R5 -DANSI -DNeedFunctionPrototypes extra libs : -lXm -lXmu -lXpm -lXt -lX11 -lintl -lsocket -lnsl -lm -lc from : Robin Schoenwald (flux@berlin.snafu.de) ---------------------------------------------------------- Linux hobbes 2.0.26 #3 Wed Nov 27 18:16:53 GMT+0100 1996 i586 XmHTML : 1.0.21 X version : X11R6.1 Motif ver. : 2.0.1 Compiler : gcc CCopts : defines : -D_GNU_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE extra libs : -lXm -lXpm -lXmu -lXt -lXext -lX11 -lSM -lICE from : Koen D'Hondt (ripley@xs4all.nl) ---------------------------------------------------------- Linux hobbes 2.0.26 #3 Wed Nov 27 18:16:53 GMT+0100 1996 i586 XmHTML : 1.0.21 X version : X11R6.1 Motif ver. : LessTif 0.80 alpha Compiler : gcc CCopts : defines : -D_GNU_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE extra libs : -lXm -lXpm -lXmu -lXt -lXext -lX11 -lSM -lICE from : Koen D'Hondt (ripley@xs4all.nl) ---------------------------------------------------------- SunOS GSTE2Z 5.5.1 Generic_103640-08 sun4u sparc SUNW,Ultra-1 XmHTML : 1.1.0 X version : 11005 Motif ver. : 1002 Compiler : Sun SC4.0 18 Oct 1995 C 4.0 CCopts : -DSYSV -DSVR4 -xF -Wa,-cg92 defines : -DSVR4 -DSYSV -DVERSION=1100 -DMotifDefines -DNO_DEBUG extra libs : from : janni@stavanger.Geco-Prakla.slb.com ---------------------------------------------------------- Linux pallas 2.0.32 #2 Thu Nov 20 13:30:27 MET 1997 i686 unknown XmHTML : 1102 XmHTML-1.1.2b (28.2.1998) X11 : 11006, X11R6.3 Server XFree86 3.3.1 SuSE X Server ATI Xpert@work AGP Motif : 2000 OSF/Motif Version 2.0.1 From : Dusan Peterc, arahne@arahne.si ---------------------------------------------------------- [uname -rms] XmHTML : X version : Motif ver. : Compiler : CCopts : defines : extra libs : from : ---------------------------------------------------------- XmHTML-1.1.10/docs/PaxHeaders.1031/QUOTES0000644000175000001440000000013212613377377015505 xustar000000000000000030 mtime=1445854975.084545878 30 atime=1445854975.083545878 30 ctime=1445854975.084545878 XmHTML-1.1.10/docs/QUOTES0000644000175000001440000000321512613377377015106 0ustar00chrisusers00000000000000Some of the answers I received about a XmHTML survey I made in April 1997, during full alpha development. The question I asked was: What do you like about XmHTML? LOVE that parser :-) Susan Liebeskind It is rapidly developing by a high skilled professional. It's alive, unlike many commercial software! And there are some utilites and approaches inside it that are interesting for me as a programmer. I like GPL licensing also. Valery Kravchuk Being written by someone else :-) (seriously, I wouldnt be nearly so far advanced in such a short time if I was writing this) Dick Porter Its license. Like LessTif, it can be used by most anybody. Also it is the basis for lots of interesting stuff. Danny Backx It's license. Also like the fact that it is being updated frequently. Eric Marttila Rather simple to build in Roland Heinen It's flexability, and price. :) Ricky Ralston - License - HTML 3.2 compliant Nourrit Jean Michel License. Our application is commercial and every other HTML widget or hypertext help system either a) was free and prohibited use in a commercial application or b) was not free and was not ported to our operating system and source was not available. Milburn Taylor Thanks a lot for a brilliant implementation of a free HTML 3.2 widget !!! Jan Arvid Veggeberg Thanks for your hard work on the XmHTML widget and for making it available under the LPGL. Dave Brown XmHTML-1.1.10/docs/PaxHeaders.1031/iso-639.map0000644000175000001440000000013212613377377016352 xustar000000000000000030 mtime=1445854975.085545877 30 atime=1445854975.084545878 30 ctime=1445854975.085545877 XmHTML-1.1.10/docs/iso-639.map0000644000175000001440000010665712613377377015771 0ustar00chrisusers00000000000000 XmHTML-1.1.10/docs/PaxHeaders.1031/Framework.PS0000644000175000001440000000013212613377377016743 xustar000000000000000030 mtime=1445854975.083545878 30 atime=1445854975.083545878 30 ctime=1445854975.083545878 XmHTML-1.1.10/docs/Framework.PS0000644000175000001440000021506712613377377016356 0ustar00chrisusers00000000000000%!PS-Adobe-3.0 %%Creator: groff version 1.11 %%CreationDate: Mon Dec 15 09:40:46 1997 %%DocumentNeededResources: font Times-Roman %%+ font Times-Bold %%+ font Times-Italic %%DocumentSuppliedResources: procset grops 1.11 0 %%Pages: 14 %%PageOrder: Ascend %%Orientation: Portrait %%EndComments %%BeginProlog %%BeginResource: procset grops 1.11 0 /setpacking where{ pop currentpacking true setpacking }if /grops 120 dict dup begin /SC 32 def /A/show load def /B{0 SC 3 -1 roll widthshow}bind def /C{0 exch ashow}bind def /D{0 exch 0 SC 5 2 roll awidthshow}bind def /E{0 rmoveto show}bind def /F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def /G{0 rmoveto 0 exch ashow}bind def /H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /I{0 exch rmoveto show}bind def /J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def /K{0 exch rmoveto 0 exch ashow}bind def /L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /M{rmoveto show}bind def /N{rmoveto 0 SC 3 -1 roll widthshow}bind def /O{rmoveto 0 exch ashow}bind def /P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /Q{moveto show}bind def /R{moveto 0 SC 3 -1 roll widthshow}bind def /S{moveto 0 exch ashow}bind def /T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def /SF{ findfont exch [exch dup 0 exch 0 exch neg 0 0]makefont dup setfont [exch/setfont cvx]cvx bind def }bind def /MF{ findfont [5 2 roll 0 3 1 roll neg 0 0]makefont dup setfont [exch/setfont cvx]cvx bind def }bind def /level0 0 def /RES 0 def /PL 0 def /LS 0 def /MANUAL{ statusdict begin/manualfeed true store end }bind def /PLG{ gsave newpath clippath pathbbox grestore exch pop add exch pop }bind def /BP{ /level0 save def 1 setlinecap 1 setlinejoin 72 RES div dup scale LS{ 90 rotate }{ 0 PL translate }ifelse 1 -1 scale }bind def /EP{ level0 restore showpage }bind def /DA{ newpath arcn stroke }bind def /SN{ transform .25 sub exch .25 sub exch round .25 add exch round .25 add exch itransform }bind def /DL{ SN moveto SN lineto stroke }bind def /DC{ newpath 0 360 arc closepath }bind def /TM matrix def /DE{ TM currentmatrix pop translate scale newpath 0 0 .5 0 360 arc closepath TM setmatrix }bind def /RC/rcurveto load def /RL/rlineto load def /ST/stroke load def /MT/moveto load def /CL/closepath load def /FL{ currentgray exch setgray fill setgray }bind def /BL/fill load def /LW/setlinewidth load def /RE{ findfont dup maxlength 1 index/FontName known not{1 add}if dict begin { 1 index/FID ne{def}{pop pop}ifelse }forall /Encoding exch def dup/FontName exch def currentdict end definefont pop }bind def /DEFS 0 def /EBEGIN{ moveto DEFS begin }bind def /EEND/end load def /CNT 0 def /level1 0 def /PBEGIN{ /level1 save def translate div 3 1 roll div exch scale neg exch neg exch translate 0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin 10 setmiterlimit []0 setdash /setstrokeadjust where{ pop false setstrokeadjust }if /setoverprint where{ pop false setoverprint }if newpath /CNT countdictstack def userdict begin /showpage{}def }bind def /PEND{ clear countdictstack CNT sub{end}repeat level1 restore }bind def end def /setpacking where{ pop setpacking }if %%EndResource %%IncludeResource: font Times-Roman %%IncludeResource: font Times-Bold %%IncludeResource: font Times-Italic grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron /scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent /ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen /period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon /semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O /P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex /underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y /z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft /guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl /endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut /dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash /quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen /brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft /logicalnot/minus/registered/macron/degree/plusminus/twosuperior /threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior /ordmasculine/guilsinglright/onequarter/onehalf/threequarters /questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE /Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex /Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis /multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn /germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla /egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis /eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash /ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def /Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE /Times-Roman@0 ENC0/Times-Roman RE %%EndProlog %%Page: 1 1 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 15/Times-Bold@0 SF (X11R6 Sample Implementation Frame W)143.992 132 Q(ork)-1.125 E/F2 10 /Times-Italic@0 SF(Katsuhisa Y)256.925 180 Q(ano)-.92 E F0 -.18(TO) 241.185 198 S(SHIB).18 E 2.5(AC)-.35 G(orporation)-2.5 E F2 -.92(Yo) 255.615 222 S(shio Horiuc).92 E(hi)-.15 E F0(IBM Japan)265.92 240 Q EP %%Page: 2 2 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 9/Times-Roman@0 SF(Cop)72 279.6 Q(yright \251 1994 by T)-.09 E(OSHIB)-.162 E 2.25(AC)-.315 G (orporation)-2.25 E(Cop)72 291.6 Q(yright \251 1994 by IBM Corporation) -.09 E(Permission to use, cop)72 307.2 Q 1.17 -.585(y, m)-.09 H(odify) .585 E 2.25(,a)-.585 G(nd distrib)-2.25 E(ute this documentation for an) -.18 E 2.25(yp)-.135 G(urpose and without fee is hereby granted,)-2.25 E (pro)72 319.2 Q(vided that the abo)-.135 E .27 -.135(ve c)-.135 H(op) .135 E(yright notice and this permission notice appear in all copies.) -.09 E -.162(TO)4.5 G(SHIB).162 E 2.25(AC)-.315 G(orporation and)-2.25 E (IBM Corporation mak)72 331.2 Q 2.25(en)-.09 G 2.25(or)-2.25 G (epresentations about the suitability for an)-2.25 E 2.25(yp)-.135 G (urpose of the information in this document.)-2.25 E (This documentation is pro)72 343.2 Q(vided as is without e)-.135 E (xpress or implied w)-.135 E(arranty)-.09 E(.)-.585 E(Cop)72 415.2 Q (yright \251 1994 X Consortium)-.09 E (Permission is hereby granted, free of char)72 430.8 Q(ge, to an)-.162 E 2.25(yp)-.135 G(erson obtaining a cop)-2.25 E 2.25(yo)-.09 G 2.25(ft) -2.25 G(his softw)-2.25 E(are and associated documenta-)-.09 E (tion \214les \(the `)72 442.8 Q(`Softw)-.666 E(are')-.09 E ('\), to deal in the Softw)-.666 E(are without restriction, including w\ ithout limitation the rights to use,)-.09 E(cop)72 454.8 Q 1.17 -.585 (y, m)-.09 H(odify).585 E 2.25(,m)-.585 G(er)-2.25 E (ge, publish, distrib)-.162 E (ute, sublicense, and/or sell copies of the Softw)-.18 E (are, and to permit persons to whom)-.09 E(the Softw)72 466.8 Q (are is furnished to do so, subject to the follo)-.09 E (wing conditions:)-.225 E(The abo)72 482.4 Q .27 -.135(ve c)-.135 H(op) .135 E(yright notice and this permission notice shall be included in al\ l copies or substantial portions of the Soft-)-.09 E -.09(wa)72 494.4 S (re.).09 E(THE SOFTW)72 510 Q(ARE IS PR)-1.08 E -.45(OV)-.36 G(IDED `) .45 E -.72(`A)-.666 G 2.25(SI).72 G(S')-2.25 E(', WITHOUT W)-.666 E (ARRANTY OF ANY KIND, EXPRESS OR IMPLIED,)-1.08 E(INCLUDING B)72 522 Q (UT NO)-.09 E 2.25(TL)-.36 G(IMITED T)-2.25 E 2.25(OT)-.162 G(HE W)-2.25 E(ARRANTIES OF MERCHANT)-1.08 E(ABILITY)-.837 E 2.25(,F)-1.161 G (ITNESS FOR A P)-2.25 E(AR)-.828 E(TIC-)-.54 E (ULAR PURPOSE AND NONINFRINGEMENT)72 534 Q 4.5(.I)-.666 G 2.25(NN)-4.5 G 2.25(OE)-2.25 G(VENT SHALL THE X CONSOR)-2.25 E(TIUM BE LIABLE FOR)-.54 E(ANY CLAIM, D)72 546 Q(AMA)-.36 E(GES OR O)-.36 E(THER LIABILITY)-.36 E 2.25(,W)-1.161 G(HETHER IN AN A)-2.25 E(CTION OF CONTRA)-.36 E(CT)-.36 E 2.25(,T)-.666 G(OR)-2.412 E 2.25(TO)-.54 G 2.25(RO)-2.25 G(TH-)-2.61 E (ER)72 558 Q(WISE, ARISING FR)-.495 E (OM, OUT OF OR IN CONNECTION WITH THE SOFTW)-.36 E(ARE OR THE USE OR O) -1.08 E(THER)-.36 E(DEALINGS IN THE SOFTW)72 570 Q(ARE.)-1.08 E(Except \ as contained in this notice, the name of the X Consortium shall not be \ used in adv)72 585.6 Q(ertising or otherwise to pro-)-.135 E (mote the sale, use or other dealings in this Softw)72 597.6 Q (are without prior written authorization from the X Consortium.)-.09 E /F2 9/Times-Italic@0 SF 2.25(XW)72 645.6 S(indow System)-2.745 E F1 (is a trademark of X Consortium, Inc.)2.25 E EP %%Page: 1 3 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF 2.75 (1. Pr)72 84 R(eface)-.198 E/F2 11/Times-Roman@0 SF(This document propo\ ses to de\214ne the structures, methods and their signatures that are e) 72 99.6 Q(xpected to)-.165 E(be common to all locale dependent function\ s within the Xlib sample implementation.)72 111.6 Q(The fol-)5.5 E(lo)72 123.6 Q(wing illustration \(Fig.1\) is proposed to outline the separati\ ng of the components within the sam-)-.275 E(ple implementation.)72 135.6 Q(... 0.237 5.796 5.24 10.14)101.262 151.2 Q (... 0.000i 4.344i 5.003i 0.000i)3.666 E .44 LW 226.562 306.88 226.562 317.88 DL 226.562 295.88 226.562 306.88 DL 226.562 284.88 226.562 295.88 DL 226.562 273.88 226.562 284.88 DL 226.562 262.88 226.562 273.88 DL 226.562 251.88 226.562 262.88 DL 226.562 245.88 226.562 256.88 DL 232.062 244.56 226.562 244.56 DL 235.562 244.56 230.062 244.56 DL 241.062 244.56 235.562 244.56 DL 246.562 244.56 241.062 244.56 DL 252.062 244.56 246.562 244.56 DL 257.562 244.56 252.062 244.56 DL 263.062 244.56 257.562 244.56 DL 268.562 244.56 263.062 244.56 DL 274.062 244.56 268.562 244.56 DL 279.562 244.56 274.062 244.56 DL 285.062 244.56 279.562 244.56 DL 290.562 244.56 285.062 244.56 DL 296.062 244.56 290.562 244.56 DL 301.562 244.56 296.062 244.56 DL 307.062 244.56 301.562 244.56 DL 312.562 244.56 307.062 244.56 DL 318.062 244.56 312.562 244.56 DL 323.562 244.56 318.062 244.56 DL 329.062 244.56 323.562 244.56 DL 334.562 244.56 329.062 244.56 DL 334.562 245.88 334.562 256.88 DL 334.562 251.88 334.562 262.88 DL 334.562 262.88 334.562 273.88 DL 334.562 273.88 334.562 284.88 DL 334.562 284.88 334.562 295.88 DL 334.562 295.88 334.562 306.88 DL 334.562 306.88 334.562 317.88 DL 232.062 316.56 226.562 316.56 DL 235.562 316.56 230.062 316.56 DL 241.062 316.56 235.562 316.56 DL 246.562 316.56 241.062 316.56 DL 252.062 316.56 246.562 316.56 DL 257.562 316.56 252.062 316.56 DL 263.062 316.56 257.562 316.56 DL 268.562 316.56 263.062 316.56 DL 274.062 316.56 268.562 316.56 DL 279.562 316.56 274.062 316.56 DL 285.062 316.56 279.562 316.56 DL 290.562 316.56 285.062 316.56 DL 296.062 316.56 290.562 316.56 DL 301.562 316.56 296.062 316.56 DL 307.062 316.56 301.562 316.56 DL 312.562 316.56 307.062 316.56 DL 318.062 316.56 312.562 316.56 DL 323.562 316.56 318.062 316.56 DL 329.062 316.56 323.562 316.56 DL 334.562 316.56 329.062 316.56 DL 231.918 280.416 226.418 280.416 DL 235.346 280.416 229.846 280.416 DL 240.846 280.416 235.346 280.416 DL 246.346 280.416 240.846 280.416 DL 251.846 280.416 246.346 280.416 DL 257.346 280.416 251.846 280.416 DL 262.846 280.416 257.346 280.416 DL 268.346 280.416 262.846 280.416 DL 273.846 280.416 268.346 280.416 DL 279.346 280.416 273.846 280.416 DL 284.846 280.416 279.346 280.416 DL 290.346 280.416 284.846 280.416 DL 295.846 280.416 290.346 280.416 DL 301.346 280.416 295.846 280.416 DL 306.846 280.416 301.346 280.416 DL 312.346 280.416 306.846 280.416 DL 317.846 280.416 312.346 280.416 DL 323.346 280.416 317.846 280.416 DL 328.846 280.416 323.346 280.416 DL 334.346 280.416 328.846 280.416 DL 280.346 245.736 280.346 256.736 DL 280.346 248.736 280.346 259.736 DL 280.346 259.736 280.346 270.736 DL 280.346 270.736 280.346 281.736 DL/F3 12/Times-Roman@0 SF(Input)235.346 262.168 Q(Method)235.346 275.904 Q(Output)289.346 262.368 Q(Method) 289.346 275.904 Q()-3 E 3 (XL)244.346 311.904 S(ocale Object)-3 E .48 LW 352.562 270 352.562 282 DL 352.562 258 352.562 270 DL 352.562 246 352.562 258 DL 352.562 246 352.562 258 DL 358.562 244.56 352.562 244.56 DL 364.562 244.56 358.562 244.56 DL 370.562 244.56 364.562 244.56 DL 376.562 244.56 370.562 244.56 DL 382.562 244.56 376.562 244.56 DL 388.562 244.56 382.562 244.56 DL 394.562 244.56 388.562 244.56 DL 400.562 244.56 394.562 244.56 DL 406.562 244.56 400.562 244.56 DL 412.562 244.56 406.562 244.56 DL 418.562 244.56 412.562 244.56 DL 424.562 244.56 418.562 244.56 DL 430.562 244.56 424.562 244.56 DL 436.562 244.56 430.562 244.56 DL 442.562 244.56 436.562 244.56 DL 448.562 244.56 442.562 244.56 DL 454.562 244.56 448.562 244.56 DL 460.562 244.56 454.562 244.56 DL 460.562 246 460.562 258 DL 460.562 246 460.562 258 DL 460.562 258 460.562 270 DL 460.562 270 460.562 282 DL 358.562 280.56 352.562 280.56 DL 364.562 280.56 358.562 280.56 DL 370.562 280.56 364.562 280.56 DL 376.562 280.56 370.562 280.56 DL 382.562 280.56 376.562 280.56 DL 388.562 280.56 382.562 280.56 DL 394.562 280.56 388.562 280.56 DL 400.562 280.56 394.562 280.56 DL 406.562 280.56 400.562 280.56 DL 412.562 280.56 406.562 280.56 DL 418.562 280.56 412.562 280.56 DL 424.562 280.56 418.562 280.56 DL 430.562 280.56 424.562 280.56 DL 436.562 280.56 430.562 280.56 DL 442.562 280.56 436.562 280.56 DL 448.562 280.56 442.562 280.56 DL 454.562 280.56 448.562 280.56 DL 460.562 280.56 454.562 280.56 DL 3(CL)361.346 262.368 S(ibrary)-3 E (ANSI impl.)406.346 275.904 Q 100.562 270 100.562 282 DL 100.562 258 100.562 270 DL 100.562 246 100.562 258 DL 100.562 246 100.562 258 DL 106.562 244.56 100.562 244.56 DL 112.562 244.56 106.562 244.56 DL 118.562 244.56 112.562 244.56 DL 124.562 244.56 118.562 244.56 DL 130.562 244.56 124.562 244.56 DL 136.562 244.56 130.562 244.56 DL 142.562 244.56 136.562 244.56 DL 148.562 244.56 142.562 244.56 DL 154.562 244.56 148.562 244.56 DL 160.562 244.56 154.562 244.56 DL 166.562 244.56 160.562 244.56 DL 172.562 244.56 166.562 244.56 DL 178.562 244.56 172.562 244.56 DL 184.562 244.56 178.562 244.56 DL 190.562 244.56 184.562 244.56 DL 196.562 244.56 190.562 244.56 DL 202.562 244.56 196.562 244.56 DL 208.562 244.56 202.562 244.56 DL 208.562 246 208.562 258 DL 208.562 246 208.562 258 DL 208.562 258 208.562 270 DL 208.562 270 208.562 282 DL 106.562 280.56 100.562 280.56 DL 112.562 280.56 106.562 280.56 DL 118.562 280.56 112.562 280.56 DL 124.562 280.56 118.562 280.56 DL 130.562 280.56 124.562 280.56 DL 136.562 280.56 130.562 280.56 DL 142.562 280.56 136.562 280.56 DL 148.562 280.56 142.562 280.56 DL 154.562 280.56 148.562 280.56 DL 160.562 280.56 154.562 280.56 DL 166.562 280.56 160.562 280.56 DL 172.562 280.56 166.562 280.56 DL 178.562 280.56 172.562 280.56 DL 184.562 280.56 178.562 280.56 DL 190.562 280.56 184.562 280.56 DL 196.562 280.56 190.562 280.56 DL 202.562 280.56 196.562 280.56 DL 208.562 280.56 202.562 280.56 DL(Locale Library)109.346 262.368 Q (non-AnSI impl.)131.882 274.104 Q 3(<< ANSI/MSE)352.346 221.904 R (API >>)3 E(\(X Contrib\))378.182 235.368 Q(XLC_XLOCALE)109.346 388.368 Q 3(-M)109.346 401.904 S(B_CUR_MAX)-3 E 3(-c)109.346 413.568 S (odeset info)-3 E 3(oc)109.346 425.304 S(har/charset)-3 E 3(oc)109.346 436.968 S(on)-3 E(v/charset)-.48 E 100.562 432 100.562 444 DL 100.562 420 100.562 432 DL 100.562 408 100.562 420 DL 100.562 396 100.562 408 DL 100.562 384 100.562 396 DL 100.562 372 100.562 384 DL 100.562 372 100.562 384 DL 106.562 370.56 100.562 370.56 DL 112.562 370.56 106.562 370.56 DL 118.562 370.56 112.562 370.56 DL 124.562 370.56 118.562 370.56 DL 130.562 370.56 124.562 370.56 DL 136.562 370.56 130.562 370.56 DL 142.562 370.56 136.562 370.56 DL 148.562 370.56 142.562 370.56 DL 154.562 370.56 148.562 370.56 DL 160.562 370.56 154.562 370.56 DL 166.562 370.56 160.562 370.56 DL 172.562 370.56 166.562 370.56 DL 178.562 370.56 172.562 370.56 DL 184.562 370.56 178.562 370.56 DL 190.562 370.56 184.562 370.56 DL 196.562 370.56 190.562 370.56 DL 202.562 370.56 196.562 370.56 DL 208.562 370.56 202.562 370.56 DL 208.562 372 208.562 384 DL 208.562 372 208.562 384 DL 208.562 384 208.562 396 DL 208.562 396 208.562 408 DL 208.562 408 208.562 420 DL 208.562 420 208.562 432 DL 208.562 432 208.562 444 DL 106.562 442.56 100.562 442.56 DL 112.562 442.56 106.562 442.56 DL 118.562 442.56 112.562 442.56 DL 124.562 442.56 118.562 442.56 DL 130.562 442.56 124.562 442.56 DL 136.562 442.56 130.562 442.56 DL 142.562 442.56 136.562 442.56 DL 148.562 442.56 142.562 442.56 DL 154.562 442.56 148.562 442.56 DL 160.562 442.56 154.562 442.56 DL 166.562 442.56 160.562 442.56 DL 172.562 442.56 166.562 442.56 DL 178.562 442.56 172.562 442.56 DL 184.562 442.56 178.562 442.56 DL 190.562 442.56 184.562 442.56 DL 196.562 442.56 190.562 442.56 DL 202.562 442.56 196.562 442.56 DL 208.562 442.56 202.562 442.56 DL(XLC_FONTSET)235.346 388.368 Q 3(-f)235.346 401.904 S(onset info)-3 E 3(-c)235.346 413.568 S (harset info)-3 E 3(-f)235.346 425.304 S(ont/charset)-3 E 3(-X)235.346 436.968 S(LFD, GL/GR)-3 E 226.562 432 226.562 444 DL 226.562 420 226.562 432 DL 226.562 408 226.562 420 DL 226.562 396 226.562 408 DL 226.562 384 226.562 396 DL 226.562 372 226.562 384 DL 226.562 372 226.562 384 DL 232.562 370.56 226.562 370.56 DL 238.562 370.56 232.562 370.56 DL 244.562 370.56 238.562 370.56 DL 250.562 370.56 244.562 370.56 DL 256.562 370.56 250.562 370.56 DL 262.562 370.56 256.562 370.56 DL 268.562 370.56 262.562 370.56 DL 274.562 370.56 268.562 370.56 DL 280.562 370.56 274.562 370.56 DL 286.562 370.56 280.562 370.56 DL 292.562 370.56 286.562 370.56 DL 298.562 370.56 292.562 370.56 DL 304.562 370.56 298.562 370.56 DL 310.562 370.56 304.562 370.56 DL 316.562 370.56 310.562 370.56 DL 322.562 370.56 316.562 370.56 DL 328.562 370.56 322.562 370.56 DL 334.562 370.56 328.562 370.56 DL 334.562 372 334.562 384 DL 334.562 372 334.562 384 DL 334.562 384 334.562 396 DL 334.562 396 334.562 408 DL 334.562 408 334.562 420 DL 334.562 420 334.562 432 DL 334.562 432 334.562 444 DL 232.562 442.56 226.562 442.56 DL 238.562 442.56 232.562 442.56 DL 244.562 442.56 238.562 442.56 DL 250.562 442.56 244.562 442.56 DL 256.562 442.56 250.562 442.56 DL 262.562 442.56 256.562 442.56 DL 268.562 442.56 262.562 442.56 DL 274.562 442.56 268.562 442.56 DL 280.562 442.56 274.562 442.56 DL 286.562 442.56 280.562 442.56 DL 292.562 442.56 286.562 442.56 DL 298.562 442.56 292.562 442.56 DL 304.562 442.56 298.562 442.56 DL 310.562 442.56 304.562 442.56 DL 316.562 442.56 310.562 442.56 DL 322.562 442.56 316.562 442.56 DL 328.562 442.56 322.562 442.56 DL 334.562 442.56 328.562 442.56 DL 3(-c)361.346 413.568 S(odeset info)-3 E 3(oc)361.346 425.304 S(har/charset)-3 E 3(oc)361.346 436.968 S(on)-3 E(v/charset)-.48 E 3(-M)361.346 401.904 S(B_CUR_MAX)-3 E (localedef DB)361.346 388.368 Q 352.562 432 352.562 444 DL 352.562 420 352.562 432 DL 352.562 408 352.562 420 DL 352.562 396 352.562 408 DL 352.562 384 352.562 396 DL 352.562 372 352.562 384 DL 352.562 372 352.562 384 DL 358.562 370.56 352.562 370.56 DL 364.562 370.56 358.562 370.56 DL 370.562 370.56 364.562 370.56 DL 376.562 370.56 370.562 370.56 DL 382.562 370.56 376.562 370.56 DL 388.562 370.56 382.562 370.56 DL 394.562 370.56 388.562 370.56 DL 400.562 370.56 394.562 370.56 DL 406.562 370.56 400.562 370.56 DL 412.562 370.56 406.562 370.56 DL 418.562 370.56 412.562 370.56 DL 424.562 370.56 418.562 370.56 DL 430.562 370.56 424.562 370.56 DL 436.562 370.56 430.562 370.56 DL 442.562 370.56 436.562 370.56 DL 448.562 370.56 442.562 370.56 DL 454.562 370.56 448.562 370.56 DL 460.562 370.56 454.562 370.56 DL 460.562 372 460.562 384 DL 460.562 372 460.562 384 DL 460.562 384 460.562 396 DL 460.562 396 460.562 408 DL 460.562 408 460.562 420 DL 460.562 420 460.562 432 DL 460.562 432 460.562 444 DL 358.562 442.56 352.562 442.56 DL 364.562 442.56 358.562 442.56 DL 370.562 442.56 364.562 442.56 DL 376.562 442.56 370.562 442.56 DL 382.562 442.56 376.562 442.56 DL 388.562 442.56 382.562 442.56 DL 394.562 442.56 388.562 442.56 DL 400.562 442.56 394.562 442.56 DL 406.562 442.56 400.562 442.56 DL 412.562 442.56 406.562 442.56 DL 418.562 442.56 412.562 442.56 DL 424.562 442.56 418.562 442.56 DL 430.562 442.56 424.562 442.56 DL 436.562 442.56 430.562 442.56 DL 442.562 442.56 436.562 442.56 DL 448.562 442.56 442.562 442.56 DL 454.562 442.56 448.562 442.56 DL 460.562 442.56 454.562 442.56 DL 154.562 163.2 154.562 181.2 DL 160.562 163.2 154.562 163.2 DL 166.562 163.2 160.562 163.2 DL 172.562 163.2 166.562 163.2 DL 178.562 163.2 172.562 163.2 DL 184.562 163.2 178.562 163.2 DL 190.562 163.2 184.562 163.2 DL 196.562 163.2 190.562 163.2 DL 202.562 163.2 196.562 163.2 DL 208.562 163.2 202.562 163.2 DL 214.562 163.2 208.562 163.2 DL 220.562 163.2 214.562 163.2 DL 226.562 163.2 220.562 163.2 DL 232.562 163.2 226.562 163.2 DL 238.562 163.2 232.562 163.2 DL 244.562 163.2 238.562 163.2 DL 250.562 163.2 244.562 163.2 DL 256.562 163.2 250.562 163.2 DL 262.562 163.2 256.562 163.2 DL 268.562 163.2 262.562 163.2 DL 274.562 163.2 268.562 163.2 DL 280.562 163.2 274.562 163.2 DL 286.562 163.2 280.562 163.2 DL 292.562 163.2 286.562 163.2 DL 298.562 163.2 292.562 163.2 DL 304.562 163.2 298.562 163.2 DL 310.562 163.2 304.562 163.2 DL 316.562 163.2 310.562 163.2 DL 322.562 163.2 316.562 163.2 DL 328.562 163.2 322.562 163.2 DL 334.562 163.2 328.562 163.2 DL 340.562 163.2 334.562 163.2 DL 346.562 163.2 340.562 163.2 DL 352.562 163.2 346.562 163.2 DL 358.562 163.2 352.562 163.2 DL 364.562 163.2 358.562 163.2 DL 370.562 163.2 364.562 163.2 DL 376.562 163.2 370.562 163.2 DL 382.562 163.2 376.562 163.2 DL 388.562 163.2 382.562 163.2 DL 394.562 163.2 388.562 163.2 DL 400.562 163.2 394.562 163.2 DL 406.562 163.2 400.562 163.2 DL 406.562 181.2 406.562 163.2 DL 160.562 181.2 154.562 181.2 DL 166.562 181.2 160.562 181.2 DL 172.562 181.2 166.562 181.2 DL 178.562 181.2 172.562 181.2 DL 184.562 181.2 178.562 181.2 DL 190.562 181.2 184.562 181.2 DL 196.562 181.2 190.562 181.2 DL 202.562 181.2 196.562 181.2 DL 208.562 181.2 202.562 181.2 DL 214.562 181.2 208.562 181.2 DL 220.562 181.2 214.562 181.2 DL 226.562 181.2 220.562 181.2 DL 232.562 181.2 226.562 181.2 DL 238.562 181.2 232.562 181.2 DL 244.562 181.2 238.562 181.2 DL 250.562 181.2 244.562 181.2 DL 256.562 181.2 250.562 181.2 DL 262.562 181.2 256.562 181.2 DL 268.562 181.2 262.562 181.2 DL 274.562 181.2 268.562 181.2 DL 280.562 181.2 274.562 181.2 DL 286.562 181.2 280.562 181.2 DL 292.562 181.2 286.562 181.2 DL 298.562 181.2 292.562 181.2 DL 304.562 181.2 298.562 181.2 DL 310.562 181.2 304.562 181.2 DL 316.562 181.2 310.562 181.2 DL 322.562 181.2 316.562 181.2 DL 328.562 181.2 322.562 181.2 DL 334.562 181.2 328.562 181.2 DL 340.562 181.2 334.562 181.2 DL 346.562 181.2 340.562 181.2 DL 352.562 181.2 346.562 181.2 DL 358.562 181.2 352.562 181.2 DL 364.562 181.2 358.562 181.2 DL 370.562 181.2 364.562 181.2 DL 376.562 181.2 370.562 181.2 DL 382.562 181.2 376.562 181.2 DL 388.562 181.2 382.562 181.2 DL 394.562 181.2 388.562 181.2 DL 400.562 181.2 394.562 181.2 DL 406.562 181.2 400.562 181.2 DL (Application)252.014 176.904 Q 3(<< ANSI/MSE)100.346 221.904 R(API >>)3 E(\(X Contrib\))126.254 235.368 Q 280.346 317.856 280.346 329.856 DL 280.346 323.784 280.346 335.784 DL 280.346 335.784 280.346 347.784 DL 280.346 347.784 280.346 359.784 DL 280.346 359.784 280.346 371.784 DL 280.346 370.344 278.546 363.144 DL 280.346 370.344 282.146 363.144 DL 262.346 343.344 280.346 329.88 DL 187.418 343.344 181.418 343.344 DL 190.346 343.344 184.346 343.344 DL 196.346 343.344 190.346 343.344 DL 202.346 343.344 196.346 343.344 DL 208.346 343.344 202.346 343.344 DL 214.346 343.344 208.346 343.344 DL 220.346 343.344 214.346 343.344 DL 226.346 343.344 220.346 343.344 DL 232.346 343.344 226.346 343.344 DL 238.346 343.344 232.346 343.344 DL 244.346 343.344 238.346 343.344 DL 250.346 343.344 244.346 343.344 DL 256.346 343.344 250.346 343.344 DL 262.346 343.344 256.346 343.344 DL 181.418 344.784 181.418 356.784 DL 181.418 347.784 181.418 359.784 DL 181.418 359.784 181.418 371.784 DL 181.418 370.344 179.618 363.144 DL 181.418 370.344 183.218 363.144 DL 298.346 343.344 280.346 329.88 DL 304.346 343.344 298.346 343.344 DL 307.346 343.344 301.346 343.344 DL 313.346 343.344 307.346 343.344 DL 319.346 343.344 313.346 343.344 DL 325.346 343.344 319.346 343.344 DL 331.346 343.344 325.346 343.344 DL 337.346 343.344 331.346 343.344 DL 343.346 343.344 337.346 343.344 DL 349.346 343.344 343.346 343.344 DL 355.346 343.344 349.346 343.344 DL 361.346 343.344 355.346 343.344 DL 367.346 343.344 361.346 343.344 DL 373.346 343.344 367.346 343.344 DL 379.346 343.344 373.346 343.344 DL 379.346 344.784 379.346 356.784 DL 379.346 347.784 379.346 359.784 DL 379.346 359.784 379.346 371.784 DL 379.346 370.344 377.546 363.144 DL 379.346 370.344 381.146 363.144 DL 127.418 281.856 127.418 293.856 DL 127.418 287.784 127.418 299.784 DL 127.418 299.784 127.418 311.784 DL 127.418 311.784 127.418 323.784 DL 127.418 323.784 127.418 335.784 DL 127.418 335.784 127.418 347.784 DL 127.418 347.784 127.418 359.784 DL 127.418 359.784 127.418 371.784 DL 127.418 370.344 125.618 363.144 DL 127.418 370.344 129.218 363.144 DL 433.346 281.856 433.346 293.856 DL 433.346 287.784 433.346 299.784 DL 433.346 299.784 433.346 311.784 DL 433.346 311.784 433.346 323.784 DL 433.346 323.784 433.346 335.784 DL 433.346 335.784 433.346 347.784 DL 433.346 347.784 433.346 359.784 DL 433.346 359.784 433.346 371.784 DL 433.346 370.344 431.546 363.144 DL 433.346 370.344 435.146 363.144 DL 253.346 182.856 253.346 194.856 DL 253.346 185.856 253.346 197.856 DL 253.346 197.856 253.346 209.856 DL 253.346 208.416 251.546 201.216 DL 253.346 208.416 255.146 201.216 DL 307.346 182.856 307.346 194.856 DL 307.346 185.856 307.346 197.856 DL 307.346 197.856 307.346 209.856 DL 307.346 208.416 305.546 201.216 DL 307.346 208.416 309.146 201.216 DL 181.418 182.856 181.418 194.856 DL 181.418 185.856 181.418 197.856 DL 181.418 197.856 181.418 209.856 DL 181.418 208.416 179.618 201.216 DL 181.418 208.416 183.218 201.216 DL 379.346 182.856 379.346 194.856 DL 379.346 185.856 379.346 197.856 DL 379.346 197.856 379.346 209.856 DL 379.346 208.416 377.546 201.216 DL 379.346 208.416 381.146 201.216 DL 109.346 460.344 100.346 451.344 DL 115.346 460.344 109.346 460.344 DL 121.346 460.344 115.346 460.344 DL 127.346 460.344 121.346 460.344 DL 133.346 460.344 127.346 460.344 DL 139.346 460.344 133.346 460.344 DL 145.346 460.344 139.346 460.344 DL 151.346 460.344 145.346 460.344 DL 157.346 460.344 151.346 460.344 DL 163.346 460.344 157.346 460.344 DL 169.346 460.344 163.346 460.344 DL 175.346 460.344 169.346 460.344 DL 181.346 460.344 175.346 460.344 DL 187.346 460.344 181.346 460.344 DL 193.346 460.344 187.346 460.344 DL 199.346 460.344 193.346 460.344 DL 205.346 460.344 199.346 460.344 DL 211.346 460.344 205.346 460.344 DL 217.346 460.344 211.346 460.344 DL 223.346 460.344 217.346 460.344 DL 229.346 460.344 223.346 460.344 DL 235.346 460.344 229.346 460.344 DL 241.346 460.344 235.346 460.344 DL 247.346 460.344 241.346 460.344 DL 253.346 460.344 247.346 460.344 DL 259.346 460.344 253.346 460.344 DL 265.346 460.344 259.346 460.344 DL 271.346 460.344 265.346 460.344 DL 277.346 460.344 271.346 460.344 DL 283.346 460.344 277.346 460.344 DL 289.346 460.344 283.346 460.344 DL 295.346 460.344 289.346 460.344 DL 301.346 460.344 295.346 460.344 DL 307.346 460.344 301.346 460.344 DL 313.346 460.344 307.346 460.344 DL 319.346 460.344 313.346 460.344 DL 325.346 460.344 319.346 460.344 DL 334.346 451.344 325.346 460.344 DL 361.346 460.344 352.346 451.344 DL 367.346 460.344 361.346 460.344 DL 373.346 460.344 367.346 460.344 DL 379.346 460.344 373.346 460.344 DL 385.346 460.344 379.346 460.344 DL 391.346 460.344 385.346 460.344 DL 397.346 460.344 391.346 460.344 DL 403.346 460.344 397.346 460.344 DL 409.346 460.344 403.346 460.344 DL 415.346 460.344 409.346 460.344 DL 421.346 460.344 415.346 460.344 DL 427.346 460.344 421.346 460.344 DL 433.346 460.344 427.346 460.344 DL 439.346 460.344 433.346 460.344 DL 445.346 460.344 439.346 460.344 DL 451.346 460.344 445.346 460.344 DL 460.346 451.344 451.346 460.344 DL(XLocale Source \(X Core\))155.606 478.368 Q(System LOcale Source)351.356 478.368 Q(XLib API)256.514 221.904 Q(\(X Core\))258.854 235.368 Q(<<)226.418 221.904 Q(>>)320.882 221.904 Q F2(Fig.1 : Frame W)173.721 497.568 Q (ork of Locale Service API Proposal)-.88 E(Generally speaking, the inte\ rnationalized portion of Xlib \(Locale Dependent X, LDX\) consists of)72 513.168 Q(three objects; locale \(LC\) , input method \(IM\) and output\ method \(OM\).)72 525.168 Q(The LC pro)5.5 E(vides a set)-.165 E (of information that depends on user')72 537.168 Q 2.75(sl)-.605 G (anguage en)-2.75 E 2.75(vironment. The)-.44 F(IM manages te)2.75 E (xt inputing, and)-.165 E(the OM manages te)72 549.168 Q(xt dra)-.165 E 2.75(wing. Both)-.165 F(IM and OM highly depend on LC data.)2.75 E (In X11R5, there are tw)72 564.768 Q 2.75(os)-.11 G (ample implementations, Ximp and Xsi, for Xlib internationalization.) -2.75 E(But in both implementations, IM and OM actually refer the pri)72 576.768 Q -.275(va)-.275 G(te e).275 E(xtension of LC.)-.165 E (It breaks)5.5 E(coe)72 588.768 Q(xistence of these tw)-.165 E 2.75(os) -.11 G(ample implementations.)-2.75 E -.165(Fo)5.5 G 2.75(re).165 G (xample, if a user creates a ne)-2.915 E 2.75(wO)-.275 G 2.75(Mf)-2.75 G (or)-2.75 E(special purpose as a part of Ximp, it will not w)72 600.768 Q(ork with Xsi.)-.11 E(As a solution of this problem, we propose to de\ \214ne the standard APIs between these three objects,)72 616.368 Q (and de\214ne the structure that are common to these objects.)72 628.368 Q F1 2.75(2. Objecti)72 655.968 R -.11(ve)-.11 G F2 21.15<8345>72 675.168 S(xplain the current X11R6 sample implementation)-21.15 E 21.15 <8344>72 690.768 S(ocument the common set of locale dependent interf) -21.15 E(aces)-.11 E 21.15<8350>72 706.368 S(ro)-21.15 E (vide more \215e)-.165 E(xible plugg)-.165 E(able layer)-.055 E F1(1) 285.25 768 Q EP %%Page: 2 4 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF (Sample Implementation Frame W)72 52 Q 176.8(ork X11,)-.825 F (Release 6.4)2.75 E 2.75(3. Locale)72 84 R(Object Binding Functions)2.75 E/F2 11/Times-Roman@0 SF(This chapter describes functions related local\ e object binding for implementing the plugg)72 99.6 Q(able)-.055 E (layer)72 111.6 Q(.)-.605 E 2.75(Al)72 127.2 S(ocale loader is an entry\ point for locale object, which instantiates XLCd object and binds)-2.75 E(locale methods with speci\214ed locale name. The beha)72 139.2 Q (vior of loader is implementation dependent.)-.22 E (And, what kind of loaders are a)72 151.2 Q -.275(va)-.22 G (ilable is also implementation dependent.).275 E (The loader is called in)72 166.8 Q F1(_XOpenLC,)3.666 E F2 -.22(bu) 3.666 G 2.75(tc).22 G(aller of)-2.75 E F1(_XOpenLC)3.666 E F2 (does not need to care about its)3.666 E 2.75(inside. F)72 178.8 R(or e) -.165 E(xample, if the loader is implemented with dynamic load function\ s, and the dynamic)-.165 E(module is e)72 190.8 Q(xpected to be unloade\ d when the corresponding XLCd is freed, close methods of)-.165 E (XLCdMethods should handle unloading.)72 202.8 Q F1 (Initializing a locale loader list)72 230.4 Q F2 -.22(vo)72 249.6 S (id _XlcInitLoader\(\)).22 E(The)72 265.2 Q F1(_XlcInitLoader)3.666 E F2 (function initializes the locale loader list with v)3.666 E (endor speci\214c manner)-.165 E 5.5(.E)-.605 G(ach)-5.5 E(loader is re) 72 277.2 Q(gistered with calling)-.165 E F1(_XlcAddLoader)3.666 E(.)-1.1 E F2(The number of loaders and their order in the)3.666 E (loader list is implementation dependent.)72 289.2 Q F1(Add a loader)72 316.8 Q F2(typedef XLCd \(*XLCdLoadProc\)\()72 338.4 Q/F3 11 /Times-Italic@0 SF(name)A F2(\);)A(char)88.5 350.4 Q F3(*name)2.75 E F2 (;)A(typedef int XlcPosition;)72 374.4 Q(#de\214ne)72 398.4 Q(XlcHead) 124.5 398.4 Q(0)287.75 398.4 Q(#de\214ne)72 410.4 Q(XlcT)124.5 410.4 Q (ail)-.88 E(-1)285 410.4 Q(Bool _XlcAddLoader\()72 435.6 Q F3(pr)A (oc, position)-.495 E F2(\))A(XLCdLoadProc)88.5 447.6 Q F3(pr)2.75 E(oc) -.495 E F2(;)A(XlcPosition)88.5 459.6 Q F3(position)2.75 E F2(;)A(The)72 478.8 Q F1(_XlcAddLoader)3.666 E F2(function re)3.666 E (gisters the speci\214ed locale loader `)-.165 E(`)-.814 E F3(pr)A(oc) -.495 E F2 1.628 -.814('' t)D 2.75(ot).814 G(he internal loader)-2.75 E 2.75(list. The)72 490.8 R(position speci\214es that the loader `)2.75 E (`)-.814 E F3(pr)A(oc)-.495 E F2 1.628 -.814('' s)D (hould be placed in the top of the loader).814 E (list\(XlcHead\) or last\(XlcT)72 502.8 Q(ail\).)-.88 E (The object loader is called from the top of the loader list in order)72 518.4 Q 2.75(,w)-.44 G(hen calling time.)-2.75 E F1(Remo)72 546 Q .22 -.11(ve a l)-.11 H(oader).11 E F2 -.22(vo)72 565.2 S(id _XlcRemo).22 E -.165(ve)-.165 G(Loader\().165 E F3(pr)A(oc)-.495 E F2(\))A (XLCdLoadProc)88.5 577.2 Q F3(pr)2.75 E(oc)-.495 E F2(;)A(The)72 596.4 Q F1(_XlcRemo)3.666 E -.11(ve)-.11 G(Loader).11 E F2(function remo)3.666 E -.165(ve)-.165 G 2.75(st).165 G(he locale loader speci\214ed by `)-2.75 E(`)-.814 E F3(pr)A(oc)-.495 E F2 1.628 -.814('' f)D(rom the loader).814 E(list.)72 608.4 Q(Current implementation pro)72 624 Q(vides follo)-.165 E(wing locale loaders;)-.275 E F1(_XlcDefaultLoader)108.916 642 Q (_XlcGenericLoader)108.916 654 Q(_XlcEucLoader)108.916 666 Q (_XlcSjisLoader)108.916 678 Q(_XlcUtfLoader)108.916 690 Q (_XaixOsDynamicLoad)108.916 702 Q(2)285.25 768 Q EP %%Page: 3 5 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF (Sample Implementation Frame W)72 52 Q 176.8(ork X11,)-.825 F (Release 6.4)2.75 E 2.75(4. Locale)72 84 R(Method Interface)2.75 E/F2 11 /Times-Roman@0 SF(This chapter describes the locale method API, which i\ s a set of accessible functions from both IM)72 99.6 Q(and OM parts.)72 111.6 Q(The locale method API pro)5.5 E(vides the functionalities;)-.165 E(obtaining locale dependent)5.5 E(information, handling charset, con)72 123.6 Q -.165(ve)-.44 G(rting te).165 E(xt, etc.)-.165 E (As a result of using these APIs instead of accessing v)72 139.2 Q (ender pri)-.165 E -.275(va)-.275 G(te e).275 E (xtension of the locale object,)-.165 E(we can k)72 151.2 Q (eep locale, IM and OM independently each other)-.11 E(.)-.605 E F1 2.75 (5. Locale)72 178.8 R(Method Functions)2.75 E(Open a Locale Method)72 194.4 Q F2(XLCd _XOpenLC\()72 213.6 Q/F3 11/Times-Italic@0 SF(name)A F2 (\))A(char)88.5 225.6 Q F3(*name)2.75 E F2(;)A(The)72 244.8 Q F1 (_XOpenLC)3.666 E F2(function opens a locale method which corresponds t\ o the speci\214ed locale name.)3.666 E F1(_XOpenLC)72.916 256.8 Q F2 (calls a locale object loader)3.666 E 2.75(,w)-.44 G(hich is re)-2.75 E (gistered via)-.165 E F1(_XlcAddLoader)3.666 E F2(into is v).916 E (alid and)-.275 E(successfully opens a locale,)72 268.8 Q F1(_XOpenLC) 3.666 E F2(returns the XLCd.)3.666 E(If the loader is in)5.5 E -.275(va) -.44 G(lid or f).275 E(ailed to)-.11 E(open a locale,)72 280.8 Q F1 (_XOpenLC)3.666 E F2(calls the ne)3.666 E(xt loader)-.165 E 5.5(.I)-.605 G 2.75(fa)-5.5 G(ll re)-2.75 E(gistered loaders cannot open a locale,) -.165 E F1(_XOpenLC)72.916 292.8 Q F2(returns NULL.)3.666 E (XLCd _XlcCurrentLC\(\))72 312 Q(The)72 331.2 Q F1(_XlcCurr)3.666 E (entLC)-.198 E F2 (function returns an XLCd that are bound to current locale.)3.666 E F1 (Close a Locale Method)72 358.8 Q F2 -.22(vo)72 378 S(id _XCloseLC\().22 E F3(lcd)A F2(\))A(XLCd)88.5 390 Q F3(lcd)2.75 E F2(;)A(The)72 409.2 Q F1(_XCloseLC)3.666 E F2 (function close a locale method the speci\214ed lcd.)3.666 E F1 (Obtain Locale Method v)72 436.8 Q(alues)-.11 E F2(char * _XGetLCV)72 456 Q(alues\()-1.221 E F3(lcd)A F2 2.75(,.)C(..\))-2.75 E(XLCd)88.5 468 Q F3(lcd)2.75 E F2(;)A(The)72 487.2 Q F1(_XGetLCV)3.666 E(alues)-1.012 E F2(function returns NULL if no error occurred; otherwise, it returns th\ e name)3.666 E(of the \214rst ar)72 499.2 Q (gument that could not be obtained.)-.198 E(The follo)5.5 E(wing v)-.275 E(alues are de\214ned as standard)-.275 E(ar)72 511.2 Q (guments. Other v)-.198 E(alues are implementation dependent.)-.275 E .44 LW 72 525.55 72 525.55 DL F1 121.902(Name T)72 540.8 R 15.158 (ype Description)-.814 F 72 551.55 72 551.55 DL F2 90.123 (XlcNCodeset char*)72 566.8 R(codeset part of locale name)16.5 E (XlcNDef)72 578.8 Q 65.791(aultString char*)-.11 F(XDef)16.5 E (aultString\(\))-.11 E 57.134(XlcNEncodingName char*)72 590.8 R (encoding name)16.5 E 82.192(XlcNLanguage char*)72 602.8 R (language part of locale name)16.5 E 73.623(XlcNMbCurMax int)72 614.8 R (ANSI C MB_CUR_MAX)29.315 E 13.75(XlcNStateDependentEncoding Bool)72 626.8 R(is state-dependent encoding or not)19.536 E(XlcNT)72 638.8 Q 86.625(erritory char*)-.77 F(territory part of locale name)16.5 E 72 649.55 72 649.55 DL F1 2.75(6. Charset)72 680.4 R(functions)2.75 E F2(T\ he XlcCharSet is an identi\214er which represents a subset of character\ s \(character set\) in the)72 696 Q(locale object.)72 708 Q F1(3)285.25 768 Q EP %%Page: 4 6 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF (Sample Implementation Frame W)72 52 Q 176.8(ork X11,)-.825 F (Release 6.4)2.75 E/F2 11/Times-Roman@0 SF(typedef enum {)72 84 Q (XlcUnkno)88.5 96 Q(wn, XlcC0, XlcGL, XlcC1, XlcGR, XlcGLGR, XlcOther) -.275 E 2.75(}X)72 108 S(lcSide;)-2.75 E (typedef struct _XlcCharSetRec *XlcCharSet;)72 132 Q(typedef struct {)72 156 Q(char *name;)88.5 168 Q(XPointer v)88.5 180 Q(alue;)-.275 E 2.75 (}X)72 192 S(lcAr)-2.75 E(g, *XlcAr)-.198 E(gList;)-.198 E (typedef char* \(*XlcGetCSV)72 216 Q(aluesProc\)\()-1.221 E/F3 11 /Times-Italic@0 SF -.165(ch)C(ar).165 E(set)-.11 E F2(,)A F3(ar)2.75 E (gs)-.407 E F2(,)A F3(num_ar)2.75 E(gs)-.407 E F2(\);)A(XlcCharSet)88.5 228 Q F3 -.165(ch)2.75 G(ar).165 E(set)-.11 E F2(;)A(XlcAr)88.5 240 Q (gList)-.198 E F3(ar)2.75 E(gs)-.407 E F2(;)A(int)88.5 252 Q F3(num_ar) 2.75 E(gs)-.407 E F2(;)A(typedef struct _XlcCharSetRec {)72 276 Q (char *name;)88.5 288 Q(XrmQuark xrm_name;)88.5 300 Q (char *encoding_name;)88.5 312 Q(XrmQuark xrm_encoding_name;)88.5 324 Q (XlcSide side;)88.5 336 Q(int char_size;)88.5 348 Q(int set_size;)88.5 360 Q(char *ct_sequence;)88.5 372 Q(XlcGetCSV)88.5 384 Q (aluesProc get_v)-1.221 E(alues;)-.275 E 2.75(}X)72 396 S(lcCharSetRec;) -2.75 E F1(Get an XlcCharSet)72 429.6 Q F2(XlcCharSet _XlcGetCharSet\() 72 448.8 Q F3(name)A F2(\))A(char)88.5 460.8 Q F3(*name)2.75 E F2(;)A (The)72 480 Q F1(_XlcGetCharSet)3.666 E F2(function gets an XlcCharSet \ which corresponds to the charset name speci-)3.666 E(\214ed by `)72 492 Q(`)-.814 E F3(name)A F2 -.814('')C(.).814 E F1(_XlcGetCharSet)6.416 E F2(returns NULL, if no XlcCharSet bound to speci\214ed `)3.666 E(`)-.814 E F3(name)A F2 -.814('')C(.).814 E(The follo)72 507.6 Q (wing character sets are pre-re)-.275 E(gistered.)-.165 E .44 LW 256.822 521.95 72 521.95 DL F1 82.511(Name Description)72 537.2 R 256.822 547.95 72 547.95 DL F2 43.395(ISO8859-1:GL 7-bit)72 563.2 R (ASCII graphics \(ANSI X3.4-1968\),)2.75 E(Left half of ISO 8859 sets) 184.75 575.2 Q 14.366(JISX0201.1976-0:GL Left)72 587.2 R (half of JIS X0201-1976 \(reaf)2.75 E(\214rmed 1984\),)-.275 E (8-Bit Alphanumeric-Katakana Code)184.75 599.2 Q 42.779 (ISO8859-1:GR Right)72 623.2 R(half of ISO 8859-1, Latin alphabet No. 1) 2.75 E 42.779(ISO8859-2:GR Right)72 635.2 R (half of ISO 8859-2, Latin alphabet No. 2)2.75 E 42.779 (ISO8859-3:GR Right)72 647.2 R(half of ISO 8859-3, Latin alphabet No. 3) 2.75 E 42.779(ISO8859-4:GR Right)72 659.2 R (half of ISO 8859-4, Latin alphabet No. 4)2.75 E 42.779 (ISO8859-7:GR Right)72 671.2 R(half of ISO 8859-7, Latin/Greek alphabet) 2.75 E 42.779(ISO8859-6:GR Right)72 683.2 R (half of ISO 8859-6, Latin/Arabic alphabet)2.75 E 42.779 (ISO8859-8:GR Right)72 695.2 R(half of ISO 8859-8, Latin/Hebre)2.75 E 2.75(wa)-.275 G(lphabet)-2.75 E 42.779(ISO8859-5:GR Right)72 707.2 R (half of ISO 8859-5, Latin/Cyrillic alphabet)2.75 E 42.779 (ISO8859-9:GR Right)72 719.2 R(half of ISO 8859-9, Latin alphabet No. 5) 2.75 E F1(4)285.25 768 Q EP %%Page: 5 7 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF (Sample Implementation Frame W)72 52 Q 176.8(ork X11,)-.825 F (Release 6.4)2.75 E .44 LW 256.822 76.75 72 76.75 DL 82.511 (Name Description)72 92 R 256.822 102.75 72 102.75 DL/F2 11 /Times-Roman@0 SF 13.75(JISX0201.1976-0:GR Right)72 118 R (half of JIS X0201-1976 \(reaf)2.75 E(\214rmed 1984\),)-.275 E (8-Bit Alphanumeric-Katakana Code)184.75 130 Q 21.087 (GB2312.1980-0:GL GB2312-1980,)72 154 R (China \(PRC\) Hanzi de\214ned as GL)2.75 E 20.471 (GB2312.1980-0:GR GB2312-1980,)72 166 R (China \(PRC\) Hanzi de\214ned as GR)2.75 E 14.366 (JISX0208.1983-0:GL JIS)72 178 R (X0208-1983, Japanese Graphic Character Set)2.75 E(de\214ned as GL) 184.75 190 Q 13.75(JISX0208.1983-0:GR JIS)72 202 R (X0208-1983, Japanese Graphic Character Set)2.75 E(de\214ned as GR) 184.75 214 Q 14.971(KSC5601.1987-0:GL KS)72 226 R(C5601-1987, K)2.75 E (orean Graphic Character Set)-.385 E(de\214ned as GL)184.75 238 Q 14.355 (KSC5601.1987-0:GR KS)72 250 R(C5601-1987, K)2.75 E (orean Graphic Character Set)-.385 E(de\214ned as GR)184.75 262 Q 14.366 (JISX0212.1990-0:GL JIS)72 274 R (X0212-1990, Japanese Graphic Character Set)2.75 E(de\214ned as GL) 184.75 286 Q 13.75(JISX0212.1990-0:GR JIS)72 298 R (X0212-1990, Japanese Graphic Character Set)2.75 E(de\214ned as GR) 184.75 310 Q 256.822 320.75 72 320.75 DL F1(Add an XlcCharSet)72 351.6 Q F2(Bool _XlcAddCharSet\()72 370.8 Q/F3 11/Times-Italic@0 SF -.165(ch)C (ar).165 E(set)-.11 E F2(\))A(XlcCharSet)88.5 382.8 Q F3 -.165(ch)2.75 G (ar).165 E(set)-.11 E F2(;)A(The)72 402 Q F1(_XlcAddCharSet)3.666 E F2 (function re)3.666 E(gisters XlcCharSet speci\214ed by `)-.165 E(`)-.814 E F3 -.165(ch)C(ar).165 E(set)-.11 E F2 -.814('')C(.).814 E F1 (Obtain Character Set v)72 429.6 Q(alues)-.11 E F2(char * _XlcGetCSV)72 448.8 Q(alues\()-1.221 E F3 -.165(ch)C(ar).165 E(set)-.11 E F2 2.75(,.)C (..\))-2.75 E(XlcCharSet)88.5 460.8 Q F3 -.165(ch)2.75 G(ar).165 E(set) -.11 E F2(;)A(The)72 480 Q F1(_XlcGetCSV)3.666 E(alues)-1.012 E F2 (function returns NULL if no error occurred; otherwise, it returns the) 3.666 E(name of the \214rst ar)72 492 Q (gument that could not be obtained.)-.198 E(The follo)5.5 E(wing v)-.275 E(alues are de\214ned as stan-)-.275 E(dard ar)72 504 Q 2.75 (guments. Other)-.198 F -.275(va)2.75 G (lues are implementation dependent.).275 E 72 518.35 72 518.35 DL F1 85.855(Name T)72 533.6 R 26.169(ype Description)-.814 F 72 544.35 72 544.35 DL F2 63.25(XlcNName char*)72 559.6 R(charset name)27.511 E 21.087(XlcNEncodingName char*)72 571.6 R(XLFD CharSet Re)27.511 E (gistry and Encoding)-.165 E 69.96(XlcNSide XlcSide)72 583.6 R (charset side \(GL, GR, ...\))16.5 E 49.192(XlcNCharSize int)72 595.6 R (number of octets per character)40.326 E 56.518(XlcNSetSize int)72 607.6 R(number of character sets)40.326 E 13.75(XlcNControlSequence char*)72 619.6 R(control sequence of Compound T)27.511 E -.165(ex)-.77 G(t).165 E 72 630.35 72 630.35 DL F1 2.75(7. Con)72 661.2 R -.11(ve)-.44 G (rter Functions).11 E F2 1.76 -.88(We p)72 676.8 T(ro).88 E (vide a set of the common con)-.165 E -.165(ve)-.44 G (rter APIs, that are independent from both of source and).165 E (destination te)72 688.8 Q(xt type.)-.165 E(typedef struct _XlcCon)72 710.4 Q(vRec *XlcCon)-.44 E(v;)-.44 E F1(5)285.25 768 Q EP %%Page: 6 8 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF (Sample Implementation Frame W)72 52 Q 176.8(ork X11,)-.825 F (Release 6.4)2.75 E/F2 11/Times-Roman@0 SF(typedef v)72 84 Q (oid \(*XlcCloseCon)-.22 E -.165(ve)-.44 G(rterProc\)\().165 E/F3 11 /Times-Italic@0 SF(con)A(v)-.44 E F2(\);)A(XlcCon)88.5 96 Q(v)-.44 E F3 (con)2.75 E(v)-.44 E F2(;)A(typedef int \(*XlcCon)72 120 Q -.165(ve)-.44 G(rtProc\)\().165 E F3(con)A(v)-.44 E F2(,)A F3(fr)2.75 E(om)-.495 E F2 (,)A F3(fr)2.75 E(om_left)-.495 E F2(,)A F3(to)2.75 E F2(,)A F3(to_left) 2.75 E F2(,)A F3(ar)2.75 E(gs)-.407 E F2(,)A F3(num_ar)2.75 E(gs)-.407 E F2(\);)A(XlcCon)88.5 132 Q(v)-.44 E F3(con)2.75 E(v)-.44 E F2(;)A (XPointer)88.5 144 Q F3(*fr)2.75 E(om)-.495 E F2(;)A(int)88.5 156 Q F3 (*fr)2.75 E(om_left)-.495 E F2(;)A(XPointer)88.5 168 Q F3(*to)2.75 E F2 (;)A(int)88.5 180 Q F3(*to_left)2.75 E F2(;)A(XPointer)88.5 192 Q F3 (*ar)2.75 E(gs)-.407 E F2(;)A(int)88.5 204 Q F3(num_ar)2.75 E(gs)-.407 E F2(;)A(typedef v)72 228 Q(oid \(*XlcResetCon)-.22 E -.165(ve)-.44 G (rterProc\)\().165 E F3(con)A(v)-.44 E F2(\);)A(XlcCon)88.5 240 Q(v)-.44 E F3(con)2.75 E(v)-.44 E F2(;)A(typedef struct _XlcCon)72 264 Q (vMethodsRec {)-.44 E(XlcCloseCon)88.5 276 Q -.165(ve)-.44 G (rterProc close;).165 E(XlcCon)88.5 288 Q -.165(ve)-.44 G(rtProc con) .165 E -.165(ve)-.44 G(rt;).165 E(XlcResetCon)88.5 300 Q -.165(ve)-.44 G (rterProc reset;).165 E 2.75(}X)72 312 S(lcCon)-2.75 E (vMethodsRec, *XlcCon)-.44 E(vMethods;)-.44 E(typedef struct _XlcCon)72 336 Q(vRec {)-.44 E(XlcCon)83 348 Q(vMethods methods;)-.44 E (XPointer state;)83 360 Q 2.75(}X)72 372 S(lcCon)-2.75 E(vRec;)-.44 E F1 (Open a con)72 405.6 Q -.11(ve)-.44 G(rter).11 E F2(XlcCon)72 424.8 Q 2.75(v_)-.44 G(XlcOpenCon)-2.75 E -.165(ve)-.44 G(rter\().165 E F3(fr)A (om_lcd)-.495 E F2(,)A F3(fr)2.75 E(om_type)-.495 E F2(,)A F3(to_lcd) 2.75 E F2(,)A F3(to_type)2.75 E F2(\))A(XLCd)88.5 436.8 Q F3(fr)2.75 E (om_lcd)-.495 E F2(;)A(char)88.5 448.8 Q F3(*fr)2.75 E(om_type)-.495 E F2(;)A(XLCd)88.5 460.8 Q F3(to_lcd)2.75 E F2(;)A(char)88.5 472.8 Q F3 (*to_type)2.75 E F2(;)A F1(_XlcOpenCon)72.916 492 Q -.11(ve)-.44 G(rter) .11 E F2(function opens the con)3.666 E -.165(ve)-.44 G(rter which con) .165 E -.165(ve)-.44 G(rts a te).165 E(xt from speci\214ed)-.165 E -.814 (``)72 504 S F3(fr).814 E(om_type)-.495 E F2 1.628 -.814('' t)D 2.75(os) .814 G(peci\214ed `)-2.75 E(`)-.814 E F3(to_type)A F2 1.628 -.814('' e)D 2.75(ncoding. If).814 F(the function cannot \214nd proper con)2.75 E -.165(ve)-.44 G(rter or).165 E(cannot open a corresponding con)72 516 Q -.165(ve)-.44 G(rter).165 E 2.75(,i)-.44 G 2.75(tr)-2.75 G(eturns NULL.) -2.75 E(Otherwise, it returns the con)5.5 E -.165(ve)-.44 G(rsion).165 E (descriptor)72 528 Q(.)-.605 E(The follo)72 543.6 Q(wing types are pre-\ de\214ned. Other types are implementation dependent.)-.275 E .44 LW 72 557.95 72 557.95 DL F1 78.21(Name T)72 573.2 R 34.408(ype Description) -.814 F(Ar)58.663 E(guments)-.11 E 72 583.95 72 583.95 DL F2 36.641 (XlcNMultiByte char)72 599.2 R 33(*m)2.75 G 68.123(ultibyte -)-33 F (XlcNW)72 611.2 Q 37.103(ideChar wchar_t)-.44 F 16.5(*w)2.75 G (ide character)-16.5 E(-)48.609 E(XlcNCompoundT)72 623.2 Q -.165(ex)-.77 G 16.5(tc).165 G(har *)-16.5 E 13.75(COMPOUND_TEXT -)33 F 54.978 (XlcNString char)72 635.2 R 33(*S)2.75 G 70.576(TRING -)-33 F 46.431 (XlcNCharSet char)72 647.2 R 33(*p)2.75 G(er charset)-33 E(XlcCharSet) 65.098 E 60.489(XlcNChar char)72 659.2 R 33(*p)2.75 G(er character)-33 E (XlcCharSet)55.946 E 72 669.95 72 669.95 DL F1(Close a con)72 700.8 Q -.11(ve)-.44 G(rter).11 E(6)285.25 768 Q EP %%Page: 7 9 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF (Sample Implementation Frame W)72 52 Q 176.8(ork X11,)-.825 F (Release 6.4)2.75 E/F2 11/Times-Roman@0 SF -.22(vo)72 84 S (id _XlcCloseCon).22 E -.165(ve)-.44 G(rter\().165 E/F3 11 /Times-Italic@0 SF(con)A(v)-.44 E F2(\))A(XlcCon)88.5 96 Q(v)-.44 E F3 (con)2.75 E(v)-.44 E F2(;)A(The)72 115.2 Q F1(_XlcCloseCon)3.666 E -.11 (ve)-.44 G(rter).11 E F2(function closes the speci\214ed con)3.666 E -.165(ve)-.44 G(rter `).165 E(`)-.814 E F3(con)A(v)-.44 E F2 -.814('')C (.).814 E F1(Code con)72 142.8 Q -.11(ve)-.44 G(rsion).11 E F2 (int _XlcCon)72 162 Q -.165(ve)-.44 G(rt\().165 E F3(con)A(v)-.44 E F2 (,)A F3(fr)2.75 E(om)-.495 E F2(,)A F3(fr)2.75 E(om_left)-.495 E F2(,)A F3(to)2.75 E F2(,)A F3(to_left)2.75 E F2(,)A F3(ar)2.75 E(gs)-.407 E F2 (,)A F3(num_ar)2.75 E(gs)-.407 E F2(\))A(XlcCon)88.5 174 Q(v)-.44 E F3 (con)2.75 E(v)-.44 E F2(;)A(XPointer)88.5 186 Q F3(*fr)2.75 E(om)-.495 E F2(;)A(int)88.5 198 Q F3(*fr)2.75 E(om_left)-.495 E F2(;)A(XPointer)88.5 210 Q F3(*to)2.75 E F2(;)A(int)88.5 222 Q F3(*to_left)2.75 E F2(;)A (XPointer)88.5 234 Q F3(*ar)2.75 E(gs)-.407 E F2(;)A(int)88.5 246 Q F3 (num_ar)2.75 E(gs)-.407 E F2(;)A(The)72 265.2 Q F1(_XlcCon)3.666 E -.11 (ve)-.44 G(rt).11 E F2(function con)3.666 E -.165(ve)-.44 G (rts a sequence of characters from one type, in the array speci\214ed) .165 E(by `)72 277.2 Q(`)-.814 E F3(fr)A(om)-.495 E F2 -.814('')C 2.75 (,i).814 G(nto a sequence of corresponding characters in another type, \ in the array speci\214ed by)-2.75 E -.814(``)72 289.2 S F3(to).814 E F2 -.814('')C 5.5(.T).814 G(he types are those speci\214ed in the)-5.5 E F1 (_XlcOpenCon)3.666 E -.11(ve)-.44 G(rter\(\)).11 E F2 (call that returned the con)3.666 E -.165(ve)-.44 G -.22(r-).165 G (sion descriptor)72 301.2 Q 2.75(,`)-.44 G(`)-3.564 E F3(con)A(v)-.44 E F2 -.814('')C 5.5(.T).814 G(he ar)-5.5 E(guments `)-.198 E(`)-.814 E F3 (fr)A(om)-.495 E F2 -.814('')C 2.75(,`).814 G(`)-3.564 E F3(fr)A (om_left)-.495 E F2 -.814('')C 2.75(,`).814 G(`)-3.564 E F3(to)A F2 1.628 -.814('' a)D(nd `).814 E(`)-.814 E F3(to_left)A F2 1.628 -.814 ('' h)D -2.475 -.22(av e).814 H(the same)2.97 E (speci\214cation of XPG4 icon)72 313.2 Q 2.75(vf)-.44 G(unction.)-2.75 E -.165(Fo)72 328.8 S 2.75(rs).165 G(tate-dependent encodings, the con) -2.75 E -.165(ve)-.44 G(rsion descriptor `).165 E(`)-.814 E F3(con)A(v) -.44 E F2 1.628 -.814('' i)D 2.75(sp).814 G (laced into its initial shift)-2.75 E(state by a call for which `)72 340.8 Q(`)-.814 E F3(fr)A(om)-.495 E F2 1.628 -.814('' i)D 2.75(saN).814 G(ULL pointer)-2.75 E 2.75(,o)-.44 G 2.75(rf)-2.75 G(or which `)-2.75 E (`)-.814 E F3(fr)A(om)-.495 E F2 1.628 -.814('' p)D (oints to a null pointer).814 E(.)-.605 E(The follo)72 356.4 Q (wing 2 con)-.275 E -.165(ve)-.44 G(rters prepared by locale returns ap\ propriate charset \(XlcCharSet\) in an area).165 E(pointed by ar)72 368.4 Q(gs[0].)-.198 E .44 LW 345.427 382.75 72 382.75 DL F1(Fr)72 398 Q 56.738(om T)-.198 F 63.943(oD)-1.012 G(escription)-63.943 E 345.427 408.75 72 408.75 DL F2 13.75(XlcNMultiByte XlcNCharSet Se)72 424 R (gmentation \(Decomposing\))-.165 E(XlcNW)72 436 Q 14.212 (ideChar XlcNCharSet)-.44 F(Se)16.5 E(gmentation \(Decomposing\))-.165 E 345.427 446.75 72 446.75 DL(The con)72 465.6 Q -.165(ve)-.44 G (rsion, from XlcNMultiByte/XlcNW).165 E(ideChar to XlcNCharSet, e)-.44 E (xtracts a se)-.165 E(gment which)-.165 E (has same charset encoding characters.)72 477.6 Q(More than one se)5.5 E (gment cannot be con)-.165 E -.165(ve)-.44 G(rted in a call.).165 E F1 (Reset a con)72 505.2 Q -.11(ve)-.44 G(rter).11 E F2 -.22(vo)72 524.4 S (id _XlcResetCon).22 E -.165(ve)-.44 G(rter\().165 E F3(con)A(v)-.44 E F2(\))A(XlcCon)88.5 536.4 Q(v)-.44 E F3(con)2.75 E(v)-.44 E F2(;)A(The) 72 555.6 Q F1(_XlcResetCon)3.666 E -.11(ve)-.44 G(rter).11 E F2 (function reset the speci\214ed con)3.666 E -.165(ve)-.44 G(rter `).165 E(`)-.814 E F3(con)A(v)-.44 E F2 -.814('')C(.).814 E F1(Register a con) 72 583.2 Q -.11(ve)-.44 G(rter).11 E F2(typedef XlcCon)72 604.8 Q 2.75 (v\()-.44 G(*XlcOpenCon)-2.75 E -.165(ve)-.44 G(rterProc\)\().165 E F3 (fr)A(om_lcd)-.495 E F2(,)A F3(fr)2.75 E(om_type)-.495 E F2(,)A F3 (to_lcd)2.75 E F2(,)A F3(to_type)2.75 E F2(\);)A(XLCd)88.5 616.8 Q F3 (fr)2.75 E(om_lcd)-.495 E F2(;)A(char)88.5 628.8 Q F3(*fr)2.75 E (om_type)-.495 E F2(;)A(XLCd)88.5 640.8 Q F3(to_lcd)2.75 E F2(;)A(char) 88.5 652.8 Q F3(*to_type)2.75 E F2(;)A F1(7)285.25 768 Q EP %%Page: 8 10 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF (Sample Implementation Frame W)72 52 Q 176.8(ork X11,)-.825 F (Release 6.4)2.75 E/F2 11/Times-Roman@0 SF(Bool _XlcSetCon)72 84 Q -.165 (ve)-.44 G(rter\().165 E/F3 11/Times-Italic@0 SF(fr)A(om_lcd)-.495 E F2 (,)A F3(fr)2.75 E(om)-.495 E F2(,)A F3(to_lcd)2.75 E F2(,)A F3(to)2.75 E F2(,)A F3(con)2.75 E(verter)-.44 E F2(\))A(XLCd)88.5 96 Q F3(fr)2.75 E (om_lcd)-.495 E F2(;)A(char)88.5 108 Q F3(*fr)2.75 E(om)-.495 E F2(;)A (XLCd)88.5 120 Q F3(to_lcd)2.75 E F2(;)A(char)88.5 132 Q F3(*to)2.75 E F2(;)A(XlcOpenCon)88.5 144 Q -.165(ve)-.44 G(rterProc).165 E F3(con)2.75 E(verter)-.44 E F2(;)A(The)72 163.2 Q F1(XlcSetCon)2.75 E -.11(ve)-.44 G (rter).11 E F2(function re)2.75 E(gisters a con)-.165 E -.165(ve)-.44 G (rter which con).165 E -.165(ve)-.44 G(rt from `).165 E(`)-.814 E F3(fr) A(om_type)-.495 E F2 1.628 -.814('' t)D(o).814 E -.814(``)72 175.2 S F3 (to_type).814 E F2 1.628 -.814('' i)D(nto the con).814 E -.165(ve)-.44 G (rter list \(in the speci\214ed XLCd\).).165 E F1 2.75(8. X)72 202.8 R (Locale Database functions)2.75 E F2 2.75(XL)72 218.4 S (ocale Database contains the subset of user')-2.75 E 2.75(se)-.605 G -.44(nv)-2.75 G(ironment that depends on language.).44 E(The fol-)5.5 E (lo)72 230.4 Q(wing APIs are pro)-.275 E (vided for accessing X Locale Database and other locale relati)-.165 E .33 -.165(ve \214)-.275 H(les.).165 E -.165(Fo)72 246 S 2.75(rm).165 G (ore detail about)-2.75 E 2.75(XL)5.5 G (ocale Database, please refer X Locale Database De\214nition document.) -2.75 E F1(Get a r)72 273.6 Q(esour)-.198 E(ce fr)-.198 E(om database) -.198 E F2 -.22(vo)72 292.8 S(id _XlcGetResource\().22 E F3(lcd)A F2(,)A F3(cate)2.75 E(gory)-.44 E F2(,)A F3(class)2.75 E F2(,)A F3(value)2.75 E F2(,)A F3(count)2.75 E F2(\))A(XLCd)88.5 304.8 Q F3(lcd)2.75 E F2(;)A (char)88.5 316.8 Q F3(*cate)2.75 E(gory)-.44 E F2(;)A(char)88.5 328.8 Q F3(*class)2.75 E F2(;)A(char)88.5 340.8 Q F3(***value)2.75 E F2(;)A(int) 88.5 352.8 Q F3(*count)2.75 E F2(;)A(The)72 372 Q F1(_XlcGetResour)3.666 E(ce)-.198 E F2 (function obtains a locale dependent data which is associated with the) 3.666 E(locale of speci\214ed `)72 384 Q(`)-.814 E F3(lcd)A F2 -.814('') C 5.5(.T).814 G(he locale data is pro)-5.5 E (vided by system locale or by X Locale Database)-.165 E (\214le, and what kind of data is a)72 396 Q -.275(va)-.22 G (ilable is implementation dependent.).275 E(The speci\214ed `)72 411.6 Q (`)-.814 E F3(cate)A(gory)-.44 E F2 1.628 -.814('' a)D(nd `).814 E(`) -.814 E F3(class)A F2 1.628 -.814('' a)D (re used for \214nding out the objecti).814 E .33 -.165(ve l)-.275 H (ocale data.).165 E(The returned)72 427.2 Q -.275(va)5.5 G (lue is returned in v).275 E(alue ar)-.275 E (gument in string list form, and the returned count sho)-.198 E(ws)-.275 E(the number of strings in the v)72 439.2 Q(alue.)-.275 E (The returned v)72 454.8 Q(alue is o)-.275 E (wned by locale method, and should not be modi\214ed or freed by caller) -.275 E(.)-.605 E F1(Get a locale r)72 482.4 Q(elati)-.198 E .22 -.11 (ve \214)-.11 H(le name).11 E F2(char * _XlcFileName\()72 501.6 Q F3 (lcd)A F2(,)A F3(cate)2.75 E(gory)-.44 E F2(\))A(XLCd)88.5 513.6 Q F3 (lcd)2.75 E F2(;)A(char)88.5 525.6 Q F3(*cate)2.75 E(gory)-.44 E F2(;)A (The)72 544.8 Q F1(_XlcFileName)3.666 E F2 (functions returns a \214le name which is bound to the speci\214ed `) 3.666 E(`)-.814 E F3(lcd)A F2 1.628 -.814('' a)D(nd `).814 E(`)-.814 E F3(cat-)A -.44(eg)72 556.8 S(ory).44 E F2 -.814('')C 2.75(,a).814 G 2.75 (san)-2.75 G(ull-terminated string.)-2.75 E (If no \214le name can be found, or there is no readable \214le for)5.5 E(the found \214le name,)72 568.8 Q F1(_XlcFileName)3.666 E F2 (returns NULL.)3.666 E(The returned \214le name should be freed by)5.5 E (caller)72 580.8 Q(.)-.605 E (The rule for searching a \214le name is implementation dependent.)72 596.4 Q(In current implementation,)5.5 E F1(_XlcFileName)72.916 608.4 Q F2(uses `)3.666 E(`{cate)-.814 E(gory}.dir')-.165 E 2.75<278c>-.814 G (le as mapping table, which has pairs of strings, a full)-2.75 E (locale name and a corresponding \214le name.)72 620.4 Q F1 2.75 (9. Utility)72 648 R(Functions)2.75 E(Compar)72 663.6 Q 2.75(eL)-.198 G (atin-1 strings)-2.75 E F2(int _XlcCompareISOLatin1\()72 682.8 Q F3 (str1)A F2(,)A F3(str2)2.75 E F2(\))A(char)88.5 694.8 Q F3(*str1)2.75 E F2(,)A F3(*str2)2.75 E F2(;)A F1(8)285.25 768 Q EP %%Page: 9 11 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF (Sample Implementation Frame W)72 52 Q 176.8(ork X11,)-.825 F (Release 6.4)2.75 E/F2 11/Times-Roman@0 SF(int _XlcNCompareISOLatin1\() 72 84 Q/F3 11/Times-Italic@0 SF(str1)A F2(,)A F3(str2)2.75 E F2(,)A F3 (len)2.75 E F2(\))A(char)88.5 96 Q F3(*str1)2.75 E F2(,)A F3(*str2)2.75 E F2(;)A(int)88.5 108 Q F3(len)2.75 E F2(;)A(The)72 127.2 Q F1 (_XlcCompar)3.666 E(eIsoLatin1)-.198 E F2(function to compares tw)3.666 E 2.75(oI)-.11 G(SO-8859-1 strings.)-2.75 E(Bytes representing)5.5 E(lo) 72 139.2 Q(wer case letters are con)-.275 E -.165(ve)-.44 G (rted to upper case before making the comparison.).165 E(The v)5.5 E (alue returned)-.275 E(is an inte)72 151.2 Q (ger less than, equal to, or greater than zero, depending on whether `) -.165 E(`)-.814 E F3(str1)A F2 1.628 -.814('' i)D 2.75(sl).814 G -.165 (ex)-2.75 G(icograph-).165 E (icly less than, equal to, or greater than `)72 163.2 Q(`)-.814 E F3 (str2)A F2 -.814('')C(.).814 E(The)72 178.8 Q F1(_XlcNCompar)3.666 E (eIsoLatin1)-.198 E F2(function is identical to)3.666 E F1(_XlcCompar) 3.666 E(eISOLatin1,)-.198 E F2 -.165(ex)3.666 G(cept that at).165 E (most `)72 190.8 Q(`)-.814 E F3(len)A F2 1.628 -.814('' b)D (ytes are compared.).814 E F1(Resour)72 218.4 Q(ce Utility)-.198 E F2 (int XlcNumber\()72 237.6 Q F3(arr)A(ay)-.165 E F2(\))A(ArrayT)88.5 249.6 Q(ype)-.88 E F3(arr)2.75 E(ay)-.165 E F2(;)A(Similar to XtNumber) 72 268.8 Q(.)-.605 E -.22(vo)72 288 S(id _XlcCop).22 E(yFromAr)-.11 E (g\()-.198 E F3(sr)A(c)-.407 E F2(,)A F3(dst)2.75 E F2(,)A F3(size)2.75 E F2(\))A(char)88.5 300 Q F3(*sr)2.75 E(c)-.407 E F2(;)A(char)88.5 312 Q F3(*dst)2.75 E F2(;)A(int)88.5 324 Q F3(size)2.75 E F2(;)A -.22(vo)72 343.2 S(id _XlcCop).22 E(yT)-.11 E(oAr)-.88 E(g\()-.198 E F3(sr)A(c) -.407 E F2(,)A F3(dst)2.75 E F2(,)A F3(size)2.75 E F2(\))A(char)88.5 355.2 Q F3(*sr)2.75 E(c)-.407 E F2(;)A(char)88.5 367.2 Q F3(**dst)2.75 E F2(;)A(int)88.5 379.2 Q F3(size)2.75 E F2(;)A(Similar to)72 398.4 Q F1 (_XtCopyFr)3.666 E(omAr)-.198 E(g)-.11 E F2(and)3.666 E F1(_XtCopyT) 3.666 E(oAr)-1.012 E -.165(g.)-.11 G F2 -.22(vo)72 417.6 S (id _XlcCountV).22 E(aList\()-1.221 E F3(var)A F2(,)A F3(count_r)2.75 E (et)-.407 E F2(\))A -.275(va)88.5 429.6 S(_list).275 E F3(var)2.75 E F2 (;)A(int)88.5 441.6 Q F3(*count_r)2.75 E(et)-.407 E F2(;)A(Similar to)72 460.8 Q F1(_XtCountV)3.666 E(aList.)-1.012 E F2 -.22(vo)72 480 S (id _XlcV).22 E(aT)-1.221 E(oAr)-.88 E(gList\()-.198 E F3(var)A F2(,)A F3(count)2.75 E F2(,)A F3(ar)2.75 E(gs_r)-.407 E(et)-.407 E F2(\))A -.275(va)88.5 492 S(_list).275 E F3(var)2.75 E F2(;)A(int)88.5 504 Q F3 (count)2.75 E F2(;)A(XlcAr)88.5 516 Q(gList)-.198 E F3(*ar)2.75 E(gs_r) -.407 E(et)-.407 E F2(;)A(Similar to)72 535.2 Q F1(_XtV)3.666 E(aT) -1.012 E(oAr)-1.012 E(gList.)-.11 E F2(typedef struct _XlcResource {)72 556.8 Q(char *name;)88.5 568.8 Q(XrmQuark xrm_name;)88.5 580.8 Q (int size;)88.5 592.8 Q(int of)88.5 604.8 Q(fset;)-.275 E (unsigned long mask;)88.5 616.8 Q 2.75(}X)72 628.8 S (lcResource, *XlcResourceList;)-2.75 E(#de\214ne)72 656.4 Q (XlcCreateMask)124.5 656.4 Q(\(1L<<0\))285 656.4 Q(#de\214ne)72 668.4 Q (XlcDef)124.5 668.4 Q(aultMask)-.11 E(\(1L<<1\))285 668.4 Q(#de\214ne)72 680.4 Q(XlcGetMask)124.5 680.4 Q(\(1L<<2\))285 680.4 Q(#de\214ne)72 692.4 Q(XlcSetMask)124.5 692.4 Q(\(1L<<3\))285 692.4 Q(#de\214ne)72 704.4 Q(XlcIgnoreMask)124.5 704.4 Q(\(1L<<4\))285 704.4 Q F1(9)285.25 768 Q EP %%Page: 10 12 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF (Sample Implementation Frame W)72 52 Q 176.8(ork X11,)-.825 F (Release 6.4)2.75 E/F2 11/Times-Roman@0 SF -.22(vo)72 84 S (id _XlcCompileResourceList\().22 E/F3 11/Times-Italic@0 SF -.407(re)C (sour).407 E(ces)-.407 E F2(,)A F3(num_r)2.75 E(esour)-.407 E(ces)-.407 E F2(\))A(XlcResourceList)88.5 96 Q F3 -.407(re)2.75 G(sour).407 E(ces) -.407 E F2(;)A(int)88.5 108 Q F3(num_r)2.75 E(esour)-.407 E(ces)-.407 E F2(;)A(Similar to)72 127.2 Q F1(_XtCompileResour)3.666 E(ceList.)-.198 E F2(char * _XlcGetV)72 146.4 Q(alues\()-1.221 E F3(base)A F2(,)A F3 -.407 (re)2.75 G(sour).407 E(ces)-.407 E F2(,)A F3(num_r)2.75 E(esour)-.407 E (ces)-.407 E F2(,)A F3(ar)2.75 E(gs)-.407 E F2(,)A F3(num_ar)2.75 E(gs) -.407 E F2(,)A F3(mask)2.75 E F2(\))A(XPointer)88.5 158.4 Q F3(base)2.75 E F2(;)A(XlcResourceList)88.5 170.4 Q F3 -.407(re)2.75 G(sour).407 E (ces)-.407 E F2(;)A(int)88.5 182.4 Q F3(num_r)2.75 E(esour)-.407 E(ces) -.407 E F2(;)A(XlcAr)88.5 194.4 Q(gList)-.198 E F3(ar)2.75 E(gs)-.407 E F2(;)A(int)88.5 206.4 Q F3(num_ar)2.75 E(gs)-.407 E F2(;)A (unsigned long)88.5 218.4 Q F3(mask)2.75 E F2(;)A(Similar to XtGetSub)72 237.6 Q -.275(va)-.165 G(lues.).275 E(char * _XlcSetV)72 256.8 Q (alues\()-1.221 E F3(base)A F2(,)A F3 -.407(re)2.75 G(sour).407 E(ces) -.407 E F2(,)A F3(num_r)2.75 E(esour)-.407 E(ces)-.407 E F2(,)A F3(ar) 2.75 E(gs)-.407 E F2(,)A F3(num_ar)2.75 E(gs)-.407 E F2(,)A F3(mask)2.75 E F2(\))A(XPointer)88.5 268.8 Q F3(base)2.75 E F2(;)A(XlcResourceList) 88.5 280.8 Q F3 -.407(re)2.75 G(sour).407 E(ces)-.407 E F2(;)A(int)88.5 292.8 Q F3(num_r)2.75 E(esour)-.407 E(ces)-.407 E F2(;)A(XlcAr)88.5 304.8 Q(gList)-.198 E F3(ar)2.75 E(gs)-.407 E F2(;)A(int)88.5 316.8 Q F3 (num_ar)2.75 E(gs)-.407 E F2(;)A(unsigned long)88.5 328.8 Q F3(mask)2.75 E F2(;)A(Similar to XtSetSub)72 348 Q -.275(va)-.165 G(lues.).275 E F1 (ANSI C Compatible Functions)72 375.6 Q F2(The follo)72 391.2 Q (wing are ANSI C/MSE Compatible Functions for non-ANSI C en)-.275 E (vironment.)-.44 E(int _Xmblen\()72 410.4 Q F3(str)A F2(,)A F3(len)2.75 E F2(\))A(char)88.5 422.4 Q F3(*str)2.75 E F2(;)A(int)88.5 434.4 Q F3 (len)2.75 E F2(;)A(The)72 453.6 Q F1(_Xmblen)3.666 E F2 (function returns the number of characters pointed to by `)3.666 E(`) -.814 E F3(str)A F2 -.814('')C 5.5(.O).814 G(nly `)-5.5 E(`)-.814 E F3 (len)A F2 1.628 -.814('' b)D(ytes).814 E(in `)72 465.6 Q(`)-.814 E F3 (str)A F2 1.628 -.814('' a)D (re used in determining the character count returned.).814 E -.814(``) 5.5 G F3(Str).814 E F2 1.628 -.814('' m)D(ay point at characters from) .814 E(an)72 477.6 Q 2.75(yv)-.165 G (alid codeset in the current locale.)-3.025 E(The call)72 493.2 Q F1 (_Xmblen)3.666 E F2(is equi)3.666 E -.275(va)-.275 G(lent to).275 E (_Xmbto)97 505.2 Q(wc\(_Xmbto)-.275 E(wc\(\()-.275 E F3(wc)A(har_t*) -.165 E F2(\)NULL,)A F3(str)2.75 E F2(,)A F3(len)2.75 E F2(\)\))A (int _Xmbto)72 524.4 Q(wc\()-.275 E F3(wstr)A F2(,)A F3(str)2.75 E F2(,) A F3(len)2.75 E F2(\))A(wchar_t)88.5 536.4 Q F3(*wstr)2.75 E F2(;)A (char)88.5 548.4 Q F3(*str)2.75 E F2(;)A(int)88.5 560.4 Q F3(len)2.75 E F2(;)A(The)72 579.6 Q F1(_Xmbto)3.666 E(wc)-.11 E F2(function con)3.666 E -.165(ve)-.44 G(rts the character\(s\) pointed to by `).165 E(`)-.814 E F3(str)A F2 1.628 -.814('' t)D 2.75(ot).814 G(heir wide character) -2.75 E(representation\(s\) pointed to by `)72 591.6 Q(`)-.814 E F3 (wstr)A F2 -.814('')C 5.5(.`).814 G(`)-6.314 E F3(Len)A F2 1.628 -.814 ('' i)D 2.75(st).814 G(he number of bytes in `)-2.75 E(`)-.814 E F3(str) A F2 1.628 -.814('' t)D 2.75(ob).814 G 2.75(ec)-2.75 G(on)-2.75 E -.165 (ve)-.44 G(rted.).165 E(The return v)72 603.6 Q (alue is the number of characters con)-.275 E -.165(ve)-.44 G(rted.).165 E(The call)72 619.2 Q F1(_Xmbto)3.666 E(wc)-.11 E F2(is equi)3.666 E -.275(va)-.275 G(lent to).275 E(_Xlcmbto)97 631.2 Q(wc\(\(XLCd\)NULL,) -.275 E F3(wstr)2.75 E F2(,)A F3(str)2.75 E F2(,)A F3(len)2.75 E F2(\))A (int _Xlcmbto)72 650.4 Q(wc\()-.275 E F3(lcd)A F2(,)A F3(wstr)2.75 E F2 (,)A F3(str)2.75 E F2(,)A F3(len)2.75 E F2(\))A(XLCd)88.5 662.4 Q F3 (lcd)2.75 E F2(;)A(wchar_t)88.5 674.4 Q F3(*wstr)2.75 E F2(;)A(char)88.5 686.4 Q F3(*str)2.75 E F2(;)A(int)88.5 698.4 Q F3(len)2.75 E F2(;)A(The) 72 717.6 Q F1(_Xlcmbto)3.666 E(wc)-.11 E F2(function is identical to) 3.666 E F1(_Xmbto)3.666 E(wc,)-.11 E F2 -.165(ex)3.666 G (cept that it requires the `).165 E(`)-.814 E F3(lcd)A F2 1.628 -.814 ('' a)D -.198(rg).814 G(ument.).198 E(If `)72 729.6 Q(`)-.814 E F3(lcd)A F2 1.628 -.814('' i)D 2.75(s\().814 G(XLCd\) NULL,)-2.75 E F1(_Xlcmbto) 3.666 E(wc,)-.11 E F2(calls)3.666 E F1(_XlcCurr)3.666 E(entLC)-.198 E F2 (to determine the current locale.)3.666 E F1(10)282.5 768 Q EP %%Page: 11 13 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF (Sample Implementation Frame W)72 52 Q 176.8(ork X11,)-.825 F (Release 6.4)2.75 E/F2 11/Times-Roman@0 SF(int _Xwctomb\()72 84 Q/F3 11 /Times-Italic@0 SF(str)A F2(,)A F3(wc)2.75 E F2(\))A(char)88.5 96 Q F3 (*str)2.75 E F2(;)A(wchar_t)88.5 108 Q F3(wc)2.75 E F2(;)A(The)72 127.2 Q F1(_Xwctomb)3.666 E F2(function con)3.666 E -.165(ve)-.44 G (rts a single wide character pointed to by `).165 E(`)-.814 E F3(wc)A F2 1.628 -.814('' t)D 2.75(oi).814 G(ts multibyte)-2.75 E (representation pointed to by `)72 139.2 Q(`)-.814 E F3(str)A F2 -.814 ('')C 5.5(.O).814 G 2.75(ns)-5.5 G(uccess, the return v)-2.75 E (alue is 1.)-.275 E(The call)72 154.8 Q F1(_Xwctomb)3.666 E F2(is equi) 3.666 E -.275(va)-.275 G(lent to).275 E(_Xlcwctomb\(\(XLCd\)NULL,)97 166.8 Q F3(str)2.75 E F2(,)A F3(wstr)2.75 E F2(\))A(int _Xlcwctomb\()72 186 Q F3(lcd)A F2(,)A F3(str)2.75 E F2(,)A F3(wc)2.75 E F2(\))A(XLCd) 88.5 198 Q F3(lcd)2.75 E F2(;)A(char)88.5 210 Q F3(*str)2.75 E F2(;)A (wchar_t)88.5 222 Q F3(wc)2.75 E F2(;)A(The)72 241.2 Q F1(_Xlcwctomb) 3.666 E F2(function is identical to _Xwctomb, e)3.666 E (xcept that it requires the `)-.165 E(`)-.814 E F3(lcd)A F2 1.628 -.814 ('' a)D -.198(rg).814 G(ument.).198 E(If `)72 253.2 Q(`)-.814 E F3(lcd)A F2 1.628 -.814('' i)D 2.75(s\().814 G(XLCd\) NULL,)-2.75 E F1 (_Xlcwctomb,)3.666 E F2(calls)3.666 E F1(_XlcCurr)3.666 E(entLC)-.198 E F2(to determine the current locale.)3.666 E(int _Xmbsto)72 272.4 Q (wcs\()-.275 E F3(wstr)A F2(,)A F3(str)2.75 E F2(,)A F3(len)2.75 E F2 (\))A(wchar_t)88.5 284.4 Q F3(*wstr)2.75 E F2(;)A(char)88.5 296.4 Q F3 (*str)2.75 E F2(;)A(int)88.5 308.4 Q F3(len)2.75 E F2(;)A(The)72 327.6 Q F1(_Xmbsto)3.666 E(wcs)-.11 E F2(function con)3.666 E -.165(ve)-.44 G (rts the NULL-terminated string pointed to by `).165 E(`)-.814 E F3(str) A F2 1.628 -.814('' t)D 2.75(oi).814 G(ts wide)-2.75 E (character string representation pointed to by `)72 339.6 Q(`)-.814 E F3 (wstr)A F2 -.814('')C 5.5(.`).814 G(`)-6.314 E F3(Len)A F2 1.628 -.814 ('' i)D 2.75(st).814 G(he number of characters in `)-2.75 E(`)-.814 E F3 (str)A F2 -.814('')C(to be con)72 351.6 Q -.165(ve)-.44 G(rted.).165 E (The call)72 367.2 Q F1(_Xmbsto)3.666 E(wcs)-.11 E F2(is equi)3.666 E -.275(va)-.275 G(lent to).275 E(_Xlcmbsto)97 379.2 Q(wcs\(\(XLCd\)NULL,) -.275 E F3(wstr)2.75 E F2(,)A F3(str)2.75 E F2(,)A F3(len)2.75 E F2(\))A (int _Xlcmbsto)72 398.4 Q(wcs\()-.275 E F3(lcd)A F2(,)A F3(wstr)2.75 E F2(,)A F3(str)2.75 E F2(,)A F3(len)2.75 E F2(\))A(XLCd)88.5 410.4 Q F3 (lcd)2.75 E F2(;)A(wchar_t)88.5 422.4 Q F3(*wstr)2.75 E F2(;)A(char)88.5 434.4 Q F3(*str)2.75 E F2(;)A(int)88.5 446.4 Q F3(len)2.75 E F2(;)A(The) 72 465.6 Q F1(_Xlcmbsto)3.666 E(wcs)-.11 E F2 (function is identical to _Xmbsto)3.666 E(wcs, e)-.275 E (xcept that it requires the `)-.165 E(`)-.814 E F3(lcd)A F2 1.628 -.814 ('' a)D -.198(rg).814 G(u-).198 E 2.75(ment. If)72 477.6 R -.814(``)2.75 G F3(lcd).814 E F2 1.628 -.814('' i)D 2.75(s\().814 G(XLCd\) NULL,)-2.75 E F1(_Xlcmbsto)3.666 E(wcs,)-.11 E F2(calls)3.666 E F1(_XlcCurr)3.666 E (entLC)-.198 E F2(to determine the cur)3.666 E(-)-.22 E(rent locale.)72 489.6 Q(int _Xwcstombs\()72 508.8 Q F3(str)A F2(,)A F3(wstr)2.75 E F2(,) A F3(len)2.75 E F2(\))A(char)88.5 520.8 Q F3(*str)2.75 E F2(;)A(wchar_t) 88.5 532.8 Q F3(*wstr)2.75 E F2(;)A(int)88.5 544.8 Q F3(len)2.75 E F2(;) A(The)72 564 Q F1(_Xwcstombs)3.666 E F2(function con)3.666 E -.165(ve) -.44 G(rts the \(wchar_t\) NULL terminated wide character string).165 E (pointed to by `)72 576 Q(`)-.814 E F3(wstr)A F2 1.628 -.814('' t)D 2.75 (ot).814 G(he NULL terminated multibyte string pointed to by `)-2.75 E (`)-.814 E F3(str)A F2 -.814('')C(.).814 E(The call)72 591.6 Q F1 (_Xwcstombs)3.666 E F2(is equi)3.666 E -.275(va)-.275 G(lent to).275 E (_Xlcwcstombs\(\(XLCd\)NULL,)97 603.6 Q F3(str)2.75 E F2(,)A F3(wstr) 2.75 E F2(,)A F3(len)2.75 E F2(\))A(int _Xlcwcstombs\()72 622.8 Q F3 (lcd)A F2(,)A F3(str)2.75 E F2(,)A F3(wstr)2.75 E F2(,)A F3(len)2.75 E F2(\))A(XLCd)88.5 634.8 Q F3(lcd)2.75 E F2(;)A(char)88.5 646.8 Q F3 (*str)2.75 E F2(;)A(wchar_t)88.5 658.8 Q F3(*wstr)2.75 E F2(;)A(int)88.5 670.8 Q F3(len)2.75 E F2(;)A(The)72 690 Q F1(_Xlcwcstombs)3.666 E F2 (function is identical to _Xwcstombs, e)3.666 E (xcept that it requires the `)-.165 E(`)-.814 E F3(lcd)A F2 1.628 -.814 ('' a)D -.198(rg).814 G(u-).198 E 2.75(ment. If)72 702 R -.814(``)2.75 G F3(lcd).814 E F2 1.628 -.814('' i)D 2.75(s\().814 G(XLCd\) NULL,)-2.75 E F1(_Xlcwcstombs,)3.666 E F2(calls)3.666 E F1(_XlcCurr)3.666 E(entLC) -.198 E F2(to determine the cur)3.666 E(-)-.22 E(rent locale.)72 714 Q F1(11)282.5 768 Q EP %%Page: 12 14 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF (Sample Implementation Frame W)72 52 Q 176.8(ork X11,)-.825 F (Release 6.4)2.75 E/F2 11/Times-Roman@0 SF(int _Xwcslen\()72 84 Q/F3 11 /Times-Italic@0 SF(wstr)A F2(\))A(wchar_t)88.5 96 Q F3(*wstr)2.75 E F2 (;)A(The)72 115.2 Q F1(_Xwcslen)3.666 E F2(function returns the count o\ f wide characters in the \(wchar_t\) NULL terminated)3.666 E (wide character string pointed to by `)72 127.2 Q(`)-.814 E F3(wstr)A F2 -.814('')C(.).814 E(wchar_t * _Xwcscp)72 146.4 Q(y\()-.11 E F3(wstr1)A F2(,)A F3(wstr2)2.75 E F2(\))A(wchar_t)88.5 158.4 Q F3(*wstr1)2.75 E F2 (,)A F3(*wstr2)2.75 E F2(;)A(wchar_t * _Xwcsncp)72 177.6 Q(y\()-.11 E F3 (wstr1)A F2(,)A F3(wstr2)2.75 E F2(,)A F3(len)2.75 E F2(\))A(wchar_t) 88.5 189.6 Q F3(*wstr1)2.75 E F2(,)A F3(*wstr2)2.75 E F2(;)A(int)88.5 201.6 Q F3(len)2.75 E F2(;)A(The)72 220.8 Q F1(_Xwcscpy)3.666 E F2(func\ tion copies the \(wchar_t\) NULL terminated wide character string point\ ed to)3.666 E(by `)72 232.8 Q(`)-.814 E F3(wstr2)A F2 1.628 -.814('' t)D 2.75(ot).814 G(he object pointed at by `)-2.75 E(`)-.814 E F3(wstr1)A F2 -.814('')C 5.5(.`).814 G(`)-6.314 E F3(Wstr1)A F2 1.628 -.814('' i)D 2.75(s\().814 G(wchar_t\) NULL terminated.)-2.75 E(The)5.5 E(return v)72 244.8 Q(alue is a pointer to `)-.275 E(`)-.814 E F3(wstr1)A F2 -.814('') C(.).814 E(The)72 260.4 Q F1(_Xwcsncpy)3.666 E F2 (function is identical to)3.666 E F1(_Xwcscpy)3.666 E(,)-.605 E F2 -.165 (ex)3.666 G(cept that it copies `).165 E(`)-.814 E F3(len)A F2 1.628 -.814('' w)D(ide characters).814 E(from the object pointed to by `)72 272.4 Q(`)-.814 E F3(wstr2)A F2 1.628 -.814('' t)D 2.75(ot).814 G (he object pointed to `)-2.75 E(`)-.814 E F3(wstr1)A F2 -.814('')C(.) .814 E(int _Xwcscmp\()72 291.6 Q F3(wstr1)A F2(,)A F3(wstr2)2.75 E F2 (\))A(wchar_t)88.5 303.6 Q F3(*wstr1)2.75 E F2(,)A F3(*wstr2)2.75 E F2 (;)A(int _Xwcsncmp\()72 322.8 Q F3(wstr1)A F2(,)A F3(wstr2)2.75 E F2(,)A F3(len)2.75 E F2(\))A(wchar_t)88.5 334.8 Q F3(*wstr1)2.75 E F2(,)A F3 (*wstr2)2.75 E F2(;)A(int)88.5 346.8 Q F3(len)2.75 E F2(;)A(The)72 366 Q F1(_Xwcscmp)3.666 E F2 2.75(function compares)3.666 F(tw)2.75 E 2.75 (o\()-.11 G(wchar_t\) NULL terminated wide character strings.)-2.75 E (The)5.5 E -.275(va)72 378 S(lue returned is an inte).275 E (ger less than, equal to, or greater than zero, depending on whether) -.165 E -.814(``)72 390 S F3(wstr1).814 E F2 1.628 -.814('' i)D 2.75(sl) .814 G -.165(ex)-2.75 G (icographicly less then, equal to, or greater than `).165 E(`)-.814 E F3 (str2)A F2 -.814('')C(.).814 E(The)72 405.6 Q F1(_Xwcsncmp)3.666 E F2 (function is identical to)3.666 E F1(_XlcCompar)3.666 E(eISOLatin1,) -.198 E F2 -.165(ex)3.666 G(cept that at most `).165 E(`)-.814 E F3(len) A F2 -.814('')C(wide characters are compared.)72 417.6 Q F1(12)282.5 768 Q F0 531.38(-- --)0 795 R EP %%Trailer end %%EOF XmHTML-1.1.10/docs/PaxHeaders.1031/Trans.PS0000644000175000001440000000013212613377377016075 xustar000000000000000030 mtime=1445854975.084545878 30 atime=1445854975.084545878 30 ctime=1445854975.084545878 XmHTML-1.1.10/docs/Trans.PS0000644000175000001440000015210712613377377015503 0ustar00chrisusers00000000000000%!PS-Adobe-3.0 %%Creator: groff version 1.11 %%CreationDate: Mon Dec 15 09:41:05 1997 %%DocumentNeededResources: font Times-Roman %%+ font Times-Bold %%+ font Times-Italic %%DocumentSuppliedResources: procset grops 1.11 0 %%Pages: 13 %%PageOrder: Ascend %%Orientation: Portrait %%EndComments %%BeginProlog %%BeginResource: procset grops 1.11 0 /setpacking where{ pop currentpacking true setpacking }if /grops 120 dict dup begin /SC 32 def /A/show load def /B{0 SC 3 -1 roll widthshow}bind def /C{0 exch ashow}bind def /D{0 exch 0 SC 5 2 roll awidthshow}bind def /E{0 rmoveto show}bind def /F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def /G{0 rmoveto 0 exch ashow}bind def /H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /I{0 exch rmoveto show}bind def /J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def /K{0 exch rmoveto 0 exch ashow}bind def /L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /M{rmoveto show}bind def /N{rmoveto 0 SC 3 -1 roll widthshow}bind def /O{rmoveto 0 exch ashow}bind def /P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /Q{moveto show}bind def /R{moveto 0 SC 3 -1 roll widthshow}bind def /S{moveto 0 exch ashow}bind def /T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def /SF{ findfont exch [exch dup 0 exch 0 exch neg 0 0]makefont dup setfont [exch/setfont cvx]cvx bind def }bind def /MF{ findfont [5 2 roll 0 3 1 roll neg 0 0]makefont dup setfont [exch/setfont cvx]cvx bind def }bind def /level0 0 def /RES 0 def /PL 0 def /LS 0 def /MANUAL{ statusdict begin/manualfeed true store end }bind def /PLG{ gsave newpath clippath pathbbox grestore exch pop add exch pop }bind def /BP{ /level0 save def 1 setlinecap 1 setlinejoin 72 RES div dup scale LS{ 90 rotate }{ 0 PL translate }ifelse 1 -1 scale }bind def /EP{ level0 restore showpage }bind def /DA{ newpath arcn stroke }bind def /SN{ transform .25 sub exch .25 sub exch round .25 add exch round .25 add exch itransform }bind def /DL{ SN moveto SN lineto stroke }bind def /DC{ newpath 0 360 arc closepath }bind def /TM matrix def /DE{ TM currentmatrix pop translate scale newpath 0 0 .5 0 360 arc closepath TM setmatrix }bind def /RC/rcurveto load def /RL/rlineto load def /ST/stroke load def /MT/moveto load def /CL/closepath load def /FL{ currentgray exch setgray fill setgray }bind def /BL/fill load def /LW/setlinewidth load def /RE{ findfont dup maxlength 1 index/FontName known not{1 add}if dict begin { 1 index/FID ne{def}{pop pop}ifelse }forall /Encoding exch def dup/FontName exch def currentdict end definefont pop }bind def /DEFS 0 def /EBEGIN{ moveto DEFS begin }bind def /EEND/end load def /CNT 0 def /level1 0 def /PBEGIN{ /level1 save def translate div 3 1 roll div exch scale neg exch neg exch translate 0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin 10 setmiterlimit []0 setdash /setstrokeadjust where{ pop false setstrokeadjust }if /setoverprint where{ pop false setoverprint }if newpath /CNT countdictstack def userdict begin /showpage{}def }bind def /PEND{ clear countdictstack CNT sub{end}repeat level1 restore }bind def end def /setpacking where{ pop setpacking }if %%EndResource %%IncludeResource: font Times-Roman %%IncludeResource: font Times-Bold %%IncludeResource: font Times-Italic grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron /scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent /ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen /period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon /semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O /P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex /underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y /z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft /guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl /endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut /dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash /quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen /brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft /logicalnot/minus/registered/macron/degree/plusminus/twosuperior /threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior /ordmasculine/guilsinglright/onequarter/onehalf/threequarters /questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE /Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex /Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis /multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn /germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla /egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis /eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash /ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def /Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE /Times-Roman@0 ENC0/Times-Roman RE %%EndProlog %%Page: 1 1 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 15/Times-Bold@0 SF (The XIM T)181.26 231 Q(ransport Speci\214cation)-1.11 E/F2 12 /Times-Bold@0 SF(Re)257.088 276 Q(vision 0.1)-.18 E 3(XV)223.944 306 S (ersion 11, Release 6.4)-4.2 E/F3 10/Times-Italic@0 SF -.92(Ta)252.835 345 S(kashi Fujiwar).92 E(a)-.15 E F0(FUJITSU LIMITED)246.755 363 Q F3 (ABSTRA)264.535 411 Q(CT)-.3 E/F4 11/Times-Roman@0 SF (This speci\214cation describes the transport layer interf)108 438.6 Q (aces between Xlib and IM)-.11 E(Serv)108 450.6 Q(er)-.165 E 2.75(,w) -.44 G(hich mak)-2.75 E(es v)-.11 E (arious channels usable such as X protocol or)-.275 E 2.75(,T)-.44 G (CP/IP)-2.75 E(,)-1.221 E(DECnet and etc.)108 462.6 Q EP %%Page: 2 2 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 9/Times-Roman@0 SF(Cop)72 195.6 Q(yright \251 1994 by FUJITSU LIMITED)-.09 E (Permission to use, cop)72 211.2 Q 1.17 -.585(y, m)-.09 H(odify).585 E 2.25(,a)-.585 G(nd distrib)-2.25 E(ute this documentation for an)-.18 E 2.25(yp)-.135 G(urpose and without fee is hereby granted,)-2.25 E(pro)72 223.2 Q(vided that the abo)-.135 E .27 -.135(ve c)-.135 H(op).135 E (yright notice and this permission notice appear in all copies.)-.09 E (Fujitsu mak)4.5 E(es no representa-)-.09 E (tions about the suitability for an)72 235.2 Q 2.25(yp)-.135 G (urpose of the information in this document.)-2.25 E (This documentation is pro)4.5 E(vided as is)-.135 E(without e)72 247.2 Q(xpress or implied w)-.135 E(arranty)-.09 E(.)-.585 E(Cop)72 319.2 Q (yright \251 1994 X Consortium)-.09 E (Permission is hereby granted, free of char)72 334.8 Q(ge, to an)-.162 E 2.25(yp)-.135 G(erson obtaining a cop)-2.25 E 2.25(yo)-.09 G 2.25(ft) -2.25 G(his softw)-2.25 E(are and associated documenta-)-.09 E (tion \214les \(the `)72 346.8 Q(`Softw)-.666 E(are')-.09 E ('\), to deal in the Softw)-.666 E(are without restriction, including w\ ithout limitation the rights to use,)-.09 E(cop)72 358.8 Q 1.17 -.585 (y, m)-.09 H(odify).585 E 2.25(,m)-.585 G(er)-2.25 E (ge, publish, distrib)-.162 E (ute, sublicense, and/or sell copies of the Softw)-.18 E (are, and to permit persons to whom)-.09 E(the Softw)72 370.8 Q (are is furnished to do so, subject to the follo)-.09 E (wing conditions:)-.225 E(The abo)72 386.4 Q .27 -.135(ve c)-.135 H(op) .135 E(yright notice and this permission notice shall be included in al\ l copies or substantial portions of the Soft-)-.09 E -.09(wa)72 398.4 S (re.).09 E(THE SOFTW)72 414 Q(ARE IS PR)-1.08 E -.45(OV)-.36 G(IDED `) .45 E -.72(`A)-.666 G 2.25(SI).72 G(S')-2.25 E(', WITHOUT W)-.666 E (ARRANTY OF ANY KIND, EXPRESS OR IMPLIED,)-1.08 E(INCLUDING B)72 426 Q (UT NO)-.09 E 2.25(TL)-.36 G(IMITED T)-2.25 E 2.25(OT)-.162 G(HE W)-2.25 E(ARRANTIES OF MERCHANT)-1.08 E(ABILITY)-.837 E 2.25(,F)-1.161 G (ITNESS FOR A P)-2.25 E(AR)-.828 E(TIC-)-.54 E (ULAR PURPOSE AND NONINFRINGEMENT)72 438 Q 4.5(.I)-.666 G 2.25(NN)-4.5 G 2.25(OE)-2.25 G(VENT SHALL THE X CONSOR)-2.25 E(TIUM BE LIABLE FOR)-.54 E(ANY CLAIM, D)72 450 Q(AMA)-.36 E(GES OR O)-.36 E(THER LIABILITY)-.36 E 2.25(,W)-1.161 G(HETHER IN AN A)-2.25 E(CTION OF CONTRA)-.36 E(CT)-.36 E 2.25(,T)-.666 G(OR)-2.412 E 2.25(TO)-.54 G 2.25(RO)-2.25 G(TH-)-2.61 E (ER)72 462 Q(WISE, ARISING FR)-.495 E (OM, OUT OF OR IN CONNECTION WITH THE SOFTW)-.36 E(ARE OR THE USE OR O) -1.08 E(THER)-.36 E(DEALINGS IN THE SOFTW)72 474 Q(ARE.)-1.08 E(Except \ as contained in this notice, the name of the X Consortium shall not be \ used in adv)72 489.6 Q(ertising or otherwise to pro-)-.135 E (mote the sale, use or other dealings in this Softw)72 501.6 Q (are without prior written authorization from the X Consortium.)-.09 E /F2 9/Times-Italic@0 SF 2.25(XW)72 549.6 S(indow System)-2.745 E F1 (is a trademark of X Consortium, Inc.)2.25 E EP %%Page: 1 3 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF 2.75 (1. Intr)72 84 R(oduction)-.198 E/F2 11/Times-Roman@0 SF(The Xlib XIM i\ mplementation is layered into three functions, a protocol layer)72 99.6 Q 2.75(,a)-.44 G 2.75(ni)-2.75 G(nterf)-2.75 E(ace layer)-.11 E (and a transport layer)72 111.6 Q 2.75(.T)-.605 G (he purpose of this layering is to mak)-2.75 E 2.75(et)-.11 G (he protocol independent of trans-)-2.75 E(port implementation.)72 123.6 Q(Each function of these layers are:)5.5 E/F3 11/Times-Italic@0 SF (The pr)97 139.2 Q(otocol layer)-.495 E F2(implements o)122 151.2 Q -.165(ve)-.165 G(rall function of XIM and calls the interf).165 E (ace layer functions when it)-.11 E(needs to communicate to IM Serv)122 163.2 Q(er)-.165 E(.)-.605 E F3(The interface layer)97 178.8 Q F2(separ\ ates the implementation of the transport layer from the protocol layer) 122 190.8 Q 2.75(,i)-.44 G 2.75(no)-2.75 G(ther)-2.75 E -.11(wo)122 202.8 S(rds, it pro).11 E(vides implementation independent hook for the\ transport layer functions.)-.165 E F3(The tr)97 218.4 Q(ansport layer) -.165 E F2(handles actual data communication with IM Serv)122 230.4 Q (er)-.165 E 2.75(.I)-.605 G 2.75(ti)-2.75 G 2.75(sd)-2.75 G (one by a set of se)-2.75 E -.165(ve)-.275 G(ral func-).165 E (tions named transporters.)122 242.4 Q (This speci\214cation describes the interf)72 258 Q (ace layer and the transport layer)-.11 E 2.75(,w)-.44 G(hich mak)-2.75 E(es v)-.11 E(arious com-)-.275 E (munication channels usable such as X protocol or)72 270 Q 2.75(,T)-.44 G(CP/IP)-2.75 E 2.75(,D)-1.221 G(ECnet, STREAM, etc., and pro)-2.75 E (vides)-.165 E(the information needed for adding another ne)72 282 Q 2.75(wt)-.275 G(ransport layer)-2.75 E 5.5(.I)-.605 G 2.75(na)-5.5 G (ddition, sample implementa-)-2.75 E(tions for the transporter using th\ e X connection is described in section 4.)72 294 Q F1 2.75 (2. Initialization)72 318 R 2.75(2.1. Registering)72 342 R(structur)2.75 E 2.75(et)-.198 G 2.75(oi)-2.75 G(nitialize)-2.75 E F2 (The structure typed as T)72 357.6 Q(ransportSW contains the list of th\ e transport layer the speci\214c implemen-)-.385 E(tations supports.)72 369.6 Q(typedef struct {)72 391.2 Q(char *transport_name;)88.5 403.2 Q (Bool \(*con\214g\);)88.5 415.2 Q 2.75(}T)72 427.2 S(ransportSW)-3.135 E (;)-.407 E F3(tr)72 452.4 Q(ansport_name)-.165 E F2 (name of transport\(*1\))12.386 E F3(con\214g)72 468 Q F2 (initial con\214guration function)55.616 E 2.75(As)72 483.6 S (ample entry for the Xlib supporting transporters is sho)-2.75 E (wn belo)-.275 E(w:)-.275 E -.385(Tr)72 505.2 S(ansportSW _XimT).385 E (ransportRec[] = {)-.385 E 24.692(/* char)72 520.2 R F3(*:)2.75 E 27.75 (*t)74.75 532.2 S -.165(ra)-27.75 G(nsport_name).165 E F2 71.136(,B)C (ool)-71.136 E F3(\(*con\214g\)\(\))2.75 E F2(*/)74.75 544.2 Q -.814(``) 108 556.2 S(X').814 E 117.534(', _XimXConf,)-.814 F -.814(``)108 568.2 S (tcp').814 E 112.034(', _XimT)-.814 F(ransConf,)-.385 E -.814(``)108 580.2 S(local').814 E 104.092(', _XimT)-.814 F(ransConf,)-.385 E -.814 (``)108 592.2 S(decnet').814 E 96.766(', _XimT)-.814 F(ransConf,)-.385 E -.814(``)108 604.2 S(streams').814 E 91.871(', _XimT)-.814 F(ransConf,) -.385 E(\(char *\)NULL,)108 616.2 Q(\(Bool \(*\)\(\)\)NULL,)77.417 E(};) 72 628.2 Q .36 LW 76.5 697 72 697 DL 81 697 76.5 697 DL 85.5 697 81 697 DL 90 697 85.5 697 DL 94.5 697 90 697 DL 99 697 94.5 697 DL 103.5 697 99 697 DL 108 697 103.5 697 DL 112.5 697 108 697 DL 117 697 112.5 697 DL 121.5 697 117 697 DL 126 697 121.5 697 DL 130.5 697 126 697 DL 135 697 130.5 697 DL 139.5 697 135 697 DL 144 697 139.5 697 DL/F4 9 /Times-Roman@0 SF (\(*1\) Refer to "The Input Method Protocol: Appendix B")72 708 Q F1(1) 285.25 768 Q EP %%Page: 2 4 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF(XIM T) 72 52 Q(ransport Speci\214cation)-.814 E(X11, Release 6.4)220.162 E 2.75 (2.2. Initialization)72 84 R(function)2.75 E/F2 11/Times-Roman@0 SF (The follo)72 99.6 Q(wing function will be called once when Xlib con\ \214gures the transporter functions.)-.275 E(Bool \(*con\214g\)\()72 121.2 Q/F3 11/Times-Italic@0 SF(im)A F2(,)A F3(tr)2.75 E(ansport_data) -.165 E F2(\))A(XIM)88.5 133.2 Q F3(im)2.75 E F2(;)A(char)88.5 145.2 Q F3(*tr)2.75 E(ansport_data)-.165 E F2(;)A F3(im)72 164.4 Q F2 (Speci\214es XIM structure address.)61 E F3(tr)72 180 Q(ansport_data) -.165 E F2(Speci\214es the data speci\214c to the transporter)6.154 E 2.75(,i)-.44 G 2.75(nI)-2.75 G 2.75(MS)-2.75 G(erv)-2.75 E (er address. \(*1\))-.165 E (This function must setup the transporter function pointers.)72 201.6 Q (The actual)72 217.2 Q F3(con\214g)2.75 E F2 (function will be chosen by IM Serv)2.75 E (er at the pre-connection time, matching by)-.165 E(the)72 229.2 Q F3 (tr)2.75 E(ansport_name)-.165 E F2(speci\214ed in the)2.75 E F1(_XimT) 2.75 E(ransportRec)-.814 E F2(array; The speci\214c members of Xim-)2.75 E(Proto structure listed belo)72 241.2 Q 2.75(wm)-.275 G (ust be initialized so that point the)-2.75 E 2.75(ya)-.165 G (ppropriate transporter func-)-2.75 E(tions.)72 253.2 Q (If the speci\214ed transporter has been con\214gured successfully)72 268.8 Q 2.75(,t)-.715 G(his function returns T)-2.75 E(rue. There is) -.385 E(no Alternati)72 280.8 Q .33 -.165(ve E)-.275 H (ntry for con\214g function itself.).165 E (The structure XimProto contains the follo)72 296.4 Q (wing function pointers:)-.275 E(Bool \(*connect\)\(\);)108 314.4 Q (/* Open connection */)98.435 E(Bool \(*shutdo)108 326.4 Q 87.391 (wn\)\(\); /*)-.275 F(Close connection */)2.75 E(Bool \(*write\)\(\);) 108 338.4 Q(/* Write data */)110.04 E(Bool \(*read\)\(\);)108 350.4 Q (/* Read data */)113.714 E(Bool \(*\215ush\)\(\);)108 362.4 Q (/* Flush data b)111.25 E(uf)-.22 E(fer */)-.275 E(Bool \(*re)108 374.4 Q 46.361(gister_dispatcher\)\(\); /*)-.165 F(Re)2.75 E (gister asynchronous data handler */)-.165 E (Bool \(*call_dispatcher\)\(\);)108 386.4 Q(/* Call dispatcher */)66.051 E(These functions are called when Xlib needs to communicate the IM Serv) 72 404.4 Q(er)-.165 E 2.75(.T)-.605 G(hese functions must)-2.75 E (process the appropriate procedure described belo)72 416.4 Q -.715(w.) -.275 G F1 2.75(3. The)72 444 R(interface/transport lay)2.75 E (er functions)-.11 E F2 -.165(Fo)72 459.6 S(llo).165 E (wing functions are used for the transport interf)-.275 E(ace.)-.11 E -.88(Ta)194.538 475.2 S(ble 3-1; The T).88 E(ransport Layer Functions.) -.385 E .36 LW 434.01 485.45 141.99 485.45 DL/F4 9/Times-Bold@0 SF (Alter)169.221 495.2 Q(nati)-.135 E .18 -.09(ve E)-.09 H 54.642 (ntry XimPr).09 F(oto member)-.162 E(\(Interface Lay)170.116 507.2 Q 56.577(er\) \(T)-.09 F(ransport Lay)-.666 E(er\))-.09 E(Section)399.761 501.2 Q 434.01 511.45 141.99 511.45 DL 434.01 513.45 141.99 513.45 DL (_XimConnect)146.49 523.2 Q/F5 9/Times-Roman@0 SF 105.645(connect 3.1) 73.893 F 434.01 527.45 141.99 527.45 DL F4(_XimShutdo)146.49 537.2 Q(wn) -.09 E F5(shutdo)66.963 E 98.859(wn 3.2)-.225 F 434.01 541.45 141.99 541.45 DL F4(_XimWrite)146.49 551.2 Q F5 115.14(write 3.3)83.397 F 434.01 555.45 141.99 555.45 DL F4(_XimRead)146.49 565.2 Q F5 118.146 (read 3.4)85.89 F 434.01 569.45 141.99 569.45 DL F4(_XimFlush)146.49 579.2 Q F5 116.13(\215ush 3.5)84.378 F 434.01 583.45 141.99 583.45 DL F4 (_XimRegisterDispatcher)146.49 593.2 Q F5(re)31.908 E 65.289 (gister_dispatcher 3.6)-.135 F 434.01 597.45 141.99 597.45 DL F4 (_XimCallDispatcher)146.49 607.2 Q F5 79.149(call_dispatcher 3.7)47.892 F 434.01 611.45 141.99 611.45 DL 393.51 485.45 393.51 611.45 DL 266.625 485.45 266.625 611.45 DL 434.01 485.45 434.01 611.45 DL 141.99 485.45 141.99 611.45 DL F2(The Protocol layer calls the abo)72 628.8 Q .33 -.165(ve f)-.165 H(unctions using the Alternati).165 E .33 -.165(ve E) -.275 H(ntry in the left column. The).165 E(transport implementation de\ \214nes XimProto member function in the right column. The Alternati)72 640.8 Q -.165(ve)-.275 G(Entry is pro)72 652.8 Q(vided so as to mak) -.165 E 2.75(ee)-.11 G(asier to implement the Protocol Layer)-2.75 E(.) -.605 E 76.5 697 72 697 DL 81 697 76.5 697 DL 85.5 697 81 697 DL 90 697 85.5 697 DL 94.5 697 90 697 DL 99 697 94.5 697 DL 103.5 697 99 697 DL 108 697 103.5 697 DL 112.5 697 108 697 DL 117 697 112.5 697 DL 121.5 697 117 697 DL 126 697 121.5 697 DL 130.5 697 126 697 DL 135 697 130.5 697 DL 139.5 697 135 697 DL 144 697 139.5 697 DL F5 (\(*1\) Refer to "The Input Method Protocol: Appendix B")72 708 Q F1(2) 285.25 768 Q EP %%Page: 3 5 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF(XIM T) 72 52 Q(ransport Speci\214cation)-.814 E(X11, Release 6.4)220.162 E 2.75 (3.1. Opening)72 84 R(connection)2.75 E/F2 11/Times-Roman@0 SF(When)72 99.6 Q F1(XOpenIM)2.75 E F2(is called, the follo)2.75 E (wing function is called to connect with the IM Serv)-.275 E(er)-.165 E (.)-.605 E(Bool \(*connect\)\()72 121.2 Q/F3 11/Times-Italic@0 SF(im)A F2(\))A(XIM)88.5 133.2 Q F3(im)2.75 E F2(;)A F3(im)72 152.4 Q F2 (Speci\214es XIM structure address.)61 E (This function must establishes the connection to the IM Serv)72 174 Q (er)-.165 E 2.75(.I)-.605 G 2.75(ft)-2.75 G (he connection is established)-2.75 E(successfully)72 186 Q 2.75(,t) -.715 G(his function returns T)-2.75 E 2.75(rue. The)-.385 F(Alternati) 2.75 E .33 -.165(ve E)-.275 H(ntry for this function is:).165 E (Bool _XimConnect\()72 207.6 Q F3(im)A F2(\))A(XIM)88.5 219.6 Q F3(im) 2.75 E F2(;)A F3(im)72 238.8 Q F2(Speci\214es XIM structure address.)61 E F1 2.75(3.2. Closing)72 266.4 R(connection)2.75 E F2(When)72 282 Q F1 (XCloseIM)2.75 E F2(is called, the follo)2.75 E (wing function is called to disconnect the connection with the)-.275 E (IM Serv)72 294 Q(er)-.165 E 2.75(.T)-.605 G(he Alternati)-2.75 E .33 -.165(ve E)-.275 H(ntry for this function is:).165 E(Bool \(*shutdo)72 315.6 Q(wn\)\()-.275 E F3(im)A F2(\))A(XIM)88.5 327.6 Q F3(im)2.75 E F2 (;)A F3(im)72 346.8 Q F2(Speci\214es XIM structure address.)61 E (This function must close connection with the IM Serv)72 368.4 Q(er) -.165 E 2.75(.I)-.605 G 2.75(ft)-2.75 G (he connection is closed successfully)-2.75 E(,)-.715 E (this function returns T)72 380.4 Q(rue. The Alternati)-.385 E .33 -.165 (ve E)-.275 H(ntry for this function is:).165 E(Bool _XimShutdo)72 402 Q (wn\()-.275 E F3(im)A F2(\))A(XIM)88.5 414 Q F3(im)2.75 E F2(;)A F3(im) 72 433.2 Q F2(Speci\214es XIM structure address.)14 E F1 2.75 (3.3. Writing)72 460.8 R(data)2.75 E F2(The follo)72 476.4 Q (wing function is called, when Xlib needs to write data to the IM Serv) -.275 E(er)-.165 E(.)-.605 E(Bool \(*write\)\()72 498 Q F3(im)A F2(,)A F3(len)2.75 E F2(,)A F3(data)2.75 E F2(\))A(XIM)88.5 510 Q F3(im)2.75 E F2(;)A(INT16)88.5 522 Q F3(len)2.75 E F2(;)A(XPointer)88.5 534 Q F3 (data)2.75 E F2(;)A F3(im)72 553.2 Q F2 (Speci\214es XIM structure address.)61 E F3(len)72 568.8 Q F2 (Speci\214es the length of writing data.)58.558 E F3(data)72 584.4 Q F2 (Speci\214es the writing data.)52.442 E(This function writes the)72 606 Q F3(data)2.75 E F2(to the IM Serv)2.75 E(er)-.165 E 2.75(,r)-.44 G -2.475 -.165(eg a)-2.75 H(rdless of the contents.).165 E (The number of bytes is)5.5 E(passed to)72 618 Q F3(len)2.75 E F2 2.75 (.T)C(he writing data is passed to)-2.75 E F3(data)2.75 E F2 2.75(.I)C 2.75(fd)-2.75 G(ata is sent successfully)-2.75 E 2.75(,t)-.715 G (he function returns)-2.75 E -.385(Tr)72 630 S(ue. Refer to "The Input \ Method Protocol" for the contents of the writing data. The Alternati) .385 E -.165(ve)-.275 G(Entry for this function is:)72 642 Q (Bool _XimWrite\()72 663.6 Q F3(im)A F2(,)A F3(len)2.75 E F2(,)A F3 (data)2.75 E F2(\))A(XIM)88.5 675.6 Q F3(im)2.75 E F2(;)A(INT16)88.5 687.6 Q F3(len)2.75 E F2(;)A(XPointer)88.5 699.6 Q F3(data)2.75 E F2(;)A F3(im)72 718.8 Q F2(Speci\214es XIM structure address.)61 E F1(3)285.25 768 Q EP %%Page: 4 6 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF(XIM T) 72 52 Q(ransport Speci\214cation)-.814 E(X11, Release 6.4)220.162 E/F2 11/Times-Italic@0 SF(len)72 84 Q/F3 11/Times-Roman@0 SF (Speci\214es the length of writing data.)58.558 E F2(data)72 99.6 Q F3 (Speci\214es the writing data.)52.442 E F1 2.75(3.4. Reading)72 127.2 R (data)2.75 E F3(The follo)72 142.8 Q (wing function is called when Xlib w)-.275 E (aits for response from IM serv)-.11 E(er synchronously)-.165 E(.)-.715 E(Bool \(*read\)\()72 164.4 Q F2(im)A F3(,)A F2 -.407(re)2.75 G(ad_b) .407 E(uf)-.22 E F3(,)A F2 -.22(bu)2.75 G(f_len).22 E F3(,)A F2 -.407 (re)2.75 G(t_len).407 E F3(\))A(XIM)88.5 176.4 Q F2(im)2.75 E F3(;)A (XPointer)88.5 188.4 Q F2 -.407(re)2.75 G(ad_b).407 E(uf)-.22 E F3(;)A (int)88.5 200.4 Q F2 -.22(bu)2.75 G(f_len).22 E F3(;)A(int)88.5 212.4 Q F2(*r)2.75 E(et_len)-.407 E F3(;)A F2(im)72 231.6 Q F3 (Speci\214es XIM structure address.)61 E F2 -.407(re)72 247.2 S(ad_b) .407 E(uf)-.22 E F3(Speci\214es the b)32.906 E(uf)-.22 E (fer to store data.)-.275 E F2 -.22(bu)72 262.8 S(f_len).22 E F3 (Speci\214es the size of the)39.22 E F2 -.22(bu)2.75 G -.198(ff).22 G (er).198 E -.407(re)72 278.4 S(t_len).407 E F3 (Speci\214es the length of stored data.)41.244 E (This function stores the read data in)72 300 Q F2 -.407(re)2.75 G(ad_b) .407 E(uf)-.22 E F3 2.75(,w)C(hich size is speci\214ed as)-2.75 E F2 -.22(bu)2.75 G(f_len).22 E F3 2.75(.T)C(he size of data)-2.75 E (is set to)72 312 Q F2 -.407(re)2.75 G(t_len).407 E F3 5.5(.T)C (his function return T)-5.5 E (rue, if the data is read normally or reading data is com-)-.385 E (pleted.)72 324 Q(The Alternati)72 339.6 Q .33 -.165(ve E)-.275 H (ntry for this function is:).165 E(Bool _XimRead\()72 361.2 Q F2(im)A F3 (,)A F2 -.407(re)2.75 G(t_len).407 E F3(,)A F2 -.22(bu)2.75 G(f).22 E F3 (,)A F2 -.22(bu)2.75 G(f_len).22 E F3(,)A F2(pr)2.75 E(edicate)-.407 E F3(,)A F2(pr)2.75 E(edicate_ar)-.407 E(g)-.407 E F3(\))A(XIM)88.5 373.2 Q F2(im)2.75 E F3(;)A(INT16)88.5 385.2 Q F2(*r)2.75 E(et_len)-.407 E F3 (;)A(XPointer)88.5 397.2 Q F2 -.22(bu)2.75 G(f).22 E F3(;)A(int)88.5 409.2 Q F2 -.22(bu)2.75 G(f_len).22 E F3(;)A(Bool)88.5 421.2 Q F2(\(*pr) 2.75 E(edicate\)\(\))-.407 E F3(;)A(XPointer)88.5 433.2 Q F2(pr)2.75 E (edicate_ar)-.407 E(g)-.407 E F3(;)A F2(im)72 452.4 Q F3 (Speci\214es XIM structure address.)61 E F2 -.407(re)72 468 S(t_len).407 E F3(Speci\214es the size of the)41.244 E F2(data)2.75 E F3 -.22(bu)2.75 G -.275(ff).22 G(er).275 E(.)-.605 E F2 -.22(bu)72 483.6 S(f).22 E F3 (Speci\214es the b)58.162 E(uf)-.22 E(fer to store data.)-.275 E F2 -.22 (bu)72 499.2 S(f_len).22 E F3(Speci\214es the length of)39.22 E F2 -.22 (bu)2.75 G -.198(ff).22 G(er).198 E F3(.)A F2(pr)72 514.8 Q(edicate) -.407 E F3(Speci\214es the predicate for the XIM data.)30.86 E F2(pr)72 530.4 Q(edicate_ar)-.407 E(g)-.407 E F3 (Speci\214es the predicate speci\214c data.)10.488 E (The predicate procedure indicates whether the)72 552 Q F2(data)2.75 E F3(is for the XIM or not.)2.75 E F2(len)2.75 E F3(This function stores) 2.75 E(the read data in)72 564 Q F2 -.22(bu)2.75 G(f).22 E F3 2.75(,w)C (hich size is speci\214ed as)-2.75 E F2 -.22(bu)2.75 G(f_len).22 E F3 2.75(.T)C(he size of data is set to)-2.75 E F2 -.407(re)2.75 G(t_len) .407 E F3 5.5(.I)C(f)-5.5 E F2(pr)2.75 E(eedi-)-.407 E(cate\(\))72 576 Q F3(returns T)2.75 E(rue, this function returns T)-.385 E 2.75(rue. If) -.385 F(not, it calls the re)2.75 E(gistered callback function.)-.165 E (The procedure and its ar)72 591.6 Q(guments are:)-.198 E (Bool \(*predicate\)\()72 616.8 Q F2(im)A F3(,)A F2(len)2.75 E F3(,)A F2 (data)2.75 E F3(,)A F2(pr)2.75 E(edicate_ar)-.407 E(g)-.407 E F3(\))A (XIM)88.5 628.8 Q F2(im)2.75 E F3(;)A(INT16)88.5 640.8 Q F2(len)2.75 E F3(;)A(XPointer)88.5 652.8 Q F2(data)2.75 E F3(;)A(XPointer)88.5 664.8 Q F2(pr)2.75 E(edicate_ar)-.407 E(g)-.407 E F3(;)A F2(im)72 684 Q F3 (Speci\214es XIM structure address.)61 E F2(len)72 699.6 Q F3 (Speci\214es the size of the)58.558 E F2(data)2.75 E F3 -.22(bu)2.75 G -.275(ff).22 G(er).275 E(.)-.605 E F2(data)72 715.2 Q F3 (Speci\214es the b)52.442 E(uf)-.22 E(fer to store data.)-.275 E F1(4) 285.25 768 Q EP %%Page: 5 7 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF(XIM T) 72 52 Q(ransport Speci\214cation)-.814 E(X11, Release 6.4)220.162 E/F2 11/Times-Italic@0 SF(pr)72 84 Q(edicate_ar)-.407 E(g)-.407 E/F3 11 /Times-Roman@0 SF(Speci\214es the predicate speci\214c data.)10.488 E F1 2.75(3.5. Flushing)72 111.6 R -.22(bu)2.75 G(ffer).22 E F3(The follo)72 127.2 Q(wing function is called when Xlib needs to \215ush the data.) -.275 E -.22(vo)72 148.8 S(id \(*\215ush\)\().22 E F2(im)A F3(\))A(XIM) 88.5 160.8 Q F2(im)2.75 E F3(;)A F2(im)72 180 Q F3 (Speci\214es XIM structure address.)61 E (This function must \215ush the data stored in internal b)72 201.6 Q(uf) -.22 E(fer on the transport layer)-.275 E 2.75(.I)-.605 G 2.75(fd)-2.75 G(ata transfer is)-2.75 E(completed, the function returns T)72 213.6 Q 2.75(rue. The)-.385 F(Alternati)2.75 E .33 -.165(ve E)-.275 H (ntry for this function is:).165 E -.22(vo)72 235.2 S(id _XimFlush\().22 E F2(im)A F3(\))A(XIM)88.5 247.2 Q F2(im)2.75 E F3(;)A F2(im)72 266.4 Q F3(Speci\214es XIM structure address.)61 E F1 2.75(3.6. Registering)72 294 R(asynchr)2.75 E(onous data handler)-.198 E F3 (Xlib needs to handle asynchronous response from IM Serv)72 309.6 Q(er) -.165 E 2.75(.T)-.605 G(his is because some of the XIM)-2.75 E (data occur asynchronously to X e)72 321.6 Q -.165(ve)-.275 G(nts.).165 E(Those data will be handled in the)72 337.2 Q F2 -.495(Fi)2.75 G(lter) .495 E F3 2.75(,a)C(nd the)-2.75 E F2 -.495(Fi)2.75 G(lter).495 E F3 (will call asynchronous data handler in the)2.75 E(protocol layer)72 349.2 Q 2.75(.T)-.605 G(hen it calls dispatchers in the transport layer) -2.75 E 2.75(.T)-.605 G(he dispatchers are implemented by)-2.75 E (the protocol layer)72 361.2 Q 2.75(.T)-.605 G(his function must store \ the information and prepare for later call of the dis-)-2.75 E (patchers using)72 373.2 Q F1(_XimCallDispatcher)2.75 E F3(.)A (When multiple dispatchers are re)72 388.8 Q(gistered, the)-.165 E 2.75 (yw)-.165 G(ill be called sequentially in order of re)-2.75 E (gistration,)-.165 E(on arri)72 400.8 Q -.275(va)-.275 G 2.75(lo).275 G 2.75(fa)-2.75 G(synchronous data. The re)-2.75 E (gister_dispatcher is declared as follo)-.165 E(wing:)-.275 E (Bool \(*re)72 422.4 Q(gister_dispatcher\)\()-.165 E F2(im)A F3(,)A F2 (dispatc)2.75 E(her)-.165 E F3(,)A F2(call_data)2.75 E F3(\))A(XIM)88.5 434.4 Q F2(im)2.75 E F3(;)A(Bool)88.5 446.4 Q F2(\(*dispatc)2.75 E (her\)\(\))-.165 E F3(;)A(XPointer)88.5 458.4 Q F2(call_data)2.75 E F3 (;)A F2(im)72 477.6 Q F3(Speci\214es XIM structure address.)61 E F2 (dispatc)72 493.2 Q(her)-.165 E F3 (Speci\214es the dispatcher function to re)25.723 E(gister)-.165 E(.) -.605 E F2(call_data)72 508.8 Q F3(Speci\214es a parameter for the) 30.442 E F2(dispatc)2.75 E(her)-.165 E F3(.)A (The dispatcher is a function of the follo)72 524.4 Q(wing type:)-.275 E (Bool \(*dispatcher\)\()72 546 Q F2(im)A F3(,)A F2(len)2.75 E F3(,)A F2 (data)2.75 E F3(,)A F2(call_data)2.75 E F3(\))A(XIM)88.5 558 Q F2(im) 2.75 E F3(;)A(INT16)88.5 570 Q F2(len)2.75 E F3(;)A(XPointer)88.5 582 Q F2(data)2.75 E F3(;)A(XPointer)88.5 594 Q F2(call_data)2.75 E F3(;)A F2 (im)72 613.2 Q F3(Speci\214es XIM structure address.)61 E F2(len)72 628.8 Q F3(Speci\214es the size of the)58.558 E F2(data)2.75 E F3 -.22 (bu)2.75 G -.275(ff).22 G(er).275 E(.)-.605 E F2(data)72 644.4 Q F3 (Speci\214es the b)52.442 E(uf)-.22 E(fer to store data.)-.275 E F2 (call_data)72 660 Q F3(Speci\214es a parameter passed to the re)30.442 E (gister_dispatcher)-.165 E(.)-.605 E(The dispatcher is pro)72 681.6 Q (vided by the protocol layer)-.165 E 2.75(.T)-.605 G(he)-2.75 E 2.75(ya) -.165 G(re called once for e)-2.75 E -.165(ve)-.275 G(ry asynchronous) .165 E(data, in order of re)72 693.6 Q (gistration. If the data is used, it must return T)-.165 E (rue. otherwise, it must return)-.385 E -.165(Fa)72 705.6 S(lse.).165 E F1(5)285.25 768 Q EP %%Page: 6 8 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF(XIM T) 72 52 Q(ransport Speci\214cation)-.814 E(X11, Release 6.4)220.162 E/F2 11/Times-Roman@0 SF(If the dispatcher function returns T)72 84 Q (rue, the T)-.385 E(ransport Layer assume that the data has been pro-) -.385 E(cessed by the upper layer)72 96 Q 5.5(.T)-.605 G(he Alternati) -5.5 E .33 -.165(ve E)-.275 H(ntry for this function is:).165 E (Bool _XimRe)72 117.6 Q(gisterDispatcher\()-.165 E/F3 11/Times-Italic@0 SF(im)A F2(,)A F3(dispatc)2.75 E(her)-.165 E F2(,)A F3(call_data)2.75 E F2(\))A(XIM)88.5 129.6 Q F3(im)2.75 E F2(;)A(Bool)88.5 141.6 Q F3 (\(*dispatc)2.75 E(her\)\(\))-.165 E F2(;)A(XPointer)88.5 153.6 Q F3 (call_data)2.75 E F2(;)A F3(im)72 172.8 Q F2 (Speci\214es XIM structure address.)61 E F3(dispatc)72 188.4 Q(her)-.165 E F2(Speci\214es the dispatcher function to re)25.723 E(gister)-.165 E (.)-.605 E F3(call_data)72 204 Q F2(Speci\214es a parameter for the) 30.442 E F3(dispatc)2.75 E(her)-.165 E F2(.)A F1 2.75(3.7. Calling)72 231.6 R(dispatcher)2.75 E F2(The follo)72 247.2 Q (wing function is used to call the re)-.275 E (gistered dispatcher function, when the asynchronous)-.165 E (response from IM Serv)72 259.2 Q(er has arri)-.165 E -.165(ve)-.275 G (d.).165 E(Bool \(*call_dispatcher\)\()72 280.8 Q F3(im)A F2(,)A F3(len) 2.75 E F2(,)A F3(data)2.75 E F2(\))A(XIM)88.5 292.8 Q F3(im)2.75 E F2(;) A(INT16)88.5 304.8 Q F3(len)2.75 E F2(;)A(XPointer)88.5 316.8 Q F3(data) 2.75 E F2(;)A F3(im)72 336 Q F2(Speci\214es XIM structure address.)61 E F3(len)72 351.6 Q F2(Speci\214es the size of)58.558 E F3(data)2.75 E F2 -.22(bu)2.75 G -.275(ff).22 G(er).275 E(.)-.605 E F3(data)72 367.2 Q F2 (Speci\214es the b)52.442 E(uf)-.22 E(fer to store data.)-.275 E(The ca\ ll_dispatcher must call the dispatcher function, in order of their re)72 382.8 Q(gistration.)-.165 E F3(len)2.75 E F2(and)2.75 E F3(data)2.75 E F2(are the data passed to re)72 394.8 Q(gister_dispatcher)-.165 E(.) -.605 E(The return v)72 410.4 Q(alues are check)-.275 E(ed at each in) -.11 E -.22(vo)-.44 G(cation, and if it \214nds T).22 E (rue, it immediately return with)-.385 E(true for its return v)72 422.4 Q(alue.)-.275 E(It is depend on the upper layer whether the read data i\ s XIM Protocol pack)72 438 Q(et unit or not.)-.11 E(The)5.5 E(Alternati) 72 450 Q .33 -.165(ve E)-.275 H(ntry for this function is:).165 E (Bool _XimCallDispatcher\()72 471.6 Q F3(im)A F2(,)A F3(len)2.75 E F2(,) A F3(data)2.75 E F2(\))A(XIM)88.5 483.6 Q F3(im)2.75 E F2(;)A(INT16)88.5 495.6 Q F3(len)2.75 E F2(;)A(XPointer)88.5 507.6 Q F3(call_data)2.75 E F2(;)A F1(6)285.25 768 Q EP %%Page: 7 9 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF(XIM T) 72 52 Q(ransport Speci\214cation)-.814 E(X11, Release 6.4)220.162 E 2.75 (4. Sample)72 84 R(implementations f)2.75 E(or the T)-.275 E (ransport Lay)-.814 E(er)-.11 E/F2 11/Times-Roman@0 SF(Sample implement\ ations for the transporter using the X connection is described here.)72 99.6 Q F1 2.75(4.1. X)72 127.2 R -.814(Tr)2.75 G(ansport).814 E F2 (At the be)72 142.8 Q(ginning of the X T)-.165 E (ransport connection for the XIM transport mechanism, tw)-.385 E 2.75 (od)-.11 G(if)-2.75 E(ferent)-.275 E(windo)72 154.8 Q (ws must be created either in an Xlib XIM or in an IM Serv)-.275 E(er) -.165 E 2.75(,w)-.44 G(ith which the Xlib and the)-2.75 E(IM Serv)72 166.8 Q(er e)-.165 E (xchange the XIM transports by using the ClientMessage e)-.165 E -.165 (ve)-.275 G(nts and W).165 E(indo)-.44 E 2.75(wP)-.275 G(roper)-2.75 E (-)-.22 E 2.75(ties. In)72 178.8 R(the follo)2.75 E(wing, the windo) -.275 E 2.75(wc)-.275 G (reated by the Xlib is referred as the "client communication)-2.75 E (windo)72 190.8 Q(w", and on the other hand, the windo)-.275 E 2.75(wc) -.275 G(reated by the IM Serv)-2.75 E(er is referred as the "IMS)-.165 E (communication windo)72 202.8 Q(w".)-.275 E F1 2.75(4.1.1. Connection)72 230.4 R F2(In order to establish a connection, a communication windo)72 246 Q 2.75(wi)-.275 G 2.75(sc)-2.75 G 2.75(reated. A)-2.75 F (ClientMessage in the)2.75 E(follo)72 258 Q(wing e)-.275 E -.165(ve) -.275 G(nt').165 E 2.75(sf)-.605 G(ormat is sent to the o)-2.75 E (wner windo)-.275 E 2.75(wo)-.275 G 2.75(fX)-2.75 G(IM_SER)-2.75 E (VER selection, which the IM)-.88 E(Serv)72 270 Q(er has created.)-.165 E(Refer to "The Input Method Protocol" for the XIM_SER)72 285.6 Q (VER atom.)-.88 E -.88(Ta)166.571 301.2 S (ble 4-1; The ClientMessage sent to the IMS windo).88 E -.715(w.)-.275 G .44 LW 364.02 311.95 72 311.95 DL F1(Structur)76.5 327.2 Q 2.75(eM)-.198 G 41.052(ember Contents)-2.75 F 364.02 337.95 72 337.95 DL F2 39.303 (int type)76.5 353.2 R(ClientMessage)59.268 E 20.361(u_long serial)76.5 365.2 R(Set by the X W)54.384 E(indo)-.44 E 2.75(wS)-.275 G(ystem)-2.75 E 29.524(Bool send_e)76.5 377.2 R -.165(ve)-.275 G 26.411(nt Set).165 F (by the X W)2.75 E(indo)-.44 E 2.75(wS)-.275 G(ystem)-2.75 E 16.698 (Display *display)76.5 389.2 R(The display to which connects)40.931 E -.44(Wi)76.5 401.2 S(ndo).44 E 16.5(ww)-.275 G(indo)-16.5 E 43.043(wI) -.275 G(MS W)-43.043 E(indo)-.44 E 2.75(wI)-.275 G(D)-2.75 E 25.861 (Atom message_type)76.5 413.2 R(XInternAtom\(display)16.5 E 2.75(,`) -.715 G(`_XIM_XCONNECT')-3.564 E(', F)-.814 E(alse\))-.165 E 39.303 (int format)76.5 425.2 R(32)48.884 E 31.361(long data.l[0])76.5 437.2 R (client communication windo)41.25 E 2.75(wI)-.275 G(D)-2.75 E 31.361 (long data.l[1])76.5 449.2 R(client-major)41.25 E(-transport-v)-.22 E (ersion \(*1\))-.165 E 31.361(long data.l[2])76.5 461.2 R(client-major) 41.25 E(-transport-v)-.22 E(ersion \(*1\))-.165 E 364.02 471.95 72 471.95 DL 200.129 4.75 200.129 471.95 DL (In order to establish the connection \(to notify the IM Serv)72 490.8 Q (er communication windo)-.165 E(w\), the IM)-.275 E(Serv)72 502.8 Q (er sends a ClientMessage in the follo)-.165 E(wing e)-.275 E -.165(ve) -.275 G(nt').165 E 2.75(sf)-.605 G (ormat to the client communication win-)-2.75 E(do)72 514.8 Q -.715(w.) -.275 G -.88(Ta)179.76 530.4 S (ble 4-2; The ClientMessage sent by IM Serv).88 E(er)-.165 E(.)-.605 E 364.02 541.15 72 541.15 DL F1(Structur)76.5 556.4 Q 2.75(eM)-.198 G 41.052(ember Contents)-2.75 F 364.02 567.15 72 567.15 DL F2 39.303 (int type)76.5 582.4 R(ClientMessage)59.268 E 20.361(u_long serial)76.5 594.4 R(Set by the X W)54.384 E(indo)-.44 E 2.75(wS)-.275 G(ystem)-2.75 E 29.524(Bool send_e)76.5 606.4 R -.165(ve)-.275 G 26.411(nt Set).165 F (by the X W)2.75 E(indo)-.44 E 2.75(wS)-.275 G(ystem)-2.75 E 16.698 (Display *display)76.5 618.4 R(The display to which connects)40.931 E -.44(Wi)76.5 630.4 S(ndo).44 E 16.5(ww)-.275 G(indo)-16.5 E 43.043(wc) -.275 G(lient communication windo)-43.043 E 2.75(wI)-.275 G(D)-2.75 E 25.861(Atom message_type)76.5 642.4 R(XInternAtom\(display)16.5 E 2.75 (,`)-.715 G(`_XIM_XCONNECT')-3.564 E(', F)-.814 E(alse\))-.165 E 39.303 (int format)76.5 654.4 R(32)48.884 E 31.361(long data.l[0])76.5 666.4 R (IMS communication windo)41.25 E 2.75(wI)-.275 G(D)-2.75 E 31.361 (long data.l[1])76.5 678.4 R(serv)41.25 E(er)-.165 E(-major)-.22 E (-transport-v)-.22 E(ersion \(*1\))-.165 E 31.361(long data.l[2])76.5 690.4 R(serv)41.25 E(er)-.165 E(-minor)-.22 E(-transport-v)-.22 E (ersion \(*1\))-.165 E 31.361(long data.l[3])76.5 702.4 R(di)41.25 E (viding size between ClientMessage and Property \(*2\))-.275 E 364.02 713.15 72 713.15 DL 200.129 4.75 200.129 713.15 DL F1(7)285.25 768 Q EP %%Page: 8 10 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF(XIM T) 72 52 Q(ransport Speci\214cation)-.814 E(X11, Release 6.4)220.162 E/F2 11/Times-Roman@0 SF 3.924(\(*1\) major/minor)72 84 R(-transport-v)-.22 E (ersion)-.165 E (The read/write method is decided by the combination of major/minor)122 96 Q(-transport-v)-.22 E(er)-.165 E(-)-.22 E(sion, as follo)122 108 Q (ws:)-.275 E -.88(Ta)141.203 123.6 S (ble 4-3; The read/write method and the major/minor).88 E(-transport-v) -.22 E(ersion)-.165 E .44 LW 450.556 134.35 150.444 134.35 DL F1 -.814 (Tr)152.457 149.6 S(ansport-v).814 E 10.262(ersion r)-.11 F(ead/write) -.198 E 450.556 160.35 150.444 160.35 DL 15.916(major minor)156.876 175.6 R 450.556 186.35 150.444 186.35 DL F2 41.882(00)168.481 201.6 S (only-CM & Property-with-CM)-12.537 E 29.345(1o)215.863 213.6 S (nly-CM & multi-CM)-29.345 E 29.345(2o)215.863 225.6 S (nly-CM & multi-CM & Property-with-CM)-29.345 E 450.556 236.35 150.444 236.35 DL 41.882(10)168.481 251.6 S(PropertyNotify)-12.537 E 450.556 262.35 150.444 262.35 DL 41.882(20)168.481 277.6 S (only-CM & PropertyNotify)-12.537 E 29.345(1o)215.863 289.6 S (nly-CM & multi-CM & PropertyNotify)-29.345 E 450.556 300.35 150.444 300.35 DL 450.556 134.35 450.556 300.35 DL 242.458 134.35 242.458 300.35 DL 194.768 160.35 194.768 300.35 DL 150.444 134.35 150.444 300.35 DL 55.297(only-CM :)168.444 325.2 R(data is sent via a ClientMessage)16.5 E 51.623(multi-CM :)168.444 337.2 R (data is sent via multiple ClientMessages)16.5 E 13.75 (Property-with-CM :)168.444 349.2 R(data is written in Property)286.386 349.2 Q 2.75(,a)-.715 G(nd its Atom)-2.75 E(is send via ClientMessage) 286.386 361.2 Q 29.029(PropertyNotify :)168.444 373.2 R (data is written in Property)286.386 373.2 Q 2.75(,a)-.715 G (nd its Atom)-2.75 E(is send via PropertyNotify)286.386 385.2 Q (The method to decide major/minor)97 406.8 Q(-transport-v)-.22 E (ersion is as follo)-.165 E(ws:)-.275 E 9.424(\(1\) The)97 426 R (client sends 0 as major/minor)2.75 E(-transport-v)-.22 E (ersion to the IM Serv)-.165 E(er)-.165 E 5.5(.T)-.605 G(he client must) -5.5 E(support all methods in T)122 438 Q(able 4-3.)-.88 E (The client may send another number as)5.5 E(major/minor)122 450 Q (-transport-v)-.22 E(ersion to use other method than the abo)-.165 E .33 -.165(ve i)-.165 H 2.75(nt).165 G(he future.)-2.75 E 9.424(\(2\) The)97 465.6 R(IM Serv)2.75 E(er sends its major/minor)-.165 E(-transport-v) -.22 E(ersion number to the client. The client)-.165 E (sends data using the method speci\214ed by the IM Serv)122 477.6 Q(er) -.165 E(.)-.605 E 9.424(\(3\) If)97 493.2 R(major/minor)2.75 E (-transport-v)-.22 E(ersion number is not a)-.165 E -.275(va)-.22 G (ilable, it is re).275 E -.055(ga)-.165 G(rded as 0.).055 E 3.924 (\(*2\) di)72 512.4 R(viding size between ClientMessage and Property) -.275 E(If data is sent via both of multi-CM and Property)122 524.4 Q 2.75(,s)-.715 G(pecify the di)-2.75 E(viding size between)-.275 E (ClientMessage and Property)122 536.4 Q 2.75(.T)-.715 G (he data, which is smaller than this size, is sent via)-2.75 E(multi-CM\ \(or only-CM\), and the data, which is lager than this size, is sent v\ ia Prop-)122 548.4 Q(erty)122 560.4 Q(.)-.715 E F1 2.75(4.1.2. r)72 588 R(ead/write)-.198 E F2 (The data is transferred via either ClientMessage or W)72 603.6 Q(indo) -.44 E 2.75(wP)-.275 G(roperty in the X W)-2.75 E(indo)-.44 E 2.75(wS) -.275 G(ystem.)-2.75 E F1 2.75(4.1.2.1. F)72 631.2 R(ormat f)-.275 E (or the data fr)-.275 E(om the Client to the IM Ser)-.198 E -.11(ve)-.11 G(r).11 E(ClientMessage)72 646.8 Q F2 (If data is sent via ClientMessage e)97 662.4 Q -.165(ve)-.275 G (nt, the format is as follo).165 E(ws:)-.275 E -.88(Ta)165.205 678 S (ble 4-4; The ClientMessage e).88 E -.165(ve)-.275 G(nt').165 E 2.75(sf) -.605 G(ormat \(\214rst or middle\))-2.75 E 397.112 688.75 97 688.75 DL F1(Structur)102.5 704 Q 2.75(eM)-.198 G 41.052(ember Contents)-2.75 F 397.112 714.75 97 714.75 DL 226.129 4.75 226.129 720.75 DL(8)285.25 768 Q EP %%Page: 9 11 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF(XIM T) 72 52 Q(ransport Speci\214cation)-.814 E(X11, Release 6.4)220.162 E .44 LW 397.112 76.75 97 76.75 DL(Structur)102.5 92 Q 2.75(eM)-.198 G 41.052 (ember Contents)-2.75 F 397.112 102.75 97 102.75 DL/F2 11/Times-Roman@0 SF 39.303(int type)102.5 118 R(ClientMessage)59.268 E 20.361 (u_long serial)102.5 130 R(Set by the X W)54.384 E(indo)-.44 E 2.75(wS) -.275 G(ystem)-2.75 E 29.524(Bool send_e)102.5 142 R -.165(ve)-.275 G 26.411(nt Set).165 F(by the X W)2.75 E(indo)-.44 E 2.75(wS)-.275 G (ystem)-2.75 E 16.698(Display *display)102.5 154 R (The display to which connects)40.931 E -.44(Wi)102.5 166 S(ndo).44 E 16.5(ww)-.275 G(indo)-16.5 E 43.043(wI)-.275 G(MS communication windo) -43.043 E 2.75(wI)-.275 G(D)-2.75 E 25.861(Atom message_type)102.5 178 R (XInternAtom\(display)16.5 E 2.75(,`)-.715 G(`_XIM_MORED)-3.564 E -1.331 -1.221(AT A')-.44 H(', F).407 E(alse\))-.165 E 39.303(int format)102.5 190 R(8)48.884 E 31.988(char data.b[20])102.5 202 R(\(read/write D) 33.308 E -1.331 -1.221(AT A)-.44 H 2.75(:2)3.971 G 2.75(0b)-2.75 G (yte\))-2.75 E 397.112 212.75 97 212.75 DL 226.129 108.75 226.129 212.75 DL -.88(Ta)171.624 231.6 S(ble 4-5; The ClientMessage e).88 E -.165(ve) -.275 G(nt').165 E 2.75(sf)-.605 G(ormat \(only or last\))-2.75 E 397.112 242.35 97 242.35 DL F1(Structur)102.5 257.6 Q 2.75(eM)-.198 G 41.052(ember Contents)-2.75 F 397.112 268.35 97 268.35 DL F2 39.303 (int type)102.5 283.6 R(ClientMessage)59.268 E 20.361(u_long serial) 102.5 295.6 R(Set by the X W)54.384 E(indo)-.44 E 2.75(wS)-.275 G(ystem) -2.75 E 29.524(Bool send_e)102.5 307.6 R -.165(ve)-.275 G 26.411(nt Set) .165 F(by the X W)2.75 E(indo)-.44 E 2.75(wS)-.275 G(ystem)-2.75 E 16.698(Display *display)102.5 319.6 R(The display to which connects) 40.931 E -.44(Wi)102.5 331.6 S(ndo).44 E 16.5(ww)-.275 G(indo)-16.5 E 43.043(wI)-.275 G(MS communication windo)-43.043 E 2.75(wI)-.275 G(D) -2.75 E 25.861(Atom message_type)102.5 343.6 R(XInternAtom\(display)16.5 E 2.75(,`)-.715 G(`_XIM_PR)-3.564 E -2.068 -.44(OT O)-.44 H(COL).44 E -.814('')-1.012 G 2.75(,F).814 G(alse\))-2.915 E 39.303(int format)102.5 355.6 R(8)48.884 E 31.988(char data.b[20])102.5 367.6 R(\(read/write D) 33.308 E -1.331 -1.221(AT A)-.44 H 2.75(:M)3.971 G(AX 20 byte\))-2.75 E (\(*1\))5.5 E 397.112 378.35 97 378.35 DL 226.129 4.75 226.129 378.35 DL 3.924(\(*1\) If)97 397.2 R (the data is smaller than 20 byte, all data other than a)2.75 E -.275 (va)-.22 G(ilable data must be 0.).275 E F1(Pr)72 412.8 Q(operty)-.198 E F2(In the case of lar)97 428.4 Q(ge data, data will be sent via the W) -.198 E(indo)-.44 E 2.75(wP)-.275 G(roperty for the ef)-2.75 E (\214cienc)-.275 E 4.18 -.715(y. T)-.165 H(here).715 E(are the follo)97 440.4 Q(wing tw)-.275 E 2.75(om)-.11 G(ethods to notify Property)-2.75 E 2.75(,a)-.715 G(nd transport-v)-2.75 E(ersion is decided which)-.165 E (method is used.)97 452.4 Q 9.424(\(1\) The)97 471.6 R(XChangeProperty \ function is used to store data in the client communication win-)2.75 E (do)122 483.6 Q 1.43 -.715(w, a)-.275 H (nd Atom of the stored data is noti\214ed to the IM Serv).715 E (er via ClientMessage e)-.165 E -.165(ve)-.275 G(nt.).165 E 9.424 (\(2\) The)97 499.2 R(XChangeProperty function is used to store data in\ the client communication win-)2.75 E(do)122 511.2 Q 1.43 -.715(w, a) -.275 H(nd Atom of the stored data is noti\214ed to the IM Serv).715 E (er via PropertyNotify e)-.165 E -.165(ve)-.275 G(nt.).165 E(The ar)97 526.8 Q(guments of the XChangeProperty are as follo)-.198 E(ws:)-.275 E -.88(Ta)194.388 542.4 S(ble 4-6; The XChangeProperty e).88 E -.165(ve) -.275 G(nt').165 E 2.75(sf)-.605 G(ormat)-2.75 E 397.112 553.15 97 553.15 DL F1(Ar)102.5 568.4 Q 63.866(gument Contents)-.11 F 397.112 579.15 97 579.15 DL F2 16.698(Display *display)102.5 594.4 R (The display to which connects)23.826 E -.44(Wi)102.5 606.4 S(ndo).44 E 16.5(ww)-.275 G(indo)-16.5 E 25.938(wI)-.275 G(MS communication windo) -25.938 E 2.75(wI)-.275 G(D)-2.75 E 25.861(Atom property)102.5 618.4 R (read/write property Atom \(*1\))23.837 E 25.861(Atom type)102.5 630.4 R (XA_STRING)42.163 E 39.303(int format)102.5 642.4 R(8)31.779 E 39.303 (int mode)102.5 654.4 R(PropModeAppend)36.663 E 20.988(u_char *data) 102.5 666.4 R(read/write D)37.279 E -1.331 -1.221(AT A)-.44 H 39.303 (int nelements)102.5 678.4 R(length of D)16.5 E -1.331 -1.221(AT A)-.44 H 397.112 689.15 97 689.15 DL 209.024 4.75 209.024 689.15 DL 3.924 (\(*1\) The)97 711.6 R(read/write property A)2.75 E -.198(TO)-1.221 G 2.75(Ma).198 G(llocates the follo)-2.75 E(wing strings by)-.275 E F1 (XInter)2.75 E(nAtom)-.165 E F2(.)A -.814(``)147 723.6 S(_clientXXX') .814 E(')-.814 E F1(9)285.25 768 Q EP %%Page: 10 12 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF(XIM T) 72 52 Q(ransport Speci\214cation)-.814 E(X11, Release 6.4)220.162 E/F2 11/Times-Roman@0 SF(The client changes the property with the mode of Pr\ opModeAppend and the IM Serv)97 84 Q(er will)-.165 E (read it with the delete mode i.e. \(delete = T)97 96 Q(rue\).)-.385 E (If Atom is noti\214ed via ClientMessage e)97 111.6 Q -.165(ve)-.275 G (nt, the format of the ClientMessage is as follo).165 E(ws:)-.275 E -.88 (Ta)144.432 127.2 S(ble 4-7; The ClientMessage e).88 E -.165(ve)-.275 G (nt').165 E 2.75(sf)-.605 G(ormat to send Atom of property)-2.75 E .44 LW 397.112 137.95 97 137.95 DL F1(Structur)102.5 153.2 Q 2.75(eM)-.198 G 41.052(ember Contents)-2.75 F 397.112 163.95 97 163.95 DL F2 39.303 (int type)102.5 179.2 R(ClientMessage)59.268 E 20.361(u_long serial) 102.5 191.2 R(Set by the X W)54.384 E(indo)-.44 E 2.75(wS)-.275 G(ystem) -2.75 E 29.524(Bool send_e)102.5 203.2 R -.165(ve)-.275 G 26.411(nt Set) .165 F(by the X W)2.75 E(indo)-.44 E 2.75(wS)-.275 G(ystem)-2.75 E 16.698(Display *display)102.5 215.2 R(The display to which connects) 40.931 E -.44(Wi)102.5 227.2 S(ndo).44 E 16.5(ww)-.275 G(indo)-16.5 E 43.043(wI)-.275 G(MS communication windo)-43.043 E 2.75(wI)-.275 G(D) -2.75 E 25.861(Atom message_type)102.5 239.2 R(XInternAtom\(display)16.5 E 2.75(,`)-.715 G(`_XIM_PR)-3.564 E -2.068 -.44(OT O)-.44 H(COL).44 E -.814('')-1.012 G 2.75(,F).814 G(alse\))-2.915 E 39.303(int format)102.5 251.2 R(32)48.884 E 31.361(long data.l[0])102.5 263.2 R (length of read/write property Atom)41.25 E 31.361(long data.l[1])102.5 275.2 R(read/write property Atom)41.25 E 397.112 285.95 97 285.95 DL 226.129 4.75 226.129 285.95 DL F1 2.75(4.1.2.2. F)72 316.8 R(ormat f) -.275 E(or the data fr)-.275 E(om the IM Ser)-.198 E -.11(ve)-.11 G 2.75 (rt).11 G 2.75(ot)-2.75 G(he Client)-2.75 E(ClientMessage)72 332.4 Q F2 (The format of the ClientMessage is as follo)97 348 Q(ws:)-.275 E -.88 (Ta)165.205 363.6 S(ble 4-8; The ClientMessage e).88 E -.165(ve)-.275 G (nt').165 E 2.75(sf)-.605 G(ormat \(\214rst or middle\))-2.75 E 397.112 374.35 97 374.35 DL F1(Structur)102.5 389.6 Q 2.75(eM)-.198 G 41.052 (ember Contents)-2.75 F 397.112 400.35 97 400.35 DL F2 39.303(int type) 102.5 415.6 R(ClientMessage)59.268 E 20.361(u_long serial)102.5 427.6 R (Set by the X W)54.384 E(indo)-.44 E 2.75(wS)-.275 G(ystem)-2.75 E 29.524(Bool send_e)102.5 439.6 R -.165(ve)-.275 G 26.411(nt Set).165 F (by the X W)2.75 E(indo)-.44 E 2.75(wS)-.275 G(ystem)-2.75 E 16.698 (Display *display)102.5 451.6 R(The display to which connects)40.931 E -.44(Wi)102.5 463.6 S(ndo).44 E 16.5(ww)-.275 G(indo)-16.5 E 43.043(wc) -.275 G(lient communication windo)-43.043 E 2.75(wI)-.275 G(D)-2.75 E 25.861(Atom message_type)102.5 475.6 R(XInternAtom\(display)16.5 E 2.75 (,`)-.715 G(`_XIM_MORED)-3.564 E -1.331 -1.221(AT A')-.44 H(', F).407 E (alse\))-.165 E 39.303(int format)102.5 487.6 R(8)48.884 E 31.988 (char data.b[20])102.5 499.6 R(\(read/write D)33.308 E -1.331 -1.221 (AT A)-.44 H 2.75(:2)3.971 G 2.75(0b)-2.75 G(yte\))-2.75 E 397.112 510.35 97 510.35 DL 226.129 4.75 226.129 510.35 DL -.88(Ta)171.624 529.2 S(ble 4-9; The ClientMessage e).88 E -.165(ve)-.275 G(nt').165 E 2.75 (sf)-.605 G(ormat \(only or last\))-2.75 E 397.112 539.95 97 539.95 DL F1(Structur)102.5 555.2 Q 2.75(eM)-.198 G 41.052(ember Contents)-2.75 F 397.112 565.95 97 565.95 DL F2 39.303(int type)102.5 581.2 R (ClientMessage)59.268 E 20.361(u_long serial)102.5 593.2 R (Set by the X W)54.384 E(indo)-.44 E 2.75(wS)-.275 G(ystem)-2.75 E 29.524(Bool send_e)102.5 605.2 R -.165(ve)-.275 G 26.411(nt Set).165 F (by the X W)2.75 E(indo)-.44 E 2.75(wS)-.275 G(ystem)-2.75 E 16.698 (Display *display)102.5 617.2 R(The display to which connects)40.931 E -.44(Wi)102.5 629.2 S(ndo).44 E 16.5(ww)-.275 G(indo)-16.5 E 43.043(wc) -.275 G(lient communication windo)-43.043 E 2.75(wI)-.275 G(D)-2.75 E 25.861(Atom message_type)102.5 641.2 R(XInternAtom\(display)16.5 E 2.75 (,`)-.715 G(`_XIM_PR)-3.564 E -2.068 -.44(OT O)-.44 H(COL).44 E -.814 ('')-1.012 G 2.75(,F).814 G(alse\))-2.915 E 39.303(int format)102.5 653.2 R(8)48.884 E 31.988(char data.b[20])102.5 665.2 R(\(read/write D) 33.308 E -1.331 -1.221(AT A)-.44 H 2.75(:M)3.971 G(AX 20 byte\) \(*1\)) -2.75 E 397.112 675.95 97 675.95 DL 226.129 4.75 226.129 675.95 DL 3.924 (\(*1\) If)97 698.4 R (the data size is smaller than 20 bytes, all data other than a)2.75 E -.275(va)-.22 G(ilable data must be 0.).275 E F1(Pr)72 714 Q(operty) -.198 E(10)282.5 768 Q EP %%Page: 11 13 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 531.38(-- --)0 4 R/F1 11/Times-Bold@0 SF(XIM T) 72 52 Q(ransport Speci\214cation)-.814 E(X11, Release 6.4)220.162 E/F2 11/Times-Roman@0 SF(In the case of lar)97 84 Q (ge data, data will be sent via the W)-.198 E(indo)-.44 E 2.75(wP)-.275 G(roperty for the ef)-2.75 E(\214cienc)-.275 E 1.43 -.715(y. T)-.165 H (here).715 E(are the follo)97 96 Q(wing tw)-.275 E 2.75(om)-.11 G (ethods to notify Property)-2.75 E 2.75(,a)-.715 G(nd transport-v)-2.75 E(ersion is decided which)-.165 E(method is used.)97 108 Q 9.424 (\(1\) The)97 127.2 R(XChangeProperty function is used to store data in\ the IMS communication win-)2.75 E(do)122 139.2 Q 1.43 -.715(w, a)-.275 H(nd Atom of the property is sent via the ClientMessage e).715 E -.165 (ve)-.275 G(nt.).165 E 9.424(\(2\) The)97 154.8 R(XChangeProperty funct\ ion is used to store data in the IMS communication win-)2.75 E(do)122 166.8 Q 1.43 -.715(w, a)-.275 H (nd Atom of the property is sent via PropertyNotify e).715 E -.165(ve) -.275 G(nt.).165 E(The ar)97 182.4 Q (guments of the XChangeProperty are as follo)-.198 E(ws:)-.275 E -.88 (Ta)191.638 198 S(ble 4-10; The XChangeProperty e).88 E -.165(ve)-.275 G (nt').165 E 2.75(sf)-.605 G(ormat)-2.75 E .44 LW 397.112 208.75 97 208.75 DL F1(Ar)102.5 224 Q 63.866(gument Contents)-.11 F 397.112 234.75 97 234.75 DL F2 16.698(Display *display)102.5 250 R (The display which to connects)23.826 E -.44(Wi)102.5 262 S(ndo).44 E 16.5(ww)-.275 G(indo)-16.5 E 25.938(wc)-.275 G (lient communication windo)-25.938 E 2.75(wI)-.275 G(D)-2.75 E 25.861 (Atom property)102.5 274 R(read/write property Atom \(*1\))23.837 E 25.861(Atom type)102.5 286 R(XA_STRING)42.163 E 39.303(int format)102.5 298 R(8)31.779 E 39.303(int mode)102.5 310 R(PropModeAppend)36.663 E 20.988(u_char *data)102.5 322 R(read/write D)37.279 E -1.331 -1.221 (AT A)-.44 H 39.303(int nelements)102.5 334 R(length of D)16.5 E -1.331 -1.221(AT A)-.44 H 397.112 344.75 97 344.75 DL 209.024 4.75 209.024 344.75 DL 3.924(\(*1\) The)97 367.2 R(read/write property A)2.75 E -.198 (TO)-1.221 G 2.75(Ma).198 G (llocates some strings, which are not allocated by the)-2.75 E (client, by)122 379.2 Q F1(XInter)2.75 E(nAtom)-.165 E F2(.)A (The IM Serv)97 394.8 Q (er changes the property with the mode of PropModeAppend and the client) -.165 E(reads it with the delete mode, i.e. \(delete = T)97 406.8 Q (rue\).)-.385 E(If Atom is noti\214ed via ClientMessage e)97 422.4 Q -.165(ve)-.275 G(nt, the format of the ClientMessage is as follo).165 E (ws:)-.275 E -.88(Ta)141.682 438 S(ble 4-11; The ClientMessage e).88 E -.165(ve)-.275 G(nt').165 E 2.75(sf)-.605 G (ormat to send Atom of property)-2.75 E 397.112 448.75 97 448.75 DL F1 (Structur)102.5 464 Q 2.75(eM)-.198 G 41.052(ember Contents)-2.75 F 397.112 474.75 97 474.75 DL F2 39.303(int type)102.5 490 R (ClientMessage)59.268 E 20.361(u_long serial)102.5 502 R(Set by the X W) 54.384 E(indo)-.44 E 2.75(wS)-.275 G(ystem)-2.75 E 29.524(Bool send_e) 102.5 514 R -.165(ve)-.275 G 26.411(nt Set).165 F(by the X W)2.75 E (indo)-.44 E 2.75(wS)-.275 G(ystem)-2.75 E 16.698(Display *display)102.5 526 R(The display to which connects)40.931 E -.44(Wi)102.5 538 S(ndo).44 E 16.5(ww)-.275 G(indo)-16.5 E 43.043(wc)-.275 G (lient communication windo)-43.043 E 2.75(wI)-.275 G(D)-2.75 E 25.861 (Atom message_type)102.5 550 R(XInternAtom\(display)16.5 E 2.75(,`)-.715 G(`_XIM_PR)-3.564 E -2.068 -.44(OT O)-.44 H(COL).44 E -.814('')-1.012 G 2.75(,F).814 G(alse\))-2.915 E 39.303(int format)102.5 562 R(32)48.884 E 31.361(long data.l[0])102.5 574 R(length of read/write property A)41.25 E -.198(TO)-1.221 G(M).198 E 31.361(long data.l[1])102.5 586 R (read/write property A)41.25 E -.198(TO)-1.221 G(M).198 E 397.112 596.75 97 596.75 DL 226.129 4.75 226.129 596.75 DL F1 2.75(4.1.3. Closing)72 627.6 R(Connection)2.75 E F2(If the client disconnect with the IM Serv) 72 643.2 Q(er)-.165 E 2.75(,s)-.44 G(hutdo)-2.75 E (wn function should free the communication)-.275 E(windo)72 655.2 Q 2.75 (wp)-.275 G(roperties and etc..)-2.75 E F1 2.75(5. Refer)72 682.8 R (ences)-.198 E F2([1] Masahik)72 698.4 Q 2.75(oN)-.11 G (arita and Hideki Hiura,)-2.75 E/F3 11/Times-Italic@0 SF -1.221(``)2.75 G(The Input Method Pr)1.221 E(otocol')-.495 E(')-1.221 E F1(11)282.5 768 Q F0 531.38(-- --)0 795 R EP %%Trailer end %%EOF XmHTML-1.1.10/docs/PaxHeaders.1031/lang.map0000644000175000001440000000013212613377377016162 xustar000000000000000030 mtime=1445854975.085545877 30 atime=1445854975.085545877 30 ctime=1445854975.085545877 XmHTML-1.1.10/docs/lang.map0000644000175000001440000001442612613377377015571 0ustar00chrisusers00000000000000 XmHTML-1.1.10/docs/PaxHeaders.1031/REASONS0000644000175000001440000000013212613377377015577 xustar000000000000000030 mtime=1445854975.084545878 30 atime=1445854975.084545878 30 ctime=1445854975.084545878 XmHTML-1.1.10/docs/REASONS0000644000175000001440000000777412613377377015216 0ustar00chrisusers00000000000000[The following describes my reasons for giving out XmHTML for free] Thanh Ma (tma@encore.com) wrote: > > Thanks for the reply. Here is another (dumb ?) question. > I know there are quite a few commercial html widgets/help-apps out there, > why yours is not ? Or because the motivation for writing these packages is to > 'give out' ?-) > That's a good question. I can think of a bunch of reasons, starting from idealism to ``let's make a better world'' ;-). The idea for creating the HTML widget originated when I started to read NCSA's distribution policy quite carefully, and I decided it is a completely ridiculous policy (you might have read that on the XntHelp pages somewhere). And NCSA's HTML widget is a rather resource hungry one (not that all of NCSA's is bad, they have done and are doing some pretty nifty pioneering). So I decided (IMHO ;-) that I could do it better. I'm hoping that I can make that true. But that doesn't really answer your question. Let me sum up some of my reasons: - First of all, the habit of giving out programs for ``free'' is historical in the Unix world. It is one of the reasons what has made Unix what it is today. And I would like to see it grow more in the future. - Second, I have seen a number of commercial programs which are just too expensive for what they offer, and often I wonder how these companies are able to get away with this. One of the answers is that there is no competition (or not fierce enough), or that these companies are soo damn big that they _can_ get away with it. By giving out my own applications for free (but copyrighted), I can offer users/programmers a cheap, but high quality, alternative. And maybe some day this will be noticed by companies, persuading them to pay more attention to the quality and price of their own applications. (I now sounds a whee bit naive ;-) - Third, (and this is a big reason), I am a huge Unix fan, and I hate m$ for what they have done with Win95. They make it seem like they have invented the wheel, while the truth is that what they want win95 to be has since long existed under the name Unix. This is something I have to live with. Now, one of the ways to persuade people to switch over to Unix is to offer an OS that is easy to use (easy adminstration tools), has a number of usefull applications (including a desktop environment, word processor, spreadsheet and a consistent help) and is cheap. (you might want to check the eXode homepage: http://www.linux-kheops.com/line/html/exodeenglish.html). Currently, the cheap OS is named Linux (or FreeBSD), and there are a number of people busy with all of the above. And XntHelp is an application that fits right in. - Fourth, there is a small part in me that wants people to notice me and my company. Writing and distributing quality programs for free might persuade people and/or companies to do business with us. - Fifth, the reason that I have choosen the LGPL/GPL is that [the LGPL/GPL] is a license which cleary states what you can and can't do with the library/application. The copyright is mine, other people can modify it as much as they want (but must make that clear), and it can be used in commercial programs (although no fee may be asked for my library/application). Also, the LGPL/GPL are an almost standard as it comes the Linux (and the FSF for that matter). I think the above fairly well describes my reasons for giving out my programs for ``free''. Friendly Greetings, Koen D'Hondt. -- ---------------------------------------------------------------------- _/_/_/_/ _/_/_/_/ _/_/_/_/ _/ _/ _/ _/ _/ Ripley Software Development _/ _/ _/ _/ _/ Roland Holstlaan 229 _/_/_/_/ _/_/_/_/ _/ _/ 2624 HG Delft, The Netherlands _/ _/ _/ _/ _/ mailto:ripley@xs4all.nl _/ _/ _/ _/ _/ http://www.xs4all.nl/~ripley _/ _/_/_/_/_/ _/_/_/_/ tel: (++31) (0) 15 2567785 ---------------------------------------------------------------------- XmHTML-1.1.10/PaxHeaders.1031/book0000644000175000001440000000013212613377377014467 xustar000000000000000030 mtime=1445854975.080545878 30 atime=1445854991.787545578 30 ctime=1445854975.080545878 XmHTML-1.1.10/book/0000755000175000001440000000000012613377377014144 5ustar00chrisusers00000000000000XmHTML-1.1.10/book/PaxHeaders.1031/forced_html.c0000644000175000001440000000013212613377377017176 xustar000000000000000030 mtime=1445854975.080545878 30 atime=1445854975.080545878 30 ctime=1445854975.080545878 XmHTML-1.1.10/book/forced_html.c0000644000175000001440000000125512613377377016601 0ustar00chrisusers00000000000000/* forced_html.c -- Force the display of the vertical scrollbar */ #include int main(int argc, char **argv) { Widget toplevel; XtAppContext app; toplevel = XtVaAppInitialize(&app, "Demos", NULL, 0, &argc, argv, NULL, NULL); /* create a XmHTML widget but this time we specify a size */ XtVaCreateManagedWidget("html", xmHTMLWidgetClass, toplevel, XmNvalue, "A minimally configured " "XmHTML widget.", XmNwidth, 200, XmNheight, 75, XmNscrollBarDisplayPolicy, XmSTATIC, XmNscrollBarPlacement, XmTOP_LEFT, XmNmarginWidth, 5, XmNmarginHeight, 5, NULL); XtRealizeWidget(toplevel); XtAppMainLoop(app); return(0); } XmHTML-1.1.10/book/PaxHeaders.1031/simple_html.c0000644000175000001440000000013212613377377017225 xustar000000000000000030 mtime=1445854975.080545878 30 atime=1445854975.080545878 30 ctime=1445854975.080545878 XmHTML-1.1.10/book/simple_html.c0000644000175000001440000000072612613377377016632 0ustar00chrisusers00000000000000/* simple_html.c -- Create a minimally configured XmHTML widget */ #include int main(int argc, char **argv) { Widget toplevel; XtAppContext app; toplevel = XtVaAppInitialize(&app, "Demos", NULL, 0, &argc, argv, NULL, NULL); XtVaCreateManagedWidget("html", xmHTMLWidgetClass, toplevel, XmNvalue, "A minimally configured XmHTML widget." "", NULL); XtRealizeWidget(toplevel); XtAppMainLoop(app); return(0); } XmHTML-1.1.10/book/PaxHeaders.1031/html.c0000644000175000001440000000013212613377377015654 xustar000000000000000030 mtime=1445854975.080545878 30 atime=1445854975.080545878 30 ctime=1445854975.080545878 XmHTML-1.1.10/book/html.c0000644000175000001440000000106212613377377015253 0ustar00chrisusers00000000000000/* simple_html.c -- Create a minimally configured XmHTML widget */ #include int main(int argc, char **argv) { Widget toplevel, html; XtAppContext app; toplevel = XtVaAppInitialize(&app, "Demos", NULL, 0, &argc, argv, NULL, NULL); html = XmCreateHTML(toplevel, "html", NULL, 0); /* All widgets returned by any XmCreateXXX function is unmanaged */ XtManageChild(html); XmHTMLTextSetString(html, "A minimally configured XmHTML " "widget."); XtRealizeWidget(toplevel); XtAppMainLoop(app); return(0); } XmHTML-1.1.10/book/PaxHeaders.1031/autosize_html.c0000644000175000001440000000013212613377377017577 xustar000000000000000030 mtime=1445854975.080545878 30 atime=1445854975.080545878 30 ctime=1445854975.080545878 XmHTML-1.1.10/book/autosize_html.c0000644000175000001440000000257412613377377017207 0ustar00chrisusers00000000000000/* autosize_html.c -- Demonstrate the autosizing feature of a XmHTML widget */ #include int main(int argc, char **argv) { Widget toplevel; XtAppContext app; toplevel = XtVaAppInitialize(&app, "Demos", NULL, 0, &argc, argv, NULL, NULL); /* make sure we may resize ourselves */ XtVaSetValues(toplevel, XmNallowShellResize, True, NULL); /* create a XmHTML widget but this time enable autosizing */ XtVaCreateManagedWidget("html", xmHTMLWidgetClass, toplevel, XmNvalue, /* "An AutoSizing XmHTML widget.", */ "" "Sat Sep 21 22:00:02 UTC 1996 * Yeltsin had heart attack during Russian elections. * Doctor says surgery may be too dangerous. * Ghost of Papandreou hovers over Greek elections. * Israeli planes hit suspected guerrilla targets in Lebanon. * Tensions heating up in southern Lebanon. * India's former prime minister resigns as party chief. * Coalition parties mull successor. * Army manuals appear to condone human rights abuse. * VMI accepts women, ends 157-year school policy. * Clinton bans same-sex marriages. * Olympic bomb probe focuses on 12-volt battery. * Justice Department to probe CIA drug-peddling charges." " ", XmNresizeWidth, True, XmNresizeHeight, True, XmNmarginWidth, 1, XmNmarginHeight, 1, NULL); XtRealizeWidget(toplevel); XtAppMainLoop(app); return(0); } XmHTML-1.1.10/book/PaxHeaders.1031/work_window.c0000644000175000001440000000013212613377377017261 xustar000000000000000030 mtime=1445854975.081545878 30 atime=1445854975.080545878 30 ctime=1445854975.081545878 XmHTML-1.1.10/book/work_window.c0000644000175000001440000000430712613377377016665 0ustar00chrisusers00000000000000/* * work_window.c: attaching an event handler to the work_window of a XmHTML * widget. */ #include void attachInfoHandler(Widget html, Widget popup) { Widget work_window; XtVaGetValues(html, XmNworkWindow, &work_window, NULL); /* * Add an event handler which responds to mouse clicks. "popup" is the * popup menu which is to be displayed, it is stored as client_data * for the event handler. */ XtAddEventHandler(work_window, ButtonPressMark, 0, (XtEventHandler)infoHandler, popup); } void infoHandler(Widget work_window, Widget popup, XButtonPressedEvent *event) { XmHTMLInfoPtr info; Widget html_w; WidgetList children; /* we only take events generated by button 3 */ if(event->button != 3) return; /* * The work_window is a child of a XmHTML widget, so we can get a handle * to the XmHTML widget itself by using Xt's XtParent routine. */ html_w = XtParent(work_window); /* get the info for the selected position. */ info = XmHTMLXYToInfo(html_w, event->x, event->y); /* * Check the returned info structure. There will be nothing to display * if the pointer wasn't over an image or anchor when the mouse was * clicked. */ if(info == NULL || (info->image == NULL && info->anchor == NULL)) return; /* * For this example we assume that the popup menu has two buttons: * a hyperlink button and an image button. We retrieve these children * of the popup menu using the XmNchildren resource of Motif's * rowColumn widget. */ XtVaGetValues(popup, XmNchildren, &children, NULL); /* check if the info structure has an anchor */ if(info->anchor) { XmString label; label = XmStringCreateLocalized(info->anchor->href); XtVaSetValues(children[0], XmNlabelString, label, NULL); XmStringFree(label); XtManageChild(children[0]); } else XtUnmanageChild(children[0]); /* check if the info structure has an image */ if(info->image) { XmString label; label = XmStringCreateLocalized(info->image->url); XtVaSetValues(children[1], XmNlabelString, label, NULL); XmStringFree(label); XtManageChild(children[1]); } else XtUnmanageChild(children[1]); /* the "popup" menu has now been configured, pop it up */ XmMenuPosition(popup, event); XtManageChild(popup); } XmHTML-1.1.10/book/PaxHeaders.1031/Imakefile0000644000175000001440000000013212613377377016355 xustar000000000000000030 mtime=1445854975.080545878 30 atime=1445854975.080545878 30 ctime=1445854975.080545878 XmHTML-1.1.10/book/Imakefile0000644000175000001440000000352212613377377015757 0ustar00chrisusers00000000000000#error The Imakefile is broken, please use the plain Makefiles #if 0 XCOMM XCOMM Imakefile for XmHTML book examples XCOMM XCOMM (C)Copyright 1995-1997 Ripley Software Development XCOMM All Rights Reserved XCOMM XCOMM This file is part of the XmHTML Widget Library. XCOMM XCOMM See the file LICENSE for the full copyright statement. XCOMM XCOMM Include the XmHTML configuration file #include "../XmHTML.cf" XCOMM On some systems, imake automatically includes Motif.tmpl, on others XCOMM it doesn't. XCOMM #ifndef MotifDefines #include #endif XCOMM XCOMM Use DebugLibXmHTML if it exists, else use static lib. XCOMM #if DebugLibXmHTML XMHTMLLIB = $(BUILDINCTOP)/src/libXmHTML_d.a #else #if SharedLibXmHTML XMHTMLLIB = -L$(BUILDINCTOP)/src -lXmHTML #else XMHTMLLIB = $(BUILDINCTOP)/src/libXmHTML.a #endif #endif XCOMM INCLUDES = -I$(BUILDINCTOP)/src $(DMALLOCINC) DEPLIBS = $(DEPXMLIB) $(DEPXTOOLLIB) $(DEPXLIB) XCOMM required libraries LOCAL_LIBRARIES = $(XMHTMLLIB) $(XMLIB) $(XTOOLLIB) $(XLIB) $(DMALLOCLIB) SRCS = simple_html.c simple_html2.c autosize_html.c forced_html.c html.c OBJS1 = simple_html.o OBJS2 = simple_html2.o OBJS3 = autosize_html.o OBJS4 = forced_html.o OBJS5 = html.o AllTarget(simple_html simple_html2 autosize_html forced_html html) NormalProgramTarget(simple_html,$(OBJS1),$(DEPLIB),$(LOCAL_LIBRARIES),) NormalProgramTarget(simple_html2,$(OBJS2),$(DEPLIB),$(LOCAL_LIBRARIES),) NormalProgramTarget(autosize_html,$(OBJS3),$(DEPLIB),$(LOCAL_LIBRARIES),) NormalProgramTarget(forced_html,$(OBJS4),$(DEPLIB),$(LOCAL_LIBRARIES),) NormalProgramTarget(html,$(OBJS5),$(DEPLIB),$(LOCAL_LIBRARIES),) DependTarget() XCOMM XCOMM Special rules for creating a distribution with the barebone makefiles XCOMM distclean:: clean $(RM) core *.out make.world *.bak *.last *.auto stamp-includes $(CP) Makefile.org Makefile #endif XmHTML-1.1.10/book/PaxHeaders.1031/simple_html2.c0000644000175000001440000000013212613377377017307 xustar000000000000000030 mtime=1445854975.080545878 30 atime=1445854975.080545878 30 ctime=1445854975.080545878 XmHTML-1.1.10/book/simple_html2.c0000644000175000001440000000110312613377377016702 0ustar00chrisusers00000000000000/* simple_html2.c -- Create another minimally configured XmHTML widget */ #include int main(int argc, char **argv) { Widget toplevel; XtAppContext app; toplevel = XtVaAppInitialize(&app, "Demos", NULL, 0, &argc, argv, NULL, NULL); /* create a XmHTML widget but this time we specify a size */ XtVaCreateManagedWidget("html", xmHTMLWidgetClass, toplevel, XmNvalue, "Another minimally configured XmHTML " "widget.", XmNwidth, 200, XmNheight, 75, NULL); XtRealizeWidget(toplevel); XtAppMainLoop(app); return(0); } XmHTML-1.1.10/book/PaxHeaders.1031/html_browser.c0000644000175000001440000000013212613377377017417 xustar000000000000000030 mtime=1445854975.080545878 30 atime=1445854975.080545878 30 ctime=1445854975.080545878 XmHTML-1.1.10/book/html_browser.c0000644000175000001440000002137012613377377017022 0ustar00chrisusers00000000000000 /* * html_browser.c -- use a XmHTMLText widget to view the contents * of arbitrary HTML files choosen by the user from a fileSelection * dialog or by following hyperlinks in a document. */ #include #include #include #include #include #include #include #include #include #include /* you might have to include for strcasecmp() proto */ static void readFile(Widget html, String file); static void fileCB(Widget item, int item_no); static void fileOkCB(Widget w, Widget html, XmFileSelectionBoxCallbackStruct *cbs); static void anchorCB(Widget html, XtPointer data, XmHTMLAnchorPtr cbs); static String mimeType(String filename, FILE *file); int main(int argc, char **argv) { Widget top, mainw, menubar, menu, html; XtAppContext context; XmString file, new, quit; /* initialize toolkit and create toplevel shell */ top = XtVaAppInitialize(&context, "HTMLDemos", NULL, 0, &argc, argv, NULL, NULL); /* mainwindow for the application */ mainw = XtVaCreateManagedWidget("mainw", xmMainWindowWidgetClass, top, NULL); /* Create a simple MenuBar that contains one menu */ file = XmStringCreateSimple("File"); menubar = XmVaCreateSimpleMenuBar(mainw, "menubar", XmVaCASCADEBUTTON, file, 'F', NULL); XmStringFree(file); /* menu is "File", callback is fileCB() */ new = XmStringCreateSimple("Open..."); quit = XmStringCreateSimple("Quit"); menu = XmVaCreateSimplePulldownMenu(menubar, "fileMenu", 0, (XtCallbackProc)fileCB, XmVaPUSHBUTTON, new, 'O', NULL, NULL, XmVaSEPARATOR, XmVaPUSHBUTTON, quit, 'Q', NULL, NULL, NULL); XmStringFree(new); XmStringFree(quit); /* Menubar is done, manage it */ XtManageChild(menubar); /* Create a simple XmHTML widget */ html = XtVaCreateManagedWidget("html", xmHTMLWidgetClass, mainw, XmNwidth, 400, XmNheight, 600, NULL); /* add a callback to respond to anchor activation */ XtAddCallback(html, XmNactivateCallback, (XtCallbackProc)anchorCB, NULL); /* store html as userdata in "File" menu for fileCB() callback */ XtVaSetValues(menu, XmNuserData, html, NULL); XtManageChild(html); XmMainWindowSetAreas(mainw, menubar, NULL, NULL, NULL, html); XtRealizeWidget(top); XtAppMainLoop(context); /* never reached but keeps compiler happy */ return(EXIT_SUCCESS); } /* The "File" menu was selected, popup a file selection */ static void fileCB(Widget item, int item_no) { static Widget dialog; Widget html; if(item_no == 1) exit(0); /* user choose Quit */ if(!dialog) { Widget menu = XtParent(item); dialog = XmCreateFileSelectionDialog(menu, "fileSB", NULL, 0); /* get the html widget handle stored as userdata in file menu */ XtVaGetValues(menu, XmNuserData, &html, NULL); XtAddCallback(dialog, XmNokCallback, (XtCallbackProc)fileOkCB, html); XtAddCallback(dialog, XmNcancelCallback, (XtCallbackProc)XtUnmanageChild, NULL); } XtManageChild(dialog); XtPopup(XtParent(dialog), XtGrabNone); /* call XMapRaised to make sure it's visible */ XMapRaised(XtDisplay(dialog), XtWindow(XtParent(dialog))); } /* * Callback routine when the user selects Ok in the fileSelectionDialog. * The name of the file to load is passed to the routine that will do * the actual loading. */ static void fileOkCB(Widget w, Widget html, XmFileSelectionBoxCallbackStruct *cbs) { char *filename; XmStringGetLtoR(cbs->value, XmSTRING_DEFAULT_CHARSET, &filename); if(!filename || *filename == '\0') { /* nothing typed? */ if(filename) XtFree(filename); return; } /* pass to readFile */ readFile(html, filename); /* all done */ XtFree(filename); } /* * Read the given file, determine the mime (= content) type and set * the contents of the file in the HTML widget. */ static void readFile(Widget html, String filename) { struct stat statbuf; String text; FILE *file; String mime; int retval; /* make sure the file is a regular file and open it */ if((retval = stat(filename, &statbuf)) == -1 || (statbuf.st_mode & S_IFMT) != S_IFREG) { if(retval == -1) perror(filename); /* couldn't open */ else fprintf(stderr, "%s: not a regular file\n", filename); return; } /* open the file and determine it's content type */ if(!(file = fopen(filename, "r")) || !(mime = mimeType(filename, file))) { perror(filename); /* couldn't read */ fclose(file); } if(!strcmp(mime, "image/")) { /* An image was selected */ /* we do not need the file but the name of the file */ fclose(file); /* * Set the name of the image to load as the value. XmHTML will * perform the loading of the image if necessary. */ XtVaSetValues(html, XmNmimeType, mime, XmNvalue, filename, NULL); return; } /* A true HTML or a plain text file. Read and set */ if(!(text = XtMalloc((unsigned int)(statbuf.st_size+1)))) { fclose(file); fprintf(stderr, "Could not load %s: malloc failed for %li bytes\n", filename, (unsigned long)statbuf.st_size+1); return; } /* file was opened, read it */ if(!fread(text, sizeof(char), statbuf.st_size + 1, file)) fprintf(stderr, "Warning: %s: may not have read entire file!\n", filename); fclose(file); /* NULL terminate */ text[statbuf.st_size] = '\0'; /* insert contents in the HTML widget */ XtVaSetValues(html, XmNmimeType, mime, XmNvalue, text, NULL); XtFree(text); } /* * Determine if the given file is a HTML file or an image that XmHTML * recognizes. */ static String mimeType(String filename, FILE *file) { String chPtr; char buf[128]; unsigned char img_type; /* check if there is a . in the filename somewhere */ if((chPtr = strstr(filename, ".")) != NULL) { String start; /* * check if this was a html file or not. We start at the end of * the given filename and walk to the front. We don't use the * return value from strstr() since the dot may have occured in a * pathname. */ for(start = &filename[strlen(filename)-1]; *start != '.' && *start != '/' ; start--) { /* any of these extensions are considered HTML files by default */ if(!strcasecmp(start, ".html") || !strcasecmp(start, ".htm")) return("text/html"); } } /* * No or a non-matching extension. Read the first line and see if it's * an image or if this file contains HTML. */ if(!(chPtr = fgets(buf, 128, file))) return(NULL); if((img_type = XmHTMLImageGetType(filename, buf, 128)) == IMAGE_ERROR) return(NULL); else if(img_type == IMAGE_UNKNOWN) { /* * Image type not known by XmHTML or not an image. * Check if it contains HTML. */ /* walk to the first < */ for(chPtr = buf; *chPtr != '\0' && *chPtr != '<'; chPtr++); /* No < found, assume plain text */ if(*chPtr == '\0') return("text/plain"); if(!strncasecmp(chPtr, "reason != XmCR_ACTIVATE) return; switch(cbs->url_type) { case ANCHOR_JUMP: /* * A named anchor was selected, See if it is a valid one */ if(XmHTMLAnchorGetId(html, cbs->href) != -1) { /* * Tell the widget it must scroll the selected hyperlink * into view and have it render all references to it as * visited. */ cbs->doit = True; cbs->visited = True; return; } cbs->doit = False; return; case ANCHOR_FILE_LOCAL: case ANCHOR_FILE_REMOTE: { String chPtr; /* Reference to a remote file */ if((chPtr = strstr(cbs->href, "file:")) != NULL) { /* * For the following cases, the file is local: * file:/some/path -- no host * file:///some/path -- null host * file://localhost/some/path -- localhost */ /* skip the "file:" marker */ chPtr += 5; if(!strcmp(chPtr, "///")) chPtr += 3; else if(!strcmp(chPtr, "//localhost")) chPtr += 11; else if(*chPtr != '/') { fprintf(stderr, "%s: unsupported hyperlink type\n", cbs->href); return; } } else chPtr = cbs->href; /* read and load the file */ readFile(html, chPtr); } break; default: fprintf(stderr, "%s: unsupported hyperlink type\n", cbs->href); } } XmHTML-1.1.10/book/PaxHeaders.1031/Makefile0000644000175000001440000000013212613377377016204 xustar000000000000000030 mtime=1445854975.080545878 30 atime=1445854975.080545878 30 ctime=1445854975.080545878 XmHTML-1.1.10/book/Makefile0000644000175000001440000000340512613377377015606 0ustar00chrisusers00000000000000 # List of sources SRCS = simple_html.c simple_html2.c autosize_html.c forced_html.c html.c \ html_browser.c # List of object files OBJS = simple_html.o simple_html2.o autosize_html.o forced_html.o html.o \ html_browser.o # Targets to make EXAMPLES=simple_html simple_html2 autosize_html forced_html html html_browser # The library XMHTMLINC= -I../lib XMHTMLLIB= -L../lib -lXmHTML LINKLIBS = $(XMHTMLLIB) $(LOADLIBES) $(DMALLOCLIB) # rule to create .o files from .c files .c.o: $(RM) $@ $(CC) $(CFLAGS) $(CPPFLAGS) $(XMHTMLINC) $(INCLUDES) -c $< all: $(EXAMPLES) # targets to build simple_html:: ../src/libXmHTML.a simple_html.o $(RM) $@ \ $(CC) -o $@ $(LDFLAGS) simple_html.o $(LINKLIBS) simple_html2:: ../src/libXmHTML.a simple_html2.o $(RM) $@ \ $(CC) -o $@ $(LDFLAGS) simple_html2.o $(LINKLIBS) autosize_html:: ../src/libXmHTML.a autosize_html.o $(RM) $@ \ $(CC) -o $@ $(LDFLAGS) autosize_html.o $(LINKLIBS) forced_html:: ../src/libXmHTML.a forced_html.o $(RM) $@ \ $(CC) -o $@ $(LDFLAGS) forced_html.o $(LINKLIBS) html:: ../src/libXmHTML.a html.o $(RM) $@ \ $(CC) -o $@ $(LDFLAGS) html.o $(LINKLIBS) html_browser:: ../src/libXmHTML.a html_browser.o $(RM) $@ \ $(CC) -o $@ $(LDFLAGS) html_browser.o $(LINKLIBS) .PHONY: ../src/libXmHTML.a depend:: $(SRCS) $(MAKEDEPEND) $(XMHTMLINC) $(INCLUDES) $(CPPFLAGS) $(SRCS) .PHONY: stamp-includes includes:: stamp-includes clean:: $(RM) $(OBJS) $(RM) $(EXAMPLES) distclean:: clean $(RM) core *.out *.log make.world *.bak *.last *.auto *.rej *.orig #$(CP) Makefile.org Makefile #-------------------------------------------------------------------------- # don't delete anything below this line, makedepend depends on it #-------------------------------------------------------------------------- XmHTML-1.1.10/PaxHeaders.1031/TODO0000644000175000001440000000013212613377377014302 xustar000000000000000030 mtime=1445854975.079545878 30 atime=1445854975.079545878 30 ctime=1445854975.079545878 XmHTML-1.1.10/TODO0000644000175000001440000000536112613377377013707 0ustar00chrisusers00000000000000List of things to do some time in the future. Gtk Port -------- - lots of stuff. Compile hasn't been tested, widget interface might be out of date, convenience functions should be updated, a whole lot of things need to be done here! Layout Engine ------------- - improve table layout. Basics are good, trouble arises with the cellpadding & cellspacing attributes. Offsets are computed and set incorrectly. - add support for and HTML elements [table]; - prevent border around the element [table]; - vertical alignment of cell content [table]; - compute correct height of nested tables; - full text flow around images; - colspan attributes is not always treated correctly: spanned cells are sometimes too wide. Paint Engine ------------ -
needs better scrolling - proper rendering of cell borders [table]; - proper rendering of cell background [table]; - improve table scrolling, sometimes it looses text and screen updates are incorrect; Embedded Objects ---------------- - get this finally working Text Searching -------------- - provide a better way for highlighting the found text. Can be done in conjunction with selection & clipboard functions. Selections & Clipboard functions -------------------------------- - needs to be fully implemented. The proto's are there but they don't do anything. - make use of plain text output for copying selection to the clipboard. Formatted Text Output --------------------- - use Postscript font metrics instead of assuming Xlib font metrics; - add printing of elements [postscript, ascii output]; - as footnotes doesn't work [postscript]; - fix background color [postscript]; - add support for formatted ascii; - enhance all formatted output routines to work with selections of the document instead of the whole document; I18N ---- - properly test fontsets. - add support for lang and dir attributes on text containes; - add support for multilingual documents (see include/XmHTML/HTML.h.new, it's got a XmHTMLLanguageCallbackStruct) - make it toolkit independant, retrieval of fontset attributes currently queries all fonts in the fontset. Imake ----- Needs to be updated for the new source tree. The current imakefiles are hugely outdated but can be adapted with little change. Autoconf -------- - current configure.in is a good start, it checks for libXpm, libjpeg, libpng and libz. Currently only for the Motif version. Needs switches for gtk - need Makefile.am for all subdirectories. Misc ---- - XmCreateHTMLDialog, XmCreateHTMLMessageBox? - update manual pages, extend programmers guide; - port examples/example_2 to gtk; - check for memory leaks, there are still a few left. Contact me if you want to work on some of these items. Koen D'Hondt ripley@xs4all.nl XmHTML-1.1.10/PaxHeaders.1031/http0000644000175000001440000000013212613377377014514 xustar000000000000000030 mtime=1445854975.099545877 30 atime=1445854991.787545578 30 ctime=1445854975.099545877 XmHTML-1.1.10/http/0000755000175000001440000000000012613377377014171 5ustar00chrisusers00000000000000XmHTML-1.1.10/http/PaxHeaders.1031/cookie.c0000644000175000001440000000013212613377377016206 xustar000000000000000030 mtime=1445854975.100545877 30 atime=1445854975.099545877 30 ctime=1445854975.100545877 XmHTML-1.1.10/http/cookie.c0000644000175000001440000004410212613377377015607 0ustar00chrisusers00000000000000/* * Cookie support for the simple HTTP library. * * Copyright (c) 1997-1998 Richard Offer * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* Author's Note * Cookies are currently undergoing standardisation, the current accepted * practise is based on Netscapes implementation. The IETF has issued * RFC2109 in Feb97, its been ammended since then, and I'm working from * the 21Nov97 version. I expect it to change before its issued. * * Pending the widespread acceptance of a standard, I've taken a few * short-cuts, namely: * * 1) no support to restrict the ports of a cookie. * 2) interaction between Netscape and RFC2109 cookies isn't 100% * * Watch this space... */ /* ChangeLog * $Log$ * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* for malloc */ #include /* for strstr() */ #ifdef HAVE_STRINGS_H #include #endif #include /* for mktime() */ #include #ifdef DMALLOC #include #endif /* DMALLOC */ #ifndef True #define True (1) #endif /* True */ #ifndef False #define False (0) #endif /* False */ /* static function decls */ static HTTPCookie * newCookie(void); static void freeCookie(HTTPCookie *); static HTTPCookieList * newCookieList(void); static HTTPCookieRequest * newCookieRequest(void); static HTTPCookie * newCookie() { HTTPCookie *new_c = (HTTPCookie *) calloc(1, sizeof(HTTPCookie)); return (new_c); } void freeCookie(HTTPCookie *cookie) { if ( cookie ) { if ( cookie->domain) free(cookie->domain); if ( cookie->comment) free(cookie->comment); if ( cookie->commentURL) free(cookie->commentURL); if ( cookie->cookie.name) free(cookie->cookie.name); if ( cookie->cookie.value) free(cookie->cookie.value); if ( cookie->path) free(cookie->path); if ( cookie->port) free(cookie->port); free(cookie); } cookie = NULL; } /* This doesn't free the actual cookie, just the linked list */ static void freeCookieList(HTTPCookieList *list) { HTTPCookieList *tmp = list; HTTPCookieList *tmp2; if(!list) return; while ( tmp->next ) { tmp2 = tmp->next; free(tmp); tmp = tmp2; } if ( tmp ) free(tmp); } void freeCookieRequest(HTTPCookieRequest *req) { if ( req->cookieList ) freeCookieList(req->cookieList); if ( req->setCookie ) freeCookieList(req->setCookie); free( req); } void freeCookieCache(HTTPCookieCache *cache, int free_cookies) { int i; if(cache == NULL) return; if ( free_cookies ) { for (i=0; i< cache->ncookies ; i++ ) freeCookie(cache->cookies[i]); } free( (void *) cache->cookies ); free( (void *) cache->filename ); free(cache); } static HTTPCookieRequest * newCookieRequest() { HTTPCookieRequest *new_c = (HTTPCookieRequest *) calloc(1, sizeof(HTTPCookieRequest) ); new_c->sendCookie = True; return new_c; } static HTTPCookieList * newCookieList() { HTTPCookieList *new_c = (HTTPCookieList *) calloc(1, sizeof(HTTPCookieList)); return (new_c); } static HTTPCookieCache * newCookieCache(void) { HTTPCookieCache *new_cc = (HTTPCookieCache *) calloc(1, sizeof(HTTPCookieCache)); new_cc->cookies = (HTTPCookie **) NULL; new_cc->ncookies = 0; new_cc->filename = NULL; new_cc->fileType = 0; return (new_cc); } int sortCookies(const void *s1, const void *s2) { HTTPCookie *c1 = *(HTTPCookie **) s1; HTTPCookie *c2 = *(HTTPCookie **) s2; int c = 0; if (c1->domain && c2->domain ) c = strcasecmp(c1->domain, c2->domain); if ( c == 0 && c2->path && c1->path ) /* reverse sense of sort */ return strcmp(c2->path, c1->path); return c; } HTTPCookieCache * loadCookieFileToCache(char *filename, char fileType) { HTTPCookieCache *cc = newCookieCache(); HTTPCookie *cookie; FILE *fp; cc->filename = NewString(filename); cc->fileType = fileType; if ((fp = fopen(filename, "r")) != NULL) { char line[4097]; /* the maximum length of a cookie as defined by the spec. */ char domain[128]; char allInDomain[128]; char path[128]; char secure[128]; int expires; char name[128]; char value[128]; char comment[128]; char commentURL[128]; int version; char port[128]; int allHostsInDomain, sec; while (fgets(line, 4096, fp) != NULL) { /* very early versions of netscape (seen on 1.12) mark the first line of the * cookie file with MCOM-HTTP-Cookie-file-1 */ if (strlen(line) == 0 || line[0] == '#' || line[0] == '\n' || !strcmp(line, "MCOM-HTTP-Cookie-file-1")) continue; switch (fileType) { case NetscapeCookieFile: /* allow white space in name and value items */ sscanf(line, "%s\t%s\t%s\t%s\t%d\t%[ -~]\t%[ -~]", domain, allInDomain, path, secure, &expires, name, value); cookie = newCookie(); cookie->domain = NewString(domain); cookie->exactHostMatch = ! stringToBoolean(allInDomain); cookie->path = NewString(path); cookie->secure = stringToBoolean(secure); cookie->expires = expires; cookie->cookie.name = NewString(name); cookie->cookie.value = NewString(value); break; case CookieJar: /* allow white space in name and value items */ sscanf(line, "%s\t%d\t%d\t%s\t%s\t%d%d\t%[ -~]\t%[ -~]\t%[ -~]\t%[ -~]", domain, &version, &allHostsInDomain, path, port, &sec, &expires, comment, commentURL, name, value); cookie = newCookie(); cookie->domain = NewString(domain); cookie->exactHostMatch = allHostsInDomain; cookie->path = NewString(path); cookie->port = NewString(port); cookie->secure = sec; cookie->expires = expires; cookie->comment = NewString(comment); cookie->commentURL = NewString(commentURL); cookie->cookie.name = NewString(name); cookie->cookie.value = NewString(value); break; } if (cc->ncookies == 0) { cc->cookies = (HTTPCookie **) calloc(1, sizeof(HTTPCookie *)); } else { cc->cookies = (HTTPCookie **) realloc((void *) cc->cookies, (cc->ncookies + 1) * sizeof(HTTPCookie *)); } cc->cookies[cc->ncookies] = cookie; cc->ncookies++; } fclose(fp); } /* sort the cookies on domain and reversed path, makes it easier * generating the cookieList. * * According to the spec (example 2), more specific paths come before * the less specific one. */ qsort((void *) cc->cookies, cc->ncookies, sizeof(HTTPCookie *), sortCookies); return cc; } HTTPCookieRequest * getCookieFromCache(HTTPCookieCache * cache, char *url) { HTTPCookieRequest *req = newCookieRequest(); HTTPCookieList *cLP = req->cookieList; int i; char *hostname, *filename; char *domain; char tmpHost[128]; parseURL(url, PARSE_HOSTNAME | PARSE_FILENAME, NULL, NULL, NULL, &hostname, NULL, &filename); for (i = 0; i < cache->ncookies; i++) { memset((void *) tmpHost, 0, 128); strcat(tmpHost, hostname); /* if the cookie has expired, ignore it (it wont get written out when we save * the cache ) */ if (cache->cookies[i]->expires < time(NULL)) continue; if ((domain = strstr(tmpHost, cache->cookies[i]->domain)) != NULL) { if (cache->cookies[i]->exactHostMatch) { if (!strcasecmp(cache->cookies[i]->domain, tmpHost) && !strncmp(filename, cache->cookies[i]->path, strlen(filename))) { /* ToDo check port numbers */ if (cLP == NULL) { req->cookieList = cLP = newCookieList(); } else if (cLP->next == NULL) { cLP->next = newCookieList(); cLP = cLP->next; } cLP->cookie = cache->cookies[i]; } } else { domain[0] = '\0'; /* hostnames with embedded dots are not allowed and the domain name must have * at least one dot */ if ( strchr(tmpHost, '.') || strchr(cache->cookies[i]->domain, '.') == NULL ) continue; if (cLP == NULL) { req->cookieList = cLP = newCookieList(); } else if (cLP->next == NULL) { cLP->next = newCookieList(); cLP = cLP->next; } cLP->cookie = cache->cookies[i]; } } } freeURL(PARSE_HOSTNAME | PARSE_FILENAME, NULL, NULL, NULL, hostname, (int)NULL, filename); return req; } char * makeCookie(HTTPCookieList *cookieList ) { char cookie[4097]; /* max length of a cookie */ /* tell the server that we support RFC2109 style cookies (if the server * does as well, it will reply with Set-Cookie2 * * Note: assume that if one cookie is version 0 they all will be (for this URL). * This IS an ASSUMPTION (the spec says that it is allowable to send two * cookies of different versions, but is this likely ? */ if ( cookieList->cookie->version == 0 ) sprintf(cookie,"Cookie2: $VERSION=\"1\"\r\nCookie: $VERSION=\"%d\"; ",cookieList->cookie->version); else sprintf(cookie,"Cookie: $VERSION=\"%d\"; ",cookieList->cookie->version); while ( cookieList ) { strcat(cookie, cookieList->cookie->cookie.name); strcat(cookie, "="); strcat(cookie, cookieList->cookie->cookie.value); strcat(cookie, ";"); if ( cookieList->cookie->type == SetCookie2 ) { if ( cookieList->cookie->path ) { strcat(cookie, "$Path"); strcat(cookie, "="); strcat(cookie, cookieList->cookie->path); strcat(cookie, ";"); } if ( cookieList->cookie->domain ) { strcat(cookie, "$Domain"); strcat(cookie, "="); strcat(cookie, cookieList->cookie->domain); strcat(cookie, ";"); } /* ToDo: Port support */ } cookieList = cookieList->next; } strcat(cookie, "\r\n"); return NewString(cookie); } void addCookieListToCache(HTTPCookieCache * cache, HTTPCookieList * cookieList) { while ( cookieList ) { int i; int install = 1; /* we look to see if the cookie is already in the cache, if so we replace it * _unless_ it has a newer VERSION */ for ( i=0; i< cache->ncookies; i++ ) { if ( ! strcasecmp(cache->cookies[i]->domain, cookieList->cookie->domain) ) if ( ! strcmp(cache->cookies[i]->path, cookieList->cookie->path) ) if ( ! strcmp(cache->cookies[i]->cookie.name, cookieList->cookie->cookie.name) && cache->cookies[i]->version >= cookieList->cookie->version ) { freeCookie(cache->cookies[i]); cache->cookies[i] = cookieList->cookie; install = 0; } } if ( install ) { cache->cookies = (HTTPCookie **) realloc((void *) cache->cookies, (cache->ncookies + 1) * sizeof(HTTPCookie *)); cache->cookies[cache->ncookies] = cookieList->cookie; cache->ncookies++; } cookieList = cookieList->next; } qsort((void *) cache->cookies, cache->ncookies, sizeof(HTTPCookie *), sortCookies); } void writeCookieCache(HTTPCookieCache * cache) { if ( cache->fileType != NetscapeCookieFile ) { FILE *fp; int i; time_t t = time(NULL); if ( (fp=fopen(cache->filename, "w") ) != NULL ) { fprintf(fp,"# CookieJar-1\n"); fprintf(fp,"# This file is autogenerated, don't edit it\n"); fprintf(fp,"# format designed by Richard Offer for HTTP cookies that \n"); fprintf(fp,"# comply with both Netscape format and the 21-Nov-97 draft of HTTP State \n"); fprintf(fp,"# Management Mechanism (was RFC2109)\n\n"); #ifdef DEBUG fprintf(fp,"# format:\n"); fprintf(fp,"# domain (String)\n"); fprintf(fp,"# \n"); fprintf(fp,"# version (int) (0==SetCookie, 1==SetCookie2)\n"); fprintf(fp,"# \n"); fprintf(fp,"# exactHostMatch (int) (0=all machines in domain can access cookie\n"); fprintf(fp,"# \n"); fprintf(fp,"# path (String)\n"); fprintf(fp,"# \n"); fprintf(fp,"# port (String) comma-separated list of ports\n"); fprintf(fp,"# \n"); fprintf(fp,"# secure (int)\n"); fprintf(fp,"# \n"); fprintf(fp,"# expires (int)\n"); fprintf(fp,"# \n"); fprintf(fp,"# comment (String)\n"); fprintf(fp,"# \n"); fprintf(fp,"# commentURL (String)\n"); fprintf(fp,"# \n"); fprintf(fp,"# name (String)\n"); fprintf(fp,"# \n"); fprintf(fp,"# value (String)\n\n"); fprintf(fp,"# Netscape style cookies do not include port comment or commentURL\n"); #endif /* DEBUG */ for (i=0; i< cache->ncookies; i++ ) { if ( ! cache->cookies[i]->discard && cache->cookies[i]->expires > t ) { fprintf(fp,"%s\t",cache->cookies[i]->domain); fprintf(fp,"%d\t",cache->cookies[i]->version); fprintf(fp,"%d\t",cache->cookies[i]->exactHostMatch); fprintf(fp,"%s\t",cache->cookies[i]->path); fprintf(fp,"%s\t",cache->cookies[i]->port ? cache->cookies[i]->port : "" ); fprintf(fp,"%d\t",cache->cookies[i]->secure); fprintf(fp,"%d\t",cache->cookies[i]->expires); fprintf(fp,"%s\t",cache->cookies[i]->comment ? cache->cookies[i]->comment : "" ); fprintf(fp,"%s\t",cache->cookies[i]->commentURL ? cache->cookies[i]->commentURL : "" ); fprintf(fp,"%s\t",cache->cookies[i]->cookie.name); fprintf(fp,"%s\n",cache->cookies[i]->cookie.value); } } fclose(fp); } } } void setCookie(HTTPCookieRequest *req, int type, char *string, char *host) { HTTPCookieList *cLP = req->setCookie; char *name, *value; char *str; int i=0; if (cLP == NULL) { cLP = newCookieList(); } else if (cLP->next == NULL) { cLP->next = newCookieList(); cLP = cLP->next; } cLP->cookie = newCookie(); /* removes leading and trailing white space */ #define TRIM(str) \ { \ int n; \ while ( *str && *str == ' ' ) \ (*str)++; \ n=strlen(str)-1; \ while ( n && str[n] == ' ' ) { \ str[n] = '\0';\ n--; \ } \ } while ( str[i] ) { name = &str[i]; while ( str[i] && str[i] != '=' ) { i++; } if ( str[i] ) { str[i] = '\0'; i++; value = &str[i]; while ( str[i] && str[i] != ';' ) { i++; } if ( str[i] ) str[i] = '\0'; i++; TRIM(name); TRIM(value); if ( strlen(value)) { if ( type == SetCookie2 ) { if ( strcasecmp(name,"comment") ) cLP->cookie->comment = NewString(value); else if ( strcasecmp(name,"commenturl") ) cLP->cookie->commentURL = NewString(value); else if ( strcasecmp(name,"discard") ) cLP->cookie->discard = True; else if ( strcasecmp(name,"domain") ) { /* if first char isn't a dot add one - spec says this */ if ( value[0] != '.' ) { char d[128]; d[0] = '.'; strcat(d,value); cLP->cookie->domain = NewString(d); } else cLP->cookie->domain = NewString(value); } else if ( strcasecmp(name,"max-age") ) { int j = atoi(value); if ( j != 0 ) cLP->cookie->expires = time(NULL) + j; else /* TODO dump cookie immediately */ ; } else if ( strcasecmp(name,"path") ) cLP->cookie->path = NewString(value); else if ( strcasecmp(name,"port" ) ) { /* TODO */ ; } else if ( strcasecmp(name,"version") ) cLP->cookie->version = atoi(value); } else { /* Netscape format cookie */ if ( strcasecmp(name,"domain") ) { /* if first char isn't a dot add one - spec says this */ if ( value[0] != '.' ) { char d[128]; d[0] = '.'; strcat(d,value); cLP->cookie->domain = NewString(d); } else cLP->cookie->domain = NewString(value); } else if ( strcasecmp(name,"path") ) cLP->cookie->path = NewString(value); } } else { /* a value that has no associated value */ if ( type == SetCookie2 ) { if ( strcasecmp(name,"discard" ) ) cLP->cookie->discard = True; else if ( strcasecmp(name, "secure") ) cLP->cookie->secure = True; } else { if ( strcasecmp(name, "expires" ) ) { /* typical of netscape they have a non-standard and facist-to-parse date * format */ char day[16],month[3]; int date,mon,yr,hr,min,sec; struct tm timeStruct; time_t t; sscanf(name, "expires %s, %d-%s-%d %d:%d%d", day, &date, month, &yr, &hr, &min, &sec); if ( month[0] == 'J' ) { if ( month[1] == 'a' ) mon = 0; else if ( month[2] == 'n' ) mon = 5; else mon = 6; } else if ( month[0] == 'F' ) mon = 1; else if ( month[0] == 'M' ) { if ( month[2] == 'r' ) mon = 2; else mon = 4; } else if ( month[0] == 'A' ) { if ( month[1] == 'p' ) mon = 3; else mon= 7; } else if ( month[0] == 'S' ) mon = 8; else if ( month[0] == 'O' ) mon = 9; else if ( month[0] == 'N' ) mon = 10; else if ( month[0] == 'D' ) mon = 11; timeStruct.tm_sec = sec; timeStruct.tm_min = min; timeStruct.tm_hour = hr; timeStruct.tm_mday = date; timeStruct.tm_mon = mon; timeStruct.tm_isdst = -1; /* the don't know flag */ t = mktime( & timeStruct ); if ( t != -1 ) cLP->cookie->expires = t ; } if ( strcasecmp(name, "secure") ) cLP->cookie->secure = True; } } } } if ( cLP->cookie->domain == NULL ) { cLP->cookie->domain = NewString(host); } if ( cLP->cookie->path == NULL ) { cLP->cookie->path = NewString("/"); } } void mergeCookieCache(HTTPCookieCache *c1, HTTPCookieCache *c2) { if ( c1 && c2 ) { c1->cookies = (HTTPCookie **) realloc( (void *) c1->cookies, (c1->ncookies + c2->ncookies) * sizeof(HTTPCookie) ); memcpy( (void *) & (c1->cookies[c1->ncookies]), (void *) c2->cookies, c2->ncookies * sizeof(HTTPCookie *) ); c1->ncookies += c2->ncookies; } } XmHTML-1.1.10/http/PaxHeaders.1031/README.http0000644000175000001440000000013212613377377016427 xustar000000000000000030 mtime=1445854975.099545877 30 atime=1445854975.099545877 30 ctime=1445854975.099545877 XmHTML-1.1.10/http/README.http0000644000175000001440000000711612613377377016034 0ustar00chrisusers00000000000000This File: README for HTTP.c ----------------------------------------------------------------------- Note: This file is in pieces until I get around to write a proper set of documentation. ----------------------------------------------------------------------- HTTP is a simple implementation of the HTTP1.0 protocol. It has been written by Richard Offer (offer@sgi.com) and expanded by Koen D'Hondt (ripley@xs4all.nl). Implementation details ---------------------- HTTP uses non-blocking communication with a user-selectable timeout and retry count. On systems that do not support the SO_RCVTIMEO setsockopt() option, alarm() is used to enforce a timeout on connect(). Once a connection has been established, HTTP uses a select() on read() to ensure the read operation doesn't block. HTTP Return Values ------------------ Upon return of loadHTTPURL(), the ret field of the HTTPRequest structure contains a HTTPRequestReturn code indicating success, partial success or failure to honor the request. Return values 0-99 are library errors All return values above 99 are messages returned by the server HTTP is connecting to. Classes: 100-199 : informative messages, can be ignored; 200-299 : request accepted 300-399 : non-fatal request errors 400-499 : fatal request errors 500-600 : remote server errors The convenience routine HTTPErrorString(error) returns a string containing an appropriate error message while the convienence routine HTTPError(msg, error) prints a user-supplied message (which may be NULL) together with an appropriate error message. Value and Meaning of the HTTP Return Values ------------------------------------------- Value Name Meaning 0 HTTPInvalid invalid request type 1 HTTPBadProtocol unsupported protocol requested. Currently only http is supported 2 HTTPBadHost hostname could not be resolved 3 HTTPBadURL badly formed URI in the HTTPRequest 4 HTTPBadLoadType unsupported data return method requested. 5 HTTPMethodUnsupported unsupported HTTP method requested. GET, POST and HEAD are the only supported (and possible) methods 6 HTTPNoSocket could not create a socket 7 HTTPNoConnection connect() failed 8 HTTPBadHttp10 unused 9 HTTPCannotCreateFile library could not create the file requested by the HTTPLoadToFile LoadType 10 HTTPConnectTimeout initial connect() failed, timed out. 11 HTTPTimeout read() timeout 100 HTTPContinue 101 HTTPSwitchProtocols 200 HTTPSuccess request succeeded and fully honored 201 HTTPCreated 202 HTTPAccepted 203 HTTPNonAuthoritativeInfo 204 HTTPNoContent 205 HTTPResetContent 206 HTTPPartialContent request only partially served 300 HTTPMultipleChoices 301 HTTPPermMoved document permanently moved to a new location 302 HTTPTempMoved document temporarely moved to a new location 303 HTTPSeeOther 304 HTTPNotModified document not modified since last request (proxy message?) 305 HTTPUseProxy 400 HTTPBadRequest 401 HTTPUnauthorised access denied, authorization required 402 HTTPPaymentReq access denied, first you must pay 403 HTTPForbidden access forbidden 404 HTTPNotFound requested document not found 405 HTTPMethodNotAllowed 406 HTTPNotAcceptable 407 HTTPProxyAuthReq proxy authorization required 408 HTTPRequestTimeOut request timed out 409 HTTPConflict 410 HTTPGone 411 HTTPLengthReq 412 HTTPPreCondFailed 413 HTTPReqEntityTooBig 414 HTTPURITooBig 415 HTTPUnsupportedMediaType 500 HTTPInternalServerError 501 HTTPNotImplemented 502 HTTPBadGateway 503 HTTPServiceUnavailable 504 HTTPGatewayTimeOut 505 HTTPHTTPVersionNotSupported XmHTML-1.1.10/http/PaxHeaders.1031/HTTP.c0000644000175000001440000000013212613377377015514 xustar000000000000000030 mtime=1445854975.099545877 30 atime=1445854975.098545877 30 ctime=1445854975.099545877 XmHTML-1.1.10/http/HTTP.c0000644000175000001440000010034312613377377015115 0ustar00chrisusers00000000000000/***** * HTTP.c : A first attempt at a simple HTTP library. * * This file Version $Revision: 1.1 $ * * Creation date: Tue Oct 21 01:41:31 GMT+0100 1997 * Last modification: $Date: 1997/10/23 00:28:23 $ * By: $Author: newt $ * Current State: $State: Exp $ * * Author: Richard Offer * * Copyright (C) 1994-1997 by Richard Offer * All Rights Reserved * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Note from the Author: * * A first attempt at a simple HTTP library, mainly used as a test harness for * the forms work in XmHTML, it does lots of bad things and isn't a complete * implementation. I didn't use the W3C libww 'cause its too big and doesn't * seem to work for POSTs --- rmo * * The code is based on a quick read of the HTTP 1.0 rfc, with ideas for * implementation taken from the Chimera Browser. * *****/ /***** * ChangeLog * $Log: HTTP.c,v $ * Revision 1.1 1997/10/23 00:28:23 newt * Initial Revision * *****/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef IRIX_65 #include #include /* select() */ #endif #include #include #include #ifdef HAVE_STRINGS_H #include #endif #include #include #include #include #ifdef HAVE_SYS_SELECT_H #include /* select() */ #endif #include #include #include #include #include #ifdef IRIX_65 struct timeval { time_t tv_sec; /* seconds */ long tv_usec; /* and microseconds */ }; #endif #ifndef SO_RCVTIMEO #include #include #endif #include #ifdef DMALLOC #include #endif /* DMALLOC */ #ifdef NEED_SOCKS /* This is _very_ firewall specific, this works for me (after much trial and * error --- offer */ #include "socks.h" #define connect Rconnect #endif /* NEED_SOCKS */ /*** External Function Prototype Declarations ***/ /*** Public Variable Declarations ***/ #ifdef DEBUG int http_debug = 0; #endif /*** Private Datatype Declarations ****/ /*** Private Function Prototype Declarations ****/ /* delete a no longer required response */ static void deleteResponse(HTTPResponse * res); /* create a new response */ static HTTPResponse *newResponse(char *buf); /***** * hexify src and append to dest. Return value points to the next available * position in dest. *****/ static char *appendHex(char *dest, char *src); /* convert all name-value pairs to a valid QUERY_STRING format */ static char *encodeFormData(HTTPNamedValues * formdata); #ifndef SO_RCVTIMEO static void connectTimeout(int signal); #endif /*** Private Variable Declarations ***/ #ifndef SO_RCVTIMEO static jmp_buf http_setjmp_buffer; #endif #ifndef SO_RCVTIMEO static void connectTimeout(int signal) { if(signal == SIGALRM) longjmp(http_setjmp_buffer, 1); } #endif /* This is the main routine for sending a request and getting a response, * everything else in this file is waffle */ void loadHTTPURL(void *unused, HTTPRequest * request, HTTPCookieRequest *cookieReq) { struct hostent *server; struct sockaddr_in name; int sock; char *scheme = NULL, *username = NULL, *password = NULL; char *hostname = NULL, *filename = NULL; int port; char *buf = NULL; size_t offset = 0, bufsize = 0; HTTPResponse *res; ssize_t val; fd_set rfds; struct timeval tv; int retval, retry_count; char *cookie = NULL ; /* see if we have an URI */ if(request->url == NULL) { request->ret = HTTPBadURL; return; } /* verify request type */ if(request->type != HTTPLoadToString && request->type != HTTPLoadToFile) { request->ret = HTTPBadLoadType; return; } /* resolve the url */ parseURL(request->url, PARSE_URL, &scheme, &username, &password, &hostname, &port, &filename); re_issue_request: /* check protocol */ if(scheme == NULL || strncasecmp(scheme, "http", 4)) { /* free off the output from parseURL() */ freeURL(PARSE_URL, scheme, username, password, hostname, port, filename); request->ret = HTTPBadProtocol; return; } #ifdef DEBUG if(http_debug) fprintf(stderr, "Lookin up host %s...\n", hostname); #endif /* see if we can resolve the host */ if((server = gethostbyname(hostname)) == NULL) { freeURL(PARSE_URL, scheme, username, password, hostname, port, filename); request->ret = HTTPBadHost; return; } /* we've got the host, open a socket */ if((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { freeURL(PARSE_URL, scheme, username, password, hostname, port, filename); request->ret = HTTPNoSocket; return; } #ifdef DEBUG if(http_debug) fprintf(stderr, "Found, connecting to %s (port %i)\n", hostname, port); #endif name.sin_family = AF_INET; name.sin_port = htons(port); #ifdef linux memcpy(&name.sin_addr, server->h_addr, server->h_length); #else memcpy(&name.sin_addr.s_addr, server->h_addr, server->h_length); #endif /***** * Wouldn't the world be easy if each system knew SO_RCVTIMEO. * But this is not the case on at least linux, so we use a brute force * approach: alarm. * * Just in case your system can enable timeouts on sockets, here's a piece * of code that should work. *****/ #ifdef SO_RCVTIMEO /* set socket timeout */ tv.tv_sec = request->timeout; tv.tv_usec = 0; if(setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(struct timeval))) { freeURL(PARSE_URL, scheme, username, password, hostname, port, filename); request->ret = HTTPNoSocket; close(sock); return; } #else if(setjmp(http_setjmp_buffer)) { freeURL(PARSE_URL, scheme, username, password, hostname, port, filename); #ifdef DEBUG if(http_debug) fprintf(stderr, "connect() timed out\n"); #endif request->ret = HTTPConnectTimeout; signal(SIGALRM, SIG_DFL); close(sock); return; } signal(SIGALRM, connectTimeout); alarm((long)request->timeout); #endif if(connect(sock, (struct sockaddr*)&name, sizeof(name)) < 0) { freeURL(PARSE_URL, scheme, username, password, hostname, port, filename); if(errno == EWOULDBLOCK) { #ifdef DEBUG if(http_debug) fprintf(stderr, "connect() timed out\n"); #endif request->ret = HTTPConnectTimeout; } else request->ret = HTTPNoConnection; close(sock); return; } #ifndef SO_RCVTIMEO /* remove connection timeout */ signal(SIGALRM, SIG_DFL); alarm(0L); #endif #ifdef DEBUG if(http_debug) fprintf(stderr, "sending request (%i)\n", request->method); #endif if( cookieReq != NULL && cookieReq->cookieList != NULL ) cookie = makeCookie(cookieReq->cookieList); #ifdef DEBUG if( http_debug ) if( cookie ) fprintf(stderr,"The server wants a cookie '%s'\n",cookie); #endif /* _DEBUG */ switch(request->method) { case HTTPGET: { char *formStr = NULL, *reqStr = NULL; if(request->form_data) { formStr = encodeFormData((HTTPNamedValues*)request->form_data); } reqStr = (char*)malloc(strlen(GET_METHOD) + strlen(filename) + (formStr ? strlen(formStr) + 1 : 0) + strlen(HTTPVERSIONHDR) + strlen(USER_AGENT) + (cookie ? strlen(cookie) + 1 : 0) + strlen(NEWLINE) + 3); sprintf(reqStr, "%s%s%s%s%s%s%s%s", GET_METHOD, filename, (formStr ? "?" : ""), /* cgi stuff requires a ? */ (formStr ? formStr : ""), HTTPVERSIONHDR, USER_AGENT, ( cookie ? cookie : "" ), NEWLINE); val = write(sock, reqStr, strlen(reqStr) + 1); free(reqStr); if(formStr) free(formStr); } break; case HTTPPOST: { char *formStr = NULL, *fullReqStr; char *reqStr = (char *) malloc(strlen(POST_METHOD) + strlen(filename) + strlen(HTTPVERSIONHDR) + (cookie ? strlen(cookie) + 1 : 0) + strlen(USER_AGENT) + strlen(NEWLINE) + 2); sprintf(reqStr, "%s%s%s%s%s", POST_METHOD, filename, HTTPVERSIONHDR, USER_AGENT, ( cookie ? cookie : "" ) ); if(request->form_data) { formStr = encodeFormData((HTTPNamedValues*)request->form_data); } fullReqStr = calloc(strlen(reqStr) + strlen(CONTENT_LEN) + strlen(CONTENT_TYPE) + MAX_FORM_LEN + (formStr ? strlen(formStr) : 0 )+ 10 /* safety */, sizeof(char)); sprintf(fullReqStr, "%s%s%d%s%s%s%s%s%s", reqStr, CONTENT_LEN, (formStr ? strlen(formStr) : 0), NEWLINE, CONTENT_TYPE, NEWLINE, NEWLINE, formStr, NEWLINE); val = write(sock, fullReqStr, strlen(fullReqStr) + 1); free(reqStr); if(formStr) free(formStr); free(fullReqStr); } break; case HTTPHEAD: /* not sure about cookies for HEAD, supported ? */ { char *reqStr = NULL; reqStr = (char*)malloc(strlen(HEAD_METHOD) + strlen(filename) + strlen(HTTPVERSIONHDR) + strlen(USER_AGENT) + strlen(NEWLINE) + 3); sprintf(reqStr, "%s%s%s%s%s", HEAD_METHOD, filename, HTTPVERSIONHDR, USER_AGENT, NEWLINE); val = write(sock, reqStr, strlen(reqStr) + 1); free(reqStr); } break; default: /* free off the output from parseURL() */ freeURL(PARSE_URL, scheme, username, password, hostname, port, filename); close(sock); request->ret = HTTPMethodUnsupported; return; } /* read output from remote HTTP server */ offset = 0; val = 0; bufsize = CHUNKSIZE; buf = calloc(bufsize, sizeof(char)); retry_count = 0; #ifdef DEBUG if(http_debug) fprintf(stderr, "awaiting input\n"); #endif /* watch socket to see when it has input */ while(1) { /* no of bytes read from socket */ val = 0; FD_ZERO(&rfds); FD_SET(sock, &rfds); /* wait up to the given no of seconds */ tv.tv_sec = request->timeout; tv.tv_usec = 0; retval = select(sock+1, &rfds, NULL, NULL, &tv); if(retval) { #ifdef DEBUG if(http_debug) fprintf(stderr, "reading socket.\n"); #endif val = read(sock, buf + offset, bufsize - offset); if(val <= 0) /* error or end of input */ break; #ifdef DEBUG if(http_debug) fprintf(stderr, "read %i bytes, offset: %i)\n", val, offset); #endif /* keep room for at least CHUNKSIZE bytes */ if(bufsize - (offset + val) < CHUNKSIZE) { bufsize += CHUNKSIZE; buf = realloc(buf, bufsize); } offset += val; buf[offset] = '\0'; /* NULL terminate */ } else { #ifdef DEBUG if(http_debug) fprintf(stderr, "timed out after %i seconds.\n", request->timeout); #endif /* * abort if we're timed out, have reached the maximum retry * times and no input was received. */ if(retry_count == request->retry && offset == 0) { close(sock); free(buf); request->ret = HTTPTimeout; return; } /* break out when we have an offset and this read timed out */ else if(offset && val <= 0) break; else { /* read timed out before any input was received */ retry_count++; } #ifdef DEBUG if(http_debug) fprintf(stderr, "retrying for the %ith time.\n", retry_count); #endif } } /* now parse the read message for headers */ res = newResponse(buf); free(buf); /* set appropriate return code */ if(val < 0) request->ret = HTTPPartialContent; else request->ret = res->status_code; #if defined(PRINT_HDRS) && defined(DEBUG) { int i; for(i = 0; i < res->num_headers; i++) { printf("hdr %s = %s\n", res->headers[i].name, res->headers[i].value); } } #endif /* valid return code? */ if(request->ret > 199 && request->ret < 299) { /* get or post include data, which head does not contain */ if(request->method != HTTPHEAD) { int i; /* parse the headers for any cookies */ for (i = 0; i < res->num_headers; i++ ) { if(!strcasecmp(res->headers[i].name, "Set-Cookie")) setCookie(cookieReq,SetCookie,res->headers[i].value, hostname); else if(!strcasecmp(res->headers[i].name, "Set-Cookie2")) setCookie(cookieReq, SetCookie2, res->headers[i].value, hostname); } /* store data in string (most likely this was a cgi request) */ if(request->type == HTTPLoadToString) { size_t len = (res->data ? strlen((char *) res->data) : 0); for (i = 0; i < res->num_headers; i++) { if(!strcasecmp(res->headers[i].name, "Content-length")) len = atoi(res->headers[i].value); } request->out_data = calloc(len + 1, sizeof(char)); memcpy((void *) request->out_data, res->data, len); request->out_data[len] = '\0'; request->length = len; } else if(request->type == HTTPLoadToFile) { /* this was a request for a remote file. Save it */ FILE *fp; if((fp = fopen((char *) request->in_data, "w")) == NULL) { request->ret = HTTPCannotCreateFile; } else { int i; size_t len = (res->data ? strlen((char *) res->data) : 0); for (i = 0; i < res->num_headers; i++) { if(!strcasecmp(res->headers[i].name, "Content-length")) len = atoi(res->headers[i].value); } /* flush data */ fwrite(res->data, sizeof(char), len, fp); fflush(fp); fclose(fp); } } } else { /* store data in string (most likely this was a cgi request) */ if(request->type == HTTPLoadToString) { /***** * Transfer header array from the result structure to the * request. *****/ request->headers = res->headers; request->num_headers = res->num_headers; res->headers = NULL; res->num_headers = 0; } else if(request->type == HTTPLoadToFile) { /* this was a request for a remote file. Save it */ FILE *fp; if((fp = fopen((char *) request->in_data, "w")) == NULL) { request->ret = HTTPCannotCreateFile; } else { int i; for (i = 0; i < res->num_headers; i++) { fprintf(fp, "%s = %s\n", res->headers[i].name, res->headers[i].value); } /* flush data */ fflush(fp); fclose(fp); } } } } else { /***** * if the URL has moved (_or_ the user left off a trailing '/' from a * directory request), then look in the Location: header for the * correct URL and re-issue the request --- offer dec 97 *****/ if(request->ret == 301 || request->ret == 302 ) { int i; for(i=0; i< res->num_headers; i++) { if(!strcasecmp(res->headers[i].name, "location")) { freeURL(PARSE_URL, scheme, username, password, hostname, port, filename); parseURL(res->headers[i].value, PARSE_URL, &scheme, &username, &password, &hostname, &port, &filename); free(request->url); /***** * Update the URL that was requested to point to the * correct one *****/ request->url = NewString(res->headers[i].value); goto re_issue_request; } } } } deleteResponse(res); /* free off the output from parseURL() */ freeURL(PARSE_URL, scheme, username, password, hostname, port, filename); /* all done */ close(sock); } void deleteHTTPRequest(HTTPRequest * req) { int i; if(req->in_data) free(req->in_data); if(req->form_data) { i = 0; while (req->form_data[i].name != NULL) { if(req->form_data[i].name) free(req->form_data[i].name); if(req->form_data[i].value) free(req->form_data[i].value); i++; } free(req->form_data); } for(i = 0; i < req->num_headers; i++) { if(req->headers[i].name) free(req->headers[i].name); if(req->headers[i].value) free(req->headers[i].value); } if(req->headers) free(req->headers); if(req->out_data) free(req->out_data); if(req->url) free(req->url); free(req); } HTTPRequest * newHTTPRequest(void) { HTTPRequest *new_r = (HTTPRequest *) calloc(1, sizeof(HTTPRequest)); new_r->type = HTTPLoadToString; new_r->in_data = NULL; new_r->form_data = NULL; new_r->out_data = NULL; new_r->method = HTTPGET; new_r->url = NULL; new_r->ret = HTTPInvalid; new_r->timeout = DEFAULT_TIMEOUT; new_r->retry = DEFAULT_RETRY; new_r->headers = NULL; new_r->num_headers = 0; return(new_r); } static void deleteResponse(HTTPResponse * res) { int i; if(res->data) free(res->data); for(i = 0; i < res->num_headers; i++) { if(res->headers[i].name) free(res->headers[i].name); if(res->headers[i].value) free(res->headers[i].value); } if(res->headers) free(res->headers); free(res); } /***** * unescape HTTP escaped chars. * Replacement is done inline. *****/ void HTTPUnescapeResponse(char *buf) { register unsigned int x, y; register char digit; for(x = 0, y = 0; buf[y]; ++x, ++y) { if((buf[x] = buf[y]) == '%') { y++; digit = (buf[y] >= 'A' ? ((buf[y] & 0xdf)-'A')+10 : (buf[y]-'0')); y++; digit *= 16; digit += (buf[y] >= 'A' ? ((buf[y] & 0xdf)-'A')+10 : (buf[y]-'0')); buf[x] = digit; } } buf[x] = '\0'; } static HTTPResponse * newResponse(char *buf) { HTTPResponse *res = (HTTPResponse *) calloc(1, sizeof(HTTPResponse)); int ver, code; int i, start; int SOL; size_t len = 0; char *EOL; if(strncasecmp(buf, "HTTP", 4)) { res->http_version = HTTP_VERSION_09; res->headers = NULL; res->num_headers = 0; res->status_code = HTTPInvalid; res->data = (unsigned char *) NewString(buf); return res; } sscanf(buf, "HTTP/1.%d %d", &ver, &code); EOL = strstr(buf, "\r\n"); start = EOL - buf + 2; #ifdef DEBUG if(http_debug) fprintf(stderr, "\nHTTP 1.%d return code = %d\n", ver, code); #endif if(ver == 0) res->http_version = HTTP_VERSION_10; else res->http_version = HTTP_VERSION_11; res->status_code = (HTTPRequestReturn) code; for (i = start, SOL = start; i < strlen(buf); i++) { if(buf[i] == '\r' || buf[i] == '\n') { if(buf[i] == '\r' && buf[i + 1] && buf[i + 1] == '\n') { char *colon = strchr(&buf[SOL], ':'); if(colon == NULL) break; if(res->headers == NULL) res->headers = (HTTPNamedValues *) malloc(sizeof(HTTPNamedValues)); else res->headers = realloc((void *)res->headers, sizeof(HTTPNamedValues) * (res->num_headers + 1)); res->headers[res->num_headers].name = NewNString(&buf[SOL], colon - &buf[SOL]); res->headers[res->num_headers].value = NewNString(colon + 2, &buf[i] - colon - 2); if(!strcasecmp(res->headers[res->num_headers].name, "Content-length")) len = atoi(res->headers[res->num_headers].value); res->num_headers++; if(buf[i + 2] && buf[i + 2] == '\r' && buf[i + 3] && buf[i + 3] == '\n') { if(len == 0) len = strlen(&buf[i + 4]); res->data = calloc(len + 1, sizeof(char)); memcpy((void *) res->data, &buf[i + 4], len); res->data[len] = '\0'; goto finish; } i++; } SOL = i + 1; } } finish: return(res); } /***** * Fast lookup table to determine which characters should be left alone and * which should be encoded. Much faster than the Chimera implementation -- kdh * const qualifier should put it in the text segment *****/ static const unsigned char allow[97] = {/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ 0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1, /* 2x !"#$%&'()*+,-./ */ 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* 3x 0123456789:;<=>? */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 4x @ABCDEFGHIJKLMNO */ 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, /* 5X PQRSTUVWXYZ[\]^_ */ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 6x `abcdefghijklmno */ 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0 /* 7X pqrstuvwxyz{\}~ DEL */ }; static const char *hex = "0123456789ABCDEF"; /***** * Name: appendHex * Return Type: char* * Description: appends src to dest, translating certain chars to their * hexadecimal representation as we do; * In: * dest: destination buffer. This buffer must be large enough to contain * the expanded source text; * src: text to be appended; * Returns: * a ptr pointing to the next available position in dest. * Note: * added 97/10/21 by kdh and based on HTEscape() from libwww *****/ static char* appendHex(char *dest, char *src) { register char *ptr, *chPtr; for(ptr = dest, chPtr = src; *chPtr!= '\0'; chPtr++) { /* no negative values */ int c = (int)((unsigned char)(*chPtr)); if(*chPtr == ' ') /* bloody exception */ *ptr++ = '+'; else if(c >= 32 && c <= 127 && allow[c-32]) *ptr++ = *chPtr; /* acceptable char */ else { *ptr++ = '%'; /* hex is following */ *ptr++ = hex[c >> 4]; *ptr++ = hex[c & 15]; } } return(ptr); } /***** * Name: encodeFormData * Return Type: char* * Description: creates a fully valid QUERY_STRING from the given name/value * pairs. * In: * formdata: array of name/value pairs from a form submit. Encoding * terminates when a NULL name has been detected. * Returns: * an allocated and hex-encoded QUERY_STRING. * Note: * - this function is based on the corresponding one from Chimera (rmo) * - 97/10/21, heavily modified by kdh *****/ static char* encodeFormData(HTTPNamedValues * formdata) { char *data, *chPtr; int nvalues, i, len = 0; /***** * First count how many bytes we have to allocate. Each entry gets two * additional bytes: the equal sign and a spacer. Each entry is also * multiplied by three to allow full expansion. * Count no of entries as well. *****/ for(i = 0; formdata[i].name != NULL; i++) { if(formdata[i].name) { len += strlen(formdata[i].name) * 3; if(formdata[i].value) len += strlen(formdata[i].value) * 3; len += 2; /* equal sign and spacer */ } } nvalues = i; /* allocate & reset query string */ data = (char*)calloc(len + 1, sizeof(char)); /***** * Now compose query string: append & convert to hex at the same time. * We can safely do this as we've already allocated room for hexadecimal * expansion of the *entire* query string. * Room for optimisation: appendHex could be done inline *****/ chPtr = data; for(i = 0; i < nvalues; i++) { if(formdata[i].name) { chPtr = appendHex(chPtr, formdata[i].name); *chPtr++ = '='; if(formdata[i].value) chPtr = appendHex(chPtr, formdata[i].value); *chPtr++ = '&'; /* spacer */ } } /* mask off last & */ data[strlen(data)-1] = '\0'; #ifdef DEBUG if(http_debug) { fprintf(stderr, "encodeFormData, computed string length: %i, " "used: %i\n", len+1, strlen(data)); fprintf(stderr, "return value: %s\n", data); } #endif /***** * Could resize data to fit exactly the no of bytes used, but I wonder * if it's worth it as this data has a pretty short lifetime --- kdh *****/ return(data); } /* * stolen from the chimera browser --- rmo. * */ #define isspace8(a) ((a) < 33 && (a) > 0) void parseURL(char *url, long parse, char **scheme, char **username, char **password, char **hostname, int *port, char **filename) { char *start; char *colon, *slash, *fslash; char *at; /* username/password @ */ char *ucolon; /* username colon */ char *pcolon; /* port number colon */ struct _part { int start; int len; } sp, up, pwp, hp, pp, fp; sp.start = 0; sp.len = 0; up.start = 0; up.len = 0; pwp.start = 0; pwp.len = 0; hp.start = 0; hp.len = 0; pp.start = 0; pp.len = 0; fp.start = 0; fp.len = 0; if(url == NULL) return; /* skip leading white-space (if any) */ for (start = url; isspace8(*start); start++); /* Look for indication of a scheme. */ colon = strchr(start, ':'); /* * Search for characters that indicate the beginning of the * path/params/query/fragment part. */ slash = strchr(start, '/'); if(slash == NULL) slash = strchr(start, ';'); if(slash == NULL) slash = strchr(start, '?'); if(slash == NULL) slash = strchr(start, '#'); /* * Check to see if there is a scheme. There is a scheme only if * all other separators appear after the colon. */ if(colon != NULL && (slash == NULL || colon < slash)) { sp.start = 0; sp.len = colon - start; } /* * If there is a slash then sort out the hostname and filename. * If there is no slash then there is no hostname but there is a * filename. */ if(slash != NULL) { /* Check for leading //. If its there then there is a host string. */ if((*(slash + 1) == '/') && ((colon == NULL && slash == start) || (colon != NULL && slash == colon + 1))) { /* Check for filename at end of host string */ slash += 2; if((fslash = strchr(slash, '/')) != NULL) { hp.start = slash - start;; hp.len = fslash - slash; fp.start = fslash - start; fp.len = strlen(fslash); } else { /* there is no filename */ hp.start = slash - start; hp.len = strlen(slash); } } else { /* * the rest is a filename because there is no // or it appears * after other characters */ if(colon != NULL && colon < slash) { fp.start = colon + 1 - start; fp.len = strlen(colon + 1); } else { fp.start = slash - start; fp.len = strlen(slash); } } } else { /* No slashes at all so the rest must be a filename */ if(colon == NULL) { fp.start = 0; fp.len = strlen(start); } else { fp.start = colon - start + 1; fp.len = strlen(colon + 1); } } /* * If there is a host string then divide it into * username:password@hostname:port as needed. */ if(hp.len != 0) { /* Look for username:password. */ if((at = strchr(&url[hp.start], '@')) != NULL) { up.start = hp.start; up.len = at - start - hp.start; hp.start = at + 1 - start; if((ucolon = strchr(&url[up.start], ':')) != NULL) { if(ucolon - start < hp.start) { pwp.start = ucolon + 1 - start; pwp.len = hp.start - pwp.start; } } } /* Grab the port. */ if((pcolon = strchr(&url[hp.start], ':')) != NULL && pcolon < ( &url[hp.start + hp.len]) ) { pp.start = pcolon + 1 - start; pp.len = fp.start - pp.start; hp.len -= pp.len + 1; } } /* now have all the fragments, make them into strings */ if(parse & PARSE_SCHEME) { if(sp.len > 0) *scheme = NewNString(&url[sp.start], sp.len); else *scheme = NULL; } if(parse & PARSE_USER) { if(up.len > 0) *username = NewNString(&url[up.start], up.len); else *username = NULL; } if(parse & PARSE_PASSWORD) { if(pwp.len > 0) *password = NewNString(&url[pwp.start], pwp.len); else *password = NULL; } if(parse & PARSE_HOSTNAME) { if(hp.len > 0) *hostname = NewNString(&url[hp.start], hp.len); else *hostname = NULL; } if(parse & PARSE_PORT) { if(pp.len > 0) { char *tmp = NewNString(&url[pp.start], pp.len); *port = atoi(tmp); free(tmp); } else *port = 80; } if(parse & PARSE_FILENAME) { if(fp.len > 0) *filename = NewString(&url[fp.start]); else *filename = NewString("/"); } return; } /* this is brain dead, needs to be expanded to cover non http schemes -- rmo */ int HTTPAbsoluteURL(char *url) { if(strncasecmp(url, "http", 4)) return(0); else return(1); } /* This is a very flakey routine and it needs a lot of work, it doesn't do compression of full paths, but it proved adequet for simple testing */ char * HTTPFindAbsoluteURL(char *url, char *baseUrl) { char new_url[1024]; char *tmpP; char *u_scheme, *u_username, *u_password, *u_hostname, *u_filename; char *b_scheme, *b_username, *b_password, *b_hostname, *b_filename; int u_port, b_port; if(baseUrl == NULL || *baseUrl == '\0') return (NewString(url)); parseURL(url, PARSE_URL, &u_scheme, &u_username, &u_password, &u_hostname, &u_port, &u_filename); parseURL(baseUrl, PARSE_URL, &b_scheme, &b_username, &b_password, &b_hostname, &b_port, &b_filename); if(u_scheme) sprintf(new_url, "%s://", u_scheme); else sprintf(new_url, "%s://", b_scheme); if(u_hostname) strcat(new_url, u_hostname); else if(b_hostname) strcat(new_url, b_hostname); else strcat(new_url, "localhost"); if(u_filename && u_filename[0] == '/') { strcat(new_url, u_filename); } else if(u_filename && u_filename[0] == '~') { strcat(new_url, u_filename); strcat(new_url, "/"); } else { if(b_filename == NULL || b_filename[0] != '/') printf("still to do\n"); else { strcat(new_url, b_filename); tmpP = strrchr(new_url, '/'); if(*tmpP++) { *tmpP = '\0'; strcat(tmpP, u_filename); } else strcat(new_url, u_filename); } } freeURL(PARSE_URL, u_scheme, u_username, u_password, u_hostname, u_port, u_filename); freeURL(PARSE_URL, b_scheme, b_username, b_password, b_hostname, b_port, b_filename); return (NewString(new_url)); } void freeURL(long parse, char *scheme, char *username, char *password, char *hostname, int port, char *filename) { if((parse & PARSE_SCHEME) && scheme) free(scheme); if((parse & PARSE_USER) && username) free(username); if((parse & PARSE_PASSWORD) && password) free(password); if((parse & PARSE_HOSTNAME) && hostname) free(hostname); if((parse & PARSE_FILENAME) && filename) free(filename); } void HTTPError(char *msg, HTTPRequestReturn error) { fprintf(stderr, "%s: %s.\n", msg, HTTPErrorString(error)); } const char* HTTPErrorString(HTTPRequestReturn error) { switch(error) { /* 0 and up (client messages) */ case HTTPInvalid: return("Invalid request (client failure)"); case HTTPBadProtocol: return("Invalid protocol requested (client failure)"); case HTTPBadHost: return("Invalid hostname (client failure)"); case HTTPBadURL: return("Invalid URL (client failure)"); case HTTPBadLoadType: return("Invalid load type (client failure)"); case HTTPMethodUnsupported: return("Unsupported method (client failure)"); case HTTPNoSocket: return("Could not open socket (client failure)"); case HTTPNoConnection: return("Not connected (client failure)"); case HTTPBadHttp10: return("Invalid HTTP/1.0 request (client failure)"); case HTTPCannotCreateFile: return("Could not create file (client failure)"); case HTTPConnectTimeout: return("Could not connect: timed out (client failure)"); case HTTPTimeout: return("Connection timed out"); /* 100 and up (informative messages) */ case HTTPContinue: return("Continue"); case HTTPSwitchProtocols: return("Bad protocol, switch required"); /* 200 and up (request succeeded) */ case HTTPSuccess: return("No error"); case HTTPCreated: return("Document created"); case HTTPAccepted: return("Request accepted"); case HTTPNonAuthoritativeInfo: return("Non-authoritative information"); case HTTPNoContent: return("Document is empty"); case HTTPResetContent: return("Content has been reset"); case HTTPPartialContent: return("Partial content"); /* 300 and up (non-fatal errors, retry possible) */ case HTTPMultipleChoices: return("Request not unique, multiple choices possible"); case HTTPPermMoved: return("Document has been permanently removed"); case HTTPTempMoved: return("Document has been temporarely moved"); case HTTPSeeOther: return("Site has move"); case HTTPNotModified: return("Document not modified since last access"); case HTTPUseProxy: return("Document only accessible through proxy"); /* 400 and up (fatal request errors) */ case HTTPBadRequest: return("Invalid HTTP request"); case HTTPUnauthorised: return("Client not authorized"); case HTTPPaymentReq: return("Payment required"); case HTTPForbidden: return("Access forbidden"); case HTTPNotFound: return("Document not found"); case HTTPMethodNotAllowed: return("Access method not allowed"); case HTTPNotAcceptable: return("Unacceptable request"); case HTTPProxyAuthReq: return("Proxy authorization required"); case HTTPRequestTimeOut: return("Timed out"); case HTTPConflict: return("Conflict of interest"); case HTTPGone: return("Document has moved"); case HTTPLengthReq: return("Invalid request length"); case HTTPPreCondFailed: return("Condition failed"); case HTTPReqEntityTooBig: return("Request entity too large"); case HTTPURITooBig: return("URI specification too big"); case HTTPUnsupportedMediaType: return("Unsupported media type"); /* 500 and up (server errors) */ case HTTPInternalServerError: return("Internal server error"); case HTTPNotImplemented: return("Method not implemented"); case HTTPBadGateway: return("Invalid gateway"); case HTTPServiceUnavailable: return("Service unavailable"); case HTTPGatewayTimeOut: return("Gateway timed out"); case HTTPHTTPVersionNotSupported: return("Unsupported HTPP version"); default: return("unknown error"); } } XmHTML-1.1.10/http/PaxHeaders.1031/Imakefile0000644000175000001440000000013212613377377016402 xustar000000000000000030 mtime=1445854975.099545877 30 atime=1445854975.099545877 30 ctime=1445854975.099545877 XmHTML-1.1.10/http/Imakefile0000644000175000001440000001101512613377377016000 0ustar00chrisusers00000000000000#error The Imakefile is broken, please use the plain Makefiles #if 0 XCOMM XCOMM Imakefile for libhttp XCOMM XCOMM (C)Copyright 1995-1997 Ripley Software Development XCOMM All Rights Reserved XCOMM XCOMM This file is part of the XmHTML Widget Library. XCOMM XCOMM See the file LICENSE for the full copyright statement. XCOMM XCOMM Include the XmHTML configuration file #include "../XmHTML.cf" XCOMM No need to change anything below this line XCOMM XCOMM SGI requires a specification file for shared library that we don't have XCOMM (Irix below 6.2) #if defined(SGIArchitecture) && !SystemV4 && HasSharedLibraries && \ (OSMajorVersion <= 6) && (OSMinorVersion <= 4) # undef SharedLibXmHTML # undef NormalLibXmHTML # define SharedLibXmHTML NO # define NormalLibXmHTML YES #endif XCOMM Linux requires a specification file for a.out shared libraries that we XCOMM don't have. XCOMM #if defined(LinuxArchitecture) && defined(UseElfFormat) && (UseElfFormat == NO) # undef SharedLibXmHTML # undef NormalLibXmHTML # define SharedLibXmHTML NO # define NormalLibXmHTML YES #endif HTTPLIBDIR = XmHTMLLibDir HTTPINCDIR = XmHTMLIncDir INCDIR = XmHTMLIncDir XCOMM Get version numbering for shared libraries from the HTTP include file #define _LIBRARY #include "HTTP.h" XCOMM Make translation from make variables to Imake variables XCOMM (convention is that all uppercase are Make variables, mixed case are XCOMM Imake variables) #ifndef HTTPVERSION #define HTTPVERSION 0 #endif #ifndef HTTPREVISION #define HTTPREVISION 1 #endif #ifndef HTTPUPDATE_LEVEL #define HTTPUPDATE_LEVEL 1 #endif HTTPVersionNum = HTTPVERSION HTTPRevision = HTTPREVISION HTTPUpdateLevel = HTTPUPDATE_LEVEL XCOMM I don't know whether or not X11R5/R4 image has got a Concat3. XCOMM This works. #if (ProjectX < 6) SOHTTPLIBREV = $(HTTPVersionNum)./**/$(HTTPRevision)./**/$(HTTPUpdateLevel) #else #ifdef SGIArchitecture SOHTTPLIBREV = Concat3(.$(HTTPVersionNum).,$(HTTPRevision).,$(HTTPUpdateLevel)) LDREQLIBS = -lc #else SOHTTPLIBREV = Concat3($(HTTPVersionNum).,$(HTTPRevision).,$(HTTPUpdateLevel)) #endif /* SGIArchitecture */ #endif HEADERS = HTTP.h HTTPP.h SRCS = HTTP.c cookie.c OBJS = HTTP.o cookie.o INSTALLFLAGS = $(INSTINCFLAGS) #define DoSharedLib SharedLibXmHTML #define DoNormalLib NormalLibXmHTML #define DoDebugLib DebugLibXmHTML #if (ProjectX < 5) STD_DEFINES = LibraryDefines CDEBUGFLAGS = LibraryCDebugFlags #else # define LibName http # define SoRev SOHTTPLIBREV XCOMM dumb stuff to prevent generation of bad includes:: rule # define LibHeaders foo # include #endif XCOMM XCOMM Ruleset for doing make includes XCOMM LinkFileList(link-includes,$(HEADERS), ../include/XmHTML,../../http) stamp-includes: link-includes touch link-includes touch $@ includes:: stamp-includes XCOMM XCOMM No stuff required when X revision >= 6, Library.tmpl does it for us XCOMM #if (ProjectX < 6) # if (ProjectX < 5) # if DoSharedLib SharedLibraryObjectRule() NormalSharedLibraryTarget(http,$(SOHTTPLIBREV),$(OBJS)) InstallSharedLibrary(http,$(SOHTTPLIBREV),$(HTTPLIBDIR)) # else /* No shared libs */ NormalLibraryObjectRule() # endif /* DoSharedLib */ NormalLibraryTarget(http,$(OBJS)) InstallLibrary(http,$(XPMLIBDIR)) # if DoDebugLib DebuggedLibObjCompile() DebuggedLibraryTarget(http,$(OBJS)) # endif /* DoDebugLib */ # else /* ProjectX == 5 */ LibraryObjectRule() # if DoSharedLib SharedLibraryTarget(http,$(SOHTTPLIBREV),$(OBJS),shared,..) InstallSharedLibrary(http,$(SOHTTPLIBREV),$(HTTPLIBDIR)) # endif /* DoSharedLib */ # if DoNormalLib NormalLibraryTarget(http,$(OBJS)) InstallLibrary(http,$(HTTPLIBDIR)) # endif /* DoNormalLib */ # if DoDebugLib DebuggedLibraryTarget(http,$(OBJS)) InstallLibrary(http_d,$(HTTPLIBDIR)) # endif /* DoDebugLib */ # endif /* ProjectX < 5 */ #else /* X11R6 */ XCOMM make a compiler friendly target libhttp.so #if DoSharedLib install all:: lib$(LIBNAME).so #ifdef SGIArchitecture lib$(LIBNAME).so: lib$(LIBNAME).so$(SOHTTPLIBREV) $(RM) $@ ln -s $@$(SOHTTPLIBREV) $@ #else lib$(LIBNAME).so: lib$(LIBNAME).so.$(SOHTTPLIBREV) $(RM) $@ ln -s $@$(SOHTTPLIBREV) $@ #endif /* SGIArchitecture */ clean:: $(RM) lib$(LIBNAME).so #endif /* DoSharedLib */ #endif /* ProjectX < 6 */ XCOMM rule to install header files InstallMultiple($(HEADERS),$(HTTPINCDIR)) DependTarget() XCOMM Special rule for creating a distribution with the barebone makefiles XCOMM distclean:: clean $(RM) libhttp.so.* $(RM) -r debugger shared unshared $(RM) core *.out make.world *.bak *.last *.auto $(RM) stamp-includes link-includes $(CP) Makefile.org Makefile #endif XmHTML-1.1.10/http/PaxHeaders.1031/Makefile0000644000175000001440000000013212613377377016231 xustar000000000000000030 mtime=1445854975.099545877 30 atime=1445854975.099545877 30 ctime=1445854975.099545877 XmHTML-1.1.10/http/Makefile0000644000175000001440000000300612613377377015630 0ustar00chrisusers00000000000000# # lint configuration. I use lclint. # LIBRARY=libhttp.a SHAREDLIB=libhttp.so.0 SONAME=libhttp.so.0 # List of source, object and header files SRCS=HTTP.c cookie.c OBJS=HTTP.o cookie.o HEADERS=HTTP.h HTTPP.h # Targets to make TARGET_STATIC=$(LIBRARY) TARGET_SHARED=$(SHAREDLIB) # Subdirectories to visit SUBDIRS= # rule to create .o files from .c files .c.o: $(RM) $@ $(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -c $< all: $(TARGET_STATIC) $(TARGET_SHARED) # targets to build $(TARGET_STATIC):: $(OBJS) $(RM) $@ \ $(AR) $@ $(OBJS) $(RANLIB) $@ $(TARGET_SHARED):: $(OBJS) $(RM) $@ ; \ $(CC) $(LDFLAGS) -o $@ -shared -Wl,-soname,$(SONAME) $(OBJS) $(LOADLIBES) stamp-includes: @if [ -d ../include ]; then set +x; \ else (set -x; mkdir ../include); fi @if [ -d ../include/XmHTML ]; then set +x; \ else (set -x; mkdir ../include/XmHTML); fi @(set -x; cd ../include/XmHTML; for i in $(HEADERS); do \ $(RM) $$i; \ $(LN) ../../http/$$i .; \ done) touch $@ includes:: stamp-includes depend:: $(SRCS) $(MAKEDEPEND) $(INCLUDES) $(CPPFLAGS) $(SRCS) clean:: $(RM) $(OBJS) $(RM) $(TARGET_STATIC) $(TARGET_SHARED) distclean:: clean $(RM) core *.out *.log make.world *.bak *.last *.auto *.rej *.orig $(RM) *.lh *.lcs *.lint stamp-includes #$(CP) Makefile.org Makefile realclean:: distclean #-------------------------------------------------------------------------- # don't delete anything below this line, makedepend depends on it #-------------------------------------------------------------------------- XmHTML-1.1.10/PaxHeaders.1031/contrib0000644000175000001440000000013212613377377015175 xustar000000000000000030 mtime=1445854975.082545878 30 atime=1445854991.787545578 30 ctime=1445854975.082545878 XmHTML-1.1.10/contrib/0000755000175000001440000000000012613377377014652 5ustar00chrisusers00000000000000XmHTML-1.1.10/contrib/PaxHeaders.1031/netscape.c0000644000175000001440000000013212613377377017220 xustar000000000000000030 mtime=1445854975.082545878 30 atime=1445854975.082545878 30 ctime=1445854975.082545878 XmHTML-1.1.10/contrib/netscape.c0000644000175000001440000000675012613377377016630 0ustar00chrisusers00000000000000#include #include #include #include #define NS_VERSION "_MOZILLA_VERSION" #define NS_COMMAND "_MOZILLA_COMMAND" #define NETSCAPE "Netscape" extern Window WsNetscapeWindow(Display *display, Window window, char *name); extern Window WsFindNetscapeWindow(Display *display, Window starting_window, char *name, Window (*compare_func)()); extern void WsSendNavigatorCommand(Display *display, Window window, char *command); Window WsNetscapeWindow(Display *display, Window window, char *name) { Atom type; int format; int status; unsigned long nitems, bytesafter; unsigned char **version=NULL; Window found=(Window)None; XClassHint *classhint; if (!name) { if ((XGetWindowProperty(display, window, XInternAtom (display, NS_VERSION, False), 0L, (long)BUFSIZ, False, XA_STRING, &type, &format, &nitems, &bytesafter, (unsigned char **)&version)) == Success && *version && type != None) { found = window; XFree((char *)version); } } else { classhint = XAllocClassHint(); if ((XGetClassHint(display, window, classhint))) { if (!strcmp(classhint->res_class, NETSCAPE) && !strcmp(classhint->res_name, name)) found = window; } XFree((char *)classhint); } return (found); } /* WsNetscapeWindow */ Window WsFindNetscapeWindow(Display *display, Window starting_window, char *name, Window (*compare_func)()) { Window rootwindow, window_parent; int i; unsigned int num_children=0; Window *children=NULL; Window window = (compare_func) (display, starting_window, name); if (window != (Window)None) return (window); if ((XQueryTree(display, starting_window, &rootwindow, &window_parent, &children, &num_children)) == 0) return ((Window)None); i = 0; while (( i < num_children ) && ( window == (Window)None )) window = WsFindNetscapeWindow(display, children[i++], name, compare_func); if (children) XFree((char *)children); return(window); } /* WsFindNetscapeWindow */ void WsSendNavigatorCommand(Display *display, Window window, char *command) { XChangeProperty(display, window, XInternAtom(display, NS_COMMAND, False), XA_STRING, 8, PropModeReplace, (unsigned char *)command, strlen(command)+1); XFlush(display); } /* WsSendNavigatorCommand */ /* Example stuff if ((window = WsFindNetscapeWindow(display, XDefaultRootWindow(display), name, WsNetscapeWindow))) { WsSendNavigatorCommand(display, window, command); } else { if (!(fork())) { if (execl("/bin/sh", "/bin/sh", "-c", cmd, NULL) == -1) { fprintf(stderr, "execl failed (%s)", strerror(errno)); exit(100); } } } */ XmHTML-1.1.10/contrib/PaxHeaders.1031/example_5.c0000644000175000001440000000013212613377377017275 xustar000000000000000030 mtime=1445854975.082545878 30 atime=1445854975.081545878 30 ctime=1445854975.082545878 XmHTML-1.1.10/contrib/example_5.c0000644000175000001440000030755312613377377016712 0ustar00chrisusers00000000000000#include #ifdef __STDC__ #include #else #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* added by rlr */ #include #include #include /* isspace */ #include #include #include /* also for getwd on non-POSIX systems */ /***** * Change this to change the application class of the examples *****/ #define APP_CLASS "HTMLDemos" /***** * We want to have the full XmHTML instance definition available * when debugging this stuff, so include XmHTMLP.h * Note: * Including XmHTMLP.h normally doesn't pull in any of the internal XmHTML * functions. If you want to do this anyway, you need to include *both* * XmHTMLP.h and XmHTMLI.h (in that order). * Note: * When being compiled with the provided or imake generated Makefile, the * symbol VERSION is defined. This is a private define which must not be used * when compiling applications: it sets other defines which pull in * other, private, header files normally not present after installation * of the library. Therefore we undefine this symbol *before* including * the XmHTMLP.h header file. This is not required when XmHTML.h is used. *****/ #if defined(VERSION) #undef VERSION #endif /* VERSION */ #include #include "../src/debug.h" /* we want to be able to enable debugging */ /* imagecache stuff */ #include "cache.h" /* catch NULL strdup's for debug builds */ #if defined(DEBUG) && !defined(DMALLOC) extern char *__rsd_strdup(const char *s1, char *file, int line); #define strdup(PTR) __rsd_strdup(PTR, __FILE__, __LINE__) #endif #ifdef NEED_STRCASECMP # include extern int my_strcasecmp(const char *s1, const char *s2); extern int my_strncasecmp(const char *s1, const char *s2, size_t n); #define strcasecmp(S1,S2) my_strcasecmp(S1,S2) #define strncasecmp(S1,S2,N) my_strncasecmp(S1,S2,N) #endif /*** External Function Prototype Declarations ***/ /* from visual.c */ extern int getStartupVisual(Widget shell, Visual **visual, int *depth, Colormap *colormap); /* can be found in XmHTML */ extern char *my_strcasestr(const char *s1, const char *s2); /* from misc.c */ extern int parseFilename(char *fullname, char *filename, char *pathname); extern void XMessage(Widget widget, String msg); #ifdef DEBUG extern void _XmHTMLUnloadFonts(XmHTMLWidget); extern void _XmHTMLAddDebugMenu(Widget, Widget, String); #endif /*** Public Variable Declarations ***/ /*** Private Datatype Declarations ****/ #define MAX_HISTORY_ITEMS 100 /* save up to this many links */ #define MAX_PATHS 25 /* size of visited path cache */ #define MAX_IMAGE_ITEMS 512 /* max. no of images per document */ #define MAX_HTML_WIDGETS 10 /* max. no of HTML widgets allowed */ #define FILE_OPEN 1 #define FILE_RELOAD 2 #define FILE_SAVEAS 3 #define FILE_RAISE 5 #define FILE_LOWER 6 #define FILE_INFO 7 #define FILE_VIEW_SOURCE 8 #define FILE_VIEW_FONTCACHE 9 #define FILE_QUIT 10 /* Link defines */ #define LINK_MADE 0 #define LINK_HOMEPAGE 1 #define LINK_TOC 2 #define LINK_INDEX 3 #define LINK_GLOSSARY 4 #define LINK_COPYRIGHT 5 #define LINK_PREVIOUS 6 #define LINK_UP 7 #define LINK_DOWN 8 #define LINK_NEXT 9 #define LINK_HELP 10 #define LINK_LAST 11 /* options menu toggle buttons defines. These may *not* be changed */ #define OPTIONS_ANCHOR_BUTTONS 0 #define OPTIONS_HIGHLIGHT_ON_ENTER 1 #define OPTIONS_ENABLE_STRICT_HTML32 2 #define OPTIONS_ENABLE_BODYCOLORS 3 #define OPTIONS_ENABLE_BODYIMAGES 4 #define OPTIONS_ENABLE_DOCUMENT_COLORS 5 #define OPTIONS_ENABLE_DOCUMENT_FONTS 6 #define OPTIONS_ENABLE_OUTLINING 7 #define OPTIONS_DISABLE_WARNINGS 8 #define OPTIONS_FREEZE_ANIMATIONS 9 #define OPTIONS_AUTO_IMAGE_LOAD 10 #define OPTIONS_FANCY_TRACKING 11 #define OPTIONS_ENABLE_IMAGES 12 #define OPTIONS_LAST 13 /* options menu pushbutton defines */ #define OPTIONS_ANCHOR 20 #define OPTIONS_FONTS 21 #define OPTIONS_BODY 22 #define OPTIONS_IMAGE 23 /* document cache */ typedef struct{ String path; /* path to this document */ String file; /* full filename of this document */ int current_ref; /* last activated hyperlink */ int nrefs; /* total no of activated hyperlinks in this document */ String refs[MAX_HISTORY_ITEMS]; /* list of activated hyperlinks */ String visited[MAX_HISTORY_ITEMS]; /* list of visited hyperlins */ int nvisited; /* total no of visited hyperlinks */ int nimages; /* no of images in this document */ String images[MAX_IMAGE_ITEMS]; /* image urls for this document */ }DocumentCache; /* List of all HTML widgets (especially for frames) */ typedef struct{ Boolean active; /* is this an active frame? */ Boolean used; /* is this frame currently being used? */ String name; /* name of this frame */ String src; /* source file for this frame */ Widget html; /* XmHTMLWidget id for this frame */ }HTMLWidgetList; #define MIME_HTML 0 /* text/html */ #define MIME_HTML_PERFECT 1 /* text/html-perfect */ #define MIME_IMAGE 2 /* image/whatever */ #define MIME_PLAIN 3 /* text/plain/unknown */ #define MIME_IMG_UNSUP 4 /* unsupported image type */ #define MIME_ERR 5 /* some error occured */ typedef struct{ int link_type; /* 0 = rev, 1 = rel, which means fetch it */ Boolean have_data; String href; String title; }documentLinks; typedef struct{ Widget w; String name; Boolean value; }optionsStruct; /*** Private Function Prototype Declarations ****/ static DocumentCache *getDocFromCache(String file); static void storeDocInCache(String file); static void storeInHistory(String file, String loc); static void storeAnchor(String href); static void removeDocFromCache(int doc); static void flushImages(Widget w); static void killImages(void); static void HelloScreen(char *use_file, Window parent); void Done(XtPointer client_data, XtIntervalId *id); /* XmHTMLWidget callbacks */ static void anchorCB(Widget w, XtPointer arg1, XmHTMLAnchorPtr href_data); static void docCB(Widget w, XtPointer arg1, XmHTMLDocumentPtr cbs); static void linkCB(Widget w, XtPointer arg1, XmHTMLLinkPtr cbs); static void frameCB(Widget w, XtPointer arg1, XmHTMLFramePtr cbs); static String collapseURL(String url); static void infoCB(Widget parent, Widget popup, XButtonPressedEvent *event); /* XmHTMLWidget functions */ static XmImageInfo *loadImage(Widget w, String url); static int testAnchor(Widget w, String href); static void jumpToFrame(String filename, String loc, String target, Boolean store); static int getImageData(XmHTMLPLCStream *stream, XtPointer buffer); static void endImageData(XmHTMLPLCStream *stream, XtPointer data, int type, Boolean ok); /* Menu and button bar callbacks */ static void linkButtonCB(Widget w, XtPointer arg1, XtPointer arg2); static void docInfoCB(Boolean font_only); static void historyCB(Widget w, int button); static void progressiveButtonCB(Widget w, int reset); static void optionsCB(Widget w, int item); static void showImageInfo(XmImageInfo *info); /*** Private Variable Declarations ***/ static XtAppContext context; static Widget back, forward, load_images, label, toplevel = NULL, reload; static Widget link_button, link_dialog, html32, verified, info_dialog; static Widget prg_button, image_dialog; static documentLinks document_links[LINK_LAST]; static XmImage *preview_image; static Widget link_buttons[LINK_LAST]; static char default_font[128], current_font[128]; static char default_charset[128], current_charset[128]; static String link_labels[LINK_LAST] = {"Mail Author", "Home", "TOC", "Index", "Glossary", "Copyright", "Prev", "Up", "Down", "Next", "Help"}; static String image_types[] = {"(error occured)", "Unknown Image type", "X11 Pixmap", "X11 Bitmap", "CompuServe(C) Gif87a or Gif89a", "Animated Gif89a", "Animated Gif89a with NETSCAPE2.0 loop extension", "CompuServe(C) Compatible Gzf87a or Gzf89a", "Gif89a Compatible animation", "Gif89a compatible animation with NETSCAPE2.0 loop extension", "JPEG", "PNG", "Fast Loadable Graphic"}; /***** * global XmHTML configuration. Elements must be in the same order as the * OPTIONS_ defines above. *****/ static optionsStruct html_config[OPTIONS_LAST] = { { NULL, XmNanchorButtons, True }, { NULL, XmNhighlightOnEnter, True }, { NULL, XmNstrictHTMLChecking, False }, { NULL, XmNenableBodyColors, True }, { NULL, XmNenableBodyImages, True }, { NULL, XmNenableDocumentColors, True }, { NULL, XmNenableDocumentFonts, True }, { NULL, XmNenableOutlining, True }, { NULL, XmNenableBadHTMLWarnings, True }, { NULL, XmNfreezeAnimations, False }, { NULL, "autoImageLoad", True }, { NULL, "fancyMouseTracking", False }, { NULL, XmNimageEnable, True }, }; /* Command line options */ static Boolean root_window, noframe, external_client; static Boolean progressive_images, allow_exec; static int animation_timeout = 175; #define MAX_PROGRESSIVE_DATA_SKIP 2048 static int progressive_data_skip = MAX_PROGRESSIVE_DATA_SKIP; static int progressive_data_inc = 0; #ifdef DEBUG static Boolean debug = False; #define Debug(MSG) do { \ if(debug) { printf MSG ; fflush(stdout); } }while(0) #else #define Debug(MSG) /* emtpy */ #endif static String usage = {"Options:\n" "\t-allow_exec : honor href=\"exec:\" or href=\"xexec:\"\n" "\t-animation_timeout : animation timeout in milliseconds. Default is 175\n" #ifdef DEBUG "\t-debug : enable application debug output\n" #endif "\t-images_delayed : delay image loading\n" "\t-netscape : fire netscape for unsupported URL's\n" "\t-noframe : don't put a frame around the HTML display area\n" "\t-root : act as root window\n" "\t-progressive : load images progressively (only GZF for now)\n" "\t-prg_skip [num] : progressive data skip. Default is 2048\n" "\t-prg_inc [num] : progressive data increment. Resets prg_skip to 256.\n" "\t Using this option overrides any prg_skip value.\n" "\t-h, --help : print this help\n"}; /* document cache */ static DocumentCache doc_cache[MAX_HISTORY_ITEMS]; static int current_doc, last_doc; /***** * List of all html widgets. The first slot is the toplevel HTML widget and * is never freed. All other slots are used by frames. *****/ static HTMLWidgetList html_widgets[MAX_HTML_WIDGETS]; /* visited paths */ static String paths[MAX_PATHS][1024]; static int max_paths; /* default settings */ static String appFallbackResources[] = { "*fontList: *-adobe-helvetica-bold-r-*-*-*-120-*-*-p-*-*-*", "*useColorObj: False", "*usePrivateColormap: True", NULL}; static void readPipe( Widget w, char *cmd ) { FILE *fd; char *buf=NULL; int i; int val, offset; fd = popen(cmd, "r"); fflush(fd); offset = 0; val = 0; buf = calloc(522, sizeof(char)); strcpy(buf, "\n"); offset += strlen(buf); val = fread(buf+offset, 1, 512, fd); offset += 512; if (val == 512) { buf = realloc(buf, offset+512); while ((val = fread(buf+offset, 1,512, fd)) == 512) { offset += 512; buf = realloc(buf, offset+512); } } pclose(fd); buf = realloc(buf, strlen(buf)+20); strcat(buf, "\n\n"); XmHTMLTextSetString(w, buf); free(buf); } /***** * Name: setBusy * Return Type: void * Description: changes the cursor from or to a stopwatch to indicate we are * busy doing something lengthy processing which can't be * interrupted. * In: * state: True to display the cursor as busy, False to display the * normal cursor. * Returns: * nothing. *****/ static void setBusy(Boolean state) { static Boolean busy; static Cursor cursor; Display *display = XtDisplay(toplevel); if(!cursor) { cursor = XCreateFontCursor(display, XC_watch); busy = False; } if(busy != state) { busy = state; if(busy) XDefineCursor(display, XtWindow(toplevel), cursor); else XUndefineCursor(display, XtWindow(toplevel)); } XFlush(display); } /***** * Name: addPath * Return Type: void * Description: adds a path to the list of visited paths if it hasn't been * stored yet. * In: * path: path to be stored; * Returns: * nothing. *****/ static void addPath(String path) { int i = 0; /* see if the path has already been added */ for(i = 0; i < max_paths; i++) if(!(strcmp((char*)(paths[i]), path))) return; /* store this path */ if(max_paths < MAX_PATHS) { strcpy((char*)(paths[max_paths]), path); max_paths++; } } /***** * Follow symbolic links (if any) to translate filename into the name of the * real file that it represents. Returns TRUE if the call was successful, * meaning the links were translated successfully, or the file was not * linked to begin with (or there was no file). Returns false if some * error prevented the call from determining if there were symbolic links * to process, or there was an error in processing them. The error * can be read from the unix global variable errno. *****/ Boolean followSymLinks(String filename) { /***** * FIXME * * readlink doesn't seem to do anything at all on Linux 2.0.27, * libc 5.3.12 *****/ int cc; char buf[1024]; cc = readlink(filename, buf, 1024); if (cc == -1) { #ifdef __sgi if (errno == EINVAL || errno == ENOENT || errno == ENXIO) #else if (errno == EINVAL || errno == ENOENT) #endif /* no error, just not a symbolic link, or no file */ return(True); else return(False); } else { buf[cc] = '\0'; strcpy(filename, buf); return(True); } } /***** * Name: resolveFile * Return Type: String * Description: checks if the given file exists on the local file system * In: * filename: file to check * Returns: * a full filename when the file exists. NULL if it doesn't. * Note: * This routine tries three things to check if a file exists on the local * file system: * 1. if "filename" is absolute, it is assumed the file exists and is * accessible; * 2. checks whether "filename" can be found in the path of the current * document; * 3. sees if "filename" can be found in the list of stored paths. * When a file has been found, it is checked if this is a regular file, * and if so it is transformed into a fully qualified pathname (with * relative paths fully resolved). *****/ static String resolveFile(String filename) { static String ret_val; char tmp[1024]; /* throw out http:// stuff */ if(!(strncasecmp(filename, "http://", 7))) return(NULL); Debug(("resolveFile, looking for %s\n", filename)); ret_val = NULL; /***** * If this is an absolute path, check if it's really a valid file * (or directory). This allows us to recognize chrooted files when * browsing the local web directory. *****/ if(filename[0] == '/') { if(!(access(filename, R_OK))) ret_val = strdup(filename); else /* a fake path, strip of the leading / */ sprintf(tmp, "%s", &filename[1]); } else { strcpy(tmp, filename); tmp[strlen(filename)] = '\0'; /* NULL terminate */ } if(ret_val == NULL) { char real_file[1024]; int i; /***** * search the paths visited so far. Do it top to bottom as the * last visited path is inserted in the last slot. Quite usefull * when looking for images or links in the current document. *****/ for(i = max_paths-1; i >= 0 ; i--) { sprintf(real_file, "%s%s", (char*)(paths[i]), tmp); /* check if we have access to this thing */ if(!(access(real_file, R_OK))) { struct stat statb; /***** * We seem to have some access rights, make sure this * is a regular file *****/ if(stat(real_file, &statb) == -1) { perror(filename); break; } else if(S_ISDIR(statb.st_mode)) { /***** * It's a dir. First check for index.html then * for Welcome.html. *****/ int len = strlen(real_file)-1; strcat(real_file, real_file[len] == '/' ? "index.html\0" : "/index.html\0"); if(!(access(real_file, R_OK))) { ret_val = strdup(real_file); break; } real_file[len+1] = '\0'; strcat(real_file, real_file[len] == '/' ? "Welcome.html\0" : "/Welcome.html\0"); if(!(access(real_file, R_OK))) { ret_val = strdup(real_file); break; } /* no file in here, too bad */ break; } else if(!S_ISREG(statb.st_mode)) { fprintf(stderr, "%s: not a regular file\n", filename); break; } ret_val = strdup(real_file); break; } } } if(ret_val == NULL) { sprintf(tmp, "%s:\ncannot display: unable to locate file.", filename); XMessage(toplevel, tmp); } else { /* clean out relative path stuff and add the path to the path index. */ char fname[1024], pname[1024]; (void)parseFilename(ret_val, fname, pname); addPath(pname); /* * resolve symbolic links as well (prevents object cache from going * haywire by having two different objects with cross-linked * mappings) */ #if 0 (void)followSymLinks(pname); #endif /***** * big chance parseFilename compressed relative paths out of ret_val, * do it again. We need to reallocate as the size of the fully * resolved path can exceed the current length. *****/ ret_val = (String)realloc(ret_val, strlen(pname) + strlen(fname) + 1); sprintf(ret_val, "%s%s", pname, fname); } Debug(("resolveFile, found as %s\n", ret_val ? ret_val : "(not found)")); return(ret_val); } /***** * Name: getMimeType * Return Type: int * Description: make a guess at the mime type of a document by looking at * the extension of the given document. * In: * file: file for which to get a mime-type; * Returns: * mime type of the given file. *****/ static int getMimeType(String file) { String chPtr; unsigned char img_type; if((chPtr = strstr(file, ".")) != NULL) { String start; /* first check if this is plain HTML or not */ for(start = &file[strlen(file)-1]; *start && *start != '.'; start--); if(!strcasecmp(start, ".html") || !strcasecmp(start, ".htm")) return(MIME_HTML); if(!strcasecmp(start, ".htmlp")) return(MIME_HTML_PERFECT); } /* something else then? */ /* check if this is an image XmHTML knows of */ if((img_type = XmHTMLImageGetType(file, NULL, 0)) == IMAGE_ERROR) return(MIME_ERR); /***** * Not an image we know of, get first line in file and see if it's * html anyway *****/ if(img_type == IMAGE_UNKNOWN) { FILE *fp; char buf[128]; /* open file */ if((fp = fopen(file, "r")) == NULL) return(MIME_ERR); /* read first line in file */ if((chPtr = fgets(buf, 128, fp)) == NULL) { /* close again */ fclose(fp); return(MIME_ERR); } /* close again */ fclose(fp); /* see if it contains any of these strings */ if(my_strcasestr(buf, "", XtNiconName, "", NULL); } XtSetSensitive(reload, True); setBusy(False); return(True); } /***** * Name: getInfoSize * Return Type: int * Description: returns the size of the given XmImageInfo structure. * In: * call_data: ptr to a XmImageInfo structure; * client_data: data registered when we called initCache. * Returns: * size of the given XmImageInfo structure. * Note: * This function is used both by us and the caching routines. *****/ static int getInfoSize(XtPointer call_data, XtPointer client_data) { int size = 0; XmImageInfo *frame = (XmImageInfo*)call_data; while(frame != NULL) { size += sizeof(XmImageInfo); size += frame->width*frame->height; /* raw image data */ /* clipmask size. The clipmask is a bitmap of depth 1 */ if(frame->clip) { int clipsize; clipsize = frame->width; /* make it byte-aligned */ while((clipsize % 8)) clipsize++; /* this many bytes on a row */ clipsize /= 8; /* and this many rows */ clipsize *= frame->height; size += clipsize; } /* reds, greens and blues */ size += 3*frame->ncolors*sizeof(Dimension); frame = frame->frame; /* next frame of this image (if any) */ } return(size); } /***** * Name: getDocFromCache * Return Type: DocumentCache* * Description: retrieves a document from the document cache. * In: * file: filename of document to be retrieved. * Returns: * nothing. *****/ static DocumentCache* getDocFromCache(String file) { int i; for(i = 0; i < last_doc; i++) { if(!(strcmp(doc_cache[i].file, file))) return(&doc_cache[i]); } return(NULL); } /***** * Name: storeDocInCache * Return Type: void * Description: stores the given document in the document cache. * In: * file: filename of document to be stored; * Returns: * nothing. *****/ static void storeDocInCache(String file) { char foo[128], pname[1024]; if(last_doc == MAX_HISTORY_ITEMS) { int i; /* free hrefs */ for(i = 0; i < doc_cache[0].nrefs; i++) { if(doc_cache[0].refs[i]) free(doc_cache[0].refs[i]); doc_cache[0].refs[i] = NULL; } /* free image url's */ for(i = 0; i < doc_cache[0].nimages; i++) { free(doc_cache[0].images[i]); doc_cache[0].images[i] = NULL; } /* free visited anchor list */ for(i = 0; i < doc_cache[0].nvisited; i++) { if(doc_cache[0].visited[i]) free(doc_cache[0].visited[i]); doc_cache[0].visited[i] = NULL; } /* free file and path fields */ free(doc_cache[0].file); free(doc_cache[0].path); /* move everything downward */ for(i = 0; i < MAX_HISTORY_ITEMS-1; i++) doc_cache[i] = doc_cache[i+1]; last_doc = MAX_HISTORY_ITEMS - 1; } Debug(("Storing document %s in document cache\n", file)); current_doc = last_doc; doc_cache[current_doc].nrefs = 0; doc_cache[current_doc].nvisited = 0; doc_cache[current_doc].nimages = 0; doc_cache[current_doc].file = strdup(file); /* get path to this file */ (void)parseFilename(file, foo, pname); /* and store it */ doc_cache[current_doc].path = strdup(pname); last_doc++; } /***** * Name: removeDocFromCache * Return Type: void * Description: removes a document from the document cache * In: * doc: id of document to be removed; * Returns: * nothing. *****/ static void removeDocFromCache(int doc) { DocumentCache *this_doc; int i; this_doc = &doc_cache[doc]; Debug(("Removing document %s from document cache\n", this_doc->file)); /* remove all document url's */ for(i = 0; i < this_doc->nrefs; i++) { if(this_doc->refs[i]) free(this_doc->refs[i]); this_doc->refs[i] = NULL; } /* free visited anchor list */ for(i = 0; i < this_doc->nvisited; i++) { if(this_doc->visited[i]) free(this_doc->visited[i]); this_doc->visited[i] = NULL; } /* and remove all image url's */ for(i = 0; i < this_doc->nimages; i++) { /* remove image cache entry for this image */ removeURLObjectFromCache(this_doc->images[i]); free(this_doc->images[i]); } /***** * Update image cache (clears out all objects with a reference count * of zero). *****/ pruneObjectCache(); this_doc->nrefs = 0; this_doc->nvisited = 0; this_doc->nimages = 0; free(this_doc->file); free(this_doc->path); } /***** * Name: storeInHistory * Return Type: void * Description: stores the given href in the history list * In: * file: name of document * loc: value of named anchor in file. * Returns: * nothing. *****/ static void storeInHistory(String file, String loc) { int i; DocumentCache *this_doc = NULL; /* sanity check */ if(file == NULL && loc == NULL) return; /* if file is NULL we are for sure in the current document */ if(file == NULL) this_doc = &doc_cache[current_doc]; else { /**** * This is a new file. If we have any documents on the stack, * remove them. ****/ if(last_doc) { for(i = current_doc+1; i < last_doc; i++) removeDocFromCache(i); last_doc = current_doc+1; } /* update refs for current document */ this_doc = &doc_cache[current_doc]; if(this_doc->nrefs) { /* remove any existing references above the current one */ for(i = this_doc->current_ref+1; i < this_doc->nrefs; i++) { if(this_doc->refs[i]) { free(this_doc->refs[i]); this_doc->refs[i] = NULL; } } this_doc->nrefs = this_doc->current_ref + 1; } if((this_doc = getDocFromCache(file)) == NULL) { storeDocInCache(file); this_doc = &doc_cache[current_doc]; } } if(this_doc->nrefs == MAX_HISTORY_ITEMS) { /* free up the first item */ if(this_doc->refs[0]) free(this_doc->refs[0]); /* move everything downward */ for(i = 0; i < MAX_HISTORY_ITEMS - 1; i++) this_doc->refs[i] = this_doc->refs[i+1]; this_doc->nrefs = MAX_HISTORY_ITEMS-1; } /* sanity check */ if(loc) this_doc->refs[this_doc->nrefs] = strdup(loc); this_doc->current_ref = this_doc->nrefs; this_doc->nrefs++; /* set button sensitivity */ XtSetSensitive(back, current_doc || this_doc->current_ref ? True : False); XtSetSensitive(forward, False); } /***** * Name: storeAnchor * Return Type: void * Description: stores the given href in the visited anchor list of current * document. * In: * href: value to store. * Returns: * nothing. *****/ static void storeAnchor(String href) { int i; DocumentCache *this_doc = NULL; /* sanity check */ if(href == NULL) return; /* pick up current document */ this_doc = &doc_cache[current_doc]; /* check if this location is already present in the visited list */ for(i = 0; i < this_doc->nvisited; i++) if(!(strcmp(this_doc->visited[i], href))) return; /* not present yet, store in visited anchor list */ /* move everything down if list is full */ if(this_doc->nvisited == MAX_HISTORY_ITEMS) { /* free up the first item */ if(this_doc->visited[0]) free(this_doc->visited[0]); /* move everything downward */ for(i = 0; i < MAX_HISTORY_ITEMS - 1; i++) this_doc->visited[i] = this_doc->visited[i+1]; this_doc->nvisited = MAX_HISTORY_ITEMS-1; } /* store this item */ this_doc->visited[this_doc->nvisited] = strdup(href); this_doc->nvisited++; } /***** * Name: loadOrJump * Return Type: void * Description: checks the given href for a file and a possible jump to * a named anchor in this file. * In: * file: name of file to load * loc: location in file to jump to. * store: history storage * Returns: * True upon success, False on failure (file load failed) *****/ static Boolean loadAndOrJump(String file, String loc, Boolean store) { static String prev_file; /* only load a file if it isn't the current one */ if(prev_file == NULL || (file && strcmp(file, prev_file))) { /* do nothing more if the load fails */ if(!(getAndSetFile(file, loc, store))) return(False); } if(prev_file) free(prev_file); prev_file = strdup(file); /* jump to the requested anchor in this file or to top of the document */ if(loc) XmHTMLAnchorScrollToName(html_widgets[0].html, loc); else XmHTMLTextScrollToLine(html_widgets[0].html, 0); return(True); } /***** * Name: readFile * Return Type: void * Description: XmNokCallback handler for the fileSelectionDialog: retrieves * the entered filename and loads it. * In: * w: widget * dialog: widget id of the fileSelectionDialog * cbs: callback data * Returns: * nothing. *****/ static void readFile(Widget widget, Widget dialog, XmFileSelectionBoxCallbackStruct *cbs) { String filename, file; int item; /* remove the fileSelectionDialog */ XtPopdown(XtParent(dialog)); /* get the entered filename */ XmStringGetLtoR(cbs->value, XmSTRING_DEFAULT_CHARSET, &filename); /* sanity check */ if(!filename || !*filename) { if(filename) XtFree(filename); return; } /* get item data */ XtVaGetValues(dialog, XmNuserData, &item, NULL); if(item == FILE_OPEN) { /* find the file */ file = resolveFile(filename); XtFree(filename); if(file == NULL) return; /* load the file, will also update the document cache */ loadAndOrJump(file, NULL, True); XFlush(XtDisplay(widget)); free(file); } else if(item == FILE_SAVEAS) { FILE *fp; /* get parser output */ String buffer = XmHTMLTextGetString(html_widgets[0].html); if(buffer) { if((fp = fopen(filename, "w")) == NULL) perror(filename); else { fputs(buffer, fp); fputs("\n", fp); fclose(fp); } XtFree(buffer); } XtFree(filename); } } static void callClient(URLType url_type, String url) { if(external_client) { char cmd[1024]; if(url_type == ANCHOR_MAILTO) sprintf(cmd, "netscape -remote 'mailto(%s)'", url); if(url_type == ANCHOR_NEWS) sprintf(cmd, "netscape -remote 'news(%s)'", url); else sprintf(cmd, "netscape -remote 'openURL(%s)'", url); if(!(fork())) { if(execl("/bin/sh", "/bin/sh", "-c", cmd, NULL) == -1) { fprintf(stderr, "execl failed (%s)", strerror(errno)); exit(100); } } } } /***** * Name: anchorCB * Return Type: void * Description: XmNactivateCallback handler for the XmHTML widget * In: * w: html widget * arg1: client_data, unused * href_data: anchor data * Returns: * nothing. *****/ static void anchorCB(Widget w, XtPointer arg1, XmHTMLAnchorPtr href_data) { /* see if we have been called with a valid reason */ if(href_data->reason != XmCR_ACTIVATE) return; switch(href_data->url_type) { /* a named anchor */ case ANCHOR_JUMP: { int id; /* see if XmHTML knows this anchor */ if((id = XmHTMLAnchorGetId(w, href_data->href)) != -1) { /* store href in history and visited anchor list... */ storeInHistory(NULL, href_data->href); storeAnchor(href_data->href); /* ...and let XmHTML jump and mark as visited */ href_data->doit = True; href_data->visited = True; return; } return; } break; /* a local file with a possible ID jump */ case ANCHOR_FILE_LOCAL: { String chPtr, file = NULL, loc = NULL; /* store href in visited anchor list */ storeAnchor(href_data->href); /* first see if this anchor contains a jump */ if((chPtr = strstr(href_data->href, "#")) != NULL) { char tmp[1024]; strncpy(tmp, href_data->href, chPtr - href_data->href); tmp[chPtr - href_data->href] = '\0'; /* try to find the file */ file = resolveFile(tmp); } else file = resolveFile(href_data->href); if(file == NULL) return; /***** * All members in the XmHTMLAnchorCallbackStruct are * *pointers* to the contents of the current document. * So, if we will be changing the document, any members of this * structure become INVALID (in this case, any jump address to * a location in a different file). Therefore we *must* save * the members we might need after the document has changed. ******/ if(chPtr) loc = strdup(chPtr); /***** * If we have a target, call the frame loader, else call the * plain document loader. *****/ if(href_data->target) jumpToFrame(file, loc, href_data->target, True); else loadAndOrJump(file, loc, True); free(file); if(loc) free(loc); } break; case ANCHOR_PIPE: if(root_window || allow_exec) { char *ptr; char *cmd=NULL; Debug(("pipe: %s\n", href_data->href)); if((ptr = strstr(href_data->href, ":")) != NULL) { ptr++; cmd = strdup(ptr); cmd[strlen(cmd)] = '\0'; readPipe(html_widgets[0].html, cmd); free(cmd); } } break; case ANCHOR_EXEC: if(root_window || allow_exec) { char *ptr; char *cmd=NULL; Debug(("execute: %s\n", href_data->href)); if((ptr = strstr(href_data->href, ":")) != NULL) { ptr++; cmd = strdup(ptr); cmd[strlen(cmd)] = '\0'; if(!(fork())) { if(execl("/bin/sh", "/bin/sh", "-c", cmd, NULL) == -1) { fprintf(stderr, "execl failed (%s)", strerror(errno)); exit(100); } } free(cmd); } } break; /* all other types are unsupported */ case ANCHOR_FILE_REMOTE: fprintf(stderr, "fetch remote file: %s\n", href_data->href); callClient(href_data->url_type, href_data->href); break; case ANCHOR_FTP: fprintf(stderr, "fetch ftp file: %s\n", href_data->href); callClient(href_data->url_type, href_data->href); break; case ANCHOR_HTTP: fprintf(stderr, "fetch http file: %s\n", href_data->href); callClient(href_data->url_type, href_data->href); break; case ANCHOR_GOPHER: fprintf(stderr, "gopher: %s\n", href_data->href); callClient(href_data->url_type, href_data->href); break; case ANCHOR_WAIS: fprintf(stderr, "wais: %s\n", href_data->href); callClient(href_data->url_type, href_data->href); break; case ANCHOR_NEWS: fprintf(stderr, "open newsgroup: %s\n", href_data->href); callClient(href_data->url_type, href_data->href); break; case ANCHOR_TELNET: fprintf(stderr, "open telnet connection: %s\n", href_data->href); callClient(href_data->url_type, href_data->href); break; case ANCHOR_MAILTO: fprintf(stderr, "email to: %s\n", href_data->href); callClient(href_data->url_type, href_data->href); break; case ANCHOR_UNKNOWN: default: fprintf(stderr, "don't know this type of url: %s\n", href_data->href); break; } } /***** * Name: setFrameText * Return Type: void * Description: loads the given file in the given HTML frame; * In: * widget: XmHTML widget id in which to load the file; * filename: file to be loaded; * loc: selected position in the file. If non-NULL this routine will * scroll to the given location. * Returns: * nothing. *****/ static void setFrameText(Widget frame, String filename, String loc) { setBusy(True); if(filename) { String buf, file, mime; file = resolveFile(filename); if(file == NULL || (buf = loadFile(file, &mime)) == NULL) { setBusy(False); return; } /* kill of any outstanding progressive image loading contexts */ XmHTMLImageProgressiveKill(frame); /* set the text in the widget */ XtVaSetValues(frame, XmNvalue, buf, XmNmimeType, mime, NULL); free(buf); free(file); } /* jump to the requested anchor in this file or to top of the document */ if(loc) XmHTMLAnchorScrollToName(frame, loc); else XmHTMLTextScrollToLine(frame, 0); setBusy(False); } /***** * Name: jumpToFrame * Return Type: void * Description: loads the contents of the given file in a named frame * In: * filename: name of file to load; * loc: url of file; * target: name of frame in which to load the file; * store: flag for history storage; * Returns: * nothing. *****/ static void jumpToFrame(String filename, String loc, String target, Boolean store) { int i; /* html_widgets[0] is the master XmHTML Widget, never framed */ for(i = 1; i < MAX_HTML_WIDGETS; i++) { if(html_widgets[i].active && !(strcmp(html_widgets[i].name, target))) { /* * Load new file into frame if it's not the same as the current * src value for this frame. */ if(html_widgets[i].src && strcmp(html_widgets[i].src, filename)) { free(html_widgets[i].src); html_widgets[i].src = strdup(filename); setFrameText(html_widgets[i].html, filename, loc); } else /* same file, jump to requested location */ setFrameText(html_widgets[i].html, NULL, loc); return; } } /* frame not found, use the toplevel HTML widget */ if(i == MAX_HTML_WIDGETS) loadAndOrJump(filename, loc, store); } /* external gif decoder */ #include "gif_decode.c" /***** * Name: frameCB * Return Type: void * Description: callback for XmHTML's XmNframeCallback * In: * w: widget id; * arg1: client_data, unused; * cbs: data about the frame being created/destroyed/notified of * creation. * Returns: * nothing. *****/ static void frameCB(Widget w, XtPointer arg1, XmHTMLFramePtr cbs) { int i; if(cbs->reason == XmCR_HTML_FRAME) { Widget html = cbs->html; /* find the first free slot where we can insert this frame */ for(i = 0; i < MAX_HTML_WIDGETS;i++) if(!html_widgets[i].active) break; /* a frame always has a name */ html_widgets[i].name = strdup(cbs->name); if(cbs->src) html_widgets[i].src = resolveFile(cbs->src); /* anchor callback */ XtAddCallback(html, XmNactivateCallback, (XtCallbackProc)anchorCB, NULL); /* HTML document callback */ XtAddCallback(html, XmNdocumentCallback, (XtCallbackProc)docCB, NULL); /* set other things we want to have */ XtVaSetValues(html, XmNanchorVisitedProc, testAnchor, XmNimageProc, loadImage, XmNprogressiveReadProc, getImageData, XmNprogressiveEndProc, endImageData, #ifdef HAVE_GIF_CODEC XmNdecodeGIFProc, decodeGIFImage, #endif /* propagate current defaults */ XmNanchorButtons, html_config[OPTIONS_ANCHOR_BUTTONS].value, XmNhighlightOnEnter, html_config[OPTIONS_HIGHLIGHT_ON_ENTER].value, XmNenableBadHTMLWarnings, html_config[OPTIONS_DISABLE_WARNINGS].value, XmNstrictHTMLChecking, html_config[OPTIONS_ENABLE_STRICT_HTML32].value, XmNenableBodyColors, html_config[OPTIONS_ENABLE_BODYCOLORS].value, XmNenableBodyImages, html_config[OPTIONS_ENABLE_BODYIMAGES].value, XmNenableDocumentColors, html_config[OPTIONS_ENABLE_DOCUMENT_COLORS].value, XmNenableDocumentFonts, html_config[OPTIONS_ENABLE_DOCUMENT_FONTS].value, XmNenableOutlining, html_config[OPTIONS_ENABLE_OUTLINING].value, XmNfreezeAnimations, html_config[OPTIONS_FREEZE_ANIMATIONS].value, XmNimageEnable, html_config[OPTIONS_ENABLE_IMAGES].value, NULL); /* store widget id */ html_widgets[i].html = html; html_widgets[i].active = True; /* set source text */ setFrameText(html_widgets[i].html, html_widgets[i].src, NULL); return; } if(cbs->reason == XmCR_HTML_FRAMECREATE) { /* see if we have an inactive frame in our frame cache */ for(i = 0; i < MAX_HTML_WIDGETS;i++) if(!html_widgets[i].active && !html_widgets[i].used) break; /* we have an available slot */ if(i != MAX_HTML_WIDGETS && html_widgets[i].html != NULL) { cbs->doit = False; cbs->html = html_widgets[i].html; /* this slot is being used */ html_widgets[i].used = True; } /* * this is the appropriate place for doing frame reuse: set * the doit field in the callback structure to False and set the * id of a *HTML* widget in the html field. */ return; } if(cbs->reason == XmCR_HTML_FRAMEDESTROY) { int freecount = 0; /* * this is the appropriate place for keeping this widget: just set * the doit field to false, update the frame cache (if this frame is * going to be reused, it's name and src value will probably change). */ for(i = 0; i < MAX_HTML_WIDGETS; i++) { if(!html_widgets[i].active) freecount++; if(html_widgets[i].html == cbs->html) { freecount++; /* a frame has always got a name */ free(html_widgets[i].name); if(html_widgets[i].src) free(html_widgets[i].src); html_widgets[i].name = NULL; html_widgets[i].src = NULL; /* we keep up to three frames in memory */ if(freecount > 3) html_widgets[i].html = NULL; html_widgets[i].active = False; html_widgets[i].used = False; break; } } if(freecount < 4) cbs->doit = False; return; } /* do nothing */ return; } /***** * Name: metaListCB * Return Type: void * Description: callback for the list in the document information dialog. * Displays the data associated with the selected item in the * list. * In: * w: list widget id; * edit: widget id of text widget in which data will be displayed. * Returns: * nothing. *****/ static void metaListCB(Widget w, Widget edit) { int *pos_list; /* selected list position */ int pos_cnt, selected; /* no of selected items */ XmHTMLMetaDataPtr meta_data = NULL; if(!(XmListGetSelectedPos(w, &pos_list, &pos_cnt))) /* no item selected */ return; selected = pos_list[0]; /* list positions start at 1 instead of zero, so be sure to adjust */ selected--; /* get meta data out of the list's userData */ XtVaGetValues(w, XmNuserData, &meta_data, NULL); /* very serious error */ if(meta_data == NULL) { fprintf(stderr, "Could not retrieve meta-data from userData field!\n"); free(pos_list); return; } /* and put the selected string in the edit field */ XmTextSetString(edit, meta_data[selected].content); free(pos_list); } static String getCharset(String content) { String ptr, start; int len = 0; static char this_set[128]; /* * We possible have a charset spec in here. Check * for it */ if((ptr = strstr(content, "charset")) != NULL) { ptr+= 7; /* move past "charset" */ /* skip until we hit = */ for(;*ptr && *ptr != '='; ptr++); ptr++; /* skip all spaces */ for(;*ptr && isspace(*ptr); ptr++); /* * now count how many chars we have. The charset spec is terminated * by a a quote */ start = ptr; while(*ptr && *ptr != '\"') { len++; ptr++; } if(len) { strncpy(this_set, start, len); this_set[len] = '\0'; /* nullify */ /* * if we don't have a - in charset, we *must* append -* to make * it a valid XmNcharset spec. */ if(!(strstr(this_set, "-"))) strcat(this_set, "-*"); return(this_set); } } return(NULL); } int #ifdef __STDC__ my_sprintf(String *dest, int *size, int *max_size, String fmt, ...) #else /* ! __STDC__ */ my_sprintf(String *dest, int *size, int *max_size, String fmt, va_list) String *dest; int *size; int *max_size; String fmt; va_dcl #endif /* __STDC__ */ { int len; String s; #ifdef __STDC__ va_list arg_list; #else va_dcl #endif if(*max_size - *size < 1024) { *max_size += 1024; /* realloc(NULL, size) ain't exactly portable */ if(*max_size == 1024) s = (char *)malloc(*max_size); else s = (char *)realloc(*dest, *max_size); *dest = s; } #ifdef __STDC__ va_start(arg_list, fmt); #else va_start(arg_list); #endif len = vsprintf(*dest + *size, fmt, arg_list); va_end(arg_list); /* new size of destination buffer */ if(len != 0) *size += strlen(*dest + *size); return(len); } /***** * Name: docInfoCB * Return Type: void * Description: shows a dialog with document information. This routine gets * activated when the file->document info menu item is selected. * In: * font_only: check only for a possible font spec in the meta information. * Returns: * nothing. *****/ static void docInfoCB(Boolean font_only) { static Widget title_label, author_label, base_label, doctype_label; static Widget list, edit; XmString xms; static XmHTMLHeadAttributes head_info; Boolean have_info = False; String tmp; int i, argc = 0; Arg args[5]; if(font_only) { char this_font[128]; String this_charset = NULL; this_font[0] = '\0'; /* get meta info for a charset and/or font spec */ if(XmHTMLGetHeadAttributes(html_widgets[0].html, &head_info, HeadMeta)) { if(head_info.num_meta) { for(i = 0; i < head_info.num_meta; i++) { tmp = (head_info.meta[i].http_equiv ? head_info.meta[i].http_equiv : head_info.meta[i].name); if(!strcmp(tmp, "font")) { sprintf(this_font, "*-%s-normal-*", head_info.meta[i].content); } else if(!strcmp(tmp, "content-type") && this_charset == NULL) { this_charset = getCharset(head_info.meta[i].content); } } } } /***** * have we been told to set a new font? * Please note that in a real world application it should be checked * if the requested font is available. XmHTML silently ignores this * kind of errors. *****/ if(*this_font) { /* font changed */ if(strcmp(this_font, current_font)) { strcpy(current_font, this_font); current_font[strlen(this_font)] = '\0'; Debug(("docInfoCB, setting XmNfontFamily to %s\n", current_font)); XtSetArg(args[argc], XmNfontFamily, current_font); argc++; } /* still the same, don't touch it */ } else if(strcmp(current_font, default_font)) { /* reset default font */ strcpy(current_font, default_font); current_font[strlen(default_font)] = '\0'; Debug(("docInfoCB, setting XmNfontFamily to %s\n", current_font)); XtSetArg(args[argc], XmNfontFamily, current_font); argc++; } /***** * have we been told to set a new character set? * Please note that a real world app *MUST* check if the requested * character set is available. XmHTML silently ignores any errors * resulting from an invalid charset, it just falls back to whatever * the X server provides. * To make these checks really consistent, it should also be verified * that the current font family is still valid if the charset is * changed. XmHTML's font allocation routines will almost *never* * fail on font allocations: if a font can not be found in the requested * character set it will use the default charset supplied by the X * server. If font allocation still fails after this, it will wildcard * the fontfamily and try again (this is done so XmHTML will always have * a default font available). If this also fails (which is almost * impossible) XmHTML will exit your application: if it can't find * any fonts at all, why keep on running? *****/ if(this_charset) { /* charset changed */ if(strcmp(current_charset, this_charset)) { /* we currently only known koi8 and iso8859-1 */ if(strstr(this_charset, "koi8")) { /* save charset */ strcpy(current_charset, this_charset); current_charset[strlen(this_charset)] = '\0'; /* koi8 has cronyx for its foundry */ strcpy(current_font, "cronyx-times-*-*\0"); argc = 0; /* overrides a fontspec */ Debug(("docInfoCB, setting XmNcharset to %s\n", current_charset)); XtSetArg(args[argc], XmNfontFamily, current_font); argc++; XtSetArg(args[argc], XmNcharset, current_charset); argc++; } else if(!strstr(this_charset, "iso8859-1")) { fprintf(stderr, "Warning: character set %s unsupported\n", current_charset); } } /* still the same, don't touch it */ } else if(strcmp(current_charset, default_charset)) { strcpy(current_charset, default_charset); current_charset[strlen(default_charset)] = '\0'; XtSetArg(args[argc], XmNcharset, current_charset); argc++; } /* plop'em in */ if(argc) XtSetValues(html_widgets[0].html, args, argc); /***** * Tell XmHTML to clear everything. This is not really required but * adviseable since XmHTML will only clear the fields that have * been requested. For example, in all subsequent calls to the above * XmHTMLGetHeadAttributes call, XmHTML will first clear the stored * meta info before filling it again. *****/ XmHTMLGetHeadAttributes(html_widgets[0].html, &head_info, HeadClear); return; } /***** * Get information from the current document. XmHTML will * take care of replacing the requested members when they have been used * before. When no is available this function returns false * Note: the value of the member is always returned if there * is one, even if GetHeadAttributes() returns False. *****/ have_info = XmHTMLGetHeadAttributes(html_widgets[0].html, &head_info, HeadDocType|HeadTitle|HeadBase|HeadMeta); if(!info_dialog) { Widget sep, rc1, rc2, fr1, fr2; Arg args[20]; int argc = 0; info_dialog = XmCreateFormDialog(toplevel, "documentAttributes", NULL, 0); XtVaSetValues(XtParent(info_dialog), XtNtitle, "Document Attributes", NULL); fr1 = XtVaCreateManagedWidget("documentTitleForm", xmFormWidgetClass, info_dialog, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, NULL); sep = XtVaCreateManagedWidget("documentSeperator", xmSeparatorGadgetClass, info_dialog, XmNorientation, XmHORIZONTAL, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, fr1, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNleftOffset, 10, XmNrightOffset, 10, XmNtopOffset, 10, NULL); fr2 = XtVaCreateManagedWidget("documentTitleForm", xmFormWidgetClass, info_dialog, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, sep, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); rc1 = XtVaCreateManagedWidget("documentTitleLeftRow", xmRowColumnWidgetClass, fr1, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XmNpacking, XmPACK_COLUMN, XmNorientation, XmVERTICAL, XmNnumColumns, 1, XmNtopOffset, 10, XmNleftOffset, 10, XmNrightOffset, 10, NULL); XtVaCreateManagedWidget("Document Title:", xmLabelGadgetClass, rc1, XmNalignment, XmALIGNMENT_BEGINNING, NULL); XtVaCreateManagedWidget("Author:", xmLabelGadgetClass, rc1, XmNalignment, XmALIGNMENT_BEGINNING, NULL); XtVaCreateManagedWidget("Document type:", xmLabelGadgetClass, rc1, XmNalignment, XmALIGNMENT_BEGINNING, NULL); XtVaCreateManagedWidget("Base Location:", xmLabelGadgetClass, rc1, XmNalignment, XmALIGNMENT_BEGINNING, NULL); rc2 = XtVaCreateManagedWidget("documentTitleRightRow", xmRowColumnWidgetClass, fr1, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, rc1, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XmNpacking, XmPACK_COLUMN, XmNorientation, XmVERTICAL, XmNnumColumns, 1, XmNtopOffset, 10, XmNleftOffset, 10, XmNrightOffset, 10, NULL); title_label = XtVaCreateManagedWidget("docTitle", xmLabelGadgetClass, rc2, XmNalignment, XmALIGNMENT_BEGINNING, NULL); author_label = XtVaCreateManagedWidget("docAuthor", xmLabelGadgetClass, rc2, XmNalignment, XmALIGNMENT_BEGINNING, NULL); doctype_label = XtVaCreateManagedWidget("docType", xmLabelGadgetClass, rc2, XmNalignment, XmALIGNMENT_BEGINNING, NULL); base_label = XtVaCreateManagedWidget("docBase", xmLabelGadgetClass, rc2, XmNalignment, XmALIGNMENT_BEGINNING, NULL); XtSetArg(args[argc], XmNlistSizePolicy, XmRESIZE_IF_POSSIBLE); argc++; XtSetArg(args[argc], XmNvisibleItemCount, 5); argc++; XtSetArg(args[argc], XmNleftAttachment, XmATTACH_FORM); argc++; XtSetArg(args[argc], XmNtopAttachment, XmATTACH_FORM); argc++; XtSetArg(args[argc], XmNbottomAttachment, XmATTACH_FORM); argc++; XtSetArg(args[argc], XmNleftOffset, 10); argc++; XtSetArg(args[argc], XmNtopOffset, 10); argc++; XtSetArg(args[argc], XmNbottomOffset, 10); argc++; list = XmCreateScrolledList(fr2, "metaList", args, argc); argc = 0; XtSetArg(args[argc], XmNscrollBarDisplayPolicy, XmAS_NEEDED); argc++; XtSetArg(args[argc], XmNscrollingPolicy, XmAUTOMATIC); argc++; XtSetArg(args[argc], XmNleftAttachment, XmATTACH_WIDGET); argc++; XtSetArg(args[argc], XmNleftWidget, list); argc++; XtSetArg(args[argc], XmNtopAttachment, XmATTACH_FORM); argc++; XtSetArg(args[argc], XmNbottomAttachment, XmATTACH_FORM); argc++; XtSetArg(args[argc], XmNrightAttachment, XmATTACH_FORM); argc++; XtSetArg(args[argc], XmNleftOffset, 10); argc++; XtSetArg(args[argc], XmNrightOffset, 10); argc++; XtSetArg(args[argc], XmNtopOffset, 10); argc++; XtSetArg(args[argc], XmNbottomOffset, 10); argc++; edit = XmCreateScrolledText(fr2, "metaEdit", args, argc); argc = 0; XtSetArg(args[argc], XmNeditable, False); argc++; XtSetArg(args[argc], XmNcolumns, 35); argc++; XtSetArg(args[argc], XmNrows, 5); argc++; XtSetArg(args[argc], XmNwordWrap, True); argc++; XtSetArg(args[argc], XmNeditMode, XmMULTI_LINE_EDIT); argc++; XtSetArg(args[argc], XmNscrollHorizontal, False); argc++; XtSetArg(args[argc], XmNscrollVertical, False); argc++; XtSetValues(edit, args, argc); /* single selection callback on the list */ XtAddCallback(list, XmNbrowseSelectionCallback, (XtCallbackProc)metaListCB, edit); XtManageChild(list); XtManageChild(edit); } /* delete all list items */ XmListDeleteAllItems(list); /* clear all text in the edit window */ XmTextSetString(edit, NULL); if(head_info.doctype) xms = XmStringCreateLocalized(head_info.doctype); else xms = XmStringCreateLocalized(""); XtVaSetValues(doctype_label, XmNlabelString, xms, NULL); XmStringFree(xms); if(have_info) { if(head_info.title) xms = XmStringCreateLocalized(head_info.title); else xms = XmStringCreateLocalized(""); XtVaSetValues(title_label, XmNlabelString, xms, NULL); XmStringFree(xms); if(head_info.base) xms = XmStringCreateLocalized(head_info.base); else xms = XmStringCreateLocalized(""); XtVaSetValues(base_label, XmNlabelString, xms, NULL); XmStringFree(xms); xms = NULL; /* * No need to check for font or charset in meta info, that's * already been done from within the documentCallback. */ if(head_info.num_meta) { for(i = 0; i < head_info.num_meta; i++) { tmp = (head_info.meta[i].http_equiv ? head_info.meta[i].http_equiv : head_info.meta[i].name); /* pick out author */ if(!strcmp(tmp, "author")) xms = XmStringCreateLocalized(head_info.meta[i].content); } } if(xms == NULL) xms = XmStringCreateLocalized(""); XtVaSetValues(author_label, XmNlabelString, xms, NULL); XmStringFree(xms); /* string table */ if(head_info.num_meta) { XmStringTable strs; strs =(XmStringTable)malloc(head_info.num_meta*sizeof(XmString*)); for(i = 0; i < head_info.num_meta; i++) { if(head_info.meta[i].http_equiv) strs[i] = XmStringCreateLocalized(head_info.meta[i].http_equiv); else strs[i] = XmStringCreateLocalized(head_info.meta[i].name); } XtVaSetValues(list, XmNitemCount, head_info.num_meta, XmNitems, strs, XmNuserData, (XtPointer)head_info.meta, NULL); for(i = 0; i < head_info.num_meta; i++) XmStringFree(strs[i]); free(strs); } } else { xms = XmStringCreateLocalized(""); XtVaSetValues(title_label, XmNlabelString, xms, NULL); XmStringFree(xms); xms = XmStringCreateLocalized(""); XtVaSetValues(author_label, XmNlabelString, xms, NULL); XmStringFree(xms); xms = XmStringCreateLocalized(""); XtVaSetValues(base_label, XmNlabelString, xms, NULL); XmStringFree(xms); } /* put on screen */ XtManageChild(info_dialog); XMapRaised(XtDisplay(info_dialog), XtWindow(info_dialog)); } /***** * Name: docCB * Return Type: void * Description: displays current document state as given by XmHTML. * In: * html: owner of this callback * arg1: client_data, unused * cbs: call_data, documentcallback structure. * Returns: * nothing * Note: * the XmNdocumentCallback is an excellent place for setting several * formatting resources: XmHTML triggers this callback when the parser * has finished, but *before* doing any formatting. As an example, we * check the information contained in the document head for a font * specification: we call docInfoCB with the font_only arg set to True. *****/ static void docCB(Widget w, XtPointer arg1, XmHTMLDocumentPtr cbs) { XmString xms; char doc_label[128]; Pixel my_pix = (Pixel)0; static Pixel red, green; /* see if we have been called with a valid reason */ if(cbs->reason != XmCR_HTML_DOCUMENT) return; /* * If we are being notified of the results of another pass on the loaded * document, only check whether the generated parser tree is balanced and * don't update the labels since the callback data is the result of a * modified document. * * XmHTML's document verification and repair routines are capable of * creating a verified, properly balanced and HTML conforming document * from even the most horrible non-HTML conforming documents! * * And when the XmNstrictHTMLChecking resource has been set to True, these * routines are also bound to make the document HTML 3.2 conformant as well. */ if(cbs->pass_level) { /* * Allow up to two iterations on the current document (remember that * the document has already been checked twice when pass_level == 1). * XmHTML sets the redo field to True whenever the parser tree is * unbalanced, so it needs to be set to False when the allowed number * of iterations has been reached. * * The results of displaying a document with an unbalanced parser tree * are undefined however and can lead to some weird markup results. */ if(!cbs->balanced && cbs->pass_level < 2) return; cbs->redo = False; /* done parsing, check if a font is given in the meta spec. */ docInfoCB(True); return; } if(!red) red = XmHTMLAllocColor((Widget)html_widgets[0].html, "Red", BlackPixelOfScreen(XtScreen(toplevel))); if(!green) green = XmHTMLAllocColor((Widget)html_widgets[0].html, "Green", WhitePixelOfScreen(XtScreen(toplevel))); if(cbs->html32) { sprintf(doc_label, "HTML 3.2"); my_pix = green; } else { sprintf(doc_label, "Bad HTML 3.2"); my_pix = red; } xms = XmStringCreateLocalized(doc_label); XtVaSetValues(html32, XmNbackground, my_pix, XmNlabelString, xms, NULL); XmStringFree(xms); if(cbs->verified) { sprintf(doc_label, "Verified"); my_pix = green; } else { sprintf(doc_label, "Unverified"); my_pix = red; } xms = XmStringCreateLocalized(doc_label); XtVaSetValues(verified, XmNbackground, my_pix, XmNlabelString, xms, NULL); XmStringFree(xms); /* * default processing here. If the parser tree isn't balanced * (cbs->balanced == False) and you want to prevent XmHTML from making * another pass on the current document, set the redo field to false. */ if(cbs->balanced) { /* check meta info for a possible font spec */ docInfoCB(True); } } /***** * Name: linkCB * Return Type: void * Description: XmHTML's XmNlinkCallback handler * In: * w: widget id; * arg1: client_data, unused; * cbs: link data found in current document. * Returns: * nothing, but copies the link data to an internal structure which is used * for displaying a site-navigation bar. *****/ static void linkCB(Widget w, XtPointer arg1, XmHTMLLinkPtr cbs) { int i, j; /* free previous document links */ for(i = 0; i < LINK_LAST; i++) { if(document_links[i].have_data) { /* we always have a href */ free(document_links[i].href); /* but title is optional */ if(document_links[i].title) free(document_links[i].title); document_links[i].href= NULL; document_links[i].title = NULL; } document_links[i].have_data = False; } /***** * Since this callback gets triggered for every document, this is also * the place for updating the info dialog (if it's up that is). *****/ if(info_dialog && XtIsManaged(info_dialog)) docInfoCB(False); /***** * if the current document doesn't have any links, unmanage the button * and dialog and return. *****/ if(cbs->num_link == 0) { /* might not have been created yet */ if(link_dialog != NULL) XtUnmanageChild(link_dialog); XtUnmanageChild(link_button); return; } /* store links in this document */ for(i = 0; i < LINK_LAST; i++) { for(j = 0; j < cbs->num_link; j++) { /* kludge for the mailto */ String tmp = (i == 0 ? "made" : link_labels[i]); /***** * url is mandatory and so is one of rel or rev. Although both * of them can be present, we prefer a rel over a rev. *****/ if(!cbs->link[j].url || (!cbs->link[j].rel && !cbs->link[j].rev)) continue; if((cbs->link[j].rel && my_strcasestr(cbs->link[j].rel, tmp)) || (cbs->link[j].rev && my_strcasestr(cbs->link[j].rev, tmp))) { document_links[i].have_data = True; document_links[i].link_type = cbs->link[j].rel ? 1 : 0; /* we always have this */ document_links[i].href = strdup(cbs->link[j].url); /* title is optional */ if(cbs->link[j].title) document_links[i].title = strdup(cbs->link[j].title); } } } /* if the dialog is already up, update the buttons */ if(link_dialog && XtIsManaged(link_dialog)) { for(i = 0; i < LINK_LAST; i++) { if(document_links[i].have_data) XtSetSensitive(link_buttons[i], True); else XtSetSensitive(link_buttons[i], False); } /* and make sure everything is up and displayed */ XmUpdateDisplay(link_dialog); } /* manage the button so user can see the site structure of this doc. */ XtManageChild(link_button); } /***** * Name: collapseURL * Return Type: * Description: Copies up to 50 chars from the given url and puts in three * dots when the given url is larger than fifty chars. * In: * url: url to be collapsed or copied; * Returns: * copied url. *****/ static String collapseURL(String url) { static char name[51]; int len; if(url == NULL) return(""); len = strlen(url); if(len < 50) { strcpy(name, url); name[len] = '\0'; /* NULL terminate */ return(name); } /* copy first 11 chars */ strncpy(name, url, 11); /* put in a few dots */ name[11] = '.'; name[12] = '.'; name[13] = '.'; name[14] = '\0'; /* copy last 36 chars */ strcat(name, &url[len - 36]); name[50] = '\0'; /* NULL terminate */ return(name); } /***** * Name: infoCB * Return Type: void * Description: ButtonPressed handler for the workArea of a XmHTML widget. * In this case, a possible use of the XmHTMLXYToInfo resource * is demonstrated. * In: * w: widget id; * popup: popup menu widget id * event: location of button press. * Returns: * nothing. *****/ static void infoCB(Widget parent, Widget popup, XButtonPressedEvent *event) { XmString xms; char tmp[84]; /* max label width */ XmHTMLInfoPtr info; WidgetList children; Widget html_w; XUngrabPointer(XtDisplay(parent), CurrentTime); /* only button 3 */ if(event->button != 3) return; html_w = XtParent(parent); if(html_w == NULL || !XmIsHTML(html_w)) { fprintf(stderr, "%s parent gotten from XtParent(%s)\n", html_w == NULL ? "NULL" : "Invalid", XtName(parent)); return; } /* get the info for the selected position */ info = XmHTMLXYToInfo(html_w, event->x, event->y); /* no popup if no image and anchor */ if(info == NULL || (info->image == NULL && info->anchor == NULL)) return; XtVaGetValues(popup, XmNchildren, &children, NULL); /* unmanage all buttons */ XtUnmanageChild(children[0]); XtUnmanageChild(children[1]); XtUnmanageChild(children[2]); XtUnmanageChild(children[3]); /***** * Note on how to convey the href or image url's to the popup callbacks: * * All strings provided in the anchor and/or image field of this callback * are internal to XmHTML and are guarenteed to exist as long as the * current document is up. Knowing this, we can safely store these strings * in the userData field of the popup menu buttons. ****/ /* if we have an anchor, we copy the url to the label */ if(info->anchor) { sprintf(tmp, "Follow this link (%s)", collapseURL(info->anchor->href)); xms = XmStringCreateLocalized(tmp); XtVaSetValues(children[0], XmNlabelString, xms, XmNuserData, info->anchor->href, NULL); XmStringFree(xms); /* manage it */ XtManageChild(children[0]); } if(info->image) { sprintf(tmp, "Open this image (%s)", collapseURL(info->image->url)); xms = XmStringCreateLocalized(tmp); XtVaSetValues(children[1], XmNlabelString, xms, XmNuserData, info->image->url, NULL); XmStringFree(xms); /* manage it */ XtManageChild(children[1]); xms = XmStringCreateLocalized("View Image details"); XtVaSetValues(children[2], XmNlabelString, xms, XmNuserData, info->image, NULL); XmStringFree(xms); /* manage it */ XtManageChild(children[2]); /* set proper string for fancy image tracking */ if(html_config[OPTIONS_FANCY_TRACKING].value) xms = XmStringCreateLocalized("Disable Anchored Image Tracking"); else xms = XmStringCreateLocalized("Enable Anchored Image Tracking"); XtVaSetValues(children[3], XmNlabelString, xms, NULL); XmStringFree(xms); /* manage it */ XtManageChild(children[3]); } /* set correct menu position */ XmMenuPosition(popup, event); /* and show it */ XtManageChild(popup); } /***** * Name: navCB * Return Type: void * Description: callback for the buttons in the link dialog (displayed * by the linkButtonCB routine) * In: * w: widget id of selected button; * item: id of selected item; * Returns: * nothing. * Note: * This routine simply creates a XmHTMLAnchorCallbackStruct and calls * the anchorCB routine to let it handle navigation of the document * (which can include loading a new local or remote document, call a mail * application to mail something, download something, whatever). *****/ static void navCB(Widget w, int item) { static XmHTMLAnchorCallbackStruct cbs; /***** * We just compose a XmHTMLAnchorCallbackStruct and let anchorCB do the * loading. *****/ cbs.reason = XmCR_ACTIVATE; cbs.event = NULL; cbs.url_type = XmHTMLGetURLType(document_links[item].href); cbs.href = document_links[item].href; cbs.title = document_links[item].title; cbs.line = 0; cbs.target = NULL; cbs.doit = False; cbs.visited= False; if(document_links[item].link_type == 0) { cbs.rev = link_labels[item]; cbs.rel = NULL; } else { cbs.rel = link_labels[item]; cbs.rev = NULL; } /* and call the activate callback */ anchorCB(html_widgets[0].html, NULL, &cbs); } /***** * Name: linkButtonCB * Return Type: void * Description: displays a dialog with buttons to allow navigation of a * document using the information contained in the * section of a HTML document. * In: * w: widget id, unused; * arg1: client_data, unused; * arg2: call_data, unused; * Returns: * nothing. *****/ static void linkButtonCB(Widget w, XtPointer arg1, XtPointer arg2) { int i; if(!link_dialog) { Widget rc; link_dialog = XmCreateFormDialog(toplevel, "Preview", NULL, 0); XtVaSetValues(XtParent(link_dialog), XtNtitle, "Site Structure", NULL); /* a rowcol for the buttons */ rc = XtVaCreateManagedWidget("rowColumn", xmRowColumnWidgetClass, link_dialog, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNspacing, 0, XmNpacking, XmPACK_COLUMN, XmNorientation, XmVERTICAL, XmNnumColumns, 1, NULL); /* all buttons */ for(i = 0; i < LINK_LAST; i++) { link_buttons[i] = XtVaCreateManagedWidget(link_labels[i], xmPushButtonWidgetClass, rc, NULL); XtAddCallback(link_buttons[i], XmNactivateCallback, (XtCallbackProc)navCB, (XtPointer)i); } } /* Now see what buttons to activate. */ for(i = 0; i < LINK_LAST; i++) { if(document_links[i].have_data) XtSetSensitive(link_buttons[i], True); else XtSetSensitive(link_buttons[i], False); } /* * Keep the focus on the html widget so the navigation keys always * work. */ XmProcessTraversal(html_widgets[0].html, XmTRAVERSE_CURRENT); /* put on screen */ XtManageChild(link_dialog); XMapRaised(XtDisplay(link_dialog), XtWindow(link_dialog)); /* and make sure everything is up and displayed */ XmUpdateDisplay(link_dialog); } /***** * Name: historyCB * Return Type: void * Description: XmNactivateCallback handler for the back & forward buttons. * moves back or forward in the history. * In: * w: widget * button: button the triggered this callback. * Returns: * nothing. *****/ static void historyCB(Widget w, int button) { DocumentCache *this_doc = &doc_cache[current_doc]; /* back button has been pressed */ if(button == 0) { if(!XtIsSensitive(back)) return; /* current_ref == 0 -> top of file */ if(this_doc->current_ref) this_doc->current_ref--; /* reached bottom of current document, move to the previous one */ else { current_doc--; this_doc = &doc_cache[current_doc]; } if(loadAndOrJump(this_doc->file, this_doc->refs[this_doc->current_ref], False)) { XtSetSensitive(forward, True); XtSetSensitive(back, current_doc || this_doc->current_ref ? True : False); } else { if(current_doc) { current_doc--; historyCB(w, button); } } } /* forward button has been pressed */ else { if(!XtIsSensitive(forward)) return; this_doc->current_ref++; /* reached max of this document, move to the next doc */ if(this_doc->current_ref == this_doc->nrefs) { this_doc->current_ref--; current_doc++; this_doc = &doc_cache[current_doc]; } if(loadAndOrJump(this_doc->file, this_doc->refs[this_doc->current_ref], False)) { XtSetSensitive(back, True); if(current_doc == last_doc - 1 && this_doc->current_ref == this_doc->nrefs - 1) XtSetSensitive(forward, False); } else { if(current_doc != last_doc-1) { current_doc++; historyCB(w, button); } } } /* * Keep the focus on the html widget so the navigation keys always * work. */ XmProcessTraversal(html_widgets[0].html, XmTRAVERSE_CURRENT); } /***** * Name: destroyCacheObject * Return Type: void * Description: gets called by the object caching routines when it wants to * destroy a cached object. * In: * call_data: object to be destroyed; * client_data:data we registered ourselves when we made the initObjectCache * call. * Returns: * nothing. *****/ static void destroyCacheObject(XtPointer call_data, XtPointer client_data) { Debug(("destroyCacheObject, called for %s\n", ((XmImageInfo*)call_data)->url)); XmHTMLImageFreeImageInfo((Widget)client_data, (XmImageInfo*)call_data); } /***** * Name: loadAnimation * Return Type: XmImageInfo * Description: load an animation consisting of multiple images * In: * names: comma separated list of images * Returns: * a list of XmImageInfo composing the animation * Note: * this is a fairly simple example on how to add support for images * that are not supported by the XmHTMLImageDefaultProc convenience * function. *****/ XmImageInfo* loadAnimation(char *names) { static XmImageInfo *all_frames; XmImageInfo *frame = NULL; String chPtr, name_buf, filename; int nframes = 0; name_buf = strdup(names); for(chPtr = strtok(name_buf, ","); chPtr != NULL; chPtr = strtok(NULL, ",")) { if((filename = resolveFile(chPtr)) == NULL) { free(name_buf); return(NULL); } if(nframes) { frame->frame = XmHTMLImageDefaultProc(html_widgets[0].html, filename, NULL, 0); frame = frame->frame; } else { all_frames = XmHTMLImageDefaultProc(html_widgets[0].html, filename, NULL, 0); frame = all_frames; } frame->timeout = animation_timeout; nframes++; free(filename); } free(name_buf); /* nframes is total no of frames in this animation */ all_frames->nframes = nframes; all_frames->timeout = animation_timeout; return(all_frames); } /***** * Name: flushImages * Return Type: void * Description: flushes all images (normal *and* delayed) to the currently * loaded document. * In: * w: widget id, unused; * Returns: * nothing. * Note: * This routine simply flushes all images in the currently loaded document. * When it finds an image that has been delayed, it loads the real image and * replaces the delayed image in the current document with the real image. * When all images have been updated, it calls XmHTMLRedisplay to force * XmHTML to do a re-computation of the document layout. *****/ static void flushImages(Widget w) { int i; static XmImageInfo *image, *new_image; String url, filename; DocumentCache *this_doc; XmImageStatus status = XmIMAGE_OK, retval = XmIMAGE_OK; setBusy(True); /* get current document */ this_doc = &doc_cache[current_doc]; for(i = 0; i < this_doc->nimages; i++) { url = this_doc->images[i]; /* get image to update */ if((image = (XmImageInfo*)getURLObjectFromCache(url)) == NULL) continue; /* only do this when the image hasn't been loaded yet */ if(image->options & XmIMAGE_DELAYED && (filename = resolveFile(url)) != NULL) { if(strstr(url, ",")) new_image = loadAnimation(url); else { new_image = XmHTMLImageDefaultProc(html_widgets[0].html, filename, NULL, 0); free(filename); } if(new_image) { /* don't let XmHTML free it */ new_image->options &= ~(XmIMAGE_DEFERRED_FREE) & ~(XmIMAGE_DELAYED); /***** * Replace it. XmHTMLImageReplace returns a statuscode * indicating success of the action. If XmIMAGE_OK is returned, * no call to XmHTMLRedisplay is necessary, the dimensions are * the same as specified in the document. It returns * XmIMAGE_ALMOST if a recomputation of document layout is * necessary, and something else if an error occured: * XmIMAGE_ERROR: the widget arg is not a XmHTML widget or * pixmap creation failed; * XmIMAGE_BAD if image and/or new_image is NULL; * XmIMAGE_UNKNOWN if image is unbound to an internal image. *****/ retval = XmHTMLImageReplace(html_widgets[0].html, image, new_image); /* update private cache */ replaceObjectInCache((XtPointer)image, (XtPointer)new_image); /* and destroy previous image data */ XmHTMLImageFreeImageInfo((Widget)html_widgets[0].html, image); } } else /* same note as above applies */ retval = XmHTMLImageUpdate(html_widgets[0].html, image); /* store return value of ImageReplace and/or ImageUpdate */ if(retval == XmIMAGE_ALMOST) status = retval; } /* force a reformat and redisplay of the current document if required */ if(status == XmIMAGE_ALMOST) XmHTMLRedisplay(html_widgets[0].html); /* keep focus on the html widget */ XmProcessTraversal(html_widgets[0].html, XmTRAVERSE_CURRENT); setBusy(False); } /***** * Name: killImages * Return Type: void * Description: kills all images (normal *and* delayed) of all documents. * Should be called at exit. * In: * nothing. * Returns: * nothing. *****/ static void killImages(void) { setBusy(True); destroyObjectCache(); setBusy(False); } static void progressiveButtonCB(Widget w, int reset) { int curr_state = 0; String label; XmString xms; if(reset) { if(XtIsManaged(prg_button)) XtUnmanageChild(prg_button); /* set new label and global PLC state */ xms = XmStringCreateLocalized("Suspend Image Load"); XtVaSetValues(prg_button, XmNlabelString, xms, XmNuserData, (XtPointer)STREAM_OK, NULL); XmStringFree(xms); return; } /* get current progressive image loading state */ XtVaGetValues(w, XmNuserData, &curr_state, NULL); switch(curr_state) { case STREAM_OK: XmHTMLImageProgressiveSuspend(html_widgets[0].html); curr_state = STREAM_SUSPEND; label = "Continue Image Load"; break; case STREAM_SUSPEND: XmHTMLImageProgressiveContinue(html_widgets[0].html); curr_state = STREAM_OK; label = "Suspend Image Load"; break; default: fprintf(stderr, "Oops, unknown button state in " "progressiveButtonCB\n"); return; } /* set new label and global PLC state */ xms = XmStringCreateLocalized(label); XtVaSetValues(prg_button, XmNlabelString, xms, XmNuserData, (XtPointer)curr_state, NULL); XmStringFree(xms); } /***** * Name: getImageData * Return Type: int * Description: XmHTMLGetDataProc method. Called when we are to * load images progressively. * In: * stream: Progressive Load Context stream object * buffer: destination buffer. * Returns: * STREAM_END when we have run out of data, number of bytes copied into the * buffer otherwise. * Note: * This routine is an example implementation of how to write a * XmHTMLGetDataProc method. As this program doesn't have networking * capabilities, we mimic a connection by providing the data requested in * small chunks (which is a command line option: prg_skip [number of bytes]). * The stream argument is a structure containing a minimum and maximum byte * count (the min_out and max_out fields), a number representing the number * of bytes used by XmHTML (the total_in field) and user_data registered * with the object that is being loaded progressively. * * If this routine returns data, it must *always* be a number between * min_out and max_out (including min_out and max_out). Returning less is * not an advisable thing to do (it will cause an additional call immediatly) * and returning more *can* cause an error (by overflowing the buffer). * * You can let XmHTML expand it's internal buffers by setting the max_out * field to the size you want the buffer to have and returning STREAM_RESIZE. * XmHTML will then try to resize its internal buffers to the requested size * and call this routine again immediatly. When a buffer has been resized, it * is very likely that XmHTML will backtrack to an appropriate starting point, * so be sure to check and use the total_in field of the stream arg when * returning data. * * If you want to abort progressive loading, you can return STREAM_ABORT. * This will cause XmHTML to terminate the progressive load for the given * object (which involves a call to any installed XmHTMLProgressiveEndData * method). Example use of this could be an ``Abort'' button. An alternative * method is to use the XmHTMLImageProgressiveKill() convenience routine as * shown in the getAndSetFile() routine above. * * Also note that returning 0 is equivalent to returning STREAM_END (which * is defined as being 0). * * As a final note, XmHTML will ignore any bytes copied into the buffer * if you return any of the STREAM_ codes. *****/ static int getImageData(XmHTMLPLCStream *stream, XtPointer buffer) { ImageBuffer *ib = (ImageBuffer*)stream->user_data; int len; Debug(("getImageData, request made for %s\n", ib->file)); Debug(("getImageData, XmHTML already has %i bytes\n", stream->total_in)); /* no more data available, everything has been copied */ if(ib->next >= ib->size) return(STREAM_END); /* * Maximum no of bytes we can return. ib->size contains the total size of * the image data, and total_in contains the number of bytes that have * already been used by XmHTML so far. * total_in may differ from ib->next due to backtracking of the calling PLC. */ len = ib->size - stream->total_in; /* * If you want to flush all data you've got to XmHTML but max_out is too * small, you can do something like this: * if(len > stream->max_out) * { * stream->max_out = len; * return(STREAM_RESIZE); * } * As noted above, XmHTML will then resize it's internal buffers to fit * the requested size and call this routine again. Before I forget, the * default size of the internal buffers is 2K. * And no, setting max_out to 0 will not cause XmHTML to choke. It will * simply ignore it (and issue a blatant warning message accusing you of * being a bad programmer :-). */ if(progressive_data_inc) { /* increment if not yet done for this pass */ if(!ib->may_free) { progressive_data_skip += progressive_data_inc; Debug(("getImageData, incrementing buffer size to %i bytes\n", progressive_data_skip)); stream->max_out = progressive_data_skip; ib->may_free = True; return(STREAM_RESIZE); } else /* already incremented, copy data for this pass */ ib->may_free = False; } /* provide the minimum if our skip is too small */ if(len < stream->min_out || progressive_data_skip < stream->min_out) len = stream->min_out; else len = progressive_data_skip; /* final sanity */ if(len + stream->total_in > ib->size) len = ib->size - stream->total_in; /* more bytes available than minimally requested, we can copy */ if(len >= stream->min_out) { /* but don't exceed the maximum allowable amount to return */ if(len > stream->max_out) len = stream->max_out; Debug(("getImageData, returning %i bytes (min_out = %i, " "max_out = %i)\n", len, stream->min_out, stream->max_out)); memcpy((char*)buffer, ib->buffer + stream->total_in, len); ib->next = stream->total_in + len; return(len); } /* * some sort of error, XmHTML requested data beyond the end of the file, * so we just return STREAM_END here and let XmHTML decide what to do. */ return(STREAM_END); } static void endImageData(XmHTMLPLCStream *stream, XtPointer data, int type, Boolean ok) { XmImageInfo *image = (XmImageInfo*)data; ImageBuffer *ib; /* * XmHTML signals us that there are no more images being loaded * progressively. Remove ``Suspend Image Load'' button. * Beware: this is the only case in which stream is NULL. */ if(type == XmPLC_FINISHED) { XtSetSensitive(prg_button, False); XtUnmanageChild(prg_button); return; } ib = (ImageBuffer*)stream->user_data; /* * To keep the cache size in sync, we update the cached image by replacing * it. As we will be replacing the same object, the only effect this call * will have is that the sizeObjectProc will be called. */ if(ok) replaceObjectInCache((XtPointer)image, (XtPointer)image); else { /* incomplete image, remove it from the image cache */ removeObjectFromCache(ib->file); cleanObjectCache(); } Debug(("endImageData, called for %s, ok = %s\n", ib->file, ok ? "True" : "False")); free(ib->file); free(ib->buffer); free(ib); } /***** * Name: loadImage * Return Type: XmImageInfo * Description: XmHTMLimageProc handler * In: * w: HTML widget id * url: src value of an img element. * Returns: * return value from the HTML widget imageDefaultProc * Note: * this is a very simple example of how to respond to requests for images: * XmHTML calls this routine with the name (or location or whatever the * src value is) of an image to load. All you need to do is get the full * name of the image requested and call the imageDefaultProc and let XmHTML * handle the actual loading. * This is also the place to fetch remote images, implement an imagecache * or add support for images not supported by the imageDefaultProc. *****/ static XmImageInfo* loadImage(Widget w, String url) { String filename = NULL; XmImageInfo *image = NULL; DocumentCache *this_doc; int i; /* get current document */ this_doc = &doc_cache[current_doc]; Debug(("Requested to load image %s\n", url)); /***** * get full path for this url. The "," strstr is used to check if this * image is an animation consisting of a list of comma-separated images * (see examples/test-pages/animation?.html for an example) *****/ if((filename = resolveFile(url)) == NULL) if(!strstr(url, ",")) return(NULL); /* * add this image to this document's image list. * First check if we haven't got it already, can only happen when the * document is reloaded (XmHTML doesn't load identical images). * Use original URL for this. */ for(i = 0; i < this_doc->nimages; i++) { if(!(strcmp(this_doc->images[i], url))) break; } /* don't have it yet */ if(i == this_doc->nimages) { /* see if it can hold any more images */ if(this_doc->nimages != MAX_IMAGE_ITEMS) { this_doc->images[this_doc->nimages++] = strdup(url); i = this_doc->nimages; } else { char buf[128]; sprintf(buf, "This document contains more than %i images,\n" "Only the first %i will be shown.", MAX_IMAGE_ITEMS, MAX_IMAGE_ITEMS); XMessage(toplevel, buf); return(NULL); } } /* now check if we have this image already available */ if((image = (XmImageInfo*)getObjectFromCache(filename, url)) != NULL) { /* * If i isn't equal to the current no of images for the current * document, the requested image has already been loaded once for this * document, so we do not have to store it again. */ /* call storeImage again as we might be using a different URL */ if(i == this_doc->nimages) storeObjectInCache((XtPointer)image, filename ? filename : url, url); if(filename) free(filename); return(image); } if(filename || (strstr(url, ",")) != NULL) { /* test delayed image loading */ if(html_config[OPTIONS_AUTO_IMAGE_LOAD].value) { if(strstr(url, ",")) image = loadAnimation(url); else { if(!progressive_images) image = XmHTMLImageDefaultProc(w, filename, NULL, 0); else { unsigned char img_type; img_type = XmHTMLImageGetType(filename, NULL, 0); if(img_type != IMAGE_ERROR && img_type != IMAGE_UNKNOWN && img_type != IMAGE_XPM && img_type != IMAGE_PNG) { FILE *file; static ImageBuffer *ib; /* open the given file */ if((file = fopen(filename, "r")) == NULL) { perror(filename); return(NULL); } /* * We load the image data into an ImageBuffer (which * we will be using in the get_data() function. */ ib = (ImageBuffer*)malloc(sizeof(ImageBuffer)); ib->file = strdup(filename); ib->next = 0; /* see how large this file is */ fseek(file, 0, SEEK_END); ib->size = ftell(file); rewind(file); /* allocate a buffer to contain the entire image */ ib->buffer = malloc(ib->size+1); /* now read the contents of this file */ if((fread(ib->buffer, 1, ib->size, file)) != ib->size) printf("Warning: did not read entire file!\n"); ib->buffer[ib->size] = '\0'; /* sanity */ /* create an empty ImageInfo */ image = (XmImageInfo*)malloc(sizeof(XmImageInfo)); memset(image, 0, sizeof(XmImageInfo)); /* set the Progressive bit and allow scaling */ image->options =XmIMAGE_PROGRESSIVE|XmIMAGE_ALLOW_SCALE; image->url = strdup(filename); /* set file buffer as user data for this image */ image->user_data = (XtPointer)ib; /* make the progressive image loading button visible */ if(!XtIsManaged(prg_button)) XtManageChild(prg_button); XtSetSensitive(prg_button, True); /* all done! */ } else image = XmHTMLImageDefaultProc(w, filename, NULL, 0); } } /* failed, too bad */ if(!image) return(NULL); /* don't let XmHTML free it */ image->options &= ~(XmIMAGE_DEFERRED_FREE); } else { image = (XmImageInfo*)malloc(sizeof(XmImageInfo)); memset(image, 0, sizeof(XmImageInfo)); image->options = XmIMAGE_DELAYED|XmIMAGE_ALLOW_SCALE; image->url = strdup(filename ? filename : url); } /* store in the cache */ storeObjectInCache((XtPointer)image, filename ? filename : url, url); } if(filename) free(filename); return(image); } /***** * Name: testAnchor * Return Type: int * Description: XmNanchorVisitedProc procedure * In: * w: widget * href: href to test * Returns: * True when the given href has already been visited, false otherwise. * Note: * This is quite inefficient. In fact, the whole history scheme is * inefficient, but then again, this is only an example and not a full * featured browser ;-) *****/ static int testAnchor(Widget w, String href) { int i, j; /* walk each document */ for(i = 0 ; i < last_doc; i++) { /* and walk the history list of each document */ for(j = 0; j < doc_cache[i].nvisited; j++) if(doc_cache[i].visited[j] && !strcmp(doc_cache[i].visited[j], href)) return(True); } /* we don't know it */ return(False); } /***** * Name: aboutCB * Return Type: void * Description: displays an ``About'' dialog when the help->about menu item * is selected. * In: * widget: menubutton widget id * client_data: unused * call_data: unused * Returns: * nothing *****/ static void aboutCB(Widget widget, XtPointer client_data, XtPointer call_data) { char label[256]; sprintf(label, "A Simple HTML browser using\n" "%s\n", XmHTMLVERSION_STRING); XMessage(toplevel, label); } static void optionsCB(Widget w, int item) { XmString label; Boolean set = False; int i, argc = 0; Arg args[4]; switch(item) { /* * These are seven XmHTML On/Off resources so we can treat them * all in the same manner */ case OPTIONS_ANCHOR_BUTTONS: case OPTIONS_HIGHLIGHT_ON_ENTER: case OPTIONS_ENABLE_STRICT_HTML32: case OPTIONS_ENABLE_BODYCOLORS: case OPTIONS_ENABLE_BODYIMAGES: case OPTIONS_ENABLE_DOCUMENT_COLORS: case OPTIONS_ENABLE_DOCUMENT_FONTS: case OPTIONS_ENABLE_IMAGES: case OPTIONS_ENABLE_OUTLINING: case OPTIONS_DISABLE_WARNINGS: case OPTIONS_FREEZE_ANIMATIONS: /* get value */ XtVaGetValues(w, XmNset, &set, NULL); /* check if changed */ if(set == html_config[item].value) break; /* store new value */ html_config[item].value = set; Debug(("optionsCB, setting value for resource %s to %s\n", html_config[item].name, set ? "True" : "False")); /* set new value */ XtSetArg(args[argc], html_config[item].name, html_config[item].value); argc++; /* * if global image support has been toggled, toggle other buttons * as well. */ if(item == OPTIONS_ENABLE_IMAGES) { XtSetSensitive(html_config[OPTIONS_ENABLE_BODYIMAGES].w, set); XtSetSensitive(html_config[OPTIONS_AUTO_IMAGE_LOAD].w, set); XtSetSensitive(load_images, set); /* set corresponding resources */ XtSetArg(args[argc], html_config[OPTIONS_ENABLE_BODYIMAGES].name, set ? html_config[OPTIONS_ENABLE_BODYIMAGES].value:False); argc++; } /* propagate changes down to all active HTML widgets */ for(i = 0; i < MAX_HTML_WIDGETS; i++) { if(html_widgets[i].active) XtSetValues(html_widgets[i].html, args, argc); } break; case OPTIONS_AUTO_IMAGE_LOAD: case OPTIONS_FANCY_TRACKING: /* get value */ XtVaGetValues(w, XmNset, &set, NULL); /* check if changed */ if(set == html_config[item].value) break; /* store new value */ html_config[item].value = set; Debug(("optionsCB, setting value for %s to %s\n", html_config[item].name, set ? "True" : "False")); /* change label as well */ if(set) label = XmStringCreateLocalized("Reload Images"); else label = XmStringCreateLocalized("Load Images"); XtVaSetValues(load_images, XmNlabelString, label, NULL); XmStringFree(label); break; case OPTIONS_ANCHOR: fprintf(stderr, "Configure anchor appearance (not ready)\n"); break; case OPTIONS_FONTS: fprintf(stderr, "Configure document fonts (not ready).\n"); break; case OPTIONS_BODY: fprintf(stderr, "Configure default body settings (not ready).\n"); break; case OPTIONS_IMAGE: fprintf(stderr, "Configure default image settings (not ready).\n"); break; default: fprintf(stderr, "optionsCB: impossible menu selection " "(item = %i)\n", item); } } /***** * Name: Main * Return Type: int * Description: main for example 2 * In: * argc: no of command line arguments * argv: array of command line arguments * Returns: * EXIT_FAILURE when an error occurs, EXIT_SUCCESS otherwise *****/ int main(int argc, char **argv) { char *filename; Display *display; Widget topLevel; XEvent event; XtAppContext app_context; XSetWindowAttributes setAttrib; XClassHint *classhint; Atom property; Window parent; int timeout = 5; XtIntervalId TimeoutID; filename = strdup(argv[1]); topLevel = XtVaAppInitialize(&app_context, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL); display = XtDisplay(topLevel); XtVaSetValues(topLevel, XmNoverrideRedirect, True, XmNx,0, XmNy,0, XmNwidth,1,XmNheight,1,NULL); XtRealizeWidget(topLevel); parent = XtWindow(topLevel); setpgrp(); if (!fork()) { HelloScreen(filename, parent); exit(0); } setAttrib.event_mask = SubstructureNotifyMask; XChangeWindowAttributes ( display, XDefaultRootWindow(display), CWEventMask, &setAttrib); setAttrib.event_mask = PropertyChangeMask; XChangeWindowAttributes ( display, parent, CWEventMask, &setAttrib); TimeoutID = XtAppAddTimeOut(app_context, (unsigned long)60000, Done, NULL); property = XInternAtom (display, "_XA_CLIENT_TIMEOUT", False); for (;;) { XtAppNextEvent(app_context, &event); if ( event.type == PropertyNotify && event.xproperty.window == parent && event.xproperty.state == PropertyNewValue && event.xproperty.atom == property) { XtRemoveTimeOut(TimeoutID); XtAppAddTimeOut(app_context, (unsigned long)5000, Done, NULL); } else XtDispatchEvent(&event); } } void Done(XtPointer client_data, XtIntervalId *id) { exit(0); } static void HelloScreen(char *use_file, Window parent) { XEvent event; XSetWindowAttributes setAttrib; Display *display = NULL; /* shutup compiler */ Visual *visual = NULL; int depth = 0; Colormap colormap = 0; root_window = False; progressive_images = False; /* set current working directory as the first path to search */ #ifdef _POSIX_SOURCE getcwd((char*)(paths[0]), sizeof(paths[0])); #else getwd((char*)(paths[0])); #endif strcat((char*)(paths[0]), "/"); max_paths = 1; toplevel = XtVaAppInitialize(&context, APP_CLASS, NULL, 0, 0, NULL, appFallbackResources, NULL, NULL); display = XtDisplay(toplevel); /* check if visual, depth or colormap have been given */ if (getStartupVisual(toplevel, &visual, &depth, &colormap)) { XtVaSetValues(toplevel, XmNvisual, visual, XmNdepth, depth, XmNcolormap, colormap, NULL); XInstallColormap(display, colormap); } XtVaSetValues(toplevel, XmNmwmDecorations, MWM_DECOR_BORDER, XmNx, 0, XmNy, 0, XmNheight, DisplayHeight(display, DefaultScreen(display)), XmNwidth, DisplayWidth(display, DefaultScreen(display)), NULL); html_widgets[0].html = XtVaCreateManagedWidget("html", xmHTMLWidgetClass, toplevel, XmNanchorVisitedProc, testAnchor, XmNimageProc, loadImage, XmNimageEnable, True, XmNprogressiveReadProc, getImageData, XmNprogressiveEndProc, endImageData, #ifdef HAVE_GIF_CODEC XmNdecodeGIFProc, decodeGIFImage, #endif XmNheight, DisplayHeight(display, DefaultScreen(display)), XmNwidth, DisplayWidth(display, DefaultScreen(display)), XtVaTypedArg, XmNforeground, XmRString, "white", 6, XtVaTypedArg, XmNbackground, XmRString, "black", 6, NULL); html_widgets[0].active = True; html_widgets[0].used = True; /* anchor activation callback */ XtAddCallback(html_widgets[0].html, XmNactivateCallback, (XtCallbackProc)anchorCB, NULL); /* HTML frame callback */ XtAddCallback(html_widgets[0].html, XmNframeCallback, (XtCallbackProc)frameCB, NULL); /* set the HTML document callback */ XtAddCallback(html_widgets[0].html, XmNdocumentCallback, (XtCallbackProc)docCB, NULL); /* link callback for site structure */ XtAddCallback(html_widgets[0].html, XmNlinkCallback, (XtCallbackProc)linkCB, NULL); initCache(5*1024*1024, (cleanObjectProc)destroyCacheObject, (sizeObjectProc)getInfoSize, (XtPointer)html_widgets[0].html); XtRealizeWidget(toplevel); XRaiseWindow(XtDisplay(toplevel), XtWindow(toplevel)); /* The HTML widget has the focus */ XmProcessTraversal(html_widgets[0].html, XmTRAVERSE_CURRENT); /* if we have a file, load it */ if (use_file) { String filename; /* get full filename */ if ((filename = resolveFile(use_file)) != NULL) { /* load the file, will also update the document cache */ loadAndOrJump(filename, NULL, True); free(filename); } } setAttrib.event_mask = StructureNotifyMask; XChangeWindowAttributes(display, XtWindow(toplevel), CWEventMask, &setAttrib); XChangeProperty(display, parent, XInternAtom (display, "_XA_CLIENT_TIMEOUT", False), XA_STRING, 8, PropModeReplace, (unsigned char *)"client", 7); XFlush(display); XSync(display, False); /* enter the event loop */ for (;;) { XtAppNextEvent(context, &event); if (event.type == ReparentNotify && event.xreparent.window == XtWindow(toplevel)) { XtDestroyApplicationContext(context); exit(0); } else XtDispatchEvent(&event); } /* never reached, but keeps compiler happy */ exit(EXIT_SUCCESS); } XmHTML-1.1.10/contrib/PaxHeaders.1031/swallow.c0000644000175000001440000000013212613377377017106 xustar000000000000000030 mtime=1445854975.082545878 30 atime=1445854975.082545878 30 ctime=1445854975.082545878 XmHTML-1.1.10/contrib/swallow.c0000644000175000001440000001373712613377377016521 0ustar00chrisusers00000000000000/* * An example that shows how an X application can "swallow" another, running, * X application. * * From: Ricky Ralston */ #include #include #include #include #include #include #include #include #include Window XmuClientWindow (); static Window TryChildren (); XErrorHandler ErrorHandler(); Window GetClient(); void ResizeExposeCallback(); #define SW_EVENTS (PropertyChangeMask | StructureNotifyMask |\ ResizeRedirectMask | SubstructureNotifyMask) Window winid; Window draw; char *name; void ResizeExposeCallback( w, client_data, call_data) Widget w; XtPointer client_data; XmDrawingAreaCallbackStruct * call_data; { XEvent *event = call_data->event; Window win = call_data->window; Display *display = XtDisplay(w); if (event->xexpose.count == 0) { if (winid) { XClearWindow(display, winid); XMapSubwindows(display, winid); XMapWindow(display,winid); } } } main(argc, argv) int argc; char **argv; { Widget topLevel; Widget drawArea; XtAppContext app_context; winid = NULL; draw = NULL; if (argv[1]) name = strdup(argv[1]); else printf("You must supply a class name\n"); topLevel = XtVaAppInitialize(&app_context, "Swallow", NULL, 0, &argc, argv, NULL, XmNallowShellResize, TRUE, XmNrecomputeSize, TRUE, XmNheight, 700, XmNwidth, 600, NULL); XtRealizeWidget(topLevel); XSetErrorHandler((XErrorHandler)ErrorHandler); drawArea=XtVaCreateManagedWidget( "drawArea", xmDrawingAreaWidgetClass, topLevel, NULL); draw = XtWindow(drawArea); XtAddCallback(drawArea, XmNexposeCallback, ResizeExposeCallback, NULL); XtAddCallback(drawArea, XmNresizeCallback, ResizeExposeCallback, NULL); winid = GetClient(XtDisplay(topLevel)); XFlush(XtDisplay(topLevel)); XtAppMainLoop( app_context); } Window XmuClientWindow (dpy, win) Display *dpy; Window win; { Atom WM_STATE; Atom type = None; int format; unsigned long nitems, after; unsigned char *data; Window inf; WM_STATE = XInternAtom(dpy, "WM_STATE", True); if (!WM_STATE) return win; XGetWindowProperty(dpy, win, WM_STATE, 0, 0, False, AnyPropertyType, &type, &format, &nitems, &after, &data); if (type) return win; inf = TryChildren(dpy, win, WM_STATE); if (!inf) inf = win; return inf; } static Window TryChildren (dpy, win, WM_STATE) Display *dpy; Window win; Atom WM_STATE; { Window root, parent; Window *children; unsigned int nchildren; unsigned int i; Atom type = None; int format; unsigned long nitems, after; unsigned char *data; Window inf = 0; if (!XQueryTree(dpy, win, &root, &parent, &children, &nchildren)) return 0; for (i = 0; !inf && (i < nchildren); i++) { XGetWindowProperty(dpy, children[i], WM_STATE, 0, 0, False, AnyPropertyType, &type, &format, &nitems, &after, &data); if (type) inf = children[i]; } for (i = 0; !inf && (i < nchildren); i++) inf = TryChildren(dpy, children[i], WM_STATE); if (children) XFree((char *)children); return inf; } Window GetClient(display) Display *display; { XClassHint *classhint; Window dummy, *children = NULL, client; unsigned nchildren = 0; int i = 0; XTextProperty text_prop; XSetWindowAttributes win_att; XWindowChanges windowChanges; if (!XQueryTree (display, DefaultRootWindow(display), &dummy, &dummy, &children, &nchildren)) return (NULL); for (i=nchildren; i >= 0; i--) { if ((client = XmuClientWindow (display, children[i])) != None) { classhint = XAllocClassHint (); if ((XGetClassHint(display, client, classhint)) != 0) { /* Print out the class name and per-instance name */ if (!(strcmp(classhint->res_class, name))) { XSync(display, False); XUnmapWindow(display,client); XFlush(display); win_att.override_redirect = True; XChangeWindowAttributes(display, client, CWOverrideRedirect, &win_att); XFlush(display); XReparentWindow(display, client, draw, 10, 10); XFlush(display); XReparentWindow(display, client, draw, 10, 10); XFlush(display); windowChanges.border_width=0; XConfigureWindow(display, client, CWBorderWidth, &windowChanges); XSelectInput(display,client,SW_EVENTS); XFlush(display); if (classhint->res_name) XFree(classhint->res_name); if (classhint->res_class) XFree(classhint->res_class); XFree(classhint); return (client); } } if (classhint->res_name) XFree(classhint->res_name); if (classhint->res_class) XFree(classhint->res_class); XFree(classhint); } } return (NULL); } XErrorHandler ErrorHandler(dpy, event) Display *dpy; XErrorEvent *event; { if((event->error_code == BadWindow)|| (event->error_code==BadDrawable)) return 0 ; fprintf(stderr,"ErrorHandler - *** internal error ***\n"); fprintf(stderr,"Request %d, Error %d\n", event->request_code, event->error_code); } XmHTML-1.1.10/contrib/PaxHeaders.1031/swallow2.c0000644000175000001440000000013212613377377017170 xustar000000000000000030 mtime=1445854975.082545878 30 atime=1445854975.082545878 30 ctime=1445854975.082545878 XmHTML-1.1.10/contrib/swallow2.c0000644000175000001440000002521012613377377016570 0ustar00chrisusers00000000000000/* Copyright 1991 by Mike Yang, mikey@sgi.com, 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 the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of SGI not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. SGI makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ /* * This program demonstrates the use of XReparentWindow to visually * integrate existing windows from a different process into a toolkit * widget hierarchy. * * If you don't have Motif, comment out the "#define MOTIF" line to use * an Xaw widget. Otherwise, a Motif text widget will be used for the * reparenting. * */ #define MOTIF /* Use a Motif widget for the new parent */ #include #include #ifdef VMS #include #include #else #include #include #include /* #include */ /* Hack to make string defs work with both Motif and Xaw */ #define XmNwidth XtNwidth #define XmNheight XtNheight #define XmNx XtNx #define XmNy XtNy #define XmNbackground XtNbackground #endif Widget toplevel, parent; Window theClient = NULL, theContainer; int widthInc = 1, heightInc = 1, widthRemainder = 0, heightRemainder = 0; int parentOffset; char name[256]; Boolean found = False; Atom WM_STATE; static int count; static Arg args[10]; static Boolean Xerror; static int ErrorHandler(dpy, event) Display *dpy; XErrorEvent *event; { Xerror = True; return False; } void resizeHandler() { Dimension w, h; int width, height; count = 0; XtSetArg(args[count], XmNwidth, &w); count++; XtSetArg(args[count], XmNheight, &h); count++; XtGetValues(toplevel, args, count); if (widthInc != 1) { while (w % widthInc != widthRemainder) { w--; } } if (heightInc != 1) { while (h % heightInc != heightRemainder) { h--; } } width = w-2*parentOffset; height = h-2*parentOffset; if (width < 1) { width = 1; } if (height < 1) { height = 1; } XResizeWindow(XtDisplay(toplevel), theClient, width, height); XResizeWindow(XtDisplay(toplevel), theContainer, width, height); } void resize_handler(w, client_data, event) Widget w; XtPointer client_data; XEvent *event; { if (event->type == ConfigureNotify) { resizeHandler(); } } void focus_handler(w, client_data, event) Widget w; XtPointer client_data; XEvent *event; { XErrorHandler old; Xerror = False; old = XSetErrorHandler((XErrorHandler) ErrorHandler); event->xfocus.window = theClient; XSendEvent(XtDisplay(toplevel), theClient, True, FocusChangeMask, event); XSetErrorHandler(old); } Window findAClientWindow(window) Window window; { int rvalue, i; Atom actualtype; int actualformat; unsigned long nitems, bytesafter; unsigned char *propreturn; Window *children; unsigned int numchildren; Window returnroot, returnparent; Window result = NULL; XErrorHandler old; Xerror = False; old = XSetErrorHandler(ErrorHandler); rvalue = XGetWindowProperty(XtDisplay(toplevel), window, WM_STATE, 0, 1, False, AnyPropertyType, &actualtype, &actualformat, &nitems, &bytesafter, &propreturn); XSetErrorHandler(old); if (!Xerror && rvalue == Success && actualtype != None) { if (rvalue == Success) { XtFree((char *) propreturn); } return window; } old = XSetErrorHandler(ErrorHandler); if (!XQueryTree(XtDisplay(toplevel), window, &returnroot, &returnparent, &children, &numchildren) || Xerror) { XSetErrorHandler(old); return NULL; } XSetErrorHandler(old); result = NULL; for (i=0; i 0) { fprintf(stderr, "Reparenting %d children.\n", numchildren); /* Stacking order is preserved since XQueryTree returns its children in bottommost to topmost order */ for (each=0; eachtype == MapNotify && !event->xmap.override_redirect && (client = findAClientWindow(event->xmap.window))) { handleMappedClientWindow(client, event->xmap.window); } else if (event->type == MapNotify && event->xmap.override_redirect && event->xmap.window) { handleMappedClientWindow(event->xmap.window, event->xmap.window); } } else { if (event->type == DestroyNotify && event->xdestroywindow.window == theClient) { fprintf(stderr, "Child killed - exiting.\n"); XDestroyWindow(XtDisplay(toplevel), theContainer); XtDestroyWidget(toplevel); exit(0); } } } main(argc, argv) int argc; char **argv; { XEvent event; printf("Name of client to reparent? "); fflush(stdout); fgets(name, sizeof(name), stdin); if (name[strlen(name)-1] == '\n') { name[strlen(name)-1] = '\0'; } toplevel = XtInitialize(argv[0], "Reparent", NULL, 0, (Cardinal *) &argc, argv); if (argc > 1) { fprintf(stderr, "Unknown option: %s.\n", argv[1]); exit(1); } count = 0; #ifdef MOTIF XtSetArg(args[count], XmNshadowThickness, 5); count++; XtSetArg(args[count], XmNhighlightThickness, 0); count++; XtSetArg(args[count], XmNeditable, False); count++; parent = XmCreateText(toplevel, "parent", args, count); #else parent = XtCreateWidget("parent", asciiTextWidgetClass, toplevel, args, count); #endif XtManageChild(parent); XtSetMappedWhenManaged(toplevel, False); XtRealizeWidget(toplevel); XSelectInput(XtDisplay(toplevel), RootWindowOfScreen(XtScreen(toplevel)), SubstructureNotifyMask); WM_STATE = XInternAtom(XtDisplay(toplevel), "WM_STATE", False); fprintf(stderr, "Waiting for '%s' or the next override-redirect window.\n", name); while (True) { XtNextEvent(&event); if (!XtDispatchEvent(&event)) { handleRawEvent(&event); } } } XmHTML-1.1.10/contrib/PaxHeaders.1031/gif_decode.c0000644000175000001440000000013212613377377017466 xustar000000000000000030 mtime=1445854975.082545878 30 atime=1445854975.082545878 30 ctime=1445854975.082545878 XmHTML-1.1.10/contrib/gif_decode.c0000644000175000001440000001733112613377377017073 0ustar00chrisusers00000000000000/***************************************************************************** * * THIS FILE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND. THE AUTHOR * SHALL HAVE NO LIABILITY WITH RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, * TRADE SECRETS OR ANY PATENTS BY THIS FILE OR ANY PART THEREOF. IN NO * EVENT WILL THE AUTHOR BE LIABLE FOR ANY LOST REVENUE OR PROFITS OR * OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL DAMAGES. * * IF YOU DECIDE TO USE THE INFORMATION CONTAINED IN THIS FILE TO CONSTRUCT * AND USE THE LZW ALGORITHM YOU AGREE TO ACCEPT FULL RESPONSIBILITY WITH * RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRECTS OR ANY PATENTS. * IN NO EVENT WILL THE AUTHOR BE LIABLE FOR ANY LOST REVENUE OR PROFITS OR * OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL DAMAGES, INCLUDING BUT NOT * LIMITED TO ANY DAMAGES RESULTING FROM ANY ACTIONS IN A COURT OF LAW. * * YOU ARE HEREBY WARNED THAT USE OF THE LZW ALGORITHM WITHOUT HAVING * OBTAINED A PROPER LICENSE FROM UNISYS CONSTITUTES A VIOLATION OF * APPLICABLE PATENT LAW. AS SUCH YOU WILL BE HELD LEGALLY RESPONSIBLE FOR * ANY INFRINGEMENT OF THE UNISYS LZW PATENT. * * UNISYS REQUIRES YOU TO HAVE A LZW LICENSE FOR *EVERY* TASK IN WHICH THE * LZW ALGORITHM IS BEING USED (WHICH INCLUDES DECODING THE LZW COMPRESSED * RASTER DATA AS FOUND IN GIF IMAGES). THE FACT THAT YOUR APPLICATION MAY * OR MAY NOT BE DISTRIBUTED AS FREEWARE IS OF NO CONCERN TO UNISYS. * * IF YOU RESIDE IN A COUNTRY OR STATE WHERE SOFTWARE PATENT LAWS DO NOT APPLY, * PLEASE BE WARNED THAT EXPORTING SOFTWARE CONTAINING THE LZW ALGORITHM TO * COUNTRIES WHERE SOFTWARE PATENT LAW *DOES* APPLY WITHOUT A VALID LICENSE * ALSO CONSTITUTES A VIOLATION OF PATENT LAW IN THE COUNTRY OF DESTINATION. * * INFORMATION ON HOW TO OBTAIN A LZW LICENSE FROM UNISYS CAN BE OBTAINED * BY CONTACTING UNISYS AT lzw_info@unisys.com * *****************************************************************************/ /* * External gif decoder for a XmHTML widget. * * NOT copyrighted, may 1997. * Provided by an anonymous contributor. * * You are totally free to do everything you want with it. * * Used as follows: * XtVaSetValues(html, XmNdecodeGIFProc, decodeGIFImage, NULL); */ #define HAVE_GIF_CODEC /* ** Pulled out of nextCode */ #define MAX_LWZ_BITS 12 typedef struct _LZW{ int curbit; int lastbit; int get_done; int last_byte; int return_clear; int stack[(1<<(MAX_LWZ_BITS))*2]; int *sp; int code_size; int set_code_size; int max_code; int max_code_size; int clear_code; int end_code; unsigned char buf[280]; int table[2][(1<< MAX_LWZ_BITS)]; int firstcode; int oldcode; }LZW; static LZW *initLWZ(int input_code_size) { static LZW *lzw; lzw = (LZW *) malloc(sizeof(LZW)); memset(lzw, 0, sizeof(LZW)); lzw->set_code_size = input_code_size; lzw->code_size = lzw->set_code_size + 1; lzw->clear_code = 1 << lzw->set_code_size ; lzw->end_code = lzw->clear_code + 1; lzw->max_code_size = 2 * lzw->clear_code; lzw->max_code = lzw->clear_code + 2; lzw->curbit = lzw->lastbit = 0; lzw->last_byte = 2; lzw->get_done = False; lzw->return_clear = True; lzw->sp = lzw->stack; return lzw; } static const int maskTbl[16] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, }; static int nextCode(LZW *lzw) { static int maskTbl[16] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, }; int i, j, ret, end; if ( lzw->return_clear ) { lzw->return_clear = False; return lzw->clear_code; } end = lzw->curbit + lzw->code_size; /* out of data for this call */ if ( end >= lzw->lastbit ) return -1; j = end / 8; i = lzw->curbit / 8; if ( i == j ) ret = (int)lzw->buf[i]; else if ( i + 1 == j ) ret = (int)lzw->buf[i] | ((int)lzw->buf[i+1] << 8); else ret = (int)lzw->buf[i] | ((int)lzw->buf[i+1] << 8) | ((int)lzw->buf[i+2] << 16); ret = ( ret >> ( lzw->curbit % 8 ) ) & maskTbl[lzw->code_size]; lzw->curbit += lzw->code_size; return ret; } #define readLWZ(lzw) ((lzw->sp > lzw->stack) ? *--lzw->sp : nextLWZ(lzw)) static int nextLWZ(LZW *lzw) { int code, incode; register int i; while( ( code = nextCode(lzw) ) >= 0) { if ( code == lzw->clear_code ) { /* corrupt GIFs can make this happen */ if ( lzw->clear_code >= ( 1 << MAX_LWZ_BITS ) ) return -2; for ( i = 0 ; i < lzw->clear_code ; ++i ) { lzw->table[0][i] = 0; lzw->table[1][i] = i; } for ( ; i < ( 1 << MAX_LWZ_BITS ) ; ++i ) lzw->table[0][i] = lzw->table[1][i] = 0; lzw->code_size = lzw->set_code_size+1; lzw->max_code_size = 2*lzw->clear_code; lzw->max_code = lzw->clear_code+2; lzw->sp = lzw->stack; do { lzw->firstcode = lzw->oldcode = nextCode(lzw); }while ( lzw->firstcode == lzw->clear_code ); return lzw->firstcode; } if ( code == lzw->end_code ) return -2; incode = code; if ( code >= lzw->max_code ) { *lzw->sp++ = lzw->firstcode; code = lzw->oldcode; } while ( code >= lzw->clear_code ) { *lzw->sp++ = lzw->table[1][code]; /* circular table entry BIG ERROR */ if ( code == lzw->table[0][code] ) return code; /* circular table STACK OVERFLOW! */ if ( (int) lzw->sp >= ( (int) lzw->stack + sizeof(lzw->stack) ) ) return code; code = lzw->table[0][code]; } *lzw->sp++ = lzw->firstcode = lzw->table[1][code]; if ( ( code = lzw->max_code ) < ( 1 << MAX_LWZ_BITS ) ) { lzw->table[0][code] = lzw->oldcode; lzw->table[1][code] = lzw->firstcode; ++lzw->max_code; if ( ( lzw->max_code >= lzw->max_code_size ) && ( lzw->max_code_size < ( 1 << MAX_LWZ_BITS ) ) ) { lzw->max_code_size *= 2; ++lzw->code_size; } } lzw->oldcode = incode; if ( lzw->sp > lzw->stack ) return *--lzw->sp; } return code; } /* * gstream contains the incoming data and should contain the decoded data * upon return. The number of bytes offered for decoding will never exceed * 256 (value of the avail_in field in the gstream structure) as this is the * maximum value a block of GIF data can possibly have. */ static int decodeGIFImage(XmHTMLGIFStream *gstream) { LZW *lzw; register int v; register unsigned char *dp; /* we are being told to initialize ourselves */ if ( gstream->state == GIF_STREAM_INIT ) { /* Initialize the decompression routines */ lzw = initLWZ(gstream->codesize); /* store it */ gstream->external_state = (XtPointer)lzw; /* and return OK */ return GIF_STREAM_OK; } /* pick up our LZW state */ lzw = (LZW *)gstream->external_state; /* * We are being told to destruct ourselves. * Note that for GIF_STREAM_END gstream->next_in will contain the value * \000\001; (zero-length data block and the GIF terminator code) and * gstream->avail_in will be equal to 3 */ if ( gstream->state == GIF_STREAM_FINAL || gstream->state == GIF_STREAM_END ) { /* free everything and return */ if ( lzw ) { free(lzw); gstream->external_state = (XtPointer)NULL; } return GIF_STREAM_END; } /* store new data */ lzw->buf[0] = lzw->buf[lzw->last_byte-2]; lzw->buf[1] = lzw->buf[lzw->last_byte-1]; memcpy(&lzw->buf[2], gstream->next_in, gstream->avail_in); lzw->last_byte = 2 + gstream->avail_in; lzw->curbit = (lzw->curbit - lzw->lastbit) + 16; lzw->lastbit = (2+gstream->avail_in)*8 ; /* current position in decoded output buffer */ dp = gstream->next_out; for( ; gstream->avail_out ; gstream->total_out++, gstream->avail_out-- ) { if ( ( v = readLWZ(lzw) ) < 0 ) { /* saw end_code */ if ( v == -2 ) return GIF_STREAM_END; /* processed all current data */ return GIF_STREAM_OK; } *dp++ = v; } /* end if we have processed all data (no more room in output buf) */ return( gstream->avail_out ? GIF_STREAM_OK : GIF_STREAM_END ); } XmHTML-1.1.10/contrib/PaxHeaders.1031/htmltest.c0000644000175000001440000000013212613377377017262 xustar000000000000000030 mtime=1445854975.082545878 30 atime=1445854975.082545878 30 ctime=1445854975.082545878 XmHTML-1.1.10/contrib/htmltest.c0000644000175000001440000005766112613377377016701 0ustar00chrisusers00000000000000 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* prototypes for wide character routines 28SEP98RCJ */ #include "XmHTML.h" /* added 25JUN98RCJ for XmHTML HTML Widget 25JUN98RCJ */ XtAppContext app_context; Display *display; /* Display */ Widget toplevel; static Widget topDrawArea = (Widget)NULL; static Widget bottomDrawArea = (Widget)NULL; static XmFontList fontlist = (XmFontList)NULL; static XFontSet font_set = (XFontSet)NULL; static long total = (long)0; static char *testString = (char *)NULL; static wchar_t *wc_array = (wchar_t *)NULL; static char *defaultString = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890"; static XFontStruct *testFontStruct = (XFontStruct *)NULL; static char *testFont = (char *)NULL; static char *defaultFont = "-dt-interface system-medium-r-normal-s sans-14-140-72-72-p-82-iso8859-1"; Pixel steelBluePixel = (Pixel) NULL; Pixel redpixel = (Pixel) NULL; Pixel yellowpixel = (Pixel) NULL; Pixel greenpixel = (Pixel) NULL; Pixel orangepixel = (Pixel) NULL; Pixel whitepixel = (Pixel) NULL; Pixel blackpixel = (Pixel) NULL; GC topDrawGC=(GC)NULL; GC bottomDrawGC=(GC)NULL; #if 0 static void GiveUp(int signo); #endif static void AllocateColors(Widget w) { Colormap cmap = (Colormap)NULL; XColor new_color,unused; if (yellowpixel) return; /* if this pixel set, assume colors allocated */ XtVaGetValues(w, XmNcolormap,&cmap,NULL); if ( !cmap ) return; XAllocNamedColor(XtDisplay(w),cmap, "white", &new_color,&unused); whitepixel = new_color.pixel; XAllocNamedColor(XtDisplay(w),cmap, "red", &new_color,&unused); redpixel = new_color.pixel; XAllocNamedColor(XtDisplay(w),cmap, "black", &new_color,&unused); blackpixel = new_color.pixel; if ( XAllocNamedColor(XtDisplay(w),cmap, "SteelBlue", &new_color,&unused)) steelBluePixel = new_color.pixel; else { printf("Could not allocate background color SteelBlue. Using black instead\n"); steelBluePixel = blackpixel; } XAllocNamedColor(XtDisplay(w),cmap, "yellow", &new_color,&unused); yellowpixel = new_color.pixel; XAllocNamedColor(XtDisplay(w),cmap, "orange", &new_color,&unused); orangepixel = new_color.pixel; XAllocNamedColor(XtDisplay(w),cmap, "green", &new_color,&unused); greenpixel = new_color.pixel; } static void GiveUp(int signo) { printf("GiveUp Entered...\n"); exit(0); /* terminate */ return; } static void KillWindow(Widget w, XtPointer client_data, XtPointer call_data) { GiveUp((int)0); return; } static int catcher (Display *dpy, XErrorEvent *err) { if (err->request_code != X_GetAtomName) { XmuPrintDefaultErrorMessage (dpy, err, stderr); } return 0; } char *GetFontFamily(char *fontname, char **charset) { char *foundry = (char *)NULL; char *family = (char *)NULL; char *start = (char *)NULL; char *encoding = (char *)NULL; char *width = (char *)NULL; char *spacing = (char *)NULL; char *ptr; char *result = (char *)NULL; char fontfamily[512]; char **names = (char **)NULL; int i,dashs=5; *charset=(char *)NULL; /* so far no character set */ /********************************************************************/ /* Create the character set encoding from the passed font name */ /********************************************************************/ if (fontname && *fontname) { /* if passed a font name */ encoding=ptr=strdup(fontname); /* get a copy to modify */ dashs = 13; /* locate 13th dash */ while (*ptr && dashs) { /* skip to spacing field */ while (*ptr && *ptr!='-') ptr++; /* find next dash */ if (*ptr) { /* if not string end */ dashs--; /* count dash if got 1 */ ptr++; /* skip over dash */ } } if (*ptr && *ptr!='*') { /* if 13th dash found and not wild carded */ *charset = strdup(ptr); /* get char encoding */ } else *charset=strdup("iso8859-1"); /* else use default */ if (encoding) free(encoding); encoding = (char *)NULL; } else *charset=strdup("iso8859-1"); /* else use default */ /********************************************************************/ /* Create the font family name from the passed font name */ /********************************************************************/ if (fontname && *fontname) { /* if passed a font name */ start=ptr=strdup(fontname); /* get a copy to modify */ while (*ptr && *ptr=='-') ptr++; /* find foundry name */ if (*ptr) foundry=ptr; /* foundry name */ while (*ptr && *ptr!='-') ptr++; /* skip over remainder */ if (*ptr) *ptr++='\0'; /* terminate foundry */ if (*ptr) family=ptr; /* family name start */ while (*ptr && *ptr!='-') ptr++; /* skip over remainder */ if (*ptr) *ptr++='\0'; /* terminate family */ while (*ptr && *ptr!='-') ptr++; /* skip over weight */ if (*ptr) ptr++; /* skip over dash */ while (*ptr && *ptr!='-') ptr++; /* skip over slant */ if (*ptr) ptr++; /* skip over dash */ if (*ptr) width=ptr; /* font width start */ while (*ptr && *ptr!='-') ptr++; /* skip over remainder */ if (*ptr) *ptr++='\0'; /* terminate font width */ dashs=5; /* 5 dashs to spacing */ while (*ptr && dashs) { /* skip to spacing field */ while (*ptr && *ptr!='-') ptr++; /* find next dash */ if (*ptr) { /* if not string end */ dashs--; /* count dash if got 1 */ ptr++; /* skip over dash */ } } if (*ptr) spacing=ptr; /* spacing spacing */ while (*ptr && *ptr!='-') ptr++; /* skip over remainder */ if (*ptr) *ptr='\0'; /* terminate spacing */ if (foundry && family && width && spacing) sprintf (fontfamily,"%s-%s-%s-%s",foundry,family, width,spacing); else strcpy(fontfamily,"adobe-times-normal-*"); } else strcpy(fontfamily,"adobe-times-normal-*"); result=strdup(fontfamily); return(result); } void DumpFontInfo(char *fontname, XFontStruct *info) { int i; int count; char *atomname; char *propname; int direction; int ascent,descent; XCharStruct char_info; int (*oldhandler)(Display *dpy, XErrorEvent *err) = XSetErrorHandler (catcher); if (!fontname) { printf("NULL font name passed to DumpFontInfo. Exiting.\n"); return; } if (!info) { printf("NULL XFontStruct pointer passed to DumpFontInfo. Exiting.\n"); return; } XQueryTextExtents(XtDisplay(toplevel),info->fid,"M",(int)1,&direction, &ascent,&descent,&char_info); printf("\n\nXFontStruct Information for font:\n\n%s:\n\n",fontname); printf("ascent(M)........................%d\n",ascent); printf("descent(M).......................%d\n",descent); printf("width(M).........................%d\n",char_info.width); printf("attributes(M)..................0x%x\n",char_info.attributes); printf("info->max_bounds->lbearing.......%d\n",info->max_bounds.lbearing); printf("info->max_bounds->rbearing.......%d\n",info->max_bounds.rbearing); printf("info->max_bounds->width..........%d\n",info->max_bounds.width); printf("info->max_bounds->ascent.........%d\n",info->max_bounds.ascent); printf("info->max_bounds->descent........%d\n",info->max_bounds.descent); printf("info->max_bounds->attributes.....%d\n\n",info->max_bounds.attributes); count=1; while ((atomname = XGetAtomName(XtDisplay(toplevel),count++))) { XFree(atomname); atomname = (char *)NULL; } XSetErrorHandler (oldhandler); printf("Number of Properties=%d\n",info->n_properties); if (info->n_properties) { for (i=0;in_properties;i++) { #if 0 printf("i=%d name Atom=%d prop Atom=%d\n",i, (unsigned long)info->properties[i].name, (unsigned long)info->properties[i].card32); #endif atomname = (char *)NULL; if (info->properties[i].name > 0 && info->properties[i].name < count) atomname = XGetAtomName(XtDisplay(toplevel),info->properties[i].name); propname = (char *)NULL; if (info->properties[i].card32 > 0 && info->properties[i].card32 < count) propname = XGetAtomName(XtDisplay(toplevel), (Atom)info->properties[i].card32); if (atomname) { if (propname) { printf( "Property %3d AtomName=%u=%s PropName=(unsigned decimal)%u=%s\n", i,(unsigned long)info->properties[i].name, atomname,(unsigned long)info->properties[i].card32, propname); XFree(propname); } else { printf( "Property %3d AtomName=%u=%s PropName=(unsigned decimal)%u (unknown)\n", i,(unsigned long)info->properties[i].name, atomname,(unsigned long)info->properties[i].card32); } XFree(atomname); } else { if (propname) { printf( "Property %3d AtomName=%u=(unknown) PropName=%u=%s\n", i,(unsigned long)info->properties[i].name, (unsigned long)info->properties[i].card32, propname); XFree(propname); } else { printf( "Property %3d AtomName=%u=(unknown) PropName=(unsigned decimal)%u=(unknown)\n", i,(unsigned long)info->properties[i].name, (unsigned long)info->properties[i].card32); } } } } } void drawAreaExpose_CB(Widget widget, XtPointer client_data, XtPointer call_data ) { XmDrawingAreaCallbackStruct *cbs = (XmDrawingAreaCallbackStruct *) call_data; int baseX; /* X coordinate of string baseline. */ int baseY; /* Y coordinate of string baseline. */ char **fontpath; int n,i,j,paths; Status error = (Status)NULL; Colormap cmap = (Colormap)NULL; XColor exact_def, screen_def; GC *drawAreaGC=(GC *)NULL; Dimension tall=0; wchar_t wc,temp; unsigned char *mb_string=(unsigned char *)NULL; unsigned int bite; int bytes; unsigned char *actual; unsigned char *uptr; unsigned char *mbptr=(unsigned char *)NULL; wchar_t *ptr = (wchar_t *)NULL; wchar_t *start = (wchar_t *)NULL; wchar_t *begin = (wchar_t *)NULL; wchar_t *wcptr = (wchar_t *)NULL; int bites = 0; int mbs = 0; XmString sample; size_t status; static XFontStruct *defaultInfo = (XFontStruct *)NULL; static XGCValues gcv; static debug=0; printf("drawAreaExpose_CB entered...\n"); if (widget == topDrawArea) drawAreaGC = &topDrawGC; else drawAreaGC = &bottomDrawGC; if (!*drawAreaGC ) { gcv.foreground = whitepixel; gcv.background = steelBluePixel; *drawAreaGC = XCreateGC (XtDisplay(widget), RootWindowOfScreen(XtScreen(widget)), (GCForeground | GCBackground), &gcv); if (*drawAreaGC) { paths = 0; fontpath = (char **)NULL; fontpath = XGetFontPath(XtDisplay(widget),&paths); if (fontpath && paths > 0) { printf("\nCurrent Font Path is:\n\n"); for (i=0;ifid) { XSetFont(XtDisplay(widget),*drawAreaGC,testFontStruct->fid); start = ptr = (wchar_t *)malloc((total*sizeof(wchar_t))); wcscpy(start,wc_array); temp = *ptr; while (temp) { /* while all strings in buffer not output */ wcptr = begin = ptr; /* save this line start */ while (*ptr && *ptr !='\n') { /* while end of line not found */ ptr++; /* bump to next character */ } temp = *ptr; /* save in case its buffer end */ *ptr = '\0'; /* replace new line with NULL */ ptr++; /* bump past string end */ if (!tall) { /* get line height in pixels just once */ sample = XmStringCreate(defaultString,"TAG1"); tall = XmStringHeight(fontlist,sample); if (sample) XmStringFree(sample); } bites = wcslen(begin); /* get wide character byte string length */ mb_string = (unsigned char *)malloc((bites*sizeof(wchar_t))); status = wcstombs((char *)mb_string,begin,(bites*sizeof(wchar_t))); mbptr = mb_string; bytes = 0; n = mblen((char *)mbptr,(size_t)bites); while ( n > 0 ) { bytes = bytes + n; mbptr = mbptr + n; n = mblen((char *)mbptr,(size_t)bites); } if (mb_string) { XmbDrawString(XtDisplay(toplevel),XtWindow(widget),font_set, *drawAreaGC,baseX,baseY,(char *)mb_string,bytes); free(mb_string); } baseY += tall; } } if (start) free(start); } XtVaGetValues(widget, XmNcolormap,&cmap,NULL); error=XLookupColor(XtDisplay(widget),cmap,"blue",&exact_def,&screen_def); } #if 0 int main (int argc, char **argv)/ main(argc, argv) int argc; char **argv; #endif main( int argc, char *argv[] ) { Widget main_form,top_form,bottom_form; Widget scrolledw; Widget _htmlWidget; Atom WM_DELETE_WINDOW; long eof; int infd; int i,j; XmFontListEntry entry1 = (XmFontListEntry)NULL; char *locale=(char *)NULL; wchar_t wc; wchar_t *wc_ptr; size_t status; char **miss_charsets=(char **)NULL; int miss_count=0; char *def_string=(char *)NULL; char *fontfamily = (char *)NULL; char *charset = (char *)NULL; locale = setlocale(LC_ALL,""); /* get the local locale */ testFont = defaultFont; testString = defaultString; total = strlen(testString); /* get length test string */ if (argc > 1) testFont = argv[1]; if (argc == 3) { /* 2nd arg is name of a text file to render */ infd=open(argv[2],O_RDONLY); if (infd <=0 ) { /* if we could not open the file */ printf( "Could not open file %s. Exiting...\n",argv[2]); exit(1); } eof=lseek(infd,0L,2); /* seek to end to get file length */ total=lseek(infd,0L,0); /* move back to file beginning */ testString=(char *)malloc(((eof+4)/4)*4); /* get file size buffer */ total=read(infd,testString,eof); /* read entire file */ testString[eof]='\0'; /* terminate string */ close(infd); /* close the file */ } else if ( argc > 3 ) { printf( "Syntax error. Too many arguments. Proper Syntax is:\n\n"); printf("htmltest [XLFD Font Name] [HTML file name]\n\n"); exit(0); } XtSetLanguageProc ( (XtAppContext) NULL, (XtLanguageProc) NULL, (XtPointer) NULL ); toplevel = XtVaAppInitialize(&app_context, "SampleApp", NULL, 0, &argc, argv, NULL, XmNtitle, "Test Program for XmHTML HTML Render Widget", NULL); if (testFont) { entry1 = XmFontListEntryLoad(XtDisplay(toplevel),testFont, XmFONT_IS_FONT,"TAG1"); if (entry1) { fontlist = XmFontListAppendEntry(NULL, entry1); XmFontListEntryFree(&entry1); } } if (!testFont || !entry1 || !fontlist) { printf( "Error. Unable to create font entry for font. Exiting...\n"); exit(2); } font_set = XCreateFontSet(XtDisplay(toplevel),testFont,&miss_charsets, &miss_count,&def_string); if (miss_count > 0 ) { printf("\nWARNING: Missing charsets for font %s\nreturned from XCreateFontSet.\n\n", testFont); printf("Missing charsets are:\n"); for (i=0;i 0 ) { wc_ptr = wc_array = (wchar_t *)malloc((total*sizeof(wchar_t))); status = mbstowcs(wc_array, testString, total); wc = *wc_ptr++; while(wc) { wc = *wc_ptr; wc_ptr++; } } else { } main_form = XtVaCreateWidget("main_form",xmFormWidgetClass,toplevel, XmNfractionBase, 100, XmNwidth, (Dimension) 600, XmNheight, (Dimension) 700, XtVaTypedArg,XmNforeground,XmRString,"white",6, XtVaTypedArg,XmNbackground,XmRString,"SteelBlue",10, NULL); AllocateColors (main_form); top_form = XtVaCreateWidget("main_form",xmFormWidgetClass,main_form, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 50, /* 50% */ XtVaTypedArg,XmNforeground,XmRString,"white",6, XtVaTypedArg,XmNbackground,XmRString,"SteelBlue",10, NULL); bottom_form = XtVaCreateWidget("main_form",xmFormWidgetClass,main_form, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, top_form, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XtVaTypedArg,XmNforeground,XmRString,"white",6, XtVaTypedArg,XmNbackground,XmRString,"SteelBlue",10, NULL); topDrawArea = XtVaCreateWidget("drawTopArea",xmDrawingAreaWidgetClass,top_form, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbackground, steelBluePixel, NULL); scrolledw = XtVaCreateWidget("scrolledHTML", xmScrolledWindowWidgetClass, bottom_form, XmNtopAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); fontfamily = GetFontFamily(testFont, &charset); if (!fontfamily) { printf("FATAL ERROR. Unable to create font family string from font:\n\n"); printf("%s\n\n",testFont); printf("Exiting....\n"); exit(4); } _htmlWidget = XtVaCreateWidget("html", xmHTMLWidgetClass, scrolledw, XmNbackground, steelBluePixel, XmNfontFamily, fontfamily, XmNcharset, charset, #if 0 /** let this default 21SEP98RCJ **/ XmNfontFamily, "sun-song-normal-*", XmNfontSizeList, fontsizes, XmNfontFamily, fixedfamily, XmNfontFamilyFixed, fixedfamily, #endif NULL); XtAddCallback(topDrawArea, XmNexposeCallback, drawAreaExpose_CB, (XtPointer)NULL); XtVaSetValues(toplevel,XmNdeleteResponse,XmDO_NOTHING,NULL); WM_DELETE_WINDOW = XmInternAtom(XtDisplay(toplevel),"WM_DELETE_WINDOW", False); XmAddWMProtocolCallback(toplevel,WM_DELETE_WINDOW, KillWindow,(XtPointer) NULL); XmHTMLTextSetString(_htmlWidget, testString); XmHTMLTextScrollToLine(_htmlWidget, 0); XtManageChild (_htmlWidget); XtManageChild (scrolledw); XtManageChild (topDrawArea); XtManageChild (top_form); XtManageChild (bottom_form); XtManageChild (main_form); XtRealizeWidget (toplevel); XtAppMainLoop(app_context); } /* end main */ XmHTML-1.1.10/contrib/PaxHeaders.1031/VUEorDT.c0000644000175000001440000000013212613377377016646 xustar000000000000000030 mtime=1445854975.081545878 30 atime=1445854975.081545878 30 ctime=1445854975.081545878 XmHTML-1.1.10/contrib/VUEorDT.c0000644000175000001440000000412412613377377016247 0ustar00chrisusers00000000000000/* * Some code to detect which HP window manager is being used: DT (HP's CDE * window manager) or HP-VUE (default window manager). * * NOTE:If you get a window from GetMWMWindow then you should have * something that acts like mwm. ;-) * * From: Ricky Ralston */ #include #include #include /* Xm/MwmUtil.h on most systems */ #include #define UNKNOWN -1 #define HP-VUE 0 #define CDE 1 extern int WhichWindowManager(Display *display, Window *mwmWindow); extern Window GetMWMWindow(Display *display); int WhichWindowManager(Display *display, Window *mwmWindow) { Atom *atoms=NULL; int count=0; int i=0; int wmgr = UNKNOWN; char *property_name=NULL; if((atoms = XListProperties(display, mwmWindow, &count)) == NULL) return(wmgr); for(i = 0; i < count; i++) { property_name = XGetAtomName(display,atoms[i]); if(!strcmp(property_name, "_DT_WORKSPACE_LIST")) { wmgr = CDE; break; } if(!strcmp(property_name, "_VUE_WORKSPACE_INFO")) { wmgr = HP-VUE; break; } } if(property_name) XFree(property_name); return(wmgr); } int Window GetMWMWindow(Display *display) { Atom actualType; int actualFormat; unsigned long nitems; unsigned long leftover; PropMotifWmInfo *pWmInfo = NULL; Window wroot, wparent, *pchildren, mwmWindow=NULL; unsigned int nchildren; int rcode, i; Atom property; property = XmInternAtom (display, _XA_MWM_INFO, False); if((rcode=XGetWindowProperty(display, XDefaultRootWindow(display), property, 0L, PROP_MWM_INFO_ELEMENTS, False, property, &actualType, &actualFormat, &nitems, &leftover, (unsigned char **)&pWmInfo))==Success) { if (actualType == property) { if(XQueryTree(display, XDefaultRootWindow(display), &wroot, &wparent, &pchildren, &nchildren)) { for (i = 0; i < nchildren; i++) { if (pchildren[i] == pWmInfo->wmWindow) { mwmWindow = pWmInfo->wmWindow; XFree ((char *)pchildren); return(mwmWindow); } } } if(pchildren) XFree ((char *)pchildren); } return(mwmWindow); } } XmHTML-1.1.10/contrib/PaxHeaders.1031/README0000644000175000001440000000013212613377377016132 xustar000000000000000030 mtime=1445854975.081545878 30 atime=1445854975.081545878 30 ctime=1445854975.081545878 XmHTML-1.1.10/contrib/README0000644000175000001440000000117112613377377015532 0ustar00chrisusers00000000000000This file: README for XmHTML contrib. Unless were noted, everything in here has been written by Ricky Ralston. - VUEorDT.c a small tool to see under what window manager an app is running; - drawBttn.c example usage of XmHTML's external XmImage support. Displays a button with an image in it (which can even be an animation...) - example_5.c how to use XmHTML as a greeting screen in an application. - netscape.c How to control netscape through ICCCM. - swallow.c, swallow2.c Two implementations of XReparentWindow. - gif_decode.c pure LZW decoder. Anonymous contributor. Koen D'Hondt ripley@xs4all.nl XmHTML-1.1.10/contrib/PaxHeaders.1031/Makefile0000644000175000001440000000013212613377377016712 xustar000000000000000030 mtime=1445854975.081545878 30 atime=1445854975.081545878 30 ctime=1445854975.081545878 XmHTML-1.1.10/contrib/Makefile0000644000175000001440000000157612613377377016323 0ustar00chrisusers00000000000000 # List of sources SRCS = swallow.c swallow2.c # List of object files OBJS = swallow.o swallow2.o # Targets to make EXAMPLES=swallow2 # rule to create .o files from .c files .c.o: $(RM) $@ $(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -c $< -o $@ all: $(EXAMPLES) # targets to build swallow:: swallow.o $(RM) $@ \ $(CC) -o $@ $(LDFLAGS) swallow.o $(LOADLIBES) swallow2:: swallow2.o $(RM) $@ \ $(CC) -o $@ $(LDFLAGS) swallow2.o $(LOADLIBES) depend:: $(SRCS) $(MAKEDEPEND) $(INCLUDES) $(CPPFLAGS) $(SRCS) clean:: $(RM) $(OBJS) $(RM) $(EXAMPLES) distclean:: clean $(RM) core *.out make.world *.bak *.last *.auto *.rej *.orig #$(CP) Makefile.org Makefile #-------------------------------------------------------------------------- # don't delete anything below this line, makedepend depends on it #-------------------------------------------------------------------------- XmHTML-1.1.10/contrib/PaxHeaders.1031/drawBttn.c0000644000175000001440000000013212613377377017203 xustar000000000000000030 mtime=1445854975.081545878 30 atime=1445854975.081545878 30 ctime=1445854975.081545878 XmHTML-1.1.10/contrib/drawBttn.c0000644000175000001440000002653412613377377016615 0ustar00chrisusers00000000000000#include #include #include #include #include #include #include #include #include static void DrawImage(Widget w, XmImage *image, Boolean from_timerCB); static void DrawFrame(Widget w, XmImage *image, int xs, int ys); static void ResizeExpose(Widget w, XtPointer client_data, XtPointer call_data); #define APP_CLASS "HTMLDemos" typedef struct _TimeOutData { Widget w; XmImage *image; } TimeOutData; int main(int argc, char **argv) { XtAppContext context; Widget toplevel, rc, button; XmImage *working_image = NULL; XmImageConfig config; String working_image_file; int i; unsigned char img_type; fprintf(stderr, "%s, %i\n", XmHTMLVERSION_STRING, XmHTMLGetVersion()); if (argv[1]) working_image_file = strdup(argv[1]); if (!working_image_file) { printf("You must supply a filename.\n"); exit(1); } /* create toplevel widget */ toplevel = XtVaAppInitialize(&context, APP_CLASS, NULL, 0, &argc, argv, NULL, NULL, NULL); /* why not create a container */ rc = XtVaCreateManagedWidget(NULL, xmRowColumnWidgetClass, toplevel, NULL); /* create the image(s) */ config.ncolors = 64; config.flags = ImageQuantize|ImageFSDither; working_image = XmImageCreate(rc, working_image_file, 0, 0, &config); if (! working_image) { printf("Unable to create image - %s.\n", working_image_file); exit(1); } button = XtVaCreateManagedWidget(NULL, xmDrawnButtonWidgetClass, rc, XmNpushButtonEnabled, True, XmNhighlightThickness, 0, XmNwidth, working_image->width+8, XmNheight, working_image->height+8, NULL); /* realize everything */ XtRealizeWidget(toplevel); /* set ready label */ img_type = XmHTMLImageGetType(working_image_file, NULL, 0); if(img_type != IMAGE_GIFANIM && img_type != IMAGE_GIFANIMLOOP) { XtAddCallback(button, XmNexposeCallback, ResizeExpose, (XtPointer)working_image); } else DrawImage(button, working_image, True); /* enter the event loop */ XtAppMainLoop(context); /* never reached, but keeps compiler happy */ exit(EXIT_SUCCESS); } /* * To prevent racing conditions, we must first remove an * existing timeout proc before we add a new one. */ #define REMOVE_TIMEOUTPROC(IMG) { \ if(IMG->proc_id) \ { \ XtRemoveTimeOut(IMG->proc_id); \ IMG->proc_id = None; \ } \ } static void TimerCB(XtPointer data, XtIntervalId *id) { TimeOutData *info = (TimeOutData*)data; info->image->options |= IMG_FRAMEREFRESH; DrawImage(info->w, info->image, True); } #define RESET_GC(MYGC) { \ values.clip_mask = None; \ values.clip_x_origin = 0; \ values.clip_y_origin = 0; \ valuemask = GCClipMask | GCClipXOrigin | GCClipYOrigin; \ XChangeGC(dpy, MYGC, valuemask, &values); \ } static void DrawImage(Widget w, XmImage *image, Boolean from_timerCB) { int xs, ys; Display *dpy = XtDisplay(w); Window win = XtWindow(w); GC gc = XDefaultGCOfScreen(XtScreen(w)); XGCValues values; unsigned long valuemask; unsigned short wi, h; XtVaGetValues(w, XmNwidth, &wi, XmNheight, &h, NULL); /* compute correct image offsets */ xs = (wi - image->width)/2; ys = (h - image->height)/2; if (ImageFrameRefresh(image)) { if (xs + image->width < 0 || ys + image->height < 0) { REMOVE_TIMEOUTPROC(image); return; } } /* * If this is an animation, paint next frame or restore current * state when we are scrolling this animation on and off screen. */ DrawFrame(w, image, xs, ys); /* reset gc */ RESET_GC(gc); } static void ResizeExpose(Widget w, XtPointer client_data, XtPointer call_data) { XmImage *image = (XmImage *)client_data; int xs, ys; unsigned short wi, h; XtVaGetValues(w, XmNwidth, &wi, XmNheight, &h, NULL); /* compute correct image offsets */ xs = (wi - image->width)/2; ys = (h - image->height)/2; XCopyArea(XtDisplay(w), image->pixmap, XtWindow(w), XDefaultGCOfScreen(XtScreen(w)), 0, 0, image->width, image->height, xs, ys); } static void DrawFrame(Widget w, XmImage *image, int xs, int ys) { int idx, width = 0, height = 0, fx, fy; unsigned long valuemask; XGCValues values; Display *dpy = XtDisplay(w); Window win = XtWindow(w); GC gc = XDefaultGCOfScreen(XtScreen(w)); Pixel bg, fg; TimeOutData *data = XtNew(TimeOutData); XtVaGetValues(w, XmNbackground, &bg, XmNforeground, &fg, NULL); data->w = w; data->image = image; /* first reset the gc */ RESET_GC(gc); /* * First check if we are running this animation internally. If we aren't * we have a simple animation of which each frame has the same size and * no disposal method has been specified. This type of animations are blit * to screen directly. */ if(!ImageHasState(image)) { /* index of current frame */ idx = image->current_frame; width = image->frames[idx].w; height = image->frames[idx].h; /* can happen when a frame falls outside the logical screen area */ if(image->frames[idx].pixmap != None) { /* plug in the clipmask */ if(image->frames[idx].clip) { values.clip_mask = image->frames[idx].clip; values.clip_x_origin = xs; values.clip_y_origin = ys; valuemask = GCClipMask | GCClipXOrigin | GCClipYOrigin; XChangeGC(dpy, gc, valuemask, &values); } /* blit frame to screen */ XCopyArea(dpy, image->frames[idx].pixmap, win, gc, 0, 0, width, height, xs, ys); } /* * Jump to frame updating when we are not triggered * by an exposure, otherwise just return. */ if(ImageFrameRefresh(image)) goto nextframe; return; } /* * If DrawFrame was triggered by an exposure, just blit current animation * state to screen and return immediatly. */ if(!ImageFrameRefresh(image)) { XCopyArea(dpy, image->pixmap, win, gc, 0, 0, image->width, image->height, xs, ys); return; } idx = image->current_frame ? image->current_frame - 1 : image->nframes - 1; if(image->frames[idx].pixmap != None) { fx = image->frames[idx].x; fy = image->frames[idx].y; width = image->frames[idx].w; height = image->frames[idx].h; if(image->frames[idx].dispose == XmIMAGE_DISPOSE_BY_BACKGROUND) { XSetForeground(dpy, gc, bg); XFillRectangle(dpy, image->pixmap, gc, fx, fy, width, height); XSetForeground(dpy, gc, fg); } else if(image->frames[idx].dispose == XmIMAGE_DISPOSE_NONE && idx == 0 && image->frames[idx].clip != None) { XSetForeground(dpy, gc, bg); XFillRectangle(dpy, image->pixmap, gc, fx, fy, width, height); XSetForeground(dpy, gc, fg); /* now plug in the clipmask */ values.clip_mask = image->frames[idx].clip; values.clip_x_origin = fx; values.clip_y_origin = fy; valuemask = GCClipMask | GCClipXOrigin | GCClipYOrigin; XChangeGC(dpy, gc, valuemask, &values); /* paint it. Use full image dimensions */ XCopyArea(dpy, image->frames[idx].pixmap, image->pixmap, gc, 0, 0, width, height, fx, fy); } /* dispose by previous (the only one to have a prev_state) */ else if(image->frames[idx].prev_state != None) { /* plug in the clipmask */ if(image->frames[idx].clip) { /* set gc values */ values.clip_mask = image->frames[idx].clip; values.clip_x_origin = fx; values.clip_y_origin = fy; valuemask = GCClipMask | GCClipXOrigin | GCClipYOrigin; XChangeGC(dpy, gc, valuemask, &values); } /* put previous screen state on current state */ XCopyArea(dpy, image->frames[idx].prev_state, image->pixmap, gc, 0, 0, width, height, fx, fy); } } /* reset gc */ RESET_GC(gc); /* index of current frame */ idx = image->current_frame; /* can happen when a frame falls outside the logical screen area */ if(image->frames[idx].pixmap != None) { fx = image->frames[idx].x; fy = image->frames[idx].y; width = image->frames[idx].w; height = image->frames[idx].h; /* * get current screen state if we are to dispose of this frame by the * previous state. The previous state is given by the current pixmap, * so we just create a new pixmap and copy the current one into it. * This is about the fastest method I can think of. */ if(image->frames[idx].dispose == XmIMAGE_DISPOSE_BY_PREVIOUS && image->frames[idx].prev_state == None) { Pixmap prev_state; GC tmpGC; /* create pixmap that is to receive the image */ /* NEEDS to get depth of screen !!! */ prev_state = XCreatePixmap(dpy, win, width, height, DefaultDepthOfScreen(XtScreen(w))); /* copy it */ tmpGC = XCreateGC(dpy, prev_state, 0, 0); XSetFunction(dpy, tmpGC, GXcopy); XCopyArea(dpy, image->pixmap, prev_state, tmpGC, fx, fy, width, height, 0, 0); /* and save it */ image->frames[idx].prev_state = prev_state; /* free and destroy */ XFreeGC(dpy, tmpGC); } if(image->frames[idx].clip) { values.clip_mask = image->frames[idx].clip; values.clip_x_origin = fx; values.clip_y_origin = fy; valuemask = GCClipMask | GCClipXOrigin | GCClipYOrigin; XChangeGC(dpy, gc, valuemask, &values); } XCopyArea(dpy, image->frames[idx].pixmap, image->pixmap, gc, 0, 0, width, height, fx, fy); /* reset gc */ RESET_GC(gc); /* blit current state to screen */ XCopyArea(dpy, image->pixmap, win, gc, 0, 0, image->width, image->height, xs, ys); } nextframe: image->current_frame++; /* will get set again by TimerCB */ image->options &= ~(IMG_FRAMEREFRESH); if(image->current_frame == image->nframes) { image->current_frame = 0; if(image->loop_count) { image->current_loop++; if(image->current_loop == image->loop_count) image->options &= ~(IMG_ISANIM); } } REMOVE_TIMEOUTPROC(image); image->proc_id = XtAppAddTimeOut(image->context, image->frames[idx].timeout, TimerCB, data); } XmHTML-1.1.10/PaxHeaders.1031/CHANGES0000644000175000001440000000013212613377377014605 xustar000000000000000030 mtime=1445854975.074545878 30 atime=1445854975.073545878 30 ctime=1445854975.074545878 XmHTML-1.1.10/CHANGES0000644000175000001440000017214612613377377014220 0ustar00chrisusers00000000000000This file: CHANGES. Describes day to day progress of the XmHTML development. December 15 HTML Form widgets are no longer actively destroyed when the parent HTML widget is destroyed. Previously, this lead to an XError. Bugfix thanks to Richard Offer .
bugfixes: - If a line is ended by a linebreak, any leading space for the first word on the next line is removed. As a result of this, text justification no longer shifts this word; - Paragraphs containing a linebreak could incorrectly double the end-of-paragraph spacing. December 14 Fixed a bug in anchor rendering when it is the first object in a page: XmHTML couldn't find a proper starting point and didn't render the anchor at all. Fixed a bug related to empty named anchors, they used to reset the left margin (this one has been lurking under the carpet for a very long time...). Some improvement in table exposure handling. December 13 Modified handling of the XmNenableBadHTMLWarnings resource: you can now select what type of errors the parser detects will be shown. December 11 libhttp: the HTTPHEAD HTTPLoadMethod now supports both HTTPLoadToFile and HTTPLoadToString. For the latter, any received headers are stored in a new headers (array of type HTTPNamedValues) field in the HTTPRequest return structure. HTML tables: cell width takes horizontal margin into account properly. Previously, the cell width tended to be too small for the widest cell. Bugfix: linebreaks contained in anchors are no longer rendered. Fixed a number of bugs in the Imakefiles. December 9 HTML tables: - Fixed handling of the ROWSPAN attribute: the extra vertical space is now distributed evenly accross spanned rows; - fixed an (important) baseline handling bug; cells now reset the linebreaking mechanism: each cell represents a minipage that must start with a clean slate. Previously paragraph breaks were transferred accross rows and cells. December 8 Fixed a small redraw bug in XmBalloon popup. Changed the handling of
tags: they are now treated as text objects. This fixes a bug in table cell content rendering if a table is placed in an intended paragraph. Added the Composite Extension fix. December 4 Released XmHTML/Beta Version 1.1.1 December 3 Nested tables seem to be working almost flawlessly. Added partial support for the BGCOLOR attribute on all table elements. Still scrolling problems and offsets between different child tables doesn't always work correctly. Loosened the parser to allow appearance of the

element inside elements it shouldn't be appearing the XmNstrictHTMLChecking resource has been set to false. December 1 Tables are really going now: the COLSPAN and ROWSPAN attributes are now working. Table margins, cell and row padding also seems to work. November 26 More work on table layout: cell heights are now computed correctly, cell and rowspacing works, cell and row spanning should work. Nested tables also seems to work but has received little testing. November 25 First success at table displaying! The layout algorithm seems to work rather well (and fast!). Details aren't rendered yet (borders, background color or image), suppport for cell and row spanning hasn't been added and scrolling is sometimes messed up, but the borderline is: the basic table layout computation algorithm works, and it works damn GOOD! November 21 Finally found a satisfying design for table support. Extended the document formatter to fill in the table data structures. November 20 Internal changes to the parser as preparation for progressive document loading. Temporarely removed the ParserObject from the XmHTML Widget library. November 14 Played around with the HTML 4.0 event model: added the XmNeventProc resource to parse any scripts attached to these events and added the XmNeventCallback callback resource whenever an event should be served. Support for all HTML4.0 events is present in the code but currently only the onMouseUp and onMouseDown events are support for anchors. Still thinking about a decent and fast way to handle tables. November 12 Some small performance increases in the document formatter: whenever possible, objects are reused instead of being deleted. November 11 Played around a bit with the HTTP.c code in the contrib dir: - added a timeout on the connect() call using either setsockopt() or a bruteforce alarm() on systems that don't have support the SO_RCVTIMEO setsockopt flag; - added a select() on read() using a user-specified timeout and retry count; - added a small tool, httpget.c, in the tools directory demonstrating a fairly straightforward use of the HTTP code. This little tool can fetch an URL from any site you give feed it. The result of the above changes is that loadHTTPURL will never block again. Modified a few routines in parse.c so that they can now be shared by both XmHTML and XmHTMLParser. Small bugfix in ScrollToLine. November 10 Added the XmNclientData resource. This resource allows one to provide a pointer to client data that should be provided as the last argument to any function installed on any of the functional XmNanchorVisitedProc and XmNimageProc resources. As a logical consequence, the corresponding typedef for these resources now have one additional argument of type XtPointer. November 8 and 9 Working on tables; Much work on example_2.c: I'm completely rewriting it in a rather modular way where a basic Browser object can act in four different ways: as a complete browser, as member of a HTML frameset, as a popup window and as the desktop window. All of which can be used in every possible combination. November 3 All resource strings used by the XmHTML Widget Library are now placed in a separate header file called HTMLStrings.h. November 2 Added a XmBalloon widget to the library. This is a simple ``tooltip'' widget that can be popped up to display a small string. The string can be displayed in a rectangle or an oval (the latter is achieved using the Shape extension). example_2.c contains a possible usage: whenever an anchor is entered that contains the title attribute, this tooltip is popped up. October 31 Modified example_4 so it now also compiles and runs with X11R5 (or earlier) October 28 CDE and Solaris related Imakefile fixes and a workaround for a possible bug in SparcWorks cpp. October 26 Bugfix: the widget's size wasn't always correctly set at creation time. Modified XmHTML's translation table: anchor selection/document scrolling now works with any key combinations but Shift, Meta and Ctrl. The previous table masked of *all* modifiers, making the widget practically unseable if, for instance, the NumLock key was active. October 22 Bugfix on vertical scrolling: any vertical scroll requests are now properly ignored when the currently loaded document doesn't have a vertical scrollbar. October 21 XmHTML's form support is now complete: the XmNformCallback is now fully implemented thanks to Richard Offer (offer@sgi.com) Richard also provided a simple HTTP/1.0 implementation. A *big* round of applause! October 11 Released XmHTML/Beta Version 1.1.0, the first XmHTML Beta Release. October 10 Last preparations for the XmHTML Beta 1.1.0 release. Fixed a small bug in local anchor jumping: XmNanchorVisitedUnderlineType resource wasn't properly honored. Removed a number of unused resource class names from the XmHTML string table (1kb of data), added the XmCAnchorUnderlineType resource class and corresponding converter and added a warning message to the parser (in some cases it forgot to complain about closing elements without an opening counterpart). October 9 Added a ``fast'' mode to the parser which entirely bypasses the document verification and repair routines (as if it wasn't fast enough already :-) If you are absolute sure that a document is fully compliant with the HTML3.2 standard, and all elements for which termination is optional HAVE a terminator, setting the value of the XmNmimeType resource to text/html-perfect will select the fast parser. October 8 Finally fixed a very annoying bug: when the widget is created, the height wasn't always computed correctly, leading to incorrect screen updates when scrolling (small gaps appeared). The only way to get around this bug was to resize the widget. It turned out that the core class height gets modified sometime *after* the Widget's Initialize method has been called, but before it is being mapped to screen. What causes this is a mystery to me. Final preparations for the first official Beta release, 1.1.0: added a collection of manual pages that describe each and every convenience function offered by XmHTML and updated the (hugely out of data) widget description. October 7 Dithering to a fixed palette is now fully possible. There are four different methods available (closest match without error correction, ordered with and without error correction and closest match with error correction). You can specify a palette using the XmNimagePalette resource or let XmHTML create one for you. October 6 Working on implementing support for the XmNimageMapToPalette and XmNimagePalette resources, which allow you to define a palette for XmHTML to use. Besides the obvious advantages this can offer, another advantage is a rather large speedup when switching pages: since a palette contains a fixed number of colors, XmHTML can allocate all colors on startup and doesn't have to free them until it is destroyed. This obliterates the need to release allocated colors each time a new page is loaded. October 3 Replaced the current quantizer with a compacter and faster one. Previously XmHTML carried two quantizers: one for global use and one specifically for PNG images. Fixed a bug in the colormap reading code of GIF images. October 2 Fixed a small bug in form handling: optionmenu's didn't get reset when the reset button was pressed. September 28 Added support for Fast Loadable Graphics. This is a format especially designed for XmHTML and optimized for *very* fast loading of images. The FLG format is actually nothing more than a compacted version of the XmImageInfo structure, and as such it supports plain transparency, alpha channel and animations (with all GIF disposal methods). Data can be stored either compressed or uncompressed. Uncompressed FLG's are the fastest possible way to load an image into XmHTML, but they can take up a huge amount of space. A funny thing I noticed though is that, quite often, an uncompressed FLG takes up less space than the same image saved as a GIF image... Animation support: the global colormap of an animation is now only allocated once for the entire animation instead of being allocated for each frame separatly. This has two significant advantages: memory usage is reduced and less time is spent in allocating colors. XmHTML will now also use the global colormap if the local colormap of an animation frame is equal to the global colormap. September 26 Some changes to reduce memory usage: - Changed the type of the color component fields of the XmImageInfo structure from signed int to unsigned short (can save up to 1.5kb per image). Modified all internal color allocation routines as well; - the size of the clipmasks is now computed correctly: storage occupied by clipmask data has been reduced by a factor 8; - alpha channel processing of PNG images been modified to use a colormap instead of full RGBA quartets: the 24bit RGB data is converted to an 8bit paletted image and the alpha channel is stored separatly. This reduces the memory occupied by these images with at least a factor two; September 22 A lot of improvements in the font allocation/caching routines: - a separate font cache for each display is now maintained. The previous scheme didn't look at which display it was running while the font cache was shared between every XmHTML instance. Displaying multiple instances of a XmHTML widget on different displays should now be possible; - made the font caching scheme a lot more efficient and removed the limit on the maximum number of loadable fonts (it now uses a binary tree lookup instead of a lineair search through a table with fixed size; - fonts are now freed when the widget is destroyed (that is, the actual font data is only freed if the widget being destroyed is the last widget using a display-bound font cache); - modified the internal data structures so font properties are now stored with each font instead of calculating them each time the layout needs to be recalculated; One very major performance enhancement is the introduction of a smart font mapping scheme which maps unknown font names to known ones. I am particularly pleased with this scheme, it allows XmHTML to map fonts it does not know in the beginning to known ones later one. Assuming the helvetica font is present in your font path and arial isn't, the following happens: when XmHTML encounters a tag, it will not know to which font it should be mapped and it will use the default font (whatever that is). However, when at a later stage a is encountered, XmHTML will see that this Arial font can be mapped to the Helvetica font (which it does known), and as a result, any future reference to the Arial font will be mapped to the Helvetica font. XmHTML is smart enough to take any combination of weight, slant and size into account when making these decisions. Performance tests with the new font caching and mapping schemes show some very satisfactory results: the cache hit ratio is steadily increasing, approaching 90 or more percent after about 10 documents with different fonts have been loaded. The average number of search actions seems to remain steady around 7 in this case. The font cache contained 55 fonts (including 10 font mappings) in various families, sizes and styles. As a side note: this new ``font technology'' allows users to define their own font mapping by providing a document with a list of simple font mappings. See html/font_map.html for a sample document. Before I forget: I made the builtin cursor allocation display-independant as well. September 21 First success at flowing text around images with the ALIGN="LEFT" or ALIGN="RIGHT" attribute set. September 20 Small parser bugfix: mime type of a new document wasn't properly saved. Added a ``View Document Source'' menu item to example_2 and fixed a bug in jumping to locations in different files. September 18 Fixed a few important bugs: - imagemap list wasn't properly reset when a document was reformatted. Could lead to a SIGSEGV in some cases; - list of anchor data wasn't properly reset in some cases; XmHTML now properly honors the XmNstringDirection resource: when set to XmSTRING_DIRECTION_R_TO_L, text is properly inversed. Paragraphs contents are ordered from bottom to top. Needs a bit more work though: list markers are always left-aligned at the first line of a paragraph instead of right aligned at the bottom. Modified the linebreaking algorithm to handle line/paragraph breaks properly when the paragraphs contain non-text objects (HTML form components and images). Table support: changed the text layout algorithms to work independantly of XmHTML's dimensions. They now use a (dynamically adjustable) bounding box. September 16 When the title of a document is requested, leading and trailing spaces are now removed. Added the HeadDocType mask bit to the XmHTMLGetHeadAttributes() convenience function. When set, the value of the tag will be returned. Improved path resolution and mime detection routines in example_2.c September 10-12 Some prelimenary work on XmHTMLTextGetFormatted() September 4 Fixed a few important memory leaks. One of those caused the stored anchor data never to be freed. Reverted a few bad fixes. September 1 XmHTMLTextSetString fix, text was always rendered twice. Moved all resources into a stringtable. This actually seems to introduce a rather noticable speedup in document loading. Haven't got the slightest clue why this happens. August 29-31 Numerous bugfixes & memory leak fixups. A GRAND applause to Ricky Ralston for having the courage to run XmHTML through purify. Thanks Ricky!! Started with daily snapshot distribution. August 28 Released XmHTML/Alpha Version 1.0.21, last Alpha release. The next release will be the first publically available Beta. August 26 Rewrote and extended

 support greatly. Plain text, form
	components and images can now be mixed freely.

	Some minor changes in anchor rendering: anchors are now only extended to
	the right when there is room for it, they no longer cover adjacent text
	when activated.

	Added the XmNimageRGBConversion resource which allows one to select
	the conversion method XmHTML should use when converting 24bit to 8bit
	images.

August 25
	Changed the proto's for XmHTMLImageReplace() and XmHTMLImageUpdate():
	they now return a status indicating whether or not the document needs
	a recomputation of document layout if an image is replaced or updated.

	Fixed a bug in the default image processing: when images are delayed, the
	delayed icon wouldn't show up. I forgot to properly propagate the image
	dimensions.

August 21, evening
	Fully restored PNG alpha channeling support, there was a silly bug in
	doing the 24 to 8 bit conversion. Alpha channeling is now also supported
	for delayed images and any combination of background setting, set either
	via the loaded document or the SetValues method.
	See XmHTML PNG Demo for some screenshots.

	Transparent background images are now also supported.

August 21, morning
	Fixed a bug in delayed image loading that caused a fatal crash when
	the delayed image was freed.

	Progressive and normal image loading now share the same XImage creation
	and update routines. Also fixed clipmask creation for progressively
	loaded images.

	Rewrote most part of the handling of PNG images with an alpha channel.

	Several bugfixes and changes to example_2 and it's caching routines.

August 20
	HTML form support: vertical scrolling of a document with a HTML form in
	it should now be correct whether or not a horizontal scrollbar is present.
	Also fixed a bug in the SetValues method which caused XmHTML to ignore the
	already present form widgets.

	Modified the debug routines, output can now be sent to a file.

	Eliminated some dead/duplicate code in the painter and widget methods.

August 19
	HTML form support:

	-	The traversal stuff for tabbing between all HTML form components
		almost works. Still need to figure out the proper XmTextField
		translations so the tab key can be used instead of the enter key;
	-	added support for the HTML 
	
		Scheduled Release Date:
		
	
		Author:
		
	
		Contact Address:
		
	
		URL:
		
	
		XmHTML:
		
	
		 
		Additional remarks can be entered here:
	
		 
		


  


 -->
Name
program's name

Description
a short description of the program's purpose.

Scheduled Release Date
Expected release date of the application (alpha, beta or final doesn't matter);

Author
author's name and email address;

URL
url where more information about the application can be obtained;

XmHTML
short description on how XmHTML is used by this application.

Or you can mail your submissions to ripley@xs4all.nl.




©Copyright 1996-1998 by Ripley Software Development
Last update: September 25, 1998 by Koen
XmHTML-1.1.10/html/PaxHeaders.1031/structures.html0000644000175000001440000000013212613377377017667 xustar000000000000000030 mtime=1445854975.098545877 30 atime=1445854975.098545877 30 ctime=1445854975.098545877 XmHTML-1.1.10/html/structures.html0000644000175000001440000000624312613377377017274 0ustar00chrisusers00000000000000 XmHTML Programmers Manual: XmHTML Structures

XmHTML Widget Set Manual Pages

XmHTML Structures

XmHTML Callback Structures




©Copyright 1996-1998 by Ripley Software Development
Last update: June 4, 1998 by Koen

XmHTML-1.1.10/html/PaxHeaders.1031/custom_map.html0000644000175000001440000000013212613377377017613 xustar000000000000000030 mtime=1445854975.094545877 30 atime=1445854975.094545877 30 ctime=1445854975.094545877 XmHTML-1.1.10/html/custom_map.html0000644000175000001440000000737312613377377017225 0ustar00chrisusers00000000000000 Default font map loaded. XmHTML-1.1.10/html/PaxHeaders.1031/copyrights.html0000644000175000001440000000013212613377377017637 xustar000000000000000030 mtime=1445854975.094545877 30 atime=1445854975.094545877 30 ctime=1445854975.094545877 XmHTML-1.1.10/html/copyrights.html0000644000175000001440000001312012613377377017234 0ustar00chrisusers00000000000000 XmHTML Copyright Statement

Copyright Notices

XmHTML Widget Set

Copyright © 1996-1997 Ripley Software Development

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library 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 Library General Public License for more details.

You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

See the GNU Library General Public License for the full distribution license.

Portions Copyright © 1990 - 1994, David Koblas. Used by permission.
Portions Copyright © 1994 by John Bradley. Used by permission.

Other Applicable Copyright Notices

The following copyrights also apply to certain portions of the XmHTML source code.

JPEG image decoding
Provided by use of libjpeg version 6.
libjpeg is copyright © 1991, 1992, 1993, 1994, 1995, Thomas G. Lane, The Independent JPEG Group.

PNG image decoding
Provided by use of libpng version 0.90 and zlib version 1.0.4.
libpng is Copyright © 1995, 1996, 1997 Guy Eric Schalnat, Group 42, Inc.
zlib is Copyright © 1995-1996 Jean-loup Gailly and Mark Adler.

GIF87a and GIF89a image decoding
Based on gifread.c, of which the copyright notice is as follows:

Copyright © 1990 - 1994, David Koblas. (koblas@netcom.com)
Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. This software is provided "as is" without express or implied warranty.

GIF87a and GIF89a LZW Compressed Raster Data Decoding
The idea for decoding the LZW compressed raster data of gif images using uncompresscomes from Derek B. Noonburg <derekn@ece.cmu.edu>, the author of the excellent xpdf PDF viewing package.

Image Quantization
Based on ppmquant.c as found in the pbmplus package, of which the copyright notice is as follows:

Copyright © 1989, 1991 by Jef Poskanzer.

Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. This software is provided "as is" without express or implied warranty.

It also contains the following note to the above:

Many people get confused by this legalese, especially the part about "without fee". Does this mean you can't charge for any product that uses PBMPLUS? No. All it means is that you don't have to pay me. You can do what you want with this software. Build it into your package, steal code from it, whatever. Just be sure to let people know where it came from.

XImage Creation
Based on portions of xvimage.c as found in xv 3.10, an excellent image viewing program by John Bradley. Used by permission.

XV is Copyright © 1989, 1994 by John Bradley.




©Copyright 1996-1997 by Ripley Software Development
Last update: September 19, 1997 by Koen
XmHTML-1.1.10/html/PaxHeaders.1031/XmHTML.html0000644000175000001440000000013212613377377016515 xustar000000000000000030 mtime=1445854975.093545877 30 atime=1445854975.093545877 30 ctime=1445854975.093545877 XmHTML-1.1.10/html/XmHTML.html0000644000175000001440000001766612613377377016135 0ustar00chrisusers00000000000000 XmHTML: a HTML Widget

XmHTML Widget Set

This document is the main index to the XmHTML Widget Set documentation. XmHTML provides a widget capable of displaying HTML 3.2 conforming text.

These pages will be updated regularly as the development of this widget progresses. Keep an eye on them!

The XmHTML Widget Set is unique in its kind: it is the only HTML 3.2 widget set available under the GNU Library General Public License. As such, XmHTML can be used for both commercial and non-commercial applications.

September 11, 1998, released XmHTML Beta 1.1.5

This page tells you where you can find it.

XmHTML reaches the press! Read the article about XmHTML Eric Foster-Johnson wrote in his Cross Thoughts column of Unix Review's Performance Computing magazine.

Table of Contents

  1. Where to get XmHTML and the XmHTML mailing list
  2. XmHTML Widget Set Overview
  3. Description of latest changes
  4. Legal Issues, distribution and licensing
  5. Copyright Notices
  6. XmHTML Widget Set Programmers and Reference Guide
  7. XmHTML Manual Pages
  8. XmHTML PNG Demo Page
  9. HTML Extensions implemented by XmHTML
  10. List of applications using XmHTML

Pointers to other Web related sites:

The full package of these web pages is also available for downloading: XmHTML.html.tar.gz (136826 bytes).

XmHTML Widget Set Overview

The XmHTML Widget Set currently consists of two widgets:

  • XmHTML, a high performance Motif Widget capable of displaying HTML 3.2 confirming text. Amongst it's many features are the following:
    • builtin image support for X11 bitmaps, X11 pixmaps, GIF87a, GIF89a, JPEG and PNG;
    • GIF images are decoded using a patent free scheme;
    • builtin support for animated GIF89a and animated GIF89a with NETSCAPE2.0 loop extension. XmHTML supports all GIF89a disposal methods;
    • image support covers all X11 visual types and display depths;
    • delayed image loading;
    • progressive image loading;
    • builtin scrolling interface (both keyboard and mouse);
    • anchors can be displayed as pushbuttons;
    • anchor can be highlighted for enhanced visual feedback;
    • autosizing;
    • capable of displaying text/html, text/plain and standalone images;
    • supports the full HTML 3.2 standard; as well as the HTML 4.0 <FRAMESET> tags;
    • an extensive set of callback resources;
    • full text justification;
    • smart and user-definable font mapping;
    • can work with a predefined palette (which it can even create for you);
    • builtin quantizer using Floyd-Steinberg error diffusion;
    • four different dithering methods allow one to achieve an optimum balance between performance and image quality;
    • HTML Table support;
    • Support for HTML4.0 Events;
    • fully compatible with LessTif;
    • comes with an extensive set of documentation (manual pages, Programmers and Reference Guide and a collection of examples);

  • XmBalloon, a very lightweight "tooltip" Widget to show a one-line string in a small popup-window. Features include the following:
    • Choose between a rectangular or shaped window;
    • Popup window can be transparent;
    • User-configurable Popup and popdown delays;
    • very easy to use;

The XmHTML Widget Set also contain a number of routines which allow one to make full use of XmHTML's image support for purposes other than XmHTML.

Plans for the future include the migration of XmHTML's image support into a seperate Image library to allow authors to add image support to their applications with a single call.

Features missing in the current version of XmHTML are the following:

  • Java applets. Kaffe, might offer some solution here.




©Copyright 1996-1997 by Ripley Software Development
Last update: September 25, 1998 by Koen

XmHTML-1.1.10/html/PaxHeaders.1031/man.html0000644000175000001440000000013212613377377016217 xustar000000000000000030 mtime=1445854975.094545877 30 atime=1445854975.094545877 30 ctime=1445854975.094545877 XmHTML-1.1.10/html/man.html0000644000175000001440000000722212613377377015622 0ustar00chrisusers00000000000000 XmHTML Programmers Manual: Manual Pages

XmHTML Widget Set Manual Pages

XmHTML Convenience Functions




©Copyright 1996-1998 by Ripley Software Development
Last update: June 4, 1998 by Koen

XmHTML-1.1.10/html/PaxHeaders.1031/parser.html0000644000175000001440000000013212613377377016740 xustar000000000000000030 mtime=1445854975.097545877 30 atime=1445854975.097545877 30 ctime=1445854975.097545877 XmHTML-1.1.10/html/parser.html0000644000175000001440000003522512613377377016347 0ustar00chrisusers00000000000000 XmHTML Parser Description

XmHTML Parser Description

Overview

This document describes XmHTML's HTML parser in detail and provides background information on the how and why of document verification and repair. It is targetted towards programmers that want to make full use of the parser and document callback resources as well as programmers that want to use the generated parser tree for different purposes.

XmHTML's HTML parser is fairly powerfull in that it is capable of repairing even the most terrible HTML documents as well as converting a non HTML 3.2 conforming document to a HTML 3.2 conforming one. The only reason for the existance of these document verification and repair capabilities is that XmHTML only works with fully balanced HTML documents. A balanced HTML document is a document in which each terminated HTML element has its opening and closing members at the same level.

Parser Tree

When a document is loaded into XmHTML, the parser translates this document to a doubly linked list of objects (referred to as the Parser Tree). Each object contains either a HTML element (and its attributes) or plain text.
typedef struct _XmHTMLObject{
	htmlEnum id;		/* ID for this element */
	String element;		/* element text */
	String attributes;	/* attributes for this element, if any */
	Boolean is_end;		/* true when this is a closing element */
	Boolean terminated;	/* true when element has a closing counterpart */
	int line;		/* line number for this element */
	struct _XmHTMLObject *next;
	struct _XmHTMLObject *prev;
}XmHTMLObject;
The id field of this structure describes the type of element. The table at the end of this document lists all elements that XmHTML knows of.

When id is HT_ZTEXT, the element field contains plain text as read from the document (character escape sequences not expanded). The attributes, is_end and terminated elements are meaningless.

In all other cases, the element field contains the element name and the attributes field contains possible attributes for this element. When an element is terminated (that is, has a closing counterpart), the terminated field will be True, and the is_end field indicates whether the current element is an opening or a closing one. Only unterminated or opening elements can have attributes.

The element and attributes fields are contained in the same memory buffer, where the latter is separated from the former by a NULL character. When freeing an object, freeing the element field will also free the attribute field.

The line field contains the line number in the source document where the element is located.

The objects field in the XmHTMLDocumentCallbackStruct contains the starting point of the parser tree.

Programmers that want to use the generated parser tree for different purposes might be interested in some of the XmHTML private functions for extracting attribute values and character escape sequence expansion.

Document Verification

Document Repair

XmNparserCallback

typedef struct
{
	int reason;		/* the reason the callback was called */
	XEvent *event;		/* always NULL for XmNparserCallback */
	int no;			/* total error count uptil now */
	int line_no;		/* input line number where error was detected */
	int start_pos;		/* absolute index where error starts */
	int end_pos;		/* absolute index where error ends */
	parserError error;	/* type of error */
	int action;		/* suggested correction action */
	String err_msg;		/* error message */
}XmHTMLParserCallbackStruct, *XmHTMLParserCallbackStructPtr;
This table lists all possible values for the action field, together with a short description of what the parser response will be.

Action Description
XmHTML_REMOVE offending element will be removed
XmHTML_INSERT insert missing element
XmHTML_SWITCH switch offending and expected element
XmHTML_KEEP keep offending element
XmHTML_IGNORE ignore, proceed as if nothing happened
XmHTML_TERMINATE terminate parser

Shown below are all possible values for the error field (default action is displayed in bold), allowed actions and the value of the err_msg field. When the action field is set to an action that is not allowed for an error, XmHTML will use the default action.

error: HTML_UNKNOWN_ELEMENT
actions: XmHTML_REMOVE, XmHTML_TERMINATE
err_msg: %s: unknown HTML identifier

error: HTML_UNKNOWN_ESCAPE
actions: XmHTML_REMOVE, XmHTML_TERMINATE
err_msg: %s: unknown character escape sequence

error: HTML_BAD
actions: XmHTML_REMOVE, XmHTML_IGNORE, XmHTML_TERMINATE
err_msg: Terrible HTML! element %s completely out of balance.

error: HTML_OPEN_BLOCK
actions: XmHTML_INSERT, XmHTML_REMOVE, XmHTML_KEEP
err_msg: A new block level element (%s) was encountered while %s is still open.

error: HTML_CLOSE_BLOCK
actions: XmHTML_REMOVE, XmHTML_INSERT, XmHTML_KEEP, XmHTML_TERMINATE
err_msg: A closing block level element (%s) was encountered while it " was never opened.

error: HTML_OPEN_ELEMENT
actions: XmHTML_REMOVE, XmHTML_SWITCH, XmHTML_TERMINATE
err_msg: Unbalanced terminator: got %s while %s is required.

error: HTML_VIOLATION
actions: XmHTML_REMOVE, XmHTML_KEEP, XmHTML_TERMINATE
err_msg: %s may not occur inside %s

error: HTML_INTERNAL
actions: XmHTML_TERMINATE, XmHTML_IGNORE
err_msg: Internal parser error

XmNdocumentCallback

typedef struct
{
	int reason;		/* the reason the callback was called */
	XEvent *event;		/* always NULL for XmNdocumentCallback */
	Boolean html32;		/* True when document was HTML 3.2 conforming */
	Boolean verified;	/* True when document has been verified */
	Boolean balanced;	/* True when parser tree is balanced */
	int pass_level;		/* current parser level count. Starts at 0 */
	Boolean redo;		/* See below */
	XmHTMLObject *objects;	/* parser tree starting point */
}XmHTMLDocumentCallbackStruct;

Private Functions

XmHTML uses a number of functions to extract values from the attributes field of the XmHTMLObject structures. This section gives a brief overview of these functions, along with the prototypes. The functions themselves are defined in the header file XmHTMLfuncs.h.
extern Boolean _XmHTMLTagCheck(char *attributes, char *tag);
Returns True when tag is present in the given attributes.

extern Boolean _XmHTMLTagCheckValue(char *attributes, char *tag, char *check);
Returns True when tag has the specified value check and False if not.

extern char *_XmHTMLTagGetValue(char *attributes, char *tag);
Returns the value of tag if found in the given attributes, NULL otherwise. The return value must be freed by the caller.

extern int _XmHTMLTagGetNumber(char *attributes, char *tag, int def);
Returns the numerical value of tag if found in the given attributes. def specifies the return value if tag is not found.

The following function searches and expands any character escape sequences in the given string:

extern void _XmHTMLExpandEscapes(char *string);
This function recognizes all escape sequences from the ISO 8895-1 character set, as well as all &# character escapes below 160. Escape sequences are not required to have a terminating semi-colon.

XmHTML Element Identifiers

This table lists the internal identifiers, the name of the corresponding HTML element and whether an element is terminated or not. It includes the complete set of HTML 3.2 elements, as well as a small number of extensions.
XmHTML Element Identifiers
id Element Terminated id Element Terminated
HT_DOCTYPE !doctype False HT_A a True
HT_ADDRESS address True HT_APPLET applet True
HT_AREA area False HT_B b True
HT_BASE base False HT_BASEFONT basefont False
HT_BIG big True HT_BLOCKQUOTE blockquote True
HT_BODY body True HT_BR br False
HT_CAPTION caption True HT_CENTER center True
HT_CITE cite True HT_CODE, code True
HT_DD dd True HT_DFN dfn True
HT_DIR dir True HT_DIV div True
HT_DL dl True HT_DT dt True
HT_EM em True HT_FONT font True
HT_FORM form True HT_FRAME frame True
HT_FRAMESET frameset True HT_H1 h2 True
HT_H2 h2 True HT_H3 h3 True
HT_H4 h4 True HT_H5 h5 True
HT_H6 h6 True HT_HEAD head True
HT_HR hr False HT_HTML html True
HT_I i True HT_IMG img False
HT_INPUT input False HT_ISINDEX isindex False
HT_KBD kbd True HT_LI li True
HT_LINK link False HT_MAP map True
HT_MENU, menu True HT_META meta False
HT_NOFRAMES noframes True HT_OL ol True
HT_OPTION option True HT_P p True
HT_PARAM param False HT_PRE pre True
HT_SAMP samp True HT_SCRIPT script True
HT_SELECT select True HT_SMALL small True
HT_STRIKE strike True HT_STRONG strong True
HT_STYLE style True HT_SUB sub True
HT_SUP sup True HT_TAB tab False
HT_TABLE table True HT_TD td True
HT_TEXTAREA textarea True HT_TH th True
HT_TITLE, title True HT_TR tr True
HT_TT tt True HT_U u True
HT_UL ul True HT_VAR var True
HT_ZTEXT plain text False      




©Copyright 1996-1997 by Ripley Software Development
Last update: September 19, 1997 by Koen
XmHTML-1.1.10/html/PaxHeaders.1031/datatypes.html0000644000175000001440000000013212613377377017442 xustar000000000000000030 mtime=1445854975.094545877 30 atime=1445854975.094545877 30 ctime=1445854975.094545877 XmHTML-1.1.10/html/datatypes.html0000644000175000001440000001535112613377377017047 0ustar00chrisusers00000000000000 XmHTML Programmers Manual: Datatypes

XmHTML Widget Set Datatypes

XmHTML Datatypes

componentType
An enumeration value used by the XmNformCallback callback resource. Identifies the type of a form member. Possible values are:

FORM_CHECK checkbox
FORM_FILE file selection box
FORM_HIDDEN hidden input
FORM_IMAGE drawnbutton
FORM_OPTION select child
FORM_PASSWD password textfield
FORM_RADIO radiobox
FORM_RESET reset button
FORM_SELECT select parent
FORM_SUBMIT submit button
FORM_TEXT singleline textfield
FORM_TEXTAREA multiline edit field
FORM_UNKNOWN unknown type

htmlEnum
An enumeration value representing a HTML tag. There are too many values to list them all (more than 70). See <XmHTML/HTML.h> for a complete list of the possible values this datatype can have.

URLType
An enumeration value representing the type of a Uniform Resource Locater. Possible values are:

ANCHOR_ABOUT href="about:..."
ANCHOR_EXEC href="exec:foo_bar"
ANCHOR_FILE_REMOTE href="file://foo.bar/file.html"
ANCHOR_FTP href="ftp://foo.bar/file"
ANCHOR_GOPHER href="gopher://foo.bar:70"
ANCHOR_HTTP href="http://foo.bar/file.html"
ANCHOR_SECURE_HTTP href="https://foo.bar/file.html"
ANCHOR_INFO href="info:.."
ANCHOR_MAILTO href="mailto:foo@bar"
ANCHOR_MAN href="man:..."
ANCHOR_NEWS href="news://foo.bar"
ANCHOR_PIPE href="pipe:foo_bar"
ANCHOR_TELNET href="telnet://foo.bar:23"
ANCHOR_WAIS href="wais://foo.bar"
ANCHOR_XEXEC href="xexec:foo_bar"
ANCHOR_UNKNOWN unknown href
ANCHOR_FILE_LOCAL href="file.html"
ANCHOR_JUMP href="#..."
ANCHOR_NAMED name="...."

XmHTMLDirection
Specifies the search direction. Valid values are: XmHTML_FORWARD, search forward, and XmHTML_BACKWARD, search backwards.

XmHTMLElementId
An opaque type representing a user-installed HTML element. Used by the XmNobjectCallback callback resource.

XmHTMLObjectId
An opaque type representing an embedded object. Used by the XmNobjectCallback callback resource.

XmHTMLRegexStatus
Specifies the return value of the XmHTMLTextFindString convenience function. Possible values are:

XmREG_ERROR indicates an error occured
XmREG_NOMATCH end of text reached but no matching text found
XmREG_MATCH a valid match was found

XmHTMLTextFinder
An opaque type representing a HTML text search engine.

XmHTMLTextPosition
An opaque type representing a location in the currently displayed document.

XmHTMLObjectStatus
An enumeration representing return values from the XmHTMLObject convenience functions. Possible values are:

OBJECT_ALMOST action completed, further action required
OBJECT_DESTROYED object has been destroyed
OBJECT_EMPTY object is empty
OBJECT_ERROR unknown error
OBJECT_FATAL fatal object error has occured
OBJECT_INVALID invalid object
OBJECT_INVALID_LOCATION object has an invalid location
OBJECT_INVALID_SIZE object has an invalid size
OBJECT_LOWERED object is lowered into the current document
OBJECT_MAPPED object is mapped to screen
OBJECT_OK action completed succesfully
OBJECT_ORPHANED object has no parent
OBJECT_PARENTED object already has a parent
OBJECT_RAISED object is raised out of the current document
OBJECT_UNIMPLEMENTED requested function is unimplemented
OBJECT_UNKNOWN unknown object
OBJECT_UNKNOWN_ELEMENT invalid element id
OBJECT_UNMAPPED object has been unmapped
OBJECT_UNUSED object is not being used
OBJECT_USED object is currently being used
OBJECT_VISIBLE object is visible

XmImageStatus
An enumeration value representing the return value from the various XmImage convenience functions.

XmIMAGE_ERROR unknown error occured
XmIMAGE_BAD bad function call: missing arguments
XmIMAGE_UNKNOWN provided XmImageInfo structure unknown/unbound
XmIMAGE_ALMOST action completed, further response necessary
XmIMAGE_OK action completed successfully




©Copyright 1996-1998 by Ripley Software Development
Last update: June 4, 1998 by Koen

XmHTML-1.1.10/html/PaxHeaders.1031/custom_map.txt0000644000175000001440000000013212613377377017466 xustar000000000000000030 mtime=1445854975.094545877 30 atime=1445854975.094545877 30 ctime=1445854975.094545877 XmHTML-1.1.10/html/custom_map.txt0000644000175000001440000001227712613377377017077 0ustar00chrisusers00000000000000<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html> <head> <META NAME="Author" CONTENT="Koen D'Hondt"> <META HTTP-EQUIV="Description" CONTENT="XmHTML font mapping."> </head> <body> <!-- Sample font map definition --> <!-- various forms of helvetica --> <!-- verdana is helvetica on macintosh --> <!-- all possible sizes, plain style --> <font face="verdana,helvetica" size="1"></font> <font face="verdana,helvetica" size="2"></font> <font face="verdana,helvetica" size="3"></font> <font face="verdana,helvetica" size="4"></font> <font face="verdana,helvetica" size="5"></font> <font face="verdana,helvetica" size="6"></font> <font face="verdana,helvetica" size="7"></font> <!-- all possible sizes, bold style --> <b><font face="verdana,helvetica" size="1"></font></b> <b><font face="verdana,helvetica" size="2"></font></b> <b><font face="verdana,helvetica" size="3"></font></b> <b><font face="verdana,helvetica" size="4"></font></b> <b><font face="verdana,helvetica" size="5"></font></b> <b><font face="verdana,helvetica" size="6"></font></b> <b><font face="verdana,helvetica" size="7"></font></b> <!-- all possible sizes, italic style --> <i><font face="verdana,helvetica" size="1"></font></i> <i><font face="verdana,helvetica" size="2"></font></i> <i><font face="verdana,helvetica" size="3"></font></i> <i><font face="verdana,helvetica" size="4"></font></i> <i><font face="verdana,helvetica" size="5"></font></i> <i><font face="verdana,helvetica" size="6"></font></i> <i><font face="verdana,helvetica" size="7"></font></i> <!-- all possible sizes, bold-italic style --> <b><i><font face="verdana,helvetica" size="1"></font></i></b> <b><i><font face="verdana,helvetica" size="2"></font></i></b> <b><i><font face="verdana,helvetica" size="3"></font></i></b> <b><i><font face="verdana,helvetica" size="4"></font></i></b> <b><i><font face="verdana,helvetica" size="5"></font></i></b> <b><i><font face="verdana,helvetica" size="6"></font></i></b> <b><i><font face="verdana,helvetica" size="7"></font></i></b> <!-- arial is helvetica on ms-windows --> <!-- all possible sizes, plain style --> <font face="arial,helvetica" size="1"></font> <font face="arial,helvetica" size="2"></font> <font face="arial,helvetica" size="3"></font> <font face="arial,helvetica" size="4"></font> <font face="arial,helvetica" size="5"></font> <font face="arial,helvetica" size="6"></font> <font face="arial,helvetica" size="7"></font> <!-- all possible sizes, bold style --> <b><font face="arial,helvetica" size="1"></font></b> <b><font face="arial,helvetica" size="2"></font></b> <b><font face="arial,helvetica" size="3"></font></b> <b><font face="arial,helvetica" size="4"></font></b> <b><font face="arial,helvetica" size="5"></font></b> <b><font face="arial,helvetica" size="6"></font></b> <b><font face="arial,helvetica" size="7"></font></b> <!-- all possible sizes, italic style --> <i><font face="arial,helvetica" size="1"></font></i> <i><font face="arial,helvetica" size="2"></font></i> <i><font face="arial,helvetica" size="3"></font></i> <i><font face="arial,helvetica" size="4"></font></i> <i><font face="arial,helvetica" size="5"></font></i> <i><font face="arial,helvetica" size="6"></font></i> <i><font face="arial,helvetica" size="7"></font></i> <!-- all possible sizes, bold-italic style --> <b><i><font face="arial,helvetica" size="1"></font></i></b> <b><i><font face="arial,helvetica" size="2"></font></i></b> <b><i><font face="arial,helvetica" size="3"></font></i></b> <b><i><font face="arial,helvetica" size="4"></font></i></b> <b><i><font face="arial,helvetica" size="5"></font></i></b> <b><i><font face="arial,helvetica" size="6"></font></i></b> <b><i><font face="arial,helvetica" size="7"></font></i></b> <!-- Inform ourselves that we have finished loading the font map --> Default font map loaded. </body> </html> XmHTML-1.1.10/html/PaxHeaders.1031/progguide.html0000644000175000001440000000013212613377377017431 xustar000000000000000030 mtime=1445854975.098545877 30 atime=1445854975.098545877 30 ctime=1445854975.098545877 XmHTML-1.1.10/html/progguide.html0000644000175000001440000001641312613377377017036 0ustar00chrisusers00000000000000 XmHTML Widget Set Programmers Guide

XmHTML Widget Set Programmers Guide

This document describes the resources, callbacks and translations associated with XmHTML. XmHTML provides a widget capable of displaying HTML 3.2 confirming text.

Table of Contents

  1. Legal Issues, distribution and licensing

  2. XmHTML Widget

    1. The Basics of a XmHTML Widget
      1. Creating a XmHTML Widget
      2. The XmHTML Widget's Text
      3. The XmHTML Widget's Dimensions
        1. Autosizing a XmHTML Widget
        2. XmHTML Widget's Dimensions and Resources
      4. Document Scrolling
      5. XmHTML Children
    2. Modifying the Document Appearance
      1. Changing the Anchor Appearance
      2. Marking a Visited Anchor
      3. Specifying the Document Fonts
        1. Specifying the Character Set
        2. Specifying the Font Family
        3. Specifying the Font Sizes
    3. XmHTML and Images
      1. The XmImageInfo Structure
        1. The XmImageInfo Structure Explained
      2. The XmHTMLDefaultImageProc
      3. Animations
      4. XmHTMLs' Imagemap Support
    4. XmHTML Widget Callback Functions
      1. Anchor Activation Callback
      2. Anchor Tracking Callback
      3. Frame Notification Callback
      4. Form Activation Callback
      5. Imagemap Activation Callback
      6. Document Verification Callback
      7. Document Link Callback
      8. Document Motion Callback
      9. Document Arm Callback
      10. Document Input Callback
    5. Collective Example
    6. Advanced XmHTML Programming Techniques
      1. Adding Support for HTML Frames
      2. Delayed Image Loading
      3. Adding Support for Other Imagetypes
      4. Using XmHTML's Image Support for Other Purposes
        1. The XmImage Structure
        2. Creating a XmImage
        3. Destroying a XmImage
        4. How to use a XmImage

  3. XmHTMLParser Widget

    1. Creating a XmHTMLParser Widget
      1. The XmHTMLParser Widget's Text
    2. Configuring a XmHTMLParser Widget
    3. XmHTMLParser Widget Callback Functions
      1. Parser Callback
      2. ModifyVerify Callback
      3. Document Verification Callback
    4. Advanced XmHTMLParser Programming Techniques
      1. Progressive Document Parsing
      2. Accessing XmHTMLParser's Parser Tree
      3. Creating a HTML Document from XmHTMLParser's Output

  4. XmHTML Functions and Macros

  5. XmHTML Widget Classes
    1. XmHTML

  6. Structures

  7. Procedures

  8. Data Types

  9. HTML Extensions




©Copyright 1996-1998 by Ripley Software Development
Last update: June 4, 1998 by Koen
XmHTML-1.1.10/html/PaxHeaders.1031/extensions.html0000644000175000001440000000013212613377377017643 xustar000000000000000030 mtime=1445854975.094545877 30 atime=1445854975.094545877 30 ctime=1445854975.094545877 XmHTML-1.1.10/html/extensions.html0000644000175000001440000001711512613377377017250 0ustar00chrisusers00000000000000 XmHTML HTML extensions

XmHTML HTML Extensions

XmHTML implements the following extensions to the HTML 3.2 standard.

The FRAMESET Extension

XmHTML widget's fully recognize and support the <FRAMESET> extension. See the XmHTML Programmers Manual on how you can add frame support to your application by using XmHTML.

Extensions to the <A> Element

Support for the <FRAMESET> extension also implies that XmHTML recognizes the target attribute on the <A> element.

Besides being usefull for the frameset extension, the target attribute can be usefull in a variety of other ways, e.i., one could use this extension in a Hypertext Help system to indicate that something should be displayed in a popup window.

Extensions to the <FONT> Element

XmHTML widget's fully support the FACE tag on the HTML 3.2 <FONT> element. This extension specifies the typeface of a font in which the text that this element encloses should be rendered.

The value for this tag should be a quoted, comma seperated list of alternative typefaces.

Extensions to the <OL> Element

XmHTML introduces the ISINDEX tag to the HTML 3.2 <OL> element. Using this extension produces a Table of Contents by propagating the current item numbering within nested lists:
<OL>
	<LI>The Basics of a XmHTML Widget
	<OL ISINDEX TYPE="a">
		<LI>Creating a XmHTML Widget
		<LI>The XmHTML Widget's Text
	</OL>
	<LI>Modifying the Document Appearance
</OL>
is rendered as:
	1. The Basics of a XmHTML Widget
		1.a Creating a XmHTML Widget
		1.b The XmHTML Widget's Text
	2. Modifying the Document Appearance
This extension can be used with any combination of the TYPE and START tags.

Extensions to the <INPUT> Element

A XmHTML Widget fully supports the file form input element. This element is consists of a textfield with a pushbutton. When a user presses this button a file selection dialog is displayed allowing the user to select a file for uploading.

The following attributes are recognized for this input element:

NAME=string, VALUE=string, SRC=string, SIZE=n, MULTIPLE

NAME
Mandatory, name for this input field;
VALUE
optional, a label to be used for the pushbutton. The default value is Browse...;
SRC
optional, a file selection pattern to be used for the file selection dialog. The default value is *;
SIZE
optional, the width of the textfield. The default value is 20;
MULTIPLE
optional, allows multiple file selection. Each file that is selected via the file selection dialog is separated from already selected files by a colon.

The ALIGN tag

The ALIGN tag is extended by one additional alignment, namely JUSTIFY. This alignment will cause text to be justified between the text margins, causing each line in a paragraph to have the same left and right margin. The last line in a paragraph is never justified, it's alignment is determined by the default alignment.

Hyphenation is not supported by this extension, but may be added in the future when a LANGUAGE tag is added to the STYLE element.

This extension for the ALIGN tag is supported for the following elements:

  • <P>
  • <DIV>
  • <TABLE>
  • <TD>
  • <TH>
  • <H1> thru <H6>
  • The COLOR tag

    XmHTML extends the use of the COLOR tag from the <FONT> element to a number of other HTML elements. These elements are:

  • <CODE>
  • <SAMP>
  • <KBD>
  • <TT>
  • <STRONG>
  • <B>
  • <EM>
  • <VAR>
  • <CITE>
  • <I>
  • <ADDRESS>
  • <H1> thru <H6>
  • <BLOCKQUOTE>
  • <PRE>
  • <DIV> and its derivative <CENTER>
  • <P>
  • <HR> with or without the noshade attribute set. Rules inherit the color attribute from surrounding container tags (such as <DIV> or <CENTER>)
  • Color Specification

    Colors are given in RGB as hexadecimal numbers (e.g. COLOR="#C0FFC0") or as one of 16 widely understood color names. These colors were originally picked as being the standard 16 colors supported with the Windows VGA palette (or how low can you go).
    Color names and sRGB values
     Black = "#000000"  Green = "#008000"
     Silver = "#C0C0C0"  Lime = "#00FF00"
     Gray = "#808080"  Olive = "#808000"
     White = "#FFFFFF"  Yellow = "#FFFF00"
     Maroon = "#800000"  Navy = "#000080"
     Red = "#FF0000"  Blue = "#0000FF"
     Purple = "#800080"  Teal = "#008080"
     Fuchsia = "#FF00FF"  Aqua = "#00FFFF"




    ©Copyright 1996-1997 by Ripley Software Development
    Last update: April 3, 1998 by Koen
    XmHTML-1.1.10/html/PaxHeaders.1031/LGPL.html0000644000175000001440000000013212613377377016202 xustar000000000000000030 mtime=1445854975.093545877 30 atime=1445854975.093545877 30 ctime=1445854975.093545877 XmHTML-1.1.10/html/LGPL.html0000644000175000001440000006454612613377377015621 0ustar00chrisusers00000000000000 GNU Library General Public License

    GNU Library General Public License

    [Note: if your browser does not know how to handle the start attribute on numbered lists, the section numbering will start at one instead of zero, and subsequent section references in this document will be incorrect.]

     
    GNU LIBRARY GENERAL PUBLIC LICENSE
    Version 2, June 1991

    Copyright (C) 1991 Free Software Foundation, Inc.
    675 Mass Ave, Cambridge, MA 02139, USA
    Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

    Preamble

    The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.

    This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too.

    When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.

    To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it.

    For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights.

    Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library.

    Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations.

    Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.

    Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license.

    The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such.

    Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better.

    However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries.

    The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library.

    Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one.

    GNU LIBRARY GENERAL PUBLIC LICENSE
    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

    1. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you".

      A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.

      The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".)

      "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.

      Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.

    2. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.

      You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

    3. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:

      1. The modified work must itself be a software library.

      2. You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.

      3. You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.

      4. If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.

        (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)

      These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.

      Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.

      In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.

    4. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.

      Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.

      This option is useful when you wish to copy part of the code of the Library into a program that is not a library.

    5. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.

      If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.

    6. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.

      However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.

      When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.

      If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)

      Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.

    7. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.

      You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:

      1. Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)

      2. Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.

      3. If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.

      4. Verify that the user has already received a copy of these materials or that you have already sent this user a copy.

      For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

      It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.

    8. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:

      1. Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.

      2. Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.

    9. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

    10. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.

    11. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.

    12. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.

      If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.

      It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.

      This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.

    13. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.

    14. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

      Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.

    15. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.

    NO WARRANTY

    1. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

    2. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

    END OF TERMS AND CONDITIONS

    Appendix: How to Apply These Terms to Your New Libraries

    If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License).

    To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.

    <one line to give the library's name and a brief idea of what it does.>

    Copyright (C) <year> <name of author>

    This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

    This library 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 Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

    Also add information on how to contact you by electronic and paper mail.

    You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names:

    Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker.

    <signature of Ty Coon>, 1 April 1990
    Ty Coon, President of Vice

    That's all there is to it! XmHTML-1.1.10/html/PaxHeaders.1031/getit.html0000644000175000001440000000013212613377377016560 xustar000000000000000030 mtime=1445854975.094545877 30 atime=1445854975.094545877 30 ctime=1445854975.094545877 XmHTML-1.1.10/html/getit.html0000644000175000001440000000702112613377377016160 0ustar00chrisusers00000000000000 XmHTML Sites & Mailing Lists

    XmHTML Distribution Sites

    Master Site: http://www.xs4all.nl/~ripley/XmHTML

    Alternate Sites

    Europe

    United States

    Volunteers for additional distribution sites are welcome.

    Daily Snapshots

    Daily snapshots are also available. They represent my current version and as such may not behave as expected, they may not even compile. Use at your own risk.

    Due to diskspace limitations my ISP poses, only one snapshot is available at any given time. Patches between snapshots are also available so you don't need to download the entire archive, but just have to get the patches to move to the latest version.

    You can find them here and at. http://www.nerdnet.nl

    Mailing Lists

    You can subscribe to the XmHTML mailing list by sending an email to Majordomo@simplicity.net and placing the following in the BODY of your mail:

    subscribe xmhtml-dev <your email address>

    You will receive a message confirming your subscribtion.


    Mail Us

    ©Copyright 1996-1998 by Ripley Software Development
    Last update: September 3, 1998 by Koen
    XmHTML-1.1.10/html/PaxHeaders.1031/xmhtml_prog.html0000644000175000001440000000013212613377377020004 xustar000000000000000030 mtime=1445854975.098545877 30 atime=1445854975.098545877 30 ctime=1445854975.098545877 XmHTML-1.1.10/html/xmhtml_prog.html0000644000175000001440000024511112613377377017410 0ustar00chrisusers00000000000000 XmHTML Programmers Guide

    Chapter 2
    XmHTML Widgets

     

    Have you ever wanted to write an application capable of displaying HTML documents, went out to find a Widget which offered HTML display capabilities and finally give up on your wonderfull idea when no such widget seemed to be available? Maybe you did find a HTML widget but were not satisfied with its capabilities? With the XmHTML Widget described in this chapter you no longer have to despair.

    With the XmHTML Widget one can create applications that range from simple HTML viewers to full-blown WWW browsers. The XmHTML Widget offers a widget capable of displaying HTML documents and, as one would expect, allows full interactive use of HTML documents thru various callback resources and convenience functions. Besides of being able to display HTML documents, displaying of plain text and images is also supported.

    XmHTML widgets provide the following mechanisms for program control:

    • Resources that access the widget's content and can alter it's appearance.
    • Callback resources that allow navigation through and between HTML documents when hyperlinks are activated.
    • Callback resources that provide both visual and content information about the widget's text.
    • Keyboard management methods that control output (paging style).
    • Convenience routines allowing quick and easy ways to load images, scroll through the widget's text and access document information.

    XmHTML widgets implement the full HTML 3.2 standard as well as a few extensions. The chapter on HTML Extensions lists the supported extensions. One supported extension that is worthwhile to mention is the <FRAMESET> extension.

    The current implementation of the XmHTML widget does have its limitations though. The most important features lacking in the current release (1.0.22 Alpha) are support for HTML tables and progressive document loading. All these features will be added in due time.

    As you will notice in this chapter, the behaviour and name of a number of XmHTML's resources and convenience functions closely resemble those of Motif's Text widget. The first reason for this similarity is that both widget's display text. The second reason is that, if you are already familiar with Motif's Text widget, the interface to a XmHTML widget will also look familiar and thus learning how to use a XmHTML widget will be a bit easier.

    2.1 The Basics of a XmHTML Widget

    To understand and appreciate most of the material described in this chapter, it is important to address some of the basic resources and functions provided by the XmHTML widget. The widget's text and HTML verification process, document fonts, dimensions of the widget and hyperlink resources are among the most important. We begin with how to create a standard XmHTML widget.

    2.1.1 Creating a XmHTML Widget

    Applications that wish to use XmHTML widgets need to include the file <XmHTML.h>. You can create a standard XmHTML widget using the XtVaCreateManagedWidget() function:
    	Widget html_w;
    
    	html_w = XtVaCreateManagedWidget("name", xmHTMLWidgetClass, parent,
    		resource-value pairs,
    		NULL);
    
    The resource-value pairs can be any number of resources specific to the XmHTML widget or its superclasses. Please note that the XmHTML widget is subclassed from the Manager widget class.

    Another way of creating a standard XmHTML widget is by using the XmCreateHTML() convenience function:

    	Widget html_w;
    
    	html_w = XmCreateHTML(parent, "name", args, nargs);
    
    The args argument can be any number of resource-value pairs specified using the XtSetArg function. nargs specifies how many resource-value pairs are contained in the args argument.

    2.1.2 The XmHTML Widget's Text

    The first thing to learn about the XmHTML widget is how to access its internal text storage. The most simple method to do this is by using the XmNvalue resource. Unlike most widgets in the Motif toolkit that use text, the XmHTML widget does not use compound strings for its value. Instead, the value is specified as a regular C string as shown in example 2-1.

    Example 2-1. The simple_html.c program

    /* simple_html.c -- Create a minimally configured XmHTML widget */
    #include <XmHTML.h>
    
    main(int argc, char **argv)
    {
    	Widget toplevel;
    	XtAppContext app;
    
    	toplevel = XtVaAppInitialize(&app, "Demos", NULL, 0,
    		&argc, argv, NULL, NULL);
    
    	XtVaCreateManagedWidget("html", xmHTMLWidgetClass, toplevel,
    		XmNvalue, "<html><body>A minimally configured XmHTML widget."
    			"</body></html>",
    		NULL);
    
    	XtRealizeWidget(toplevel);
    	XtAppMainLoop(app);
    }
    
    This short program simply creates a XmHTML widget whose initial value is set to "A minimally configured XmHTML widget." (See Figure 2-1).

    [A Simple HTML Widget]
    Figure 2-1. simple_html.c: a minimally configured XmHTML widget

    HTML Verification

    As one can see in the above example, the value of the XmNvalue resource contains five HTML elements: four markup and one text element. This brings us to one of the most important aspects of the XmHTML widget: it is a widget for displaying HTML documents. HTML documents are text documents written in the HyperText Markup Language, which is a language composed of a set of elements that define a document and guide its display.

    In order for XmHTML to display such a document properly, it is necessary that the widget verifies the correctness of these markup elements. It does this by comparing the contents of the document that is to be displayed against the now official W3C HTML 3.2 recommendation (referred to as the HTML 3.2 standard). This standard defines both appearance and content of each markup element. During this verification process (which is performed before anything is displayed), the widget goes thru great lengths as to ensure that the document adheres to this standard. As such, the widget is capable of modifying the specified markup elements substantially (it will never modify text elements). The disadvantage of this document verification is that a document might not look as expected, but the main advantage is that even the most horrid HTML document will be displayed.

    A detailed description of this document verification and repair process is given in the next chapter, so we will only mention that the more a document adheres to the HTML 3.2 standard, the less the widget will modify the markup elements.

    Setting a XmHTML Widget's Text

    The initial value of the XmNvalue resource may be set either at initialization time (as in example 2-1) or by using XtVaSetValues:
    	XtVaSetValues(html_w, XmNvalue, text, NULL);
    
    This resource always represents the entire text of the widget.

    Another method for setting the text in a XmHTML widget is by using the convenience routine XmHTMLTextSetString:

    	void
    	XmHTMLTextSetString(html_w, value)
    		Widget  html_w;
    		char   *value;
    
    Although the two methods produce the same results, the convenience routine may be more efficient since it accesses the internals of the widget directly (The XtVaSetValues() method involves going through the X Toolkit Intrinsics). On the other hand, if you are also setting many other resources at the same time, the XtVaSetValues method is better since it saves the overhead of multiple function calls (All resources can be set in a single call).

    Whichever function you use, the value (however it is provided) is copied into the internals of the widget. This is important to known if you have provided the value via an allocated memory buffer: once the text is set in the widget, you can safely free this memory buffer.

    A XmHTML widget's may contain large amounts of text provided there is enough memory available on the computer running the client application. The upper limit on the number of bytes a XmHTML widget may have is given by the maximum value of an unsigned int (4 gigabyte on 32 bit systems), so it is more likely that the user's computer will run out of memory before the XmHTML widget's maximum capacity is reached.

    Getting a XmHTML Widget's Text

    XmHTML widget's provide several methods for obtaining text. Before learning how to get the widget's text however, it is important to make a distinction between the source text and the displayed text. The source text is the text you have set into a XmHTML widget by using the XmNvalue resource (or by using the XmHTMLTextSetString() convenience function), while the displayed text is the source text after HTML verification has taken place. This distinction is important since XmHTML widget's will never modify the source text but instead create a new HTML document while the HTML verification process is taking place.

    [Note: A new HTML document is not actually created: when text is set in a XmHTML widget, the HTML parser translates the source text to a list of internal objects. The new HTML document that is mentioned in the above paragraph only exists in theory but can be created upon request as we will soon see.]

    You might ask yourself why this distinction is important. The answer is that it depends on the type of application you are using a XmHTML widget for. Lets assume you are using a XmHTML widget in an application that displays HTML documents you have retrieved via a network layer (a WWW browser for example). When the user of your application wishes to save the document he has been viewing, it is most likely he wishes to save the original document and not the verified document. On the other hand, when you are using a XmHTML widget in an application intended for writing and/or verifying HTML documents, the most obvious thing a user would want to save is his verified document.

    Getting the Source Text

    So how does one go about getting a XmHTML widget's text? To get the widget's source text, you can use either XtVaGetValues() or the XmHTMLTextGetSource() convenience function. Both methods return the value of the XmNvalue resource. The value returned is a pointer to the internal text storage, which may never be freed nor modified. The code fragment below demonstrates how to use the convenience function:
    	String text_p;
    
    	if((text_p = XmHTMLTextGetSource(html_w)) != NULL)
    	{
    		/* Save, display the text, but never modify or free it */
    	}
    
    Or, by using the Xt function XtVaGetValues():
    	String text;
    
    	XtVaGetValues(html_w, XmNvalue, &text_p, NULL);
    
    Similar to using the XmHTMLTextSetString() convenience function to set a XmHTML widget's text, using the XmHTMLTextGetSource() to get a XmHTML widget's text may be more efficient since it accesses the internals of the widget directly instead of going through the X Toolkit Intrinsics.

    [Note: It is also worthwhile to mention that all of the XmHTML... convenience functions access the internals of the XmHTML widget directly. None of them involves going through the X Toolkit Intrinsics.]

    If you want to modify the source text, or you just want a copy of the text that you can modify for other reasons, then you must copy the text into your own local dataspace:

    	char *text_p, buf[1024];
    
    	text_p = XmHTMLTextGetSource(html_w);
    
    	(void)strncpy(buf, text_p, 1024);
    	/* modify "buf" all you want */
    
    Here, we don't know how much text text_p points to, but for purposes of this demonstration, we assume it's not more than 1024 bytes. Just to be sure that we don't cause an overflow of buf, we use strncpy(). Let me stress that, unless you are intimately familiar with the nature of the XmHTML widget your are using, it is unwise to make general assumptions about the amount of text you are getting.

    Getting the Displayed Text

    The method to get the displayed text is very similar to the Motif Text XmTextGetString() convenience function: XmHTMLTextGetString(). Both functions allocate enough space (using XtMalloc()) to contain all the text and return a pointer to this newly allocated area. While the pointer can be modified any way you like, you must free it using XtFree() when you are through using it. The code fragment below demonstrates how this function may be used:
    	String text_p;
    
    	if((text_p = XmHTMLTextGetString(html_w)) != NULL)
    	{
    		/*
    		* Allocated memory returned.
    		* do anything with "text_p" you want.
    		*/
    		XtFree(text_p);
    		/* we *must* free "text" or there will be a memory leak */
    	}
    
    This convenience function returns a HTML document created from the XmHTML widget's internal representation of the original source document after HTML verification has taken place. Depending on the adherance to the HTML 3.2 standard of the original source document, the newly created HTML document may or may not differ from the original source document. If there is a difference, it will only be found in the markup elements; XmHTML widget's never modify text elements.

    Getting the displayed text of a XmHTML widget is potentially an expensive operation if the widget contains large amounts of text. A XmHTML widget needs to create a HTML document from the internal representation every time XmHTMLTextGetString() is called.

    2.1.3 XmHTML Widget's Dimensions

    Let's return to Example 2-1 and examine more closely what is exposed to the user. As you can notice from the output of the program (shown in Figure 2-1), a vertical scrollbar is displayed and the text is not entirely visible: the user has to drag the vertical scrollbar to see all the text contained in the XmHTML widget. When no size has been specified, the width of a XmHTML widget defaults to 20 ex (a TEX measure for average character width) and the height of a single line in the default font.

    You specify the size of a XmHTML widget by using the XmNwidth and XmNheight resources (which a XmHTML widget inherits from the Core widget), as shown in Example 2-2:

    Example 2-2. The simple_html2.c program

    /* simple_html2.c -- Create another minimally configured XmHTML widget */
    #include <XmHTML.h>
    
    main(int argc, char **argv)
    {
    	Widget toplevel;
    	XtAppContext app;
    
    	toplevel = XtVaAppInitialize(&app, "Demos", NULL, 0,
    		&argc, argv, NULL, NULL);
    
    	/* create a XmHTML widget but this time we specify a size */
    	XtVaCreateManagedWidget("html", xmHTMLWidgetClass, toplevel,
    		XmNvalue, "<html><body>Another minimally configured XmHTML "
    			"widget.</body></html>",
    		XmNwidth, 200,
    		XmNheight, 75,
    	NULL);
    
    	XtRealizeWidget(toplevel);
    	XtAppMainLoop(app);
    }
    
    The output of this program is shown in Figure 2-2.

    [Another Simple HTML Widget]
    Figure 2-2. simple_html2.c: another minimally configured XmHTML widget

    The specified width and height are only used at initialization. Once the application is up and running, the user can resize windows and effectively change those dimensions.

    2.1.3.1 Autosizing a XmHTML Widget

    As you can see in Figure 2-2, the widget's text is now entirely visible but a vertical scrollbar is still present. We could remove this vertical scrollbar by obtaining a handle to it and then unmanaging it, but another and more subtle way to remove the vertical scrollbar is to use the autosizing feature of a XmHTML widget as shown in Example 2-3.

    Example 2-3. The autosize_html.c program

    /* autosize_html.c -- Demonstrate the autosizing feature of a XmHTML widget */
    #include <XmHTML.h>
    
    main(int argc, char **argv)
    {
    	Widget toplevel;
    	XtAppContext app;
    
    	toplevel = XtVaAppInitialize(&app, "Demos", NULL, 0,
    		&argc, argv, NULL, NULL);
    
    	/* make sure we may resize ourselves */
    	XtVaSetValues(toplevel, XmNallowShellResize, True, NULL);
    
    	/* create a XmHTML widget but this time enable autosizing */
    	XtVaCreateManagedWidget("html", xmHTMLWidgetClass, toplevel,
    		XmNvalue, "<html><body>An AutoSizing XmHTML widget.</body></html>",
    		XmNresizeWidth, True,
    		XmNresizeHeight, True,
    	NULL);
    
    	XtRealizeWidget(toplevel);
    	XtAppMainLoop(app);
    }
    
    The output of this program is shown in Figure 2-3.

    [An Autosizing HTML Widget]
    Figure 2-3. autosize_html.c: an autosizing XmHTML widget

    When looking at Example 2-3, we notice a few things that are of interest. First of all, there is the XmNallowShellResize resource. The value of this resource determines whether a Shell widget (or any of its subclasses, in this case a topLevelShellWidget) will honor geometry requests from its children. Since we want the XmHTML widget to compute its own size, we must set this resource to True (it is False by default).

    The second and most interesting thing to notice are the XmNresizeWidth and XmNresizeHeight resources. These resources control the autosizing feature of XmHTML widgets. The first enables autosizing in horizontal direction and the latter in vertical direction. When the XmNresizeWidth resource is set to True, XmHTML widget's base their initial width on the width of the longest text element in the source document, with a maximum of 80 characters. XmHTML widget's with autosizing enabled will never cover the entire screen: the maximum dimensions a XmHTML widget take will never exceed 80% of the available screen dimensions.

    In strong contrast with specifying the dimensions of XmHTML widget's using the XmNwidth and XmNheight resources, autosizing is persistent: When the user resizes a window, the dimensions of a XmHTML widget are not affected. Autosizing remains effective as long as the autosizing resources are set.

    You should use the autosizing feature of XmHTML widget's sparingly. Dynamic resizing of widgets is generally considered as poor design. This is especially true of widgets in a Shell or Dialog with other elements in it.

    An example of acceptable use of dynamic resizing would be when a XmHTML widget is used in a popup dialog used for displaying small amounts of text (such as explanation of terminology in a Hypertext Help system).

    2.1.3.2 XmHTML Widget's Dimensions and Resources

    As we will see in section 2.1.5, XmHTML Children, a XmHTML widget creates three subwidgets: a DrawingArea and two scrollbars.

    When a XmHTML widget is created, the size of the DrawingArea is set explicitly by the widget itself, but it uses the Motif default values when it creates the scrollbars. It is important that you realize this when you set the dimensions of a XmHTML widget by means of application-wide fallback resources or when specifying them in a resource file: if you specify the dimensions of a XmHTML widget using resource wildcarding you can be sure to expect unwanted behaviour whenever text is set into the widget.

    The correct way to specify the widget dimensions is as follows:

    static String fallbackResources[] = {
    	"*XmHTML.width:       575",
    	"*XmHTML.height:      600",
    };
    
    This will only set the width of the DrawingArea subwidget to 575 pixels and the height to 600 pixels, leading to the expected behaviour.

    If on the other hand you incorrectly specify the dimensions as follows:

    static String fallbackResources[] = {
    	"*XmHTML*width:       575",
    	"*XmHTML*height:      600",
    };
    
    you are not only setting the dimensions of the DrawingArea subwidget but also the dimensions for every subwidget created by a XmHTML widget. Needless to say that this kind of behaviour is unwanted. The correct way to specify the dimensions of both a XmHTML widget and its ScrollBar subwidgets is as follows:
    static String fallbackResources[] = {
    	"*XmHTML.width:       575",
    	"*XmHTML.height:      600",
    	"*XmHTML*verticalScrollBar.width:       25",
    	"*XmHTML*horizontalScrollBar.height:    25",
    };
    

    [Note: although it is possible to use resource wildcarding to set the dimensions of a XmHTML widget when the width and height of a ScrollBar are explicitly set, it is advisable that this is never done. The problem is not limited to the dimensions of the ScrollBars subwidgets but extends to any subwidgets a XmHTML widget creates when it encounters a HTML document with a <FORM></FORM> declaration in it.]

    2.1.4 Document Scrolling

    Adding document scrolling to XmHTML widget's is easy: you don't. If you look at the output of Example 2-1 (Figure 2-1), you will notice that a vertical scrollbar is present while we didn't instruct the XmHTML widget to add one. When the XmHTML widget was created it noticed that it wasn't high enough to display all of the text and thus it added a vertical scrollbar to allow the user to view all of the text by dragging the scrollbar. If you resize the window vertically, the vertical scrollbar will disappear when the widget is high enough to contain all text (including the horizontal and vertical margins).

    The behaviour you have observed in Example 2-1 is the default behaviour for the XmHTML widget: when not all of the text can be fitted in the available dimensions, a horizontal and/or vertical scrollbar is added, and when all text can be fitted in the available dimensions, the horizontal and/or vertical scrollbar is removed.

    As there might be cases where you want the presence of a vertical scrollbar while one is not required, you can force the presence of a vertical scrollbar by using the XmNscrollBarDisplayPolicy resource as shown in the following example:

    Example 2-4. The forced_html.c program

    /* forced_html.c -- Force the display of the vertical scrollbar */
    #include <XmHTML.h>
    
    main(int argc, char **argv)
    {
    	Widget toplevel;
    	XtAppContext app;
    
    	toplevel = XtVaAppInitialize(&app, "Demos", NULL, 0,
    		&argc, argv, NULL, NULL);
    
    	/* create a XmHTML widget but this time we specify a size */
    	XtVaCreateManagedWidget("html", xmHTMLWidgetClass, toplevel,
    		XmNvalue, "<html><body>A minimally configured "
    			"XmHTML widget.</body><html>",
    		XmNwidth, 200,
    		XmNheight, 75,
    		XmNscrollBarDisplayPolicy, XmSTATIC,
    		XmNscrollBarPlacement, XmTOP_LEFT,
    		XmNmarginWidth, 5,
    		XmNmarginHeight, 5,
            NULL);
    
    	XtRealizeWidget(toplevel);
    	XtAppMainLoop(app);
    }
    
    The XmNmarginWidth and XmNmarginHeight resources determine the spacing between the outer borders of a XmHTML widget and the displayed text. For demonstration purposes they have been set to a smaller value than the default value of 20. If you compile and run this program you will see that a vertical scrollbar is present and stays present when the widget is resized, even when the widget is high enough to contain all text.

    Example 2-4 also shows the XmNscrollBarPlacement resource. This resource controls the placement of both horizontal and vertical scrollbar. In this case the vertical scrollbar is placed on the left side of the window and the horizontal scrollbar is placed on top of the window (making the window smaller will show the horizontal scrollbar). Possible values for this resource are:

    • XmTOP_LEFT: vertical ScrollBar on left; horizontal on top;
    • XmBOTTOM_LEFT: vertical ScrollBar on left; horizontal on bottom;
    • XmTOP_RIGHT: vertical ScrollBar on right; horizontal on top;
    • XmBOTTOM_RIGHT: vertical ScrollBar on right; horizontal on bottom;

    XmHTML widget's do not provide any way to force the display of a horizontal scrollbar, you can only control it's placement.

    Keyboard Scrolling

    XmHTML widget's implement a full keyboard navigation interface by installing a number of translations. On most keyboards, the arrows provide the same behaviour as dragging the scrollbars while the PageUp and PageDown keys scroll through a document a page at a time. Additional keys are also available, see the XmHTML Reference Manual for the complete set of translations that XmHTML widget's install.

    2.1.5 XmHTML Children

    A XmHTML widget is made up of a number of subwidgets: a DrawingArea widget in which the document is displayed, and two ScrollBars. You can get the handles to these children using the Xt XtVaGetValues() method, as demonstrated in the following code fragment:
    	Widget work_window, hsb, vsb;
    
    	XtVaGetValues(html_w,
    		XmNworkWindow, &work_window,
    		XmNhorizontalScrollBar, &hsb,
    		XmNverticalScrollBar, &vsb,
    		NULL);
    
    Getting XmHTML widget children can be usefull when you want to install your own event handlers or set additional resources on these children.

    Let us now demonstrate a case where it is usefull to get a handle to one of XmHTML's children: the workWindow. Amongst the many convenience routines offered by the XmHTML widget's is the XmHTMLXYToInfo() function. This function takes a XmHTML widget and a pointer position as it's arguments and returns a structure containing information about the contents of the currently displayed document at the requested pointer position. The structure returned is of type XmHTMLInfoStructure, which is defined as follows:

    typedef struct
    {
    	int line_no;		/* line number at selected position */
    	Boolean is_map;		/* true when clicked image is an imagemap */
    	int x,y;		/* position relative to image corner */
    	XmImageInfo *image;	/* image data */
    	XmHTMLAnchorPtr anchor;	/* possible anchor data */
    }XmHTMLInfoStructure, *XmHTMLInfoPtr;
    
    The XmImageInfo and XmHTMLAnchorPtr members of this structure will be explained in the following sections, so we will now only say that the first structure contains information about an image over which the pointer is located, while the latter contains information about a hyperlink over which the anchor is currently located.

    A perfect way to display this information to the user would be to display a popup menu when the user clicks on the currently displayed document. In order for this to work, we need to attach an event handler to the workWindow of a XmHTML widget. The following example demonstrates how to attach the event handler to the workWindow and how to use the XmHTMLXYToInfo() function:

    Example 2-5. The work_window.c program

    /*
    * work_window.c: attaching an event handler to the work_window of a XmHTML
    * widget.
    */
    #include <XmHTML.h>
    
    void
    attachInfoHandler(Widget html, Widget popup)
    {
    	Widget work_window;
    
    	XtVaGetValues(html, XmNworkWindow, &work_window, NULL);
    
    	/*
    	* Add an event handler which responds to mouse clicks. "popup" is the
    	* popup menu which is to be displayed, it is stored as client_data
    	* for the event handler.
    	*/
    	XtAddEventHandler(work_window, ButtonPressMark, 0,
    		(XtEventHandler)infoHandler, popup);
    }
    
    void
    infoHandler(Widget work_window, Widget popup, XButtonPressedEvent *event)
    {
    	XmHTMLInfoPtr info;
    	Widget html_w;
    	WidgetList children;
    
    	/* we only take events generated by button 3 */
    	if(event->button != 3)
    		return;
    
    	/*
    	* The work_window is a child of a XmHTML widget, so we can get a handle
    	* to the XmHTML widget itself by using Xt's XtParent routine.
    	*/
    	html_w = XtParent(work_window);
    
    	/* get the info for the selected position.  */
    	info = XmHTMLXYToInfo(html_w, event->x, event->y);
    
    	/*
    	* Check the returned info structure. There will be nothing to display
    	* if the pointer wasn't over an image or anchor when the user 
    	* clicked his mouse.
    	*/
    	if(info == NULL || (info->image == NULL && info->anchor == NULL))
    		return;
    
    	/*
    	* For this example we assume that the popup menu has two buttons:
    	* a hyperlink button and an image button. We retrieve these children
    	* of the popup menu using the XmNchildren resource of Motif's
    	* rowColumn widget.
    	*/
    	XtVaGetValues(popup, XmNchildren, &children, NULL);
    
    	/* check if the info structure has an anchor */
    	if(info->anchor)
    	{
    		XmString label;
    		label = XmStringCreateLocalized(info->anchor->href);
    		XtVaSetValues(children[0], XmNlabelString, label, NULL);
    		XmStringFree(label);
    		XtManageChild(children[0]);
    	}
    	else
    		XtUnmanageChild(children[0]);
    
    	/* check if the info structure has an image */
    	if(info->image)
    	{
    		XmString label;
    		label = XmStringCreateLocalized(info->image->url);
    		XtVaSetValues(children[1], XmNlabelString, label, NULL);
    		XmStringFree(label);
    		XtManageChild(children[1]);
    	}
    	else
    		XtUnmanageChild(children[1]);
    
    	/* the "popup" menu has now been configured, pop it up */
    	XmMenuPosition(popup, event);
    	XtManageChild(popup);
    }
    
    Note that the above example does not use any global variables; we can obtain all handles to the widgets we need. The handle to the popup menu is stored as client_data for the event handler, while the handles to the menu buttons of the popup menu can be easily obtained using one of Motif's RowColumn widget resources. It is also important to notice that it is very easy to obtain the widget id of the XmHTML widget. The event handler was attached to the workWindow of a XmHTML widget, and therefore this workWindow is the same widget as the work_window argument to the infoHandler routine. This is the reason why the XtParent(work_window) call returns the handle of the XmHTML widget.

    Also notice that we do not have to free any of the members of the returned XmHTMLInfoStructure structure. In fact, we are not permitted to do this since the image and anchor members of this structure contain pointers to data owned by a XmHTML widget. Unless it is explicitly mentioned, all structures returned by any of XmHTML widget's resources, callback resources or convenience routines should be considered as read only.

    Example 2-5 is a simple demonstration which does not use any callbacks on the popup menu buttons. In a real implementation however, callback resources could be attached to each of the popup menu buttons which would allow the user to jump to the selected hyperlink or display information about the selected image.

    [Note: if you want to specify resource values for the subwidgets mentioned in this chapter by means of application fallback resources or in a resource file, the following names should be used: workWindow for the DrawingArea child, verticalScrollBar for the vertical ScrollBar child and horizontalScrollBar for the horizontal ScrollBar child.]

    2.2 Modifying the Document Appearance

    A HTML document typically contains a number of hyperlinks. Hyperlinks (also referred to as anchors) are often used in HTML documents to allow the reader to navigate the currently displayed document or between different documents. In order for the reader to recognize these anchors they should appear different from the main content of a HTML document. XmHTML widget's provide a number of resources that control the appearance of these anchors.

    Another set of resources allow you to control the fonts that are used to render the displayed text.

    2.2.1 Changing the Anchor Appearance

    XmHTML widget's identify three different types of anchors: a regular anchor, a visited anchor and an anchor which has the target attribute set. The latter is a special type of anchor and is one of the extensions to the HTML 3.2 standard that are implemented by XmHTML. Typical use of this attribute can be found in HTML documents that utilize the HTML <FRAMESET> extension, where this attribute indicates a destination to which the contents of the activated anchor should be sent. This destination can target (amongst others) another XmHTML widget or a new dialog. Other use of this attribute can be found in Hypertext help systems where it might be used to indicate that the contents of the activated anchor should be displayed in a popup window.

    A visited anchor is an anchor that the reader of the document has selected in the past.

    Each anchor has three states: passive, armed and activated. An anchor is considered armed when a user has located the mouse pointer over an anchor. It is active when the user presses the first or second mouse button on an armed anchor. It is considered passive otherwise.

    XmHTML widget's provide four ways to let an anchor stand out:

    • by changing the cursor when an anchor is armed;
    • by actively changing the look of an anchor when it is armed;
    • by rendering the anchor as a pushbutton;
    • by underlining the anchor;

    The first and second item in this list are always selectable, while the third and fourth item are mutually exclusive: you choose either to display the anchors as pushbuttons or to underline them. The latter offers the most control on anchor appearance, while some users may find pushbutton anchors aesthetically more pleasing (although it can be slightly more difficult to identify anchors). Both types allow you to control the color in which the anchor is displayed in both it's passive and activated state.

    XmHTML widget's will display anchors as pushbuttons by default: the default value of the XmNanchorButtons resource is True. By setting this resource to False, anchors will be underlined instead of being displayed as a pushbutton.

    2.2.1.1 Anchor Cursor Resources

    To indicate that an anchor can be activated by the user, it is often convenient to not only render the anchor differently than the remainder of the document but also to change the cursor when the pointer is moved over an anchor.

    XmHTML widget's will change the cursor to a hand with a pointing finger when the user moves the pointer over an anchor. The default cursor is a built-in cursor, but it can be changed to a different cursor by using the XmNanchorCursor resource. Although it will seldomly be needed, the XmNanchorDisplayCursor resource allows you to control whether or not XmHTML widget's should change the cursor when the pointer is moved over an anchor (it is True by default).

    The following code fragment demonstrates how to create, set and destroy a cursor:

    #include <X11/cursorfont.h>	/* standard X cursors */
    #include <XmHTML.h>
    
    void
    setCursor(Widget html_w, Boolean destroy_cursor)
    {
    	static Cursor cursor;
    
    	/* create a standard X cursor when it is not yet created */
    	if(cursor == None)
    		cursor = XCreateFontCursor(XtDisplay(html_w), XC_hand2);
    
    	if(destroy_cursor)
    	{
    		/* only free the cursor when we have created one */
    		if(cursor != None)
    			XFreeCursor(XtDisplay(html_w), cursor);
    		cursor = None;
    	}
    	else	/* set this cursor as the anchor cursor for this XmHTML widget */
    		XtVaSetValues(html_w,
    			XmNanchorCursor, cursor,
    			XmNanchorDisplayCursor, True,
    			NULL);
    }
    
    The cursor is created using XCreateFontCursor(), but this is not required; you may use other functions like XCreateGlyphCursor() or XCreatePixmapCursor(), if you like. See O'Reilly's X Window System Programming guides Volume One, Xlib Programmer's Manual, for more information.

    It is also considered nice programming to use X resources sparingly (although in the case of cursor's it is not really required, they are a virtually unlimited resource under X). This is why the above fragment declares the allocated cursor as a static variable: once allocated the cursor id is always available and we can use it for every XmHTML widget that is provided as an argument to the above routine. When this routine is called with the destroy_cursor argument set to True the cursor is destroyed and reset.

    2.2.1.2 Anchor Display Resources

    Whether or not you select to display anchors as pushbuttons or to underline them, you can always specify the foreground color in which an anchor is rendered. You can specify a different foreground color for the passive state of each of the anchor types mentioned in the introduction to this section:

    • XmNanchorForeground:
      specifies the foreground color that is to be used to render a regular anchor;
    • XmNanchorVisitedForeground:
      specifies the foreground color that is to be used to render a visited anchor;
    • XmNanchorTargetForeground:
      specifies the foreground color that is to be used to render an anchor that has the target attribute set;

    The XmNanchorActivatedForeground resource identifies the foreground color to be used when an anchor is activated. This resource is the same for all three anchor types.

    When you opt to underline the anchors, you can also use the XmNanchorActivatedBackground resource to specify the background color to use when an anchor is activated.

    [Note: When a HTML document contains a background image and displaying of background images is enabled (which is true by default), the XmNanchorActivatedBackground resource is also ignored when anchors are to be underlined, making the anchors appear as being transparent.]

    You need to specify a Pixel for all three resources. You can specify a Pixel value by pre-allocating a pixel (by using any of Xlib's XAllocColor() routines) or by using Xt's XtVaTypedArg method. Both methods have their pro's and con's, but in either case you must free the allocated color values when your application exits.

    When you have set the XmNanchorButtons resource to False, you can also specify the type of underlining for each of the three anchor types. XmHTML widget's support the following types of underlining:

    • XmNO_LINE:
      no lines are drawn;
    • XmSINGLE_LINE:
      a single solid line. This is the default for regular and visited anchors;
    • XmDOUBLE_LINE:
      a double solid line. This is the default for anchors that have the target attribute set;
    • XmSINGLE_DASHED_LINE:
      a single dashed line;
    • XmDOUBLE_DASHED_LINE:
      a double dashed line;

    The resource names are as follows:

    • XmNanchorUnderlineType:
      specifies the type of underlining to use for regular anchors;
    • XmNanchorVisitedUnderlineType:
      specifies the type of underlining to use for visited anchors;
    • XmNanchorTargetUnderlineType:
      specifies the type of underlining to use for anchors that have the target attribute set;

    Finally, there is the XmNhighlightOnEnter resource. When set to True (which is the default), a XmHTML widget will actively modify the look of an anchor whenever it becomes armed by highlighting the anchor. The actual color and type of highlighting used heavily depends on the content of the document that is currently displayed. When a background image is present, a XmHTML widget will base the highlight color on the value of the XmNanchorActivatedForeground resource and render the anchor's text in the computed color. When no background image is present, the highlight color will be based on the current document background and the anchor's text will be rendered in a rectangle filled with the computed color. If you decide to enable this resource, it is adviced that you offer a possibility to the user to toggle the value of this resource: a XmHTML widget attempts to do it's best when computing the highlight color, but might fail to find a suitable color. This can happen, for instance, on documents where the colors used by the background (fixed color or background image), text and anchors are poorly balanced.

    2.2.2 Marking a Visited Anchor

    You now know that XmHTML widget's contain the concept of visited anchors, which are anchors that the reader of the document has selected in the past (e.g, have already been visited). But when the user of your application is switching between documents the following question arises: how do you inform a XmHTML widget that an anchor was previously visited by the user?

    The answer is fairly simple: you use the XmNanchorVisitedProc resource. When a procedure has been installed for this resource, a XmHTML widget will call this procedure to test if an anchor has already been visited. There are two arguments to this procedure: the widget id of a XmHTML widget and the name of the anchor. It should return True when the anchor should be rendered using the XmNanchorVisitedForeground resource and False when it should be rendered as a regular anchor.

    Please note that a XmHTML widget only calls any installed procedure when a document is set into a XmHTML widget, and that it will be called for every anchor that is found in this document.

    The following example shows how easy it can be to use this resource:

    #include <XmHTML.h>
    
    static int num_visited_anchors;
    String visited_anchors[100];
    
    static Boolean
    visitedTestProc(Widget html_w, String anchor)
    {
    	int i;
    
    	for(i = 0; i < num_visited_anchors; i++)
    		if(!strcasecmp(visited_anchors[i], anchor))
    			return(True);
    	return(False);
    }
    
    int
    main(int argc, char **argv)
    {
    	Widget toplevel;
    	XtAppContext app;
    
    	toplevel = XtVaAppInitialize(&app, "Demos", NULL, 0,
    		&argc, argv, NULL, NULL);
    
    	XtVaCreateManagedWidget("html", xmHTMLWidgetClass, toplevel,
    		XmNanchorVisitedProc, visitedTestProc,
    		NULL);
    
    	XtRealizeWidget(toplevel);
    	XtAppMainLoop(app);
    }
    
    In this example we assume that text can be set in the XmHTML widget, visited_anchors contains a list of already visited anchors and that num_visited_anchors contains the number of items in the visited anchor list. In section 2.5 we will demonstrate how to maintain this list.

    2.2.3 Specifying the Document Fonts

    One of the most important (if not the most important) aspect that will determine the way a document will look to the user concerns the fonts used to render the text in a document. Selecting an appropriate default font (and its size) is a very important decision when using a XmHTML widget, and it is more difficult than it might seem, especially if you want to internationalize your application.

    Font specification for a XmHTML widget does not follow the standard Motif font specification rules (the XmFontList type). Due to the nature of the HTML language this would be rather impossible; it does not only contain font markup elements that allow the writer of a HTML document to change the style of a font, but also to change the typeface and size of a font. To make things even more complicated, all of these font markup elements can be used in arbitrary sequence.

    In order to cope efficiently with this virtually unlimited number of font combinations in HTML documents, XmHTML widget's allocate their fonts directly and employ a smart font caching scheme that will keep the number of required font allocations to an absolute minimum. The font cache is shared by all XmHTML widget's on a per display basis (which effectively means that you can use a XmHTML widget for a multi-display application).

    Another reason why XmHTML widget's do not use the Motif font specification rules is that the XmHTML font allocation routines go thru great lengths to ensure that a requested font is matched. When a requested font can not be exactly matched, the font allocation routines attempt to find a close match by following a number of different paths instead of giving up immediatly and using a default font. XmHTML widget's produce much better looking text than some of the most well known HTML browsers as a result of this.

    Because XmHTML widget's allocate their fonts themselves instead of relying on Motif, a number of resources are offered that allow you, the programmer, to select a character set, foundry, typeface, spacing and size of the fonts that are to be used for displaying a document.

    [Note: In order to fully appreciate the font resources of XmHTML widget's you are encouraged to read Appendix A of O'Reilly's X Window System Programming guides, Volume One, Xlib Programmer's Manual.]

    Before explaining the various font resources I will mention that a XmHTML widget uses the contents of the font resources to compose a X Logical Font Description (XLFD) which is used to query your X server. Knowing this, it is obvious that you are allowed to use wildcards for all font resources (except size of course). This can be potentially dangerous: depending on the configuration of your font path and directories, the font returned by the X server may or may not be what is intended.

    As a final note in this fairly long introduction, the default values for each of the various font resources have been choosen in such a way that every combination represents a font that is present in the default font path of the standard R5 X distribution.

    2.2.3.1 Specifying the Character Set

    The character set resource, XmNcharset, is a string representing the ISO character set encoding to be used. The default character set used by XmHTML widget's, ISO8859-1, represents the ISO Latin-1 character set (which is used by all of the fonts in the 75dpi and 100dpi directories of X's default font path). This character set is a superset of the standard ASCII character set, which includes various special characters used in European languages other than English.

    The XmNcharset resource makes it relatively easy to select a font for non-European (non-English) languages. For example, "XmNcharset: koi8-*" specifies the koi8 Cyrillic font, while "XmNcharset: UJIS-*" identifies a Japanese font.

    It is also important to notice that this resource is very important, if not the most important font resource. If a charset is specified which is unknown to the X server (or the charset is given as a wildcard), a XmHTML widget has almost no control about the fonts to use: the actual charset that is used will then only depend on the fontpath configuration of the X server and the specified font family. Therefore it is considered wise to first verify if the requested character set is available on the system your application is running on before changing it. See also section 2.2.3.2, Specifying the Font Family.

    The font allocation scheme used by XmHTML will first try to load a font for a given character set and font family. When that fails it will wildcard the charset. This causes a XmHTML Widget to honor the following sequence of HTML tags with the default charset:

      <FONT FACE="symbol">alpha</FONT>

    which is rendered as:

      alpha

    [Note: this will render the word alpha in the symbol font if it is installed on your X server, and in english if you are viewing this document with almost any other browser or haven't got the symbol font installed.]

    2.2.3.2 Specifying the Font Family

    XmHTML widget's use two different types of font: a proportional font and a fixed-width font. Proportional fonts are fonts in which each character in a character set has a different width (an example of a proportional font is Times Roman), while fonts in which each character has the same width are called fixed-width fonts. Proportional fonts are more easy for the human eye to read than fixed-width fonts and therefore the main portion of the text in a HTML document is rendered in a proportional font. Fixed-width fonts are used to display preformatted text in a HTML document.

    You specify the proportional font family by using the XmNfontFamily resource, and the fixed-width font family by using the XmNfontFamilyFixed resource. The value for both these resources is a sequence of four dash-seperated strings that define a font family. These four fields are:

    1. foundry: the type foundry that digitized and supplied the font, i.e. Adobe;
    2. family: the font family name (also known as typeface), i.e. roman;
    3. set width: a value describing a font's proportionate width according to the selected foundry, i.e. normal;
    4. spacing: type of character spacing for a font. m (for monospace, i.e. fixed width) or p (proportional, i.e., variable-width) are two well known font spacings.

    The default value for the XmNfontFamily resource is adobe-times-normal-*, and the default value for the XmNfontFamilyFixed resource is adobe-courier-normal-*. Both font families represent a standard, scalable font, present on each X server.

    You should always try to specify a scalable font whenever possible: HTML documents intend to use a lot of differently sized fonts (the header markup elements for example all require a different font size), and the displayed text will generally look much better if a scalable font is used instead of a bitmapped font.

    A note of caution: before changing any of the fontFamily resources, the existence of this font (within the context of the current or new value of the XmNcharset resource) should be verified before actually changing it. An unsuccesfull attempt to change the default font settings can cause a XmHTML widget to exit your application: if it can not find a default font it simply can not display anything.

    2.2.3.3 Specifying the Font Sizes

    The last step in specifying the document fonts is to specify the font sizes for both the proportional and fixed-width font families. Font sizes are always specified in points and not in pixels: specifying a font size in pixels would require you to know in advance the x- and y-resolution of the screen your application is running on. The XmHTML widget determines the screen resolution and selects an appropriate pixel size automatically.

    You can specify the text font size, the sup- and superscript font size and the font size for each of the header markup elements for the proportional font family. For the fixed-width font family you can specify the text font size and sup- and superscript size.

    The sizes for the proportional font family are given by the XmNfontSizeList resource. The value for this resource is a comma seperated list of eight strings. The list below describes the fields in this resource.

    1. normal text size;
    2. sub and superscript font size;
    3. font size for the <H1> markup element;
    4. font size for the <H2> markup element;
    5. font size for the <H3> markup element;
    6. font size for the <H4> markup element;
    7. font size for the <H5> markup element;
    8. font size for the <H6> markup element;

    The default value for this resource is "14,8,24,18,14,12,10,8".

    You do not have to specify all values; when an element in this list has the value 0 (zero), the appropriate default font size is used.

    The sizes for the fixed-width font family are given by the XmNfontSizeFixedList resource. The value for this resource is a comma seperated list of two strings, where the first value describes the normal text size and the second value the size for sup- and superscript text. The default value for this resource is "12,8".

    2.3 XmHTML and Images

    One of the strong and much admired features of the XmHTML Widget is it's built in image support. A XmHTML widget can support a wide range of different image types (from simple X11 bitmaps through complex GIF animations to full 32bit RGB PNG images with an alpha channel). For simple applications one does not need to know anything about this image support as a XmHTML widget can handle almost everything by itself. In fact, you only need to read this section if you want to exploit XmHTML's image support to it's fullest.

    2.3.1 The XmImageInfo Structure

    The basis of XmHTML's image API is formed by the XmImageInfo structure. XmHTML uses this structure to compose the actual image.
    typedef struct _XmImageInfo
    {
        /* regular image fields */
        String url;                    /* original location of image */
        unsigned char *data;           /* raw image data. ZPixmap format */
        unsigned char *clip;           /* raw clipmask data. XYBitmap format */
        Dimension width;               /* used image width, in pixels */
        Dimension height;              /* used image height, in pixels */
        int *reds;                     /* red image pixels */
        int *greens;                   /* green image pixels */
        int *blues;                    /* blue image pixels */
        unsigned int ncolors;          /* Number of colors in the image */
        int bg;                        /* transparent pixel index */
        unsigned char *rgba;           /* image data in rgba format */
        float fg_gamma;                /* image gamma */
        unsigned int options;          /* image option bits */
    
        /* Additional animation data */
        int x;                         /* logical screen x-position for a frame */
        int y;                         /* logical screen y-position for a frame */
        int loop_count;                /* animation loop count */
        unsigned char dispose;         /* image disposal method */
        int timeout;                   /* frame refreshment in milliseconds */
        int nframes;                   /* no of animation frames remaining */
        struct _XmImageInfo *frame;    /* ptr to next animation frame */
    
        /* image classification fields and original data */
        unsigned char type;            /* image type, see below */
        int depth;                     /* bits per pixel for this image */
        unsigned char colorspace;      /* colorspace for this image */
        unsigned char transparency;    /* transparency type for this image */
        Dimension swidth;              /* image width as read from image */
        Dimension sheight;             /* image height as read from image */
        unsigned int scolors;          /* Original number of colors in the image */
    
        XtPointer user_data;           /* any data to be stored with this image */
    }XmImageInfo, *XmImageInfoStruct;
    
    The first part of this structure contains the raw image data XmHTML requires to create an image. The second part is used for creating animations while the third part provides additional information about the image represented by this structure.

    As will be shown in the following sections of this chapter, all of the convenience functions of a XmHTML widget that deal with images work with this structure, either as an argument or as a return value.

    2.3.1.1 The XmImageInfo Structure Explained

    Although this section is mostly intended for those that want to add support for an image type that is unknown to XmHTML, it also contains important information for those that want to enable what is known as delayed image loading or want to exploit XmHTML's built-in image support to its fullest extent. It explains every field in the XmImageInfo structure, what each field should contain and the default values assumed when an image is loaded using the XmHTMLImageDefaultProc.

    url
    This field represents the original location from where the image in question should be or has been obtained. It is actually the contents of the SRC attribute of the <IMG> tag. It is important that this field always contains a value, especially if you want to switch on delayed image loading.

    data
    This field represents the actual image data in ZPixmap format. It is a continuous stream of bytes in which each byte represents an index in the colormap for this image (as defined by the reds, greens and blues fields).

    clip
    This field represents a bitmap (a pixmap with depth 1) which a XmHTML widget will use to create a clipmask. It is a continuous stream of bits, where each bit defines if the underlying pixel should be rendered (bit set to 1) or should be left as it is (bit set to 0). It is only valid for transparent images, although it is very well possible to use this field for defining non-rectangular pixmaps. The dimensions of this bitmap should equal the actual image dimensions.

    width and height
    These fields contain the absolute dimensions of the final pixmap as given by the data field. They are specified in pixel units, and their product must match the size of the data field.

    reds, greens, blues and ncolors
    Each of these fields is an array of color component values which together form the RGB colormap of the image. Each array must have the same size, and this size is given by the value of ncolors. This number must be equal the the number of colors used by the image. A XmHTML widget uses these arrays to allocate the actual image colors and then maps the image data onto these colors.

    bg
    The index of the transparent pixel, or -1 when the image is fully opaque.

    rgba
    This field is only used for images containing an alpha channel. An alpha channel is a series of pixel values in an image used to compute partial pixel transparency. With partial pixel transparency fade in/out or anti-aliasing effects can be achieved regardless of the current background setting. The XmHTMLImageDefaultProc supports alpha channelled PNG images. The format of the data stored in this field is a continuous stream of bytes where each pixel is represented by its red, green, blue and alpha channel component.

    fg_gamma
    This field contains the gamma value of the display on which the image was created. It is only used in combination with alpha channelled images.

    options
    This field contains a combination of OR'd constants which tell a XmHTML Widget what it can and can't do with an XmImageInfo structure. A number of these constants define how and when a XmHTML should free a structure (or members of it), while others determine what type of operations are allowed and how the actual image should be processed.

    "Set by default" indicates a bit set when the XmHTMLImageDefaultProc was used to read an image.

    XmIMAGE_DELAYED
    When set, XmHTML will ignore all fields except url and use a default image instead. This default image can be updated at a later stage using either the XmHTMLImageReplace or XmHTMLImageUpdate convenience function; See the section on Delayed Image Loading for more information.

    XmIMAGE_DEFERRED_FREE
    When set, XmHTML will take care of destroying this structure when a new document is loaded. Set by default;

    XmIMAGE_IMMEDIATE_FREE
    When set, this structure will be destroyed as soon as XmHTML no longer needs it;

    XmIMAGE_RGB_SINGLE
    set this bit when the reds, greens and blues fields have been allocated with one single malloc instead of three separate. Set by default;

    XmIMAGE_ALLOW_SCALE
    set this bit when scaling an image is allowed. Set by default;

    XmIMAGE_FRAME_IGNORE
    use with animations: set this bit when a frame falls outside the logical screen area. No pixmap is created but the timeout for the frame is kept.

    XmIMAGE_CLIPMASK
    This bit is set when the returned XmImageInfo structure contains clipmask data. XmHTML uses this info to create a clipping bitmap. Changing this bit from set to unset will lead to a memory leak while changing it from unset to set without providing a clipmask yourself will cause an error to happen. You can however set this bit when you are providing your own clipmask (to provide non-rectangular images for example), provided you fill the "clip" field with valid bitmap data.

    XmIMAGE_SHARED_DATA
    This bit is set when images share data. XmHTML sets this bit when the image in question is an internal image, e.i., one for which the image data may never be freed. Be carefull setting this bit yourself, since it prevents XmHTML from freeing the image data present in the XmImageInfo structure. It can easily lead to memory leaks when an image is not an internal image.

    XmIMAGE_PROGRESSIVE
    Setting this bit will enable progressive image loading. A function must have been installed on the XmNprogressiveReadProc resource prior to setting this bit. Installing a function on the XmNprogressiveEndProc is optional but strongly advised. When this bit is set all other bits and all members except the url field of the XmImageInfo structure will be ignored.

    XmIMAGE_DELAYED_CREATION
    This bit is read-only. It is used internally by XmHTML for images with an alpha channel. Alpha channel processing merges the current background with the original RGBA data (see above) from the image and uses the result to compose the actual on-screen image (the merged data is stored in the "data" field of the XmImageInfo structure). XmHTML needs to store the original data somewhere, and when this bit is set it is stored in the "rgba" field of the XmImageInfo structure. When this bit is set, the returned structure may not be freed as long as the current document is alive. You can discard it as soon as a new document is loaded.

    type
    This field contains a value which describes the type of image that is represented by this structure. This field is unused internally and is provided for your convenience only. You should consider this value read-only though as it might well be used in the future. Table 2-1 lists all possible values for this field.

    Table 2-1. Supported Image Types
    Type Image description
    IMAGE_ERROR error on image loading
    IMAGE_UNKNOWN unknown image
    IMAGE_XPM X11 pixmap
    IMAGE_XBM X11 bitmap
    IMAGE_GIF CompuServe(C) Gif87a or Gif89a
    IMAGE_GIFANIM animated gif
    IMAGE_GIFANIMLOOP animated gif with NETSCAPE2.0 loop extension
    IMAGE_GZF compatible Gif87a or Gif89a
    IMAGE_GZFANIM compatible animated gif
    IMAGE_GZFANIMLOOP compatible animated gif with NETSCAPE2.0 loop extension
    IMAGE_JPEG JPEG image
    IMAGE_PNG PNG image

    2.3.2 The XmHTMLDefaultImageProc

    2.3.3 Animations

    2.3.4 XmHTML's Imagemap Support

    2.4 XmHTML Widget Callback Functions

    2.4.1 Anchor Activation Callback

    2.4.2 Anchor Tracking Callback

    2.4.3 Frame Notification Callback

    2.4.4 Form Activation Callback

    2.4.5 Imagemap Activation Callback

    2.4.6 Document Verification Callback

    2.4.7 Document Link Callback

    2.4.8 Document Motion Callback

    2.4.9 Document Arm Callback

    2.4.10 Document Input Callback

    2.5 Collective Example

    2.6 Advanced XmHTML Programming Techniques

    2.6.1 Adding Support for HTML Frames

    2.6.2 Delayed Image Loading

    When a document is loaded into a XmHTML widget, it might not always be possible to provide an image when the XmHTML widget encounters one in the document: a net connection might be slow or the image requested can be that large that loading it can take quite a long time. It can be quite annoying if XmHTML should block until the image is available. Therefore, XmHTML offers Delayed Image Loading. Delayed Image Loading fools XmHTML into thinking that it has the image it wants, so it will happily continue without a noticable slowdown, and display the document once it has been parsed and formatted.

    Now, how does it work? Basically it is quite simple: when a XmHTML widget finds a <IMG> tag, it will call the function that has been installed for the XmNimageProc resource function (say, imageProc).

    The XmNimageProc function should then initialise a blank XmImageInfo structure, fill in the url field and set the XmIMAGE_DELAYED bit (this last step is imperative). It should then call a function which requests an image from a remote server and return the new XmImageInfo to XmHTML. The image is retrieved asynchronously.

    At some point in the future, the image has been retrieved by the network layer, and the application calls a routine (say replaceImage) which will replace the blank image in the XmImageInfo structure with the newly loaded one.

    XmHTML widget's provide two functions for replacing or updating a delayed image: XmHTMLImageReplace and XmHTMLImageUpdate. The difference between these two functions is that the former will actually replace the given XmImageInfo structure with a new one while the latter will only update the given image.

    The above will probably make more sense in an example, so here is one.

    Example 2-?: Delayed Image Loading

    #include <XmHTML.h>
    
    XmImageInfo *imageProc(Widget w, String url)
    {
    	String filename;
    	static XmImageInfo *image;
    
    	image = NULL;
    
    	/* test delayed image loading */
    	if((filename = resolveFile(url)) != NULL)
    	{
    		image = XmHTMLImageDefaultProc(html, filename, NULL, 0);
    		image_cache[current_image].image = image;
    		image_cache[current_image++].name = strdup(filename);
    	}
    	else
    	{
    		image = (XmImageInfo*)malloc(sizeof(XmImageInfo));
    		memset(image, 0, sizeof(XmImageInfo));
    		image->options = XmIMAGE_DELAYED; /* Tell XmHTML this image is delayed */
    		image->url = strdup(url);
    		/* associate the new XmImageInfo with this url */
    		image_cache[current_image].image = image;
    		image_cache[current_image++].name = strdup(url);
    		fetchFileFromServer(url);
    	}
    	return(image);
    }
    
    In the above example, it is first tested if the requested image is already available. When it is, XmHTMLImageDefaultProc is called to load the image, and it's return value is stored in an image cache.

    When the requested image is not available on the other hand, a blank XmImageInfo structure is initialized and stored, the delayed bit is set and a function is called which will fetch the image asynchronously from a server. The blank XmImageInfo structure is then returned and XmHTML will continue where it left off. When the image has been received, the application calls the replaceImage function.

    Example 2-?: Updating delayed images

    #include <XmHTML.h>
    
    void replaceImage(String url, unsigned char *buf, int len)
    {
    	int i;
    	XmImageInfo *image;
    
    	for(i = 0; i < image_cache_size; i++)
    	{
    		if(!(strcmp(image_cache[i].name, url)))
    		{
    			image = XmHTMLImageDefaultProc(html, url, buf, len);
    			XmHTMLImageReplace(html, image_cache[i].image, image);
    			image_cache[i].image = image;
    		}
    	}
    }
    
    As already explained in this section, the replaceImage function is called when an image has been retrieved from a server. Contents of the image from location url have been placed in the buffer buf with size len.

    Remember that we have already associated a XmImageInfo structure with a url in the imageProc function, so the first thing we do is get the correct XmImageInfo. When we have found the correct entry, we simply call XmHTMLImageDefaultProc to actually load the image, replace the image represented by our old XmImageInfo structure and update the image cache.

    In a real world implementation the previous XmImageInfo structure would also be freed. It would also call the XmHTMLRedisplay function after all images have been loaded to force XmHTML to do a recalculation of it's screen layout.

    2.6.3 Adding Support for Other Imagetypes

    2.6.4 Using XmHTML's Image Support for Other Purposes

    One of the many nice features in a XmHTML widget is the built-in image support. What is even nicer is that this image support is also available for purposes other than use with a XmHTML widget: the XmHTML widget set contains a number of routines that allow you to read an image of any of the supported image types. You can then use the returned XmImage to your own likings. This section explains the XmImage image datatype and describes how to create, destroy and use such images.

    2.6.4.1 The XmImage Structure

    The basis of the external image support of the XmHTML widget set is formed by the XmImage structure. This structure is defined as follows:
    typedef struct{
    	/* regular image data */
    	String file;		/* originating file */
    	unsigned char type;	/* image type */
    	Pixmap pixmap;		/* actual image	*/
    	Pixmap clip;		/* for transparant pixmaps */
    	int width;		/* image width */
    	int height;		/* image height */	
    
    	/* animation data */
    	XmImageFrame *frames;	/* array of animation frames */
    	int nframes;		/* no of frames following */
    	int current_frame;	/* current frame count */
    	int current_loop;	/* current loop count */
    	int loop_count;		/* maximum loop count */
    	XtIntervalId proc_id;	/* timer id for animations */
    	Widget w;		/* image owner */
    	XtAppContext context;	/* Application context for animations */
    
    	/* Private data */
    	unsigned long *pixels;
    	int npixels;
      	struct _XColorContext *xcc;
    }XmImage;
    
    The pixmap field contains the actual image. It is this pixmap that you should use in a call to XCopyArea to put it directly in a window or in combination with Motif's XmNlabelPixmap resource to put the pixmap in a label widget.

    If the value of the clip field is other than None, it means the original image is a transparent image. You can then use this field as a clipmask of a GC so your image will also be transparent.

    [Note: the clipmask is a pixmap of depth 1, so it is actually a X11 bitmap.]

    One important reminder before explaining how to create and use a XmImage: you should never touch any of the fields in the XmImage structure which are mentioned as private data. This private data is used when the XmImage is destroyed, so modifying any of these fields is a potential danger and leads at least to a memory leak. If you really want to know what these fields represent, here's a very short explanation of what they represent:

    • pixels: an array of allocated pixels values;
    • npixels: the number of elements in pixels;
    • xcc: a structure containing a lot of information about the current visual, colormap, maximum number of colors, color shifts and masks, etc... This structure is used when allocating colors. If you really want to know more about this structure, you should examine the following source files of the XmHTML Widget Set source code: XCC.c, XCC.h and XCCP.h

    2.6.4.2 Creating a XmImage

    You can create an XmImage by using the XmImageCreate convenience function. This function is defined as follows:
    XmImage *XmImageCreate(Widget w, String file, Dimension width,
    	Dimension height);
    
    w must contain the id of a Widget (and not a Gadget) which will be the owner of this image, file is the name of a file representing the image that is to be loaded. The width and height arguments allow you to scale the image. If both have the value 0 (zero), the dimensions of the loaded image will be the dimensions as found in the image. Otherwise, XmImageCreate will scale to image to fit the given dimensions. Scaling is only done in the directions for which a value is given: if you only want to scale the image horizontally, you should only specify a value for width and set height to zero (or a value for height and 0 for width to only scale the image vertically).

    Although the external image support is independent of a XmHTML widget, you can also use the XmImageInfo structure to create a XmImage. An example where this can be usefull is in conjuction with the XmHTMLXYToInfo() convenience function. As you may know by now, the return value of this function can contain a pointer to a XmImageInfo structure. Supposing this is the case and you would want to display a dialog box to the user with a thumbnail of the image, it is much more convenient to create a XmImage directly from the XmImageInfo structure instead of creating it from a file.

    The syntax of the XmImageCreateFromInfo() convenience function is as follows:

    XmImage *XmImageCreateFromInfo(Widget w, XmImageInfo *info, Dimension width,
    	Dimension height);
    
    The only difference with the XmImageCreate() function is that instead of a filename you now supply a XmImageInfo structure.

    2.6.4.3 Destroying a XmImage

    When you are done using a XmImage, you should destroy it using the XmImageDestroy convenience function. The syntax to this function is as follows:
    void XmImageDestroy(XmImage *image);
    
    This function will take care of destroying all pixmaps, possible animation data and will free the colors allocated to this image. When this function returns the given XmImage will no longer be valid.

    One thing that this function will not do is release any XtIntervalId that might be present in the given XmImage structure. It is your responsibility to do this.

    2.6.4.4 How to use a XmImage

    Normal Images

    Running Animations

    For the sake of clarity, we will repeat the animation data of the XmImage structure here:
    	/* animation data */
    	XmImageFrame *frames;	/* array of animation frames */
    	int nframes;		/* no of frames following */
    	int current_frame;	/* current frame count */
    	int current_loop;	/* current loop count */
    	int loop_count;		/* maximum loop count */
    	XtIntervalId proc_id;	/* timer id for animations */
    	Widget w;		/* image owner */
    	XtAppContext context;	/* Application context for animations */
    
    The *frames field points to an array of structures of the following type:
    typedef struct
    {
    	int x;			/* x position in logical screen */
    	int y;			/* y position in logical screen */
    	int w;			/* width of this particular frame */
    	int h;			/* height of this particular frame */
    	int timeout;		/* timeout for the next frame */
    	unsigned char dispose;	/* previous frame disposal method */
    	Pixmap pixmap;		/* actual image */
    	Pixmap clip;		/* image clipmask */
    	Pixmap prev_state;	/* previous screen state */
    
    	/* private data */
    	unsigned long *pixels;
    	int npixels;
    }XmImageFrame;
    
    The total number of frames is given by the nframes field in the XmImage structure. Each member of this array of structures represents a single frame in an animation, so displaying all frames in sequence will result in an animation being shown to the user.

    Before embarking on how to display animations, it is necessary that you understand the what the fields of the XmImageFrame structure represent.

    x, y, w and h

    The first frame in an animation determines the screen size of the animation. This is what is called the logical screen. Every following frame can have a size equal to or less than the logical screen size. The x and y fields of the XmImageFrame structure determine the place of a frame on the logical screen, while the w and h fields determine the size of a frame.

    [Note: Frames crossing logical screen boundaries are automatically clipped by the XmImageCreate routines.]

    timeout

    This field field indicates the number of milliseconds that should expire before the next frame in an animation is displayed.

    loop_count

    This field indicates how many times an animation should be run. A loop_count of zero indicates forever. Any self-respecting application should run animations with a non-zero loop_count only for the specified number of loops.

    dispose

    This indicates how the previous frame should be removed before a new frame is displayed. This field can have the following values:

    XmIMAGE_DISPOSE_NONE (value = 1)
    do nothing, overlay the previous frame with the current frame;
    XmIMAGE_DISPOSE_BY_BACKGROUND (value = 2)
    Restore to background color. The area used by the previous frame should be restored to the background color/image;

    XmIMAGE_DISPOSE_BY_PREVIOUS (value = 3)
    Restore to previous. The area used by the previous frame should be restored to what was there prior to rendering the previous frame.

    Handling disposal methods 2 and 3 are one of the most difficult items to deal with when running an animation. This is the reason why the prev_state field is present in the XmImageFrame structure.

    The use of the remaining fields of the XmImageFrame structure will become clear in the following example which demonstrates how to run an animation and how to deal with the different disposal methods.

    Example 2-?: Running an animation

    [Put in a copy of the src/paint.c, routine DrawFrame]
    




    ©Copyright 1996-1997 by Ripley Software Development
    Last update: September 19, 1997 by Koen
    XmHTML-1.1.10/html/PaxHeaders.1031/legals.html0000644000175000001440000000013212613377377016713 xustar000000000000000030 mtime=1445854975.094545877 30 atime=1445854975.094545877 30 ctime=1445854975.094545877 XmHTML-1.1.10/html/legals.html0000644000175000001440000001114112613377377016311 0ustar00chrisusers00000000000000 XmHTML Legal Issues, Distribution and Licensing

    Introduction

    This document discusses the legal issues involved with using XmHTML in any program, but is mainly intended for those who want to use XmHTML in a commercial program.

    If you intend to use XmHTML with a program which will be distributed under the GPL or combine XmHTML into a library distributed under the LGPL, you can skip this document entirely.

    Licensing and Distribution

    XmHTML is distributed and licensed under the Library GNU Public License (LGPL). This license is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.

    The LGPL distinguishes two different uses of a library, each of which is described in the following paragraphs.

    A work based on the library

    Simply said, this means that you have modified a copy of the library (or any portion of it), or use parts of the library in a program. The resulting library must be distributed and licensed under the same terms, while the resulting program may opt to use the GNU Public License instead.

    A work based on the library may never become commercialized.

    See section 2 and 3 in the LGPL for more details.

    A work that uses the library

    This means: you have written a program the uses the library. (using header files from the library does not make it a work based on the library, header files are public interfaces and as such may be used without further consent).

    Such a program may be distributed under any license you choose, and thus XmHTML can also be used in commercial programs. See the next section for more details on using XmHTML in commercial programs. See section 5 and 6 in the LGPL for more details.

    Use of XmHTML in commercial programs

    Section 6 in the LGPL clearly states the requirements to any commercial program using XmHTML. It is mostly intended to allow users to upgrade and/or modify the library without depending on the vendor of such a program.

    If you find it very hard to comply with the requirements stated in section 6, you can obtain XmHTML under a different license which will allow full commercial use without any restrictions. This license does not exist yet but it will be a one-time source license with no run-time fees associated with it.

    This license however will come with a pricetag attached to it. Please contact us if you want to know more about this.




    ©Copyright 1996-1997 by Ripley Software Development
    Last update: September 19, 1997 by Koen
    XmHTML-1.1.10/html/PaxHeaders.1031/parser_prog.html0000644000175000001440000000013212613377377017767 xustar000000000000000030 mtime=1445854975.097545877 30 atime=1445854975.097545877 30 ctime=1445854975.097545877 XmHTML-1.1.10/html/parser_prog.html0000644000175000001440000000651412613377377017375 0ustar00chrisusers00000000000000 XmHTMLParser Programmers Guide

    Chapter 3
    XmHTMLParser Objects

    3.1 Creating a XmHTMLParser Object

    3.1.1 The XmHTMLParser Object's Text

    3.2 Configuring a XmHTMLParser Object

    3.3 XmHTMLParser Object Callback Functions

    3.3.1 Parser Callback

    3.3.2 ModifyVerify Callback

    3.3.3 Document Verification Callback

    3.4 Advanced XmHTMLParser Programming Techniques

    3.4.1 Progressive Document Parsing

    3.4.2 Accessing XmHTMLParser's Parser Tree

    3.4.3 Creating a HTML Document from XmHTMLParser's Output




    ©Copyright 1996-1997 by Ripley Software Development
    Last update: September 19, 1997 by Koen

    XmHTML-1.1.10/html/PaxHeaders.1031/procedures.html0000644000175000001440000000013212613377377017617 xustar000000000000000030 mtime=1445854975.098545877 30 atime=1445854975.097545877 30 ctime=1445854975.098545877 XmHTML-1.1.10/html/procedures.html0000644000175000001440000000375112613377377017225 0ustar00chrisusers00000000000000 XmHTML Programmers Manual: Procedures

    XmHTML Widget Set Datatypes

    XmHTML Procedures




    ©Copyright 1996-1998 by Ripley Software Development
    Last update: June 4, 1998 by Koen

    XmHTML-1.1.10/html/PaxHeaders.1031/font_map.html0000644000175000001440000000013212613377377017247 xustar000000000000000030 mtime=1445854975.094545877 30 atime=1445854975.094545877 30 ctime=1445854975.094545877 XmHTML-1.1.10/html/font_map.html0000644000175000001440000001505012613377377016650 0ustar00chrisusers00000000000000 XmHTML: Sample Font Map Definition

    Sample of a Custom Font Map Definition

    Users of XmHTML can define their own font mappings by providing a document containing various combinations of fonts in different styles and sizes. The document shown below is a typical example of such a font map definition.

    Note that it should be a valid HTML document. It does not need to contain any visible text however.

    custom_map.html

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
    <html>
    <head>
    	<META NAME="Author" CONTENT="Koen D'Hondt">
    	<META HTTP-EQUIV="Description" CONTENT="XmHTML font mapping.">
    </head>
    <body>
    
    <!--
    	Sample font map definition
     -->
    
    <!-- various forms of helvetica -->
    
    <!-- verdana is helvetica on macintosh -->
    
    <!-- all possible sizes, plain style -->
    <font face="verdana,helvetica" size="1"></font>
    <font face="verdana,helvetica" size="2"></font>
    <font face="verdana,helvetica" size="3"></font>
    <font face="verdana,helvetica" size="4"></font>
    <font face="verdana,helvetica" size="5"></font>
    <font face="verdana,helvetica" size="6"></font>
    <font face="verdana,helvetica" size="7"></font>
    
    <!-- all possible sizes, bold style -->
    <b><font face="verdana,helvetica" size="1"></font></b>
    <b><font face="verdana,helvetica" size="2"></font></b>
    <b><font face="verdana,helvetica" size="3"></font></b>
    <b><font face="verdana,helvetica" size="4"></font></b>
    <b><font face="verdana,helvetica" size="5"></font></b>
    <b><font face="verdana,helvetica" size="6"></font></b>
    <b><font face="verdana,helvetica" size="7"></font></b>
    
    <!-- all possible sizes, italic style -->
    <i><font face="verdana,helvetica" size="1"></font></i>
    <i><font face="verdana,helvetica" size="2"></font></i>
    <i><font face="verdana,helvetica" size="3"></font></i>
    <i><font face="verdana,helvetica" size="4"></font></i>
    <i><font face="verdana,helvetica" size="5"></font></i>
    <i><font face="verdana,helvetica" size="6"></font></i>
    <i><font face="verdana,helvetica" size="7"></font></i>
    
    <!-- all possible sizes, bold-italic style -->
    <b><i><font face="verdana,helvetica" size="1"></font></i></b>
    <b><i><font face="verdana,helvetica" size="2"></font></i></b>
    <b><i><font face="verdana,helvetica" size="3"></font></i></b>
    <b><i><font face="verdana,helvetica" size="4"></font></i></b>
    <b><i><font face="verdana,helvetica" size="5"></font></i></b>
    <b><i><font face="verdana,helvetica" size="6"></font></i></b>
    <b><i><font face="verdana,helvetica" size="7"></font></i></b>
    
    <!-- arial is helvetica on ms-windows -->
    
    <!-- all possible sizes, plain style -->
    <font face="arial,helvetica" size="1"></font>
    <font face="arial,helvetica" size="2"></font>
    <font face="arial,helvetica" size="3"></font>
    <font face="arial,helvetica" size="4"></font>
    <font face="arial,helvetica" size="5"></font>
    <font face="arial,helvetica" size="6"></font>
    <font face="arial,helvetica" size="7"></font>
    
    <!-- all possible sizes, bold style -->
    <b><font face="arial,helvetica" size="1"></font></b>
    <b><font face="arial,helvetica" size="2"></font></b>
    <b><font face="arial,helvetica" size="3"></font></b>
    <b><font face="arial,helvetica" size="4"></font></b>
    <b><font face="arial,helvetica" size="5"></font></b>
    <b><font face="arial,helvetica" size="6"></font></b>
    <b><font face="arial,helvetica" size="7"></font></b>
    
    <!-- all possible sizes, italic style -->
    <i><font face="arial,helvetica" size="1"></font></i>
    <i><font face="arial,helvetica" size="2"></font></i>
    <i><font face="arial,helvetica" size="3"></font></i>
    <i><font face="arial,helvetica" size="4"></font></i>
    <i><font face="arial,helvetica" size="5"></font></i>
    <i><font face="arial,helvetica" size="6"></font></i>
    <i><font face="arial,helvetica" size="7"></font></i>
    
    <!-- all possible sizes, bold-italic style -->
    <b><i><font face="arial,helvetica" size="1"></font></i></b>
    <b><i><font face="arial,helvetica" size="2"></font></i></b>
    <b><i><font face="arial,helvetica" size="3"></font></i></b>
    <b><i><font face="arial,helvetica" size="4"></font></i></b>
    <b><i><font face="arial,helvetica" size="5"></font></i></b>
    <b><i><font face="arial,helvetica" size="6"></font></i></b>
    <b><i><font face="arial,helvetica" size="7"></font></i></b>
    
    <!-- Inform ourselves that we have finished loading the font map -->
    Default font map loaded.
    
    </body>
    </html>
    
    XmHTML-1.1.10/PaxHeaders.1031/noautoupdate0000644000175000001440000000013212613377377016245 xustar000000000000000030 mtime=1445854975.137545877 30 atime=1445854975.137545877 30 ctime=1445854975.137545877 XmHTML-1.1.10/noautoupdate0000644000175000001440000000000012613377377015633 0ustar00chrisusers00000000000000XmHTML-1.1.10/PaxHeaders.1031/Changelog.txt0000644000175000001440000000013212613377377016242 xustar000000000000000030 mtime=1445854975.075545878 30 atime=1445854975.074545878 30 ctime=1445854975.075545878 XmHTML-1.1.10/Changelog.txt0000644000175000001440000001011212613377377015635 0ustar00chrisusers00000000000000This File lists changes after Version 1.1.7. which are not bugfixes ( see FIXES for bugfixes ) Change numbering: -, , , initials: cl: Christian Linhart cl/a: Christian Linhart , work sponsored by Arahne d.o.o. ( http:/www.arahne.si. ) ji: User Jimmer at nekochan.net ================================================================== 10/26/2015-1, cl Release 1.1.10 ================================================================== 10/25/2015-1, cl/a optionally disable XPM ================================================================== 10/10/2014-1, cl proper license for form-test.pl from the author ================================================================== 04/02/2014-2, "ji" and some changes by "cl" Make it optionally build on IRIX. To build on IRIX, set the make-variable "OS" to "IRIX" by editing the top makefile or specifying it on commandline: make OS=IRIX ================================================================== 03/18/2014-2, cl Release 1.1.9 ================================================================== 03/13/2014-2, cl remove rcsId from all files. reasons: * RCS is not used anymore * and the rcsId generates compiler warnings about unused static vars, therefore creating a lot of warning-spam which makes finding important warnings difficult. ================================================================== 03/13/2014-1, cl make SONAME configurable explicitely in the main Makefile ================================================================== 02/27/2014-1, cl added EXTRA_CFLAGS to CFLAGS rule in the main Makefile, so that additional CFLAGS may be specified by the caller of make. This helps with integration in build systems of a bigger project. ================================================================== 02/26/2014-2, cl remove Makefile.org files These files are not needed when working with plain Makefiles. I have removed them because otherwise they'd need to be kept consistent with the Makefiles. ================================================================== 02/26/2014-1, cl fix build system distclean does not destroy the makefiles anymore Prevent using the Imakefiles by #error and #if 0 Prevent using automake with an error message and exit 1 in autogen.sh ================================================================== 01/08/2014-1, cl/a, Version 1.1.8 * added support for XFT: - Added the following resources: - fontType: if this is set to "FONT_IS_XFT", then xft-mode is enabled. - xftFontFamily: fontFamily in XFT-Mode - xftFontFamilyFixed: fontFamilyFixed in XFT-Mode * added support for UTF-8 if in XFT-mode - If the resource "charset" has the value "utf-8", then UTF-8 encoding is assumed. * possibilty to specifiy a factor for text height. This can help to get more text on the screen for fonts with large line height. Controlled by the following float-resources - textHeightFactor: factor for proportional font - textHeightFactorFixed: factor for fixed font * add generation of shared lib to Makefiles * add targets to tools/Makefile for generating automatically generated files by mkString * tried to make GTK-mode compilable again, but this failed because the GTK-mode uses deprecated gdk functions such as GdkColorContextDither which are not contained anymore in current versions of gdk. * added the possibilty to specify a minimum horizontal padding for table cell contents. Reason: To avoid that the text directly touches the cell borders. - Added the following resources: - minColPadding: use at least this many pixels for horizontal padding Default-value: 0 * added the possibilty to specify an additional horizontal padding for text in tables. Reason: To avoid that the text directly touches the cell borders, but allow other objects such as nested tables to still touch the cell borders. - Added the following resources: - additionalHorizontalTextPaddingInTables: Default-value: 2 * new function XmHTMLScrollToYPos XmHTML-1.1.10/PaxHeaders.1031/LICENSE0000644000175000001440000000013212613377377014617 xustar000000000000000030 mtime=1445854975.078545878 30 atime=1445854975.078545878 30 ctime=1445854975.078545878 XmHTML-1.1.10/LICENSE0000644000175000001440000000176512613377377014230 0ustar00chrisusers00000000000000 This File: LICENSE for XmHTML Version 1.1.4 Beta This is a public BETA release of XmHTML, a Motif Widget capable of rendering HTML3.2 conforming documents. (C) Copyright 1993-1997 Ripley Software Development This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Koen D'Hondt Ripley Software Development ripley@xs4all.nl http://www.xs4all.nl/~ripley XmHTML-1.1.10/PaxHeaders.1031/include0000644000175000001440000000013212613377377015160 xustar000000000000000030 mtime=1445854975.107545877 30 atime=1445854991.789545578 30 ctime=1445854975.107545877 XmHTML-1.1.10/include/0000755000175000001440000000000012613377377014635 5ustar00chrisusers00000000000000XmHTML-1.1.10/include/PaxHeaders.1031/http0000644000175000001440000000013212613377377016137 xustar000000000000000030 mtime=1445854975.107545877 30 atime=1445854991.789545578 30 ctime=1445854975.107545877 XmHTML-1.1.10/include/http/0000755000175000001440000000000012613377377015614 5ustar00chrisusers00000000000000XmHTML-1.1.10/include/http/PaxHeaders.1031/HTTPP.h0000644000175000001440000000013212613377377017264 xustar000000000000000030 mtime=1445854975.107545877 30 atime=1445854975.107545877 30 ctime=1445854975.107545877 XmHTML-1.1.10/include/http/HTTPP.h0000644000175000001440000000557612613377377016701 0ustar00chrisusers00000000000000/***** * HTTPP.h : Private HTTP.c header file. * * This file Version $Revision: 1.1 $ * * Creation date: Tue Oct 21 01:57:37 GMT+0100 1997 * Last modification: $Date: 1997/10/23 00:28:29 $ * By: $Author: newt $ * Current State: $State: Exp $ * * Author: Richard Offer * * Copyright (C) 1994-1997 by Richard Offer * All Rights Reserved * * This file is part of insert_program_name_here * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * *****/ /***** * $Source: /usr/local/rcs/Newt/XmHTML/RCS/HTTPP.h,v $ *****/ /***** * ChangeLog * $Log: HTTPP.h,v $ * Revision 1.1 1997/10/23 00:28:29 newt * Initial Revision * *****/ #ifndef _HTTPP_h_ #define _HTTPP_h_ #include #define HTTP_VERSION_09 900 #define HTTP_VERSION_10 1000 #define HTTP_VERSION_11 1100 #define DEFAULT_TIMEOUT 5 /* default connect() and select() timeout */ #define DEFAULT_RETRY 0 /* default retry if select() fails */ #define GET_METHOD "GET " #define POST_METHOD "POST " #define HEAD_METHOD "HEAD " #define META_METHOD "META " #define HTTPVERSIONHDR " HTTP/1.0\r\n" #define NEWLINE "\r\n" #define CONTENT_LEN "Content-Length: " #define CONTENT_TYPE "Content-Type: text/plain" /* makes the HTTP header for the cookieList, it is the string returned from * this function that should be sent across the wire * The user is responsible for freeing the space. */ char *makeCookie(HTTPCookieList *cookieList); /* parse str, make a cookie and add it to the req->setCooke list, type is * SetCookie or SetCookie2, host is the host url (used as default for domain) */ void setCookie(HTTPCookieRequest *req, int type, char *str, char *host); /***** * This is the strlen of the Content-length of the form data. * 10 => forms with up to 100000000 bytes of data. *****/ #define MAX_FORM_LEN 10 /* read request size increment */ #define CHUNKSIZE 65536 /* HTTP server response definition */ typedef struct _HTTPResponse { unsigned char *data; /* message */ int http_version; /* server version */ HTTPRequestReturn status_code; /* request succeeded? */ HTTPNamedValues *headers; /* array of returned headers */ int num_headers; /* no of headers */ } HTTPResponse; /* Don't add anything after this endif! */ #endif /* _HTTPP_h_ */ XmHTML-1.1.10/include/http/PaxHeaders.1031/HTTP.h0000644000175000001440000000013212613377377017144 xustar000000000000000030 mtime=1445854975.107545877 30 atime=1445854975.107545877 30 ctime=1445854975.107545877 XmHTML-1.1.10/include/http/HTTP.h0000644000175000001440000002557612613377377016563 0ustar00chrisusers00000000000000/***** * HTTP.h : Public header file for HTTP.c, a simple HTTP/1.0 implementation. * * This file Version $Revision: 1.1 $ * * Creation date: Tue Oct 21 01:56:19 GMT+0100 1997 * Last modification: $Date: 1997/10/23 00:28:26 $ * By: $Author: newt $ * Current State: $State: Exp $ * * Author: Richard Offer * * Copyright (C) 1994-1997 by Richard Offer * All Rights Reserved * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * *****/ /***** * $Source: /usr/local/rcs/Newt/XmHTML/RCS/HTTP.h,v $ *****/ /***** * ChangeLog * $Log: HTTP.h,v $ * Revision 1.1 1997/10/23 00:28:26 newt * Initial Revision * *****/ #ifndef _HTTP_h_ #define _HTTP_h_ #define HTTPVERSION 0 #define HTTPREVISION 1 #define HTTPUPDATE_LEVEL 1 #define HTTPVersion \ (HTTPVERSION * 1000 + HTTPREVISION * 100 + HTTPUPDATE_LEVEL) /* used by Imake to get Shared library version numbering */ #ifndef _LIBRARY #define LIBHTTPVERSION_STRING \ "Client/HTTP Version 0.1.1 (C)Richard Offer and Ripley Software Development" /***** * Feel free to re-define the following, this is passed to every web-server * during all requests. * If you do change this, be careful (bad editing may lead to failed requests) * the format is * User-Agent: (manditory) * / * * cookieList is a list of all the cookies that apply * to the the URL (it will be NULL if no cookies are wanted by the server). * 3) at this point the application can step in and inform the user that a * cookie is wanted by the server, if the user doesn't want to send the * cookie, it should set cookieRequest->sendCookie to false _before_ calling * loadHTTPUrl() (this is better than simply passing NULL into * loadHTTPUrl() since it gives tha application chnace to recieve any new * cookies. * 4) on return from loadHTTPUrl() cookieRequest->setCookie will be non-null * if the server sent a save cookie response. The application can then * decide to save this cookie for the rest of the session by calling * addCookieListToCache (passing in cookieRequest->setCookie). * 5) for permanant saving of the cookies the application needs to call * writeCookieCache(); */ /* * Notes. * * url must be fully qualified, CookieList is a linked-list of Cookies, all * that apply to the url. * * To save the cookies between sessions, use writeCookieCache(). This writes * cache back out (including any new cookies set during the session). Note that * for safety, I'm not going to allow for the writing of Netscape cookie files * (but using mergeCookieCache() we can read the existing Netscape cookie file * and merge it with a custom cookie file (makes it easier moving to a new * browser from netscape. * ---if pushed, this may change later. */ extern HTTPCookieRequest *getCookieFromCache(HTTPCookieCache *, char * url); extern void addCookieListToCache(HTTPCookieCache *, HTTPCookieList *); extern void writeCookieCache(HTTPCookieCache *cache); /* take the cookies from cache c2 and add them into c1. * The reason for this is so that you can open an empty CookieJar file _and_ * a Netscape cookie file (in that order), then take the cookies from the * Netscape file and save them into the CookieJar file (since I don't * support the writing of Netscape cookie files * * Do not free c2 */ extern void mergeCookieCache(HTTPCookieCache *c1, HTTPCookieCache *c2); void freeCookieCache(HTTPCookieCache * , int /* free cookies ? */); void freeCookieRequest(HTTPCookieRequest *); /* convenience macros */ #define NewNString(STR,len) \ ((STR) != NULL ? (strncpy(calloc(len+1,sizeof(char)), STR,(len))) : NULL) #define NewString(STR) \ ((STR) != NULL ? (strcpy(malloc(strlen(STR)+1),STR)) : NULL) #define stringToBoolean(str) \ ((str) != NULL && *(str) ? ( *(str) == 'T' || *(str) == 't' || *(str) == 'y' ? 1: 0 ) : 0) #endif /* _LIBRARY */ /* Don't add anything after this endif! */ #endif /* _HTTP_h_ */ XmHTML-1.1.10/include/PaxHeaders.1031/common0000644000175000001440000000013212613377377016450 xustar000000000000000030 mtime=1445854975.106545877 30 atime=1445854991.789545578 30 ctime=1445854975.106545877 XmHTML-1.1.10/include/common/0000755000175000001440000000000012613377377016125 5ustar00chrisusers00000000000000XmHTML-1.1.10/include/common/PaxHeaders.1031/miniparse.h0000644000175000001440000000013212613377377020665 xustar000000000000000030 mtime=1445854975.105545877 30 atime=1445854975.105545877 30 ctime=1445854975.105545877 XmHTML-1.1.10/include/common/miniparse.h0000644000175000001440000003032712613377377020272 0ustar00chrisusers00000000000000/***** * miniparse.h : required header file when compiling the parser standalone. * * This file Version $Revision: 1.7 $ * * Creation date: Wed Mar 19 17:26:15 GMT+0100 1997 * Last modification: $Date: 1998/04/27 07:01:07 $ * By: $Author: newt $ * Current State: $State: Exp $ * * Author: newt * * Copyright (C) 1994-1997 by Ripley Software Development * All Rights Reserved * * This file is part of the XmHTML Widget Library. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * *****/ /***** * $Source: /usr/local/rcs/Newt/XmHTML/RCS/miniparse.h,v $ *****/ /***** * ChangeLog * $Log: miniparse.h,v $ * Revision 1.7 1998/04/27 07:01:07 newt * Added _FastLower macro * * Revision 1.6 1997/10/23 00:30:39 newt * XmHTML Beta 1.1.0 release * * Revision 1.5 1997/08/30 02:04:25 newt * _XmHTMLWarning proto changes. * * Revision 1.3 1997/05/28 01:56:39 newt * Added my_strdup. * * Revision 1.2 1997/04/29 14:31:41 newt * Removed unused structures. * * Revision 1.1 1997/03/20 08:01:55 newt * Initial Revision * *****/ #ifndef _miniparse_h_ #define _miniparse_h_ #ifndef MINIPARSE #define MINIPARSE 1 #endif #include #include #ifdef __STDC__ #include #else #include #endif #include /* perror */ /* required typedefs */ typedef char* String; typedef unsigned char Byte; typedef unsigned char Boolean; typedef unsigned short Dimension; typedef unsigned char* Widget; typedef Widget XmHTMLWidget; #define _XFUNCPROTOBEGIN /* */ #define _XFUNCPROTOEND /* */ /* Set to False if you don't want any warnings being issued */ extern Boolean parser_warnings; /* Running count of encountered errors */ extern int parser_errors; /* Count of HTML segments in the input text */ extern int parsed_object_count; /* Count of text segments in the input text */ extern int parsed_text_object_count; /* Set to False if you want the parser to be a bit more lenient */ extern Boolean parser_strict_checking; /* Set to True if you want to see debug output */ extern Boolean parser_debug; /* Set to True if you want to get timings from the parser tree verification */ extern Boolean parser_verification_timings; /* we always set debug flag in here, unless NDEBUG was defined */ #ifdef NDEBUG # undef DEBUG #else # ifndef DEBUG # define DEBUG 1 # endif #endif #ifndef True # define True 1 # define False 0 #endif /* tolower macro replacement */ extern const Byte __my_translation_table[]; #define _FastLower(x) (__my_translation_table[(Byte)x]) /***** * HTML Elements internal id's * This list is alphabetically sorted to speed up the searching process. * DO NOT MODIFY *****/ typedef enum{ HT_DOCTYPE, HT_A, HT_ADDRESS, HT_APPLET, HT_AREA, HT_B, HT_BASE, HT_BASEFONT, HT_BIG, HT_BLOCKQUOTE, HT_BODY, HT_BR, HT_CAPTION, HT_CENTER, HT_CITE, HT_CODE, HT_DD, HT_DFN, HT_DIR, HT_DIV, HT_DL, HT_DT, HT_EM, HT_FONT, HT_FORM, HT_FRAME, HT_FRAMESET, HT_H1, HT_H2, HT_H3, HT_H4, HT_H5, HT_H6, HT_HEAD, HT_HR, HT_HTML, HT_I, HT_IMG, HT_INPUT, HT_ISINDEX, HT_KBD, HT_LI, HT_LINK, HT_MAP, HT_MENU, HT_META, HT_NOFRAMES, HT_OL, HT_OPTION, HT_P, HT_PAGE,HT_PARAM, HT_PRE, HT_SAMP, HT_SCRIPT, HT_SELECT, HT_SMALL, HT_STRIKE, HT_STRONG, HT_STYLE, HT_SUB, HT_SUP, HT_TAB, HT_TABLE, HT_TD, HT_TEXTAREA, HT_TH, HT_TITLE, HT_TR, HT_TT, HT_U, HT_UL, HT_VAR, HT_ZTEXT }htmlEnum; /***** * and corresponding name table, defined in parse.c *****/ extern String *html_tokens; /* elements for which a closing counterpart is optional */ #define OPTIONAL_CLOSURE(id) ((id) == HT_DD || (id) == HT_DT || \ (id) == HT_LI || (id) == HT_P || (id) == HT_OPTION || (id) == HT_TD || \ (id) == HT_TH || (id) == HT_TR) /* physical/logical markup elements */ #define IS_MARKUP(id) ((id) == HT_TT || (id) == HT_I || (id) == HT_B || \ (id) == HT_U || (id) == HT_STRIKE || (id) == HT_BIG || (id) == HT_SMALL || \ (id) == HT_SUB || (id) == HT_SUP || (id) == HT_EM || (id) == HT_STRONG || \ (id) == HT_DFN || (id) == HT_CODE || (id) == HT_SAMP || (id) == HT_KBD || \ (id) == HT_VAR || (id) == HT_CITE || (id) == HT_FONT) /* text containers */ #define IS_CONTAINER(id) ((id) == HT_BODY || (id) == HT_DIV || \ (id) == HT_CENTER || (id) == HT_BLOCKQUOTE || (id) == HT_FORM || \ (id) == HT_TH || (id) == HT_TD || (id) == HT_DD || (id) == HT_LI || \ (id) == HT_NOFRAMES) /* all elements that may be nested */ #define NESTED_ELEMENT(id) (IS_MARKUP(id) || (id) == HT_APPLET || \ (id) == HT_BLOCKQUOTE || (id) == HT_DIV || (id) == HT_CENTER || \ (id) == HT_FRAMESET) /* other elements */ #define IS_MISC(id) ((id) == HT_P || (id) == HT_H1 || (id) == HT_H2 || \ (id) == HT_H3 || (id) == HT_H4 || (id) == HT_H5 || (id) == HT_H6 || \ (id) == HT_PRE || (id) == HT_ADDRESS || (id) == HT_APPLET || \ (id) == HT_CAPTION || (id) == HT_A || (id) == HT_DT) /***** * possible error codes for XmNparserCallback *****/ typedef enum{ HTML_UNKNOWN_ELEMENT = 1, /* unknown HTML element */ HTML_BAD, /* very badly placed element */ HTML_OPEN_BLOCK, /* block still open while new block started */ HTML_CLOSE_BLOCK, /* block closed but was never opened */ HTML_OPEN_ELEMENT, /* unbalanced terminator */ HTML_NESTED, /* improperly nested element */ HTML_VIOLATION, /* bad content for current block/element */ HTML_NOTIFY, /* insertion of optional opening/closing */ HTML_INTERNAL /* internal parser error */ }parserError; /***** * And corresponding values for XmNenableBadHTMLWarnings. * These are or'd together. * XmNONE disables warnings and XmHTML_ALL enables all warnings. * See parserError for their meaning. *****/ enum{ XmHTML_NONE = 0, /* no warnings */ XmHTML_UNKNOWN_ELEMENT = 1, XmHTML_BAD = 2, XmHTML_OPEN_BLOCK = 4, XmHTML_CLOSE_BLOCK = 8, XmHTML_OPEN_ELEMENT = 16, XmHTML_NESTED = 32, XmHTML_VIOLATION = 64, XmHTML_ALL = 127 /* all warnings */ }; /***** * Definition of parsed HTML elements *****/ typedef struct _XmHTMLObject{ htmlEnum id; /* ID for this element */ String element; /* * Raw text. For HTML elements, freeing this * member also frees attributes. */ String attributes; /* attributes for this element, if any */ Boolean is_end; /* true when this is a closing element */ Boolean terminated; /* true when element has a closing counterpart */ Boolean ignore; /* true if element must be ignored */ Boolean auto_insert;/* auto inserted element */ Boolean violation; /* element is in violation of HTML standard */ int line; /* line number for this element */ struct _XmHTMLObject *next; struct _XmHTMLObject *prev; }XmHTMLObject; /***** * Function to be called when the parser finished a single pass on the input * * ARGS: * First : The current list of parser objects, which may NOT be freed. * Second: True if input was HTML3.2 conforming, False if not; * Third : True if parser verification succeeded; * Fourth: True if parser tree was balanced; * Fifth : current parser pass (count starts at 0); * Sixth : length of input text; * Return values: * True : make another pass on the input using the current (possibly * repaired) output; * False : don't make another pass on the input; *****/ typedef Boolean (*ParserDocumentCallback)(XmHTMLObject*, Boolean, Boolean, Boolean, int, int); extern ParserDocumentCallback parser_document_callback; /***** * Function to be called upon completion of a single pass * ARGS: * First : number of elements still on stack (only when document is * unbalanced); * Second: number of (missing) HTML tags inserted by the parser; * Third : number of HTML tags ignored by the parser; * Return values: * None. *****/ typedef void (*ParserAutoCorrectCallback)(int, int, int); extern ParserAutoCorrectCallback parser_autocorrect_callback; /***** * Parser state stack object *****/ typedef struct _stateStack{ htmlEnum id; /* current state id */ struct _stateStack *next; /* ptr to next record */ }stateStack; typedef struct _XmHTMLParserTag{ /* user-provided data fields */ String tag; /* name of tag */ Boolean terminated; /* tag has a terminating counterpart */ unsigned long flags; /* defined attributes */ void *user_data; /* external tag data, unused internally */ /* internal fields */ int id; /* internal id, -1 == unused */ }XmHTMLParserTag; /***** * A Parser *****/ typedef struct _Parser{ String source; /* text being parsed */ int index; /* last known position */ int len; /* length of input text */ int num_lines; /* current line count */ Dimension line_len; /* maximum line length so far */ Dimension cnt; /* current line length */ void (*store_text)(); /* text insertion function */ /* running list of inserted elements */ int num_elements; /* no of tags inserted so far */ int num_text; /* no of text elements inserted so far */ XmHTMLObject *head; /* head of object list */ XmHTMLObject *current; /* lastly inserted element */ stateStack state_base; /* stack base point */ stateStack *state_stack; /* actual stack */ int cstart; /* current element start position */ int cend; /* current element end position */ Boolean strict_checking; /* HTML 3.2 looseness flag */ Boolean have_body; /* indicates presence of tag */ Boolean have_page; Boolean warn; /* warn about bad html constructs */ Boolean bad_html; /* bad HTML document flag */ Boolean html32; /* HTML32 conforming document flag */ Boolean automatic; /* when in automatic mode */ Boolean do_icons; /* look for icon entities */ Widget widget; /* for the warning messages */ }Parser; /***** * Various helper functions used by the parser (and defined by the parser * when it's compiled with -DMINIPARSE *****/ extern void my_locase(char *string); extern char* my_strcasestr(const char *s1, const char *s2); extern char* my_strndup(const char *s1, size_t len); extern char* my_strdup(const char *s1); /***** * The parser uses strcasecmp and strncasecmp. Since these do not exist * on every system, the parser carriers fallback copies which will be used * if you define -DNEED_STRCASECMP at compile time. *****/ #ifdef NEED_STRCASECMP extern int my_strcasecmp (const char *s1, const char *s2); extern int my_strncasecmp (const char *s1, const char *s2, size_t n); #define strcasecmp(S1,S2) my_strcasecmp(S1,S2) #define strncasecmp(S1,S2,N) my_strncasecmp(S1,S2,N) #endif /***** * Warning message display function * When parser_warnings has been set to False, no warnings will be * generated. *****/ #define __WFUNC__(WIDGET_ID, FUNC) (Widget)WIDGET_ID, __FILE__, \ __LINE__, FUNC extern void __XmHTMLWarning( #ifdef __STDC__ Widget w, String module, int line, String routine, String fmt, ... #endif ); #define _XmHTMLWarning __XmHTMLWarning /***** * Public Parser Functions *****/ /***** * Write the list of objects to the given file. If notext is True, HTML * text segments will not be included in the output file. *****/ extern void ParserWriteOutputToFile(XmHTMLObject *objects, String prefix, Boolean notext); /* Write the list of objects to the given file as a HTML file */ extern void ParserWriteHTMLOutputToFile(XmHTMLObject *objects, String prefix, Boolean notext); /* compose a HTML output string from the list of objects */ extern String _XmHTMLTextGetString(XmHTMLObject *objects); /* free the given list of objects */ extern void _XmHTMLFreeObjects(XmHTMLObject *objects); /***** * The parser. Takes a two widgets, a previous list of objects and the text * to be parsed as it's input. * Returns a list of parsed objects. *****/ extern XmHTMLObject *_XmHTMLparseHTML(XmHTMLWidget html, XmHTMLObject *old_list, char *input, XmHTMLWidget dest); /* Don't add anything after this endif! */ #endif /* _miniparse_h_ */ XmHTML-1.1.10/include/common/PaxHeaders.1031/XmHTMLI.h0000644000175000001440000000013212613377377020060 xustar000000000000000030 mtime=1445854975.105545877 30 atime=1445854975.105545877 30 ctime=1445854975.105545877 XmHTML-1.1.10/include/common/XmHTMLI.h0000644000175000001440000012160412613377377017464 0ustar00chrisusers00000000000000/***** * XmHTMLI.h : XmHTML internal function proto's. * Only required when building the XmHTML Library. * If you whish to include this file, it *must* be included * AFTER XmHTMLP.h as it references a number of structures defined * in that header. * * This file Version $Revision: 1.4 $ * * Creation date: Tue Aug 19 16:03:22 GMT+0100 1997 * Last modification: $Date: 1998/04/27 06:56:48 $ * By: $Author: newt $ * Current State: $State: Exp $ * * Author: newt * * Copyright (C) 1994-1997 by Ripley Software Development * All Rights Reserved * * This file is part of the XmHTML Widget Library. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU [Library] General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU [Library] General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * *****/ /***** * $Source: /usr/local/rcs/Newt/XmHTML/RCS/XmHTMLI.h,v $ *****/ /***** * ChangeLog * $Log: XmHTMLI.h,v $ * Revision 1.4 1998/04/27 06:56:48 newt * Removed a few obsolete functions and added new protos from private.c and * public.c * * Revision 1.3 1998/04/04 06:27:54 newt * XmHTML Beta 1.1.3 * * Revision 1.2 1997/10/23 00:24:46 newt * XmHTML Beta 1.1.0 release * * Revision 1.1 1997/08/30 00:07:31 newt * Initial Revision * *****/ #ifndef _XmHTMLI_h_ #define _XmHTMLI_h_ #ifdef _XFUNCPROTOBEGIN _XFUNCPROTOBEGIN #else #ifdef __cplusplus extern "C" { #endif /* __clpusplus */ #endif /***** * When XmHTML_ERROR_FUNCS is defined, only the error functions (at the end * of this include file) will be visible to the outside world. *****/ #ifndef XmHTML_ERROR_FUNCS /* usefull macros */ #define Abs(x) ((x) < 0 ? -(x) : (x)) #define Max(x,y) (((x) > (y)) ? (x) : (y)) #define Min(x,y) (((x) < (y)) ? (x) : (y)) /* RANGE forces a to be in the range b..c (inclusive) */ #define RANGE(a,b,c) { if (a < b) a = b; if (a > c) a = c; } /********************************************************************* * @Module: parse.c * @Description: XmHTML HTML parser * * @Exports: * _XmHTMLparseHTML : raw HTML parser. * _XmHTMLFreeObjects : free the given parser tree. * _XmHTMLTextGetSTring: create a HTML source document from the given * parser tree. * _ParserCreate : create a parser Object. * _ParserDelete : delete a parser Object. * _ParserReset : reset a parser Object. * _ParserCheckElementOccurance: check whether presence of an element in * in a certain state is allowed. * _ParserCheckElementContent : check whether an element is allowed to * appear in a certain state. * _ParserCutComment : cut a HTML comment from the input stream. * _ParserNewObject : allocate a new object. * _ParserPushState : push a parser state on the stack. * _ParserPopState : pop a parser state from the stack. * _ParserOnStack : check if the given element is on the stack. * _ParserTokenToId : convert a string to an internal element id. * _ParserStoreElement : store a real element * _ParserStoreTextElement: store a text element. * _ParserStoreTextElementRtoL: store a text element and reverse it's contents. * _ParserInsertElement: insert a new element in the list of elements. * _ParserTerminateElement: terminate the given element. Backtracks both stack * and element list * _ParserCopyElement : copy an element * _ParserVerify : verify (and correct) the presence of an element. * _ParserVerifyVerification: verify whether the parser successfully * verified/repaired a document. * **********************************************************************/ extern Parser *_ParserCreate(Widget w); extern void _ParserDelete(Parser *parser); extern int _ParserCheckElementOccurance(Parser *parser, htmlEnum current, htmlEnum state); extern Boolean _ParserCheckElementContent(Parser *parser, htmlEnum current, htmlEnum state); extern String _ParserCutComment(Parser *parser, String start); extern XmHTMLObject *_ParserNewObject(Parser *parser, htmlEnum id, char *element, char *attributes, Boolean is_end, Boolean terminated); extern void _ParserPushState(Parser *parser, htmlEnum id); extern htmlEnum _ParserPopState(Parser *parser); extern Boolean _ParserOnStack(Parser *parser, htmlEnum id); extern htmlEnum _ParserTokenToId(Parser *parser, String token, Boolean warn); extern String _ParserStoreElement(Parser *parser, char *start, char *end); extern void _ParserStoreTextElement(Parser *parser, char *start, char *end); extern void _ParserStoreTextElementRtoL(Parser *parser, char *start, char *end); extern void _ParserInsertElement(Parser *parser, String element, htmlEnum new_id, Boolean is_end); extern Boolean _ParserTerminateElement(Parser *parser, String element, htmlEnum current, htmlEnum expect); extern void _ParserCopyElement(Parser *parser, XmHTMLObject *src, Boolean is_end); extern int _ParserVerify(Parser *parser, htmlEnum id, Boolean is_end); extern XmHTMLObject *_ParserVerifyVerification(XmHTMLObject *objects); extern XmHTMLObject *_XmHTMLparseHTML(XmHTMLWidget html, XmHTMLObject *old_list, char *input, XmHTMLWidget dest); extern void _XmHTMLFreeObjects(XmHTMLObject *objects); extern String _XmHTMLTextGetString(XmHTMLObject *objects); /* set of macros used by both parse.c and Parser.c */ /* elements for which a closing counterpart is optional */ #define OPTIONAL_CLOSURE(id) ((id) == HT_DD || (id) == HT_DT || \ (id) == HT_LI || (id) == HT_P || (id) == HT_OPTION || (id) == HT_TD || \ (id) == HT_TH || (id) == HT_TR || (id) == HT_PAGE) /* physical/logical markup elements */ #define IS_MARKUP(id) ((id) == HT_TT || (id) == HT_I || (id) == HT_B || \ (id) == HT_U || (id) == HT_STRIKE || (id) == HT_BIG || (id) == HT_SMALL || \ (id) == HT_SUB || (id) == HT_SUP || (id) == HT_EM || (id) == HT_STRONG || \ (id) == HT_DFN || (id) == HT_CODE || (id) == HT_SAMP || (id) == HT_KBD || \ (id) == HT_VAR || (id) == HT_CITE || (id) == HT_FONT) /* text containers */ #define IS_CONTAINER(id) ((id) == HT_BODY || (id) == HT_DIV || \ (id) == HT_CENTER || (id) == HT_BLOCKQUOTE || (id) == HT_FORM || \ (id) == HT_TH || (id) == HT_TD || (id) == HT_DD || (id) == HT_LI || \ (id) == HT_NOFRAMES || (id) == HT_PAGE) /* all elements that may be nested */ #define NESTED_ELEMENT(id) (IS_MARKUP(id) || (id) == HT_APPLET || \ (id) == HT_BLOCKQUOTE || (id) == HT_DIV || (id) == HT_CENTER || \ (id) == HT_FRAMESET) /* other elements */ #define IS_MISC(id) ((id) == HT_P || (id) == HT_H1 || (id) == HT_H2 || \ (id) == HT_H3 || (id) == HT_H4 || (id) == HT_H5 || (id) == HT_H6 || \ (id) == HT_PRE || (id) == HT_ADDRESS || (id) == HT_APPLET || \ (id) == HT_CAPTION || (id) == HT_A || (id) == HT_DT) /********************************************************************* * @Module: callbacks.c * @Description: XmHTML callback routines * * @Exports: * _XmHTMLLinkCallback : XmNlinkCallback driver. * _XmHTMLTrackCallback: XmNanchorTrackCallback driver. * _XmHTMLActivateCallback: XmNactivateCallback drivers * _XmHTMLDocumentCallback: XmNdocumentCallback drivers. * _XmHTMLFrameCreateCallback : XmNframeCallback driver for frame creation. * _XmHTMLFrameDestroyCallback: XmNframeCallback driver for frame * destruction. * _XmHTMLEventProcess : XmNeventCallback driver. * _XmHTMLEventFreeDatabase: release all storage allocated for the * HTML 4.0 event handling. * **********************************************************************/ extern void _XmHTMLLinkCallback(XmHTMLWidget html); extern void _XmHTMLTrackCallback(XmHTMLWidget html, XEvent *event, XmHTMLAnchor *anchor); extern Boolean _XmHTMLActivateCallback(XmHTMLWidget html, XEvent *event, XmHTMLAnchor *anchor); extern Boolean _XmHTMLDocumentCallback(XmHTMLWidget html, Boolean html32, Boolean verified, Boolean balanced, Boolean terminated, int pass_level); extern void _XmHTMLFocusOutCallback(XmHTMLWidget html, XEvent *event); extern void _XmHTMLFocusInCallback(XmHTMLWidget html, XEvent *event); extern void _XmHTMLMotionCallback(XmHTMLWidget html, XEvent *event); extern void _XmHTMLInputCallback(XmHTMLWidget html, XEvent *event); extern void _XmHTMLArmCallback(XmHTMLWidget html, XEvent *event); extern void _XmHTMLImagemapCallback(XmHTMLWidget html, XmHTMLImage *image, XmHTMLImagemapCallbackStruct *cbs); extern Widget _XmHTMLFrameCreateCallback(XmHTMLWidget html, XmHTMLFrameWidget *frame); extern void _XmHTMLFrameDoneCallback(XmHTMLWidget html, XmHTMLFrameWidget *frame, Widget widget); extern int _XmHTMLFrameDestroyCallback(XmHTMLWidget html, XmHTMLFrameWidget *frame); extern Boolean _XmHTMLEventProcess(XmHTMLWidget html, XEvent *event, HTEvent *ht_event); extern void _XmHTMLEventFreeDatabase(XmHTMLWidget old, XmHTMLWidget html); /********************************************************************* * @Module: format.c * @Description : XmHTML formatting routines, translate the parse output * to a set of objects suitable for displaying a HTML page. * * @Exports: * _XmHTMLformatObjects: create a list of formatted objects. * _XmHTMLNewAnchor : allocate and fill a new anchor. * **********************************************************************/ extern void _XmHTMLformatObjects(XmHTMLWidget old, XmHTMLWidget html); extern XmHTMLAnchor* _XmHTMLNewAnchor(XmHTMLWidget html, XmHTMLObject *object); /********************************************************************* * @Module: frames.c * @Description: XmHTML frame support * * @Exports: * _XmHTMLCreateFrames : create all required HTML frame widgets. * _XmHTMLCreateFrame : create a htmlWidgetClass for use in HTML frames * _XmHTMLCheckForFrames: check for a frameset definition, destroying * any previous frame lists. * _XmHTMLReconfigureFrames : recompute the frame layout after a widget * resize. * **********************************************************************/ extern Boolean _XmHTMLCreateFrames(XmHTMLWidget old, XmHTMLWidget html); extern Widget _XmHTMLCreateFrame(XmHTMLWidget html, XmHTMLFrameWidget *frame, XmHTMLFrameCallbackStruct *fptr); extern void _XmHTMLDestroyFrames(XmHTMLWidget html, int nframes); extern int _XmHTMLCheckForFrames(XmHTMLWidget html, XmHTMLObject *objects); extern void _XmHTMLReconfigureFrames(XmHTMLWidget html); /********************************************************************* * @Module: forms.c * @Description: XmHTML HTML form support. * * @Exports: * _XmHTMLStartForm : start a new form. * _XmHTMLEndForm : terminate the form opened with _XmHTMLStartForm. * _XmHTMLFreeForm : destroy a given form. * _XmHTMLFormAddInput : add an input field to the current form. * _XmHTMLFormAddSelect : add a select field to the current form. * _XmHTMLFormSelectAddOption: add an option to select opened with * _XmHTMLFormAddSelect. * _XmHTMLFormSelectClose : close the select opened with * _XmHTMLFormAddSelect. * _XmHTMLFormAddTextArea : add a text area to the current form. * _XmHTMLFormActivate : XmNformCallback driver. * _XmHTMLFormReset : reset a given form to it's default values. * _XmHTMLProcessTraversal: form widget traversal handler. * _XmHTMLFormCreateClipmask: create a clipmask for fast scrolling. * **********************************************************************/ extern void _XmHTMLStartForm(XmHTMLWidget html, String attributes); extern void _XmHTMLEndForm(XmHTMLWidget html); extern XmHTMLForm *_XmHTMLFormAddInput(XmHTMLWidget html, String attributes); extern XmHTMLForm *_XmHTMLFormAddSelect(XmHTMLWidget html, String attributes); extern XmHTMLForm *_XmHTMLFormAddTextArea(XmHTMLWidget html, String attributes, String text); extern void _XmHTMLFormSelectAddOption(XmHTMLWidget html, XmHTMLForm *entry, String attributes, String label); extern void _XmHTMLFormSelectClose(XmHTMLWidget html, XmHTMLForm *entry); extern void _XmHTMLFreeForm(XmHTMLWidget html, XmHTMLFormData *form); extern Boolean _XmHTMLFormActivate(XmHTMLWidget html, XEvent *event, XmHTMLForm *entry); extern void _XmHTMLFormReset(XmHTMLWidget html, XmHTMLForm *entry); extern void _XmHTMLProcessTraversal(Widget w, int direction); extern Boolean _XmHTMLFormCreateClipmask(XmHTMLWidget html); /********************************************************************* * @Module: XmHTML.c * @Description: XmHTML Widget definition, widget methods and public * functions. * * @Exports: * _XmHTMLGetAnchorByValue: finds the object of a named anchor by it's id. * _XmHTMLGetAnchorByName : finds the object of a named anchor by it's name. * _XmHTMLMoveToPos : scroll the display area by a given amount. * Scroll direction is given by the widget id. * _XmHTMLCheckXCC : create a XColorContext for the a HTML widget. * _XmHTMLClearArea : XClearArea for a XmHTML widget. * _XmHTMLCvtStringToWarning: convert a XmCHTMLWarningType to it's internal * representation. * _XmHTMLScrollToLine : position the given line on the top of the display * area. * _XmHTMLVerticalPosToLine: figure out the line number of the first element * at the given (absolute) y position. * _XmHTMLOnImage : find the image at the given (relative) * coordinates. * _XmHTMLGetImageAnchor : determines if the given (relative) coordinates lie * upon an image that has an imagemap and thus * represent an anchor. * _XmHTMLGetAnchor : determines if the (relative) coordinates are within * the bounding rectangle of an anchor and thus * represent an anchor. **********************************************************************/ extern XmHTMLObjectTableElement _XmHTMLGetAnchorByValue(XmHTMLWidget html, int anchor_id); extern XmHTMLObjectTableElement _XmHTMLGetAnchorByName(XmHTMLWidget html, String anchor); extern void _XmHTMLClearArea(XmHTMLWidget html, int x, int y, int width, int height); /***** * This function is only used by the Motif version of XmHTML. *****/ #ifdef _XtIntrinsic_h extern Boolean _XmHTMLCvtStringToWarning(Display *dpy, XrmValuePtr args, Cardinal *num_args, XrmValuePtr from_val, XrmValuePtr to_val, XtPointer *converter_data); #endif extern void _XmHTMLScrollToLine(XmHTMLWidget html, int line); extern int _XmHTMLVerticalPosToLine(XmHTMLWidget html, int y); extern XmHTMLImage *_XmHTMLOnImage(XmHTMLWidget html, int x, int y); extern XmHTMLAnchor *_XmHTMLGetImageAnchor(XmHTMLWidget html, int x, int y, XmHTMLImage *list); extern XmHTMLWord *_XmHTMLGetAnchor(XmHTMLWidget html, int x, int y, XmHTMLImage *img); extern void _XmHTMLGetScrollDim(XmHTMLWidget html, int *hsb_height, int *vsb_width); extern void _XmHTMLCheckScrollBars(XmHTMLWidget html); /* manage scrollbars if necessary */ #define _XmHTMLSetScrollBars(HTML) { \ if(ATTR_HTML(HTML, needs_hsb) && \ !(ATTR_HTML(HTML,tka)->IsManaged(ATTR_HTML(HTML,hsb)))) \ ATTR_HTML(HTML,tka)->ManageChild(ATTR_HTML(HTML, hsb)); \ if(ATTR_HTML(HTML, needs_vsb) && \ !(ATTR_HTML(HTML,tka)->IsManaged(ATTR_HTML(HTML,vsb)))) \ ATTR_HTML(HTML,tka)->ManageChild(ATTR_HTML(HTML, vsb)); \ } extern void _XmHTMLAdjustVerticalScrollValue(Widget vsb, int *value); extern void _XmHTMLRaiseFormWidgets(XmHTMLWidget html); /* private.c */ extern XmHTMLObjectTableElement _XmHTMLGetLineObject(XmHTMLWidget html, int y_pos); extern void _XmHTMLSetCurrentLineNumber(XmHTMLWidget html, int y_pos); extern void _XmHTMLCheckMaxColorSetting(XmHTMLWidget html); extern void _XmHTMLCheckGC(XmHTMLWidget html); extern void _XmHTMLResize(Widget w); extern void _XmHTMLLayout(XmHTMLWidget html); extern void _XmHTMLReset(XmHTMLWidget html, Boolean free_img); extern void _XmHTMLFreeExpendableResources(XmHTMLWidget html, Boolean free_img); extern void _XmHTMLDestroyPhaseZero(XmHTMLWidget html); extern void _XmHTMLRefresh(XmHTMLWidget html, int x, int y, int width, int height); extern void _XmHTMLMoveToPos(Widget w, XmHTMLWidget html, int value); extern void _XmHTMLCheckXCC(XmHTMLWidget html); /********************************************************************* * @Module: paint.c * @Description: XmHTML rendering routines. * * @Exports: * _XmHTMLPaint : display a list of objects. * _XmHTMLRestartAnimations: freeze or restart all animations in a document. * _XmHTMLDrawImage : refresh a single image. * **********************************************************************/ extern void _XmHTMLPaint(XmHTMLWidget html, XmHTMLObjectTable *start, XmHTMLObjectTable *end); extern void _XmHTMLRestartAnimations(XmHTMLWidget html); extern void _XmHTMLDrawImage(XmHTMLWidget html, XmHTMLObjectTableElement data, int y_offset, Boolean from_timerCB); extern void _XmHTMLPaintAnchorUnSelected(XmHTMLWidget html); extern void _XmHTMLPaintAnchorSelected(XmHTMLWidget html, XmHTMLWord *anchor); extern void _XmHTMLPaintAnchorLeave(XmHTMLWidget html); extern void _XmHTMLPaintAnchorEntry(XmHTMLWidget html, XmHTMLObjectTable *anchor); /********************************************************************* * @Module: layout.c * @Description : XmHTML layout computation routines * * @Exports: * _XmHTMLComputeLayout: computes the full screen layout for a XmHTML * widget. * **********************************************************************/ extern void _XmHTMLComputeLayout(XmHTMLWidget html); /********************************************************************* * @Module: StringUtil.c * @Description: string manipulators and HTML tag analyzers. * * @Exports: * __my_translation_table : lowercase translation table. * my_upcase : make a string all uppercase. * my_locase : make a string all lowercase. * my_strcasestr : case insensitive strstr. * ToAsciiLower : convert a number to all lowercase ASCII. * ToAsciiUpper : convert a number to all uppercase ASCII. * ToRomanLower : convert a number to all uppercase roman numerals. * ToRomanUpper : convert a number to all lowercase roman numerals. * stringToToken : convert a string to a numeric id. * _XmHTMLExpandEscapes : expand all escape sequences in the given text. * _XmHTMLTagCheck : Check the existance of a tag. * _XmHTMLTagGetValue : Get the value of a tag. * _XmHTMLTagGetNumber : Get the numerical value of a tag. * _XmHTMLTagCheckNumber : Get the absolute (positive no returned) or * relative (negative no returned) value of a tag. * _XmHTMLTagCheckValue : check if the given tag exists. * _XmHTMLGetImageAlignment : Retrieve the value of the ALIGN attribute on * images. * _XmHTMLGetHorizontalAlignment: Retrieve the value of the ALIGN attribute. * _XmHTMLGetVerticalAlignment: Retrieve the value of the VALIGN attribute. * _XmHTMLGetFraming : Retrieve the value of the FRAME table attribute. * _XmHTMLGetRuling : Retrieve the value of the RULE table attribute * _XmHTMLGetMaxLineLength : Returns maximum width of a line in pixels of * the current document or 75% of screen width, * whatever is the smallest. * **********************************************************************/ extern void my_upcase(char *string); extern void my_locase(char *string); extern char *my_strcasestr(const char *s1, const char *s2); extern char *my_strndup(const char *s1, size_t len); /***** * Proper support for I18N requires a POSIX compliant tolower, which * the internal tablelookup is not. *****/ #ifdef I18N #define _FastLower(x) tolower(x) #else extern const Byte __my_translation_table[]; #define _FastLower(x) (__my_translation_table[(Byte)x]) #endif /* I18N */ #ifdef NEED_STRERROR extern char *sys_errlist[]; extern int errno; #define strerror(ERRNUM) sys_errlist[ERRNUM] #endif #ifdef NEED_STRCASECMP # include extern int my_strcasecmp(const char *s1, const char *s2); extern int my_strncasecmp(const char *s1, const char *s2, size_t n); #define strcasecmp(S1,S2) my_strcasecmp(S1,S2) #define strncasecmp(S1,S2,N) my_strncasecmp(S1,S2,N) #else # ifdef HAVE_STRINGS_H /* Some systems have str[n]casecmp in strings.h */ # include # endif #endif extern String ToAsciiLower(int val); extern String ToAsciiUpper(int val); extern String ToRomanUpper(int val); extern String ToRomanLower(int val); extern Byte stringToToken(String token, String *tokens, int max_val); extern void _XmHTMLExpandEscapes(char *string, Boolean warn); extern Boolean _XmHTMLTagCheck(char *attributes, char *tag); extern char *_XmHTMLTagGetValue(char *attributes, char *tag); extern int _XmHTMLTagGetNumber(char *attributes, char *tag, int def); extern int _XmHTMLTagCheckNumber(char *attributes, char *tag, int def); extern Boolean _XmHTMLTagCheckValue(char *attributes, char *tag, char *check); extern Alignment _XmHTMLGetImageAlignment(char *attributes); extern Alignment _XmHTMLGetHorizontalAlignment(char *attributes, Alignment def_align); extern Alignment _XmHTMLGetVerticalAlignment(char *attributes, Alignment def_align); extern TableFraming _XmHTMLGetFraming(char *attributes, TableFraming def); extern TableRuling _XmHTMLGetRuling(char *attributes, TableRuling def); extern Dimension _XmHTMLGetMaxLineLength(XmHTMLWidget html); /********************************************************************* * @Module: colors.c * @Description : XmHTML *text* color allocation routines. * * @Exports: * _XmHTMLGetPixelByName : allocate and return the named pixel. * _XmHTMLConfirmColor32 : check name of the given color. Only when * XmNstrictHTMLChecking is True. * _XmHTMLAddPalette : add a palette to the widget (used for dithering) * **********************************************************************/ extern Pixel _XmHTMLGetPixelByName(XmHTMLWidget html, String color, Pixel def_pixel); extern Boolean _XmHTMLConfirmColor32(char *color); extern Boolean _XmHTMLAddPalette(XmHTMLWidget html); /********************************************************************* * @Module: images.c * @Description: XmHTML image loading/manipulation routines. * * @Defines: * struct XmHTMLRawImageData: intermediate image data structure. * * @Exports: * bitmap_bits[] : bit array required for creating depth 1 * images (bitmaps). * XmImageGifProc_plugin : external gif decoder hook. * XmImageGifzCmd_plugin : external decompressor hook. * _xmimage_cfg : XmImage configuration hook. * _XmHTMLGetImageType : return type of image * _XmHTMLImageFileToBuffer: read a file in a buffer * _XmHTMLNewImage : create a new image * _XmHTMLLoadBodyImage :load and set the body image. * _XmHTMLImageUpdateChilds: update all copies of the given parent image. * _XmHTMLImageCheckDelayedCreation: process all images that need rereading * (alpha channel processing) * _XmHTMLMakeAnimation : create an animation for the given image. * _XmHTMLInfoToPixmap : create a pixmap from the given ImageInfo data. * _XmHTMLReplaceOrUpdateImage: replace or update an image. * _XmHTMLFreeImage : Free private image data. * _XmHTMLFreeImageInfo : Free external image data. * _XmHTMLReleaseImage : Free an image and adjust the internal list of * images. * _XmHTMLCreateXImage : create a new but empty XImage with given * dimensions * _XmHTMLFillXImage : fill the given XImage. * _XmHTMLReadBitmap : read an X11 bitmap. * _XmHTMLReadGIF : read a GIF file. * _XmHTMLReadFLG : read a FLG file (Fast Loadable Graphic). * _XmHTMLReadXPM : read an X11 XPM image. * _XmHTMLReadPNG : read a PNG image. * _XmHTMLReadJPEG : read a JPEG image. * _XmHTMLGifReadOK : read a number of bytes from a GIF datafile. * _XmHTMLGifGetDataBlock : read a GIF datablock from a GIF datafile. * _XmHTMLIsGifAnimated : check whether a GIF is animated or not * _XmHTMLGifAnimInit : Initialize gif animation reading * _XmHTMLGifAnimNextFrame : read a frame from an animated gif file. * _XmHTMLGifAnimTerminate : wrap up animated gif reading. * _XmHTMLCreateXpmFromData: read an X11 XPM image from raw XPM data. * _XmHTMLReReadPNG : process alpha channelled PNG images. * _XmHTMLImageGetIconAttribs: get attribute string for a W3C icon entity; * **********************************************************************/ extern Byte bitmap_bits[]; extern XmImageGifProc XmImageGifProc_plugin; extern String XmImageGifzCmd_plugin; extern XmImageConfig *_xmimage_cfg; typedef struct _XmHTMLRawImageData{ Byte *data; /* raw image data */ Byte *alpha; /* alpha channel data */ int width; /* image width in pixels */ int height; /* image height in pixels */ int bg; /* transparent pixel index */ XCOLOR *cmap; /* colormap for this image */ int cmapsize; /* actual no of colors in image colormap */ Byte type; /* type of image */ Byte color_class; /* color class for this image */ Boolean delayed_creation; float fg_gamma; /* image foreground gamma */ }XmHTMLRawImageData; #define FreePixmap(DPY,PIX) if((PIX)!= None) tka->FreePixmap ((DPY),(PIX)) /* check whether the body image is fully loaded */ #define BodyImageLoaded(IMAGE) \ ((IMAGE) ? (!ImageInfoDelayed((IMAGE)) && \ !ImageInfoProgressive((IMAGE))) : True) /* XmHTMLImage macros */ #define ImageIsBackground(IMG) ((IMG)->options & IMG_ISBACKGROUND) #define ImageIsInternal(IMG) ((IMG)->options & IMG_ISINTERNAL) #define ImageIsCopy(IMG) ((IMG)->options & IMG_ISCOPY) #define ImageIsAnim(IMG) ((IMG)->options & IMG_ISANIM) #define ImageFrameRefresh(IMG) ((IMG)->options & IMG_FRAMEREFRESH) #define ImageHasDimensions(IMG) ((IMG)->options & IMG_HASDIMENSIONS) #define ImageHasState(IMG) ((IMG)->options & IMG_HASSTATE) #define ImageInfoFreed(IMG) ((IMG)->options & IMG_INFOFREED) #define ImageDelayedCreation(IMG) ((IMG)->options & IMG_DELAYED_CREATION) #define ImageIsOrphaned(IMG) ((IMG)->options & IMG_ORPHANED) #define ImageIsProgressive(IMG) ((IMG)->options & IMG_PROGRESSIVE) /* XmImageInfo macros */ #define ImageInfoDelayed(INFO) ((INFO)->options & XmIMAGE_DELAYED) #define ImageInfoFreeLater(INFO) ((INFO)->options & XmIMAGE_DEFERRED_FREE) #define ImageInfoFreeNow(INFO) ((INFO)->options & XmIMAGE_IMMEDIATE_FREE) #define ImageInfoScale(INFO) ((INFO)->options & XmIMAGE_ALLOW_SCALE) #define ImageInfoRGBSingle(INFO) ((INFO)->options & XmIMAGE_RGB_SINGLE) #define ImageInfoShared(INFO) ((INFO)->options & XmIMAGE_SHARED_DATA) #define ImageInfoClipmask(INFO) ((INFO)->options & XmIMAGE_CLIPMASK) #define ImageInfoDelayedCreation(INFO) \ ((INFO)->options & XmIMAGE_DELAYED_CREATION) #define ImageInfoProgressive(INFO) ((INFO)->options & XmIMAGE_PROGRESSIVE) /* rewind the given image buffer */ #define RewindImageBuffer(IB) do{ \ (IB)->next = (size_t)0; \ (IB)->curr_pos = (IB)->buffer; \ }while(0) /* free the given image buffer */ #define FreeImageBuffer(IB) { \ if((IB)->may_free) { \ free((IB)->file); \ free((IB)->buffer); \ free((IB)); \ (IB) = NULL; \ } \ } /* allocate and initialize a rawImageData structure */ #define AllocRawImage(IMG, W, H) do { \ IMG = (XmHTMLRawImageData*)malloc(sizeof(XmHTMLRawImageData)); \ memset(IMG, 0, sizeof(XmHTMLRawImageData)); \ IMG->cmapsize = 0; \ IMG->bg = -1; \ IMG->width = W; \ IMG->height = H; \ IMG->data = (Byte*)calloc(W*H, sizeof(Byte)); \ IMG->delayed_creation = False; \ IMG->color_class = XmIMAGE_COLORSPACE_INDEXED; \ }while(0) /* allocate and initialize a rawImageData structure with a colormap */ #define AllocRawImageWithCmap(IMG, W, H, SIZE) do { \ int i; \ IMG = (XmHTMLRawImageData*)malloc(sizeof(XmHTMLRawImageData)); \ memset(IMG, 0, sizeof(XmHTMLRawImageData)); \ IMG->cmap = (XCOLOR*)calloc(SIZE, sizeof(XCOLOR)); \ for(i = 0; i < SIZE; i++) GETP(IMG->cmap[i]) = i;\ IMG->cmapsize = SIZE; \ IMG->bg = -1; \ IMG->width = W; \ IMG->height = H; \ IMG->data = (Byte*)calloc(W*H, sizeof(Byte)); \ IMG->delayed_creation = False; \ }while(0) /* allocate a colormap for the given rawImageData */ #define AllocRawImageCmap(IMG,SIZE) do { \ int i; \ IMG->cmap = (XCOLOR*)calloc(SIZE, sizeof(XCOLOR)); \ for(i = 0; i < SIZE; i++) GETP(IMG->cmap[i]) = i; \ IMG->cmapsize = SIZE; \ }while(0) /* destroy allocated image. Only to be called upon error */ #define FreeRawImage(IMG) do{ \ if(IMG != NULL) { \ if(IMG->data) free(IMG->data); \ if(IMG->cmap) free(IMG->cmap); \ free(IMG); \ IMG = NULL; \ }\ }while(0) /* reset a rawImageData structure */ #define ResetRawImage(IMG) do { \ memset(IMG, 0, sizeof(XmHTMLRawImageData)); \ if(IMG->cmap) free(IMG->cmap); /* erase existing colormap */ \ IMG->cmap = (XCOLOR*)NULL; \ IMG->cmapsize = 0; \ IMG->bg = -1; \ IMG->width = 0; \ IMG->height = 0; \ IMG->data = (Byte*)NULL; \ IMG->delayed_creation = False; \ }while(0) /***** * Definition of a W3C icon entity. *****/ typedef struct { char *escape; char **data; XmImageInfo *icon; int len; }IconEntity; /* list of default icons */ extern IconEntity _XmHTMLIconEntities[]; #if 0 extern IconEntity _XmHTMLIconTags[]; #endif extern Byte _XmHTMLGetImageType(ImageBuffer *ib); extern ImageBuffer *_XmHTMLImageFileToBuffer(String file); extern XmHTMLRawImageData *_XmHTMLReadBitmap(Widget html, ImageBuffer *ib); extern XmHTMLRawImageData *_XmHTMLReadGIF(Widget html, ImageBuffer *ib); extern XmImageInfo *_XmHTMLReadFLG(XmHTMLWidget html, ImageBuffer *ib); extern size_t _XmHTMLGifReadOK(ImageBuffer *ib, unsigned char *buf, int len); extern size_t _XmHTMLGifGetDataBlock(ImageBuffer *ib, unsigned char *buf); extern unsigned char _XmHTMLIsGifAnimated(ImageBuffer *fd); extern unsigned char _XmHTMLIsGzfAnimated(ImageBuffer *fd); extern int _XmHTMLGifAnimInit(Widget html, ImageBuffer *ib, XmHTMLRawImageData *data); extern Boolean _XmHTMLGifAnimNextFrame(ImageBuffer *ib, XmHTMLRawImageData *data, int *x, int *y, int *timeout, int *dispose); extern void _XmHTMLGifAnimTerminate(ImageBuffer *ib); extern XmHTMLRawImageData *_XmHTMLReadXPM(Widget html, ImageBuffer *ib); extern XmHTMLRawImageData *_XmHTMLCreateXpmFromData(Widget html, char **data, String src); extern XmHTMLRawImageData *_XmHTMLReadPNG(Widget html, ImageBuffer *ib); extern XmHTMLRawImageData *_XmHTMLReReadPNG(XmHTMLWidget html, XmHTMLRawImageData *raw_data, int x, int y, Boolean is_body_image); extern XmHTMLRawImageData *_XmHTMLReadJPEG(Widget html, ImageBuffer *ib); extern XImage *_XmHTMLCreateXImage(XmHTMLWidget html, XCC xcc, Dimension width, Dimension height, String url); extern void _XmHTMLFillXImage(XmHTMLWidget html, XImage *ximage, XCC xcc, Byte *data, unsigned long *xcolors, int *start, int *end); extern XmHTMLImage *_XmHTMLNewImage(XmHTMLWidget html, String attributes, Dimension *width, Dimension *height); extern void _XmHTMLImageUpdateChilds(XmHTMLImage *image); extern void _XmHTMLImageCheckDelayedCreation(XmHTMLWidget html); extern void _XmHTMLMakeAnimation(XmHTMLWidget html, XmHTMLImage *image, Dimension width, Dimension height); extern Pixmap _XmHTMLInfoToPixmap(XmHTMLWidget html, XmHTMLImage *image, XmImageInfo *info, Dimension width, Dimension height, unsigned long *global_cmap, PIXMAP *clip); extern XmImageStatus _XmHTMLReplaceOrUpdateImage(XmHTMLWidget html, XmImageInfo *info, XmImageInfo *new_info, XmHTMLObjectTableElement *elePtr); extern void _XmHTMLFreeImage(XmHTMLWidget html, XmHTMLImage *image); extern void _XmHTMLFreeImageInfo(XmHTMLWidget html, XmImageInfo *info, Boolean external); extern void _XmHTMLReleaseImage(XmHTMLWidget html, XmHTMLImage *image); extern void _XmHTMLLoadBodyImage(XmHTMLWidget html, String url); extern String _XmHTMLImageGetIconAttribs(Widget w, int index); /********************************************************************* * @Module: quantize.c * @Description : XmHTML color quantization and dithering routines * * @Exports: * _XmHTMLQuantizeImage: quantize the given image data down to max_colors. * _XmHTMLConvert24to8 : convert a 24bit image to an 8bit paletted one, * quantizing if required. * _XmHTMLPixelizeRGB : convert an RGB image to a 8bit paletted image. * _XmHTMLDitherImage : dither the given image to a fixed palette. * **********************************************************************/ extern void _XmHTMLConvert24to8(Byte *data, XmHTMLRawImageData *img_data, int max_colors, Byte mode); extern void _XmHTMLQuantizeImage(XmHTMLRawImageData *img_data, int max_colors); extern void _XmHTMLPixelizeRGB(Byte *rgb, XmHTMLRawImageData *img_data); extern void _XmHTMLDitherImage(XmHTMLWidget html, XmHTMLRawImageData *img_data); /********************************************************************* * @Module: map.c * @Description: XmHTML imagemap routines * * @Defines: * struct _mapArea: structure identifying the shape and size of a HTML * AREA definition. * * @Exports: * _XmHTMLCreateImagemap : create an imagemap. * _XmHTMLStoreImagemap : store an imagemap * _XmHTMLAddAreaToMap : add an area to an imagemap. * _XmHTMLGetImagemap : get the named imagemap * _XmHTMLGetAnchorFromMap: return anchor data referenced by the given * positions and imagemap. * _XmHTMLCheckImagemaps : check for possible external imagemaps. * _XmHTMLFreeImageMaps : free all imagemaps for a XmHTMLWidget. * _XmHTMLDrawImagemapSelection: draw selection areas around each area * in an imagemap. * **********************************************************************/ extern XmHTMLImageMap* _XmHTMLCreateImagemap(String name); extern void _XmHTMLStoreImagemap(XmHTMLWidget html, XmHTMLImageMap *map); extern void _XmHTMLAddAreaToMap(XmHTMLWidget html, XmHTMLImageMap *map, XmHTMLObject *object); extern XmHTMLImageMap *_XmHTMLGetImagemap(XmHTMLWidget html, String name); extern XmHTMLAnchor *_XmHTMLGetAnchorFromMap(XmHTMLWidget html, int x, int y, XmHTMLImage *image, XmHTMLImageMap *map); extern void _XmHTMLCheckImagemaps(XmHTMLWidget html); extern void _XmHTMLFreeImageMaps(XmHTMLWidget html); extern void _XmHTMLDrawImagemapSelection(XmHTMLWidget html, XmHTMLImage *image); /********************************************************************* * @Module: plc.c * Description: XmHTML Progressive Loader Context interfacing routines. * * @Exports: * _XmHTMLPLCCreate: create a PLC object suitable for progressive loading. * _XmHTMLPLCCycler: main PLC cycler with dynamic timeout recalculation. * _XmHTMLKillPLCCycler: kill and remove any outstanding PLC's * **********************************************************************/ extern PLCPtr _XmHTMLPLCCreate(XmHTMLWidget html, XtPointer priv_data, String url, Byte type); extern void _XmHTMLPLCCycler(XtPointer call_data, XtIntervalId *proc_id); extern void _XmHTMLKillPLCCycler(XmHTMLWidget html); extern void _XmHTMLPLCCheckIntervals(XmHTMLWidget html); /********************************************************************* * @Module: fonts.c * @Description: XmHTML font loading & caching routines. * * @Exports: * xmhtml_fn_sizes : array with scalable font sizes. * xmhtml_basefont_sizes : array with basefont sizes. * xmhtml_fn_fixed_sizes : array with fixed font sizes. * _XmHTMLSelectFontCache: initialize and/or select a font cache * (each display has a seperate one). * _XmHTMLaddFontMapping : alias a known font to an unknown font. * _XmHTMLLoadFont : load a font as specified by id and size. * Properties are inherited from a given * font. * _XmHTMLLoadFontWithFace: load a font with a named face and size. * Properties are inherited from a given * font. * _XmHTMLUnloadFonts : Release all fonts used by widget. Fonts * are only unloaded when the last widget using * a font cache has unloaded it's fonts. * **********************************************************************/ extern int xmhtml_fn_sizes[8]; extern int xmhtml_basefont_sizes[7]; extern int xmhtml_fn_fixed_sizes[2]; extern XmHTMLfont *_XmHTMLSelectFontCache(XmHTMLWidget html, Boolean reset); extern void _XmHTMLaddFontMapping(XmHTMLWidget html, String name, String family, int ptsz, Byte style, XmHTMLfont *font); extern XmHTMLfont *_XmHTMLLoadFont(XmHTMLWidget html, htmlEnum font_id, int size, XmHTMLfont *curr_font); extern XmHTMLfont *_XmHTMLLoadFontWithFace(XmHTMLWidget html, int size, String face, XmHTMLfont *curr_font); extern void _XmHTMLUnloadFonts(XmHTMLWidget html); /********************************************************************* * @Module: events.c * @Description: HTML4.0 event routines * * @Exports: * _XmHTMLCheckCoreEvents: check for the HTML 4.0 core events. * _XmHTMLCheckBodyEvents: check for the HTML 4.0 body events as well * as the core events. * _XmHTMLCheckFormEvents: check for the HTML 4.0
    events as well * as the core events. * **********************************************************************/ extern AllEvents *_XmHTMLCheckCoreEvents(XmHTMLWidget html, String attributes, unsigned long *mask_return); extern AllEvents *_XmHTMLCheckBodyEvents(XmHTMLWidget html, String attributes, unsigned long *mask_return); extern AllEvents *_XmHTMLCheckFormEvents(XmHTMLWidget html, String attributes, unsigned long *mask_return); /********************************************************************* * @Module: output.c * @Description: XmHTML text output/conversion functions * * @Exports: * _XmHTMLTextCheckAndConvertPaperDef: verify and convert a papertype * definition to the appropriate papersize * type. * _XmHTMLTextGetPlain : return a plain text buffer; * _XmHTMLTextGetFormatted : return a nicely formatted text buffer; * _XmHTMLTextGetPS : convert to postscript. * **********************************************************************/ extern XmHTMLPaperSize *_XmHTMLTextCheckAndConvertPaperDef(XmHTMLWidget html, XmHTMLPaperSize *pdef, Byte type); extern String _XmHTMLTextGetPlain(XmHTMLWidget html, XmHTMLPaperSize *pdef, XmHTMLObjectTableElement start, XmHTMLObjectTableElement end, Byte options); extern String _XmHTMLTextGetFormatted(XmHTMLWidget html, XmHTMLPaperSize *pdef, XmHTMLObjectTableElement start, XmHTMLObjectTableElement end, Byte options); extern String _XmHTMLTextGetPS(XmHTMLWidget html, XmHTMLPaperSize *pdef, XmHTMLObjectTableElement start, XmHTMLObjectTableElement end, Byte options); #endif /* XmHTML_ERROR_FUNCS */ /********************************************************************* * @Module: error.c * @Description: XmHTML warning/error functions * * @Exports: * _XmHTMLWarning : Displays a warning message and continues. * _XmHTMLError : Displays an error message and exits. * __XmHTMLBadParent: Display a NULL/invalid parent warning message and * continue. * _XmHTMLAllocError: Displays an error message due to allocation * problems and exits. * * @Note: There are two separate versions of XmHTML's error & warning * functions. The debug versions include full location information while * the normal build versions only contain the warning/error message. * This allows us to reduce the data size of the normal build. * **********************************************************************/ #ifdef DEBUG #define __WFUNC__(WIDGET_ID, FUNC) (Widget)WIDGET_ID, __FILE__, \ __LINE__, FUNC extern void __XmHTMLWarning( #if NeedVarargsPrototypes Widget w, String module, int line, String routine, String fmt, ... #endif ); extern void __XmHTMLError( #if NeedVarargsPrototypes Widget w, String module, int line, String routine, String fmt, ... #endif ); extern void __XmHTMLBadParent(Widget w, String src_file, int line, String func); #define _XmHTMLBadParent(W,FUNC) __XmHTMLBadParent(W,__FILE__,__LINE__,FUNC) #else /* !DEBUG */ #define __WFUNC__(WIDGET_ID, FUNC) (Widget)WIDGET_ID extern void __XmHTMLWarning( #if NeedVarargsPrototypes Widget w, String fmt, ... #endif ); extern void __XmHTMLError( #if NeedVarargsPrototypes Widget w, String fmt, ... #endif ); extern void __XmHTMLBadParent(Widget w, String func); #define _XmHTMLBadParent(W,FUNC) __XmHTMLBadParent(W,FUNC) #endif /* DEBUG */ #define _XmHTMLWarning __XmHTMLWarning #define _XmHTMLError __XmHTMLError extern void _XmHTMLAllocError(Widget w, char *module, char *routine, char *func, int size); #ifdef _XFUNCPROTOEND _XFUNCPROTOEND #else #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* Don't add anything after this endif! */ #endif /* _XmHTMLI_h_ */ XmHTML-1.1.10/include/common/PaxHeaders.1031/xpmtags.h0000644000175000001440000000013212613377377020361 xustar000000000000000030 mtime=1445854975.106545877 30 atime=1445854975.106545877 30 ctime=1445854975.106545877 XmHTML-1.1.10/include/common/xpmtags.h0000644000175000001440000001171012613377377017761 0ustar00chrisusers00000000000000/***** * Automatically generated file. * *** DO NOT EDIT THIS FILE *** *****/ /***** * File created at Thu Sep 24 20:45:45 CEST 1998 by newt *****/ #ifndef _xpmtags_h_ #define _xpmtags_h_ #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 #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 #include #include #include #include #include #include #include #include #include #include #define NUM_TAG_ICONS 74 /***** * List of all HTML tags and their corresponding icons *****/ IconEntity _XmHTMLTagIcons[NUM_TAG_ICONS] = { {"DOCTYPE", DOCTYPE_xpm, NULL, 7}, {"A", A_xpm, NULL, 1}, {"ADDRESS", ADDRESS_xpm, NULL, 7}, {"APPLET", APPLET_xpm, NULL, 6}, {"AREA", AREA_xpm, NULL, 4}, {"B", B_xpm, NULL, 1}, {"BASE", BASE_xpm, NULL, 4}, {"BASEFONT", BASEFONT_xpm, NULL, 8}, {"BIG", BIG_xpm, NULL, 3}, {"BLOCKQUOTE", BLOCKQUOTE_xpm, NULL, 10}, {"BODY", BODY_xpm, NULL, 4}, {"BR", BR_xpm, NULL, 2}, {"CAPTION", CAPTION_xpm, NULL, 7}, {"CENTER", CENTER_xpm, NULL, 6}, {"CITE", CITE_xpm, NULL, 4}, {"CODE", CODE_xpm, NULL, 4}, {"DD", DD_xpm, NULL, 2}, {"DFN", DFN_xpm, NULL, 3}, {"DIR", DIR_xpm, NULL, 3}, {"DIV", DIV_xpm, NULL, 3}, {"DL", DL_xpm, NULL, 2}, {"DT", DT_xpm, NULL, 2}, {"EM", EM_xpm, NULL, 2}, {"FONT", FONT_xpm, NULL, 4}, {"FORM", FORM_xpm, NULL, 4}, {"FRAME", FRAME_xpm, NULL, 5}, {"FRAMESET", FRAMESET_xpm, NULL, 8}, {"H1", H1_xpm, NULL, 2}, {"H2", H2_xpm, NULL, 2}, {"H3", H3_xpm, NULL, 2}, {"H4", H4_xpm, NULL, 2}, {"H5", H5_xpm, NULL, 2}, {"H6", H6_xpm, NULL, 2}, {"HEAD", HEAD_xpm, NULL, 4}, {"HR", HR_xpm, NULL, 2}, {"HTML", HTML_xpm, NULL, 4}, {"I", I_xpm, NULL, 1}, {"IMG", IMG_xpm, NULL, 3}, {"INPUT", INPUT_xpm, NULL, 5}, {"ISINDEX", ISINDEX_xpm, NULL, 7}, {"KBD", KBD_xpm, NULL, 3}, {"LI", LI_xpm, NULL, 2}, {"LINK", LINK_xpm, NULL, 4}, {"MAP", MAP_xpm, NULL, 3}, {"MENU", MENU_xpm, NULL, 4}, {"META", META_xpm, NULL, 4}, {"NOFRAMES", NOFRAMES_xpm, NULL, 8}, {"OL", OL_xpm, NULL, 2}, {"OPTION", OPTION_xpm, NULL, 6}, {"P", P_xpm, NULL, 1}, {"PAGE", PAGE_xpm, NULL, 4}, {"PARAM", PARAM_xpm, NULL, 5}, {"PRE", PRE_xpm, NULL, 3}, {"SAMP", SAMP_xpm, NULL, 4}, {"SCRIPT", SCRIPT_xpm, NULL, 6}, {"SELECT", SELECT_xpm, NULL, 6}, {"SMALL", SMALL_xpm, NULL, 5}, {"STRIKE", STRIKE_xpm, NULL, 6}, {"STRONG", STRONG_xpm, NULL, 6}, {"STYLE", STYLE_xpm, NULL, 5}, {"SUB", SUB_xpm, NULL, 3}, {"SUP", SUP_xpm, NULL, 3}, {"TAB", TAB_xpm, NULL, 3}, {"TABLE", TABLE_xpm, NULL, 5}, {"TD", TD_xpm, NULL, 2}, {"TEXTAREA", TEXTAREA_xpm, NULL, 8}, {"TH", TH_xpm, NULL, 2}, {"TITLE", TITLE_xpm, NULL, 5}, {"TR", TR_xpm, NULL, 2}, {"TT", TT_xpm, NULL, 2}, {"U", U_xpm, NULL, 1}, {"UL", UL_xpm, NULL, 2}, {"VAR", VAR_xpm, NULL, 3}, {"ZTEXT", ZTEXT_xpm, NULL, 5}, {NULL, NULL, NULL, 0} }; /* Don't add anything after this endif! */ #endif /* _xpmtags_h_ */ XmHTML-1.1.10/include/common/PaxHeaders.1031/stack.h0000644000175000001440000000013212613377377020003 xustar000000000000000030 mtime=1445854975.106545877 30 atime=1445854975.106545877 30 ctime=1445854975.106545877 XmHTML-1.1.10/include/common/stack.h0000644000175000001440000000612112613377377017403 0ustar00chrisusers00000000000000/***** * stack.h : generic stack routines * * This file Version $Revision: 1.1 $ * * Creation date: Thu Apr 2 12:26:52 GMT+0100 1998 * Last modification: $Date: 1998/04/04 06:27:26 $ * By: $Author: newt $ * Current State: $State: Exp $ * * Author: newt * * Copyright (C) 1994-1998 by Ripley Software Development * All Rights Reserved * * This file is part of the XmHTML Widget Library * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * *****/ /***** * $Source: /usr/local/rcs/Newt/XmHTML/RCS/stack.h,v $ *****/ /***** * ChangeLog * $Log: stack.h,v $ * Revision 1.1 1998/04/04 06:27:26 newt * Initial Revision * *****/ #ifndef _stack_h_ #define _stack_h_ /* Stack is an opaque definition, defined in stack.c */ typedef struct _StackRegistry *Stack; /***** * Create a stack. * fallback: data to return when the stack is becoming negative. * destroy_data_func is a function that will be called when the stack * is destroyed while items are still remaining on the stack. *****/ extern Stack StackCreate(void *fallback, void (*destroy_data_func)(void*)); /* create a stack that can stack two sets of data */ extern Stack StackCreateDouble(void *fallback_data1, void *fallback_data2, void (*destroy_data_func)(void*), void (*second_destroy_data_func)(void*)); /***** * Destroy the given stack (and any data remaining). Returns the no * of items that still remained on the stack. *****/ extern int StackDestroy(Stack stack); /***** * Push data onto a stack. data is the data to be pushed, and should be cast * to void* by the caller. Returns 1 when data was successfully pushed, 0 * if not. *****/ extern int StackPushData(Stack stack, void *data); /* push two sets of data on the stack */ extern int StackPushDoubleData(Stack stack, void *data1, void *data2); /***** * Pop data from the stack. Returned data should be cast to an appropriate * type by the caller. *****/ extern void* StackPopData(Stack stack); /* pop two sets of data from the stack */ extern void* StackPopDoubleData(Stack stack, void **data); /* return size of the stack */ extern int StackSize(Stack stack); /* convenient macros, take care of typecasting when pushing & popping data */ #define StackPush(S,D) StackPushData(S,(void*)(D)) #define StackPop(S) StackPopData(S) #define StackPushDouble(S,D1,D2) \ StackPushDoubleData(S,(void*)(D1), (void*)(D2)) #define StackPopDouble(S,D) \ StackPopDoubleData(S,(void**)&(D)) /* Don't add anything after this endif! */ #endif /* _stack_h_ */ XmHTML-1.1.10/include/common/PaxHeaders.1031/plc.h0000644000175000001440000000013212613377377017454 xustar000000000000000030 mtime=1445854975.106545877 30 atime=1445854975.105545877 30 ctime=1445854975.106545877 XmHTML-1.1.10/include/common/plc.h0000644000175000001440000004147712613377377017071 0ustar00chrisusers00000000000000/***** * plc.h : XmHTML progressive object loading interface * * This file Version $Revision: 1.4 $ * * Creation date: Tue Jun 10 14:30:39 GMT+0100 1997 * Last modification: $Date: 1998/04/27 07:02:47 $ * By: $Author: newt $ * Current State: $State: Exp $ * * Author: newt * * Copyright (C) 1994-1997 by Ripley Software Development * All Rights Reserved * * This file is part of the XmHTML Widget Library. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * *****/ /***** * $Source: /usr/local/rcs/Newt/XmHTML/RCS/plc.h,v $ *****/ /***** * ChangeLog * $Log: plc.h,v $ * Revision 1.4 1998/04/27 07:02:47 newt * tka stuff * * Revision 1.3 1998/04/04 06:28:26 newt * XmHTML Beta 1.1.3 * * Revision 1.2 1997/08/30 01:26:58 newt * Small number of bugfixes, mostly wrong types of structure members. * * Revision 1.1 1997/08/01 12:51:51 newt * Initial Revision * *****/ #ifndef _plc_h_ #define _plc_h_ /* Pull in required declarations */ #ifdef HAVE_LIBPNG # include #else /* fix 10/27/97-01, shl */ # ifdef HAVE_LIBZ # include # endif #endif /***** * png.h includes setjmp.h and issues a cpp error on Linux when it gets * included more than once... *****/ #ifdef HAVE_LIBJPEG # include # ifndef HAVE_LIBPNG # include # endif #endif /* GIF decoder */ #include "LZWStream.h" /***** * Definition of the Progressive Loader Context. * This structure forms the basis of XmHTML's progressive object loading * mechanism. * All PLC's in use by a XmHTML widget are represented by a ringbuffer with * various function pointers. The PLC monitoring routine will circulate this * buffer using an adjustable interval, calling functions as they are * necessary. *****/ /* * definition of a PLC data manipulation procedure. * (PLCPtr is typedef'd in XmHTMLP.h) */ typedef void (*PLCProc)(PLCPtr); typedef struct _PLC{ String url; /* object identifier */ union _PLCObject *object; /* object-specific data */ Boolean obj_set; /* indicates object type has been set */ Byte *buffer; /* current data */ Cardinal buf_size; /* size of buffer */ Cardinal size; /* size of valid data in buffer */ Cardinal left; /* bytes left in buffer */ Byte *next_in; /* current position in buffer */ Byte *input_buffer; /* input buffer */ int input_size; /* size of input buffer */ Cardinal total_in; /* total number of bytes received so far */ Cardinal max_in; /* get_data() maximum request size */ Cardinal min_in; /* get_data() minimum request size */ int plc_status; /* current PLC status */ int plc_data_status; /* last return value from get_data() */ Boolean initialized; /* indicates object data has been set * and actual processing can begin. */ XtPointer priv_data; /* private PLC data, used by XmHTML */ XtPointer user_data; /* data registered for this PLC */ struct s_funcs{ /* stream manipulation routines */ XmHTMLGetDataProc get_data; XmHTMLEndDataProc end_data; PLCProc c_new; /* PLCObject initializer */ }sf; PLCProc init; /* object initializer function */ PLCProc destructor; /* object destructor */ PLCProc transfer; /* object transfer function */ PLCProc finalize; /* object completion function */ PLCProc obj_funcs[3]; /* object manipulation functions */ int curr_obj_func; /* current obj_func */ Boolean obj_funcs_complete; /* obj_func calling flag */ struct _PLC *self; /* ptr to self */ struct _PLC *next_plc; /* ptr to next PLC */ struct _PLC *prev_plc; /* ptr to previous PLC */ }PLC; /***** * Explanation of the PLCProc fields. * * init(): * this function is called when the object-specific data should be * initialized. When the object is initialized, the initialized field should * be set to True. The PLC cycler will call this function as long as the * initialized field is False, and the plc_status field is either PLC_ACTIVE * or PLC_SUSPEND. * destructor(): * this function is called if the object should destroy its own data. * It is called when the plc_status field reaches either PLC_COMPLETE or * PLC_ABORT. * transfer(): * this function is called whenever an object-specific function returns. * The purpose of this function is to signal the application that it * can transfer the processed data to its final destination (for images, this * should include transfering the newly decoded scanlines to the screen * buffer). It is called whenever the PLC cycler returns from any function * in the obj_funcs array. * finalize(): * this function is called when the plc_status field reaches PLC_COMPLETE * (get_data() returned STREAM_END or processing has finished). The * application should then save *all* decoded data. The object may *not* * destruct itself, the PLC cycler will call the object-specific destructor * method when it has called the finalize() function. * * The PLCProc array contains object-specific functions. * For images, only the first slot is used: it is the scanline function. * curr_obj_func gives the index of the obj_func to call. * obj_funcs_complete indicates whether or not the PLC cycler should continue * calling any obj_func. If it is set to True, the cycler will call the * finalize() PLCProc to allow final processing of the received data. *****/ /***** * PLC status flags *****/ #define PLC_ACTIVE 0 /* PLC is active */ #define PLC_SUSPEND 1 /* PLC has been suspended */ #define PLC_ABORT 2 /* PLC has been aborted */ #define PLC_COMPLETE 3 /* PLC is done */ /***** * The fun part: PLCObject definitions. * Each object for which a PLC is to be used has a unique PLCObject definition. * All objects are grouped in the PLCObject union and each object is identified * by the type member of this union. *****/ /***** * global object * The buffer and counters in this global object are used for storing the * entire data as it is being received. For images the buffer and buffer * counters will contain the compressed image data as it is being received. * It is free for the decoders to decide whether or not this feature is used. * (jpeg for example doesn't use it). The routines in plc.c only use the * ``owner'' field of these fields, so be sure it's valid. ******/ #define plc_common_object_fields \ Byte type; /* type of object, may not be modified */ \ Byte *buffer; /* destination buffer */ \ Cardinal buf_size; /* size of destination buffer */ \ Cardinal byte_count; /* number of bytes received so far */ \ Cardinal buf_pos; /* current position in buffer */ \ XmHTMLWidget owner /* owner of this PLC */ typedef struct{ plc_common_object_fields; /* fields common for all PLC structures */ }PLCAny; /***** * Common image object fields. * The common image object fields are divided in two main sections: * public fields: these fields must be set/updated by the decoder and can * be used by the decoder. The image transfer function uses * the values of these fields to compose the image itself, * and *can* modify the values of data_pos and prev_pos for * backtracking purposes. * private fields: these fields are used by the image transfer function, and * may *never* be touched by the decoder. ******/ #define plc_image_public_fields \ int depth; /* depth of image */ \ Byte colorclass; /* colorclass of image */ \ Byte transparency; /* transparency type of image */ \ XCOLOR *cmap; /* colormap for this image */ \ int cmapsize; /* size of colormap */ \ int ncolors; /* original no of colors in image */ \ Cardinal width; /* width in pixels */ \ Cardinal height; /* height in pixels (= no of scanlines)*/ \ Cardinal npasses; /* no of passes required on image data */ \ Cardinal curr_pass; /* current pass on data */ \ Cardinal curr_scanline; /* current scanline */ \ Cardinal stride; /* scanline stride */ \ Byte *data; /* raw image data */ \ int data_size; /* maximum data size */ \ int data_pos; /* current position in data */ \ int prev_pos /* last known position in data */ #define plc_image_private_fields \ int used[XmHTML_MAX_IMAGE_COLORS]; /* array of used colors */ \ int nused; /* colors already used */ \ unsigned long xcolors[XmHTML_MAX_IMAGE_COLORS]; /* arr alloc'd pixels */ \ int bg_pixel; /* transparent pixel index */ \ XCOLOR *bg_cmap; /* background colormap for this image */ \ int bg_cmapsize; /* background colormap size */ \ PIXMAP pixmap; /* destination pixmap */ \ PIXMAP clipmask; /* destination clipmask */ \ Byte *clip_data; /* raw clipmask data */ \ Byte *scaled_data; /* scaled image data */ \ int sc_start; /* curr. pos in scaled data */ \ int sc_end; /* end pos in scaled data */ \ Boolean is_scaled; /* True when scaling required */ \ XImage *ximage; /* destination image */ \ XmImageInfo *info; /* raw image information */ \ XmHTMLImage *image /* destination image */ /***** * Common image object. This structure contains the fields that are common to * *all* image objects. The main plc code (plc.c) uses this structure to do * its magic. The image-specific objects are used by the respective decoders. * Note that all image-specific objects *must* share the common image object. *****/ typedef struct{ plc_common_object_fields; /* fields common for all PLC structures */ plc_image_public_fields; /* public fields for all image objects */ plc_image_private_fields; /* private fields for all image objects */ }PLCImage; /***** * GIF image object *****/ typedef struct{ plc_common_object_fields; /* fields common for all PLC structures */ plc_image_public_fields; /* public fields for all image objects */ plc_image_private_fields; /* private fields for all image objects */ /* GIF specific data follows */ Byte gbuf[256]; /* block of compressed raster data */ Boolean external_codec; /* True -> uses external decoder */ XmImageGifProc inflate; /* external gif decoder */ XmHTMLGIFStream *gstream; /* GIFStream() stream object */ ImageBuffer ib; /* LZWStream data provider */ LZWStream *lstream; /* LZWStream() stream object */ }PLCImageGIF; /***** * GZF image object *****/ typedef struct{ plc_common_object_fields; /* fields common for all PLC structures */ plc_image_public_fields; /* public fields for all image objects */ plc_image_private_fields; /* private fields for all image objects */ /* GZF specific data follows */ #if defined(HAVE_LIBPNG) || defined(HAVE_LIBZ) Byte zbuf[256]; /* block of compressed raster data */ z_stream zstream; /* zlib inflate() stream object */ #endif }PLCImageGZF; /***** * JPEG image object *****/ #ifdef HAVE_LIBJPEG /* default libjpeg error override */ typedef struct _plc_jpeg_err_mgr{ struct jpeg_error_mgr pub; /* jpeg public fields */ jmp_buf setjmp_buffer; /* for return to caller */ }plc_jpeg_err_mgr; typedef struct{ plc_common_object_fields; /* fields common for all PLC structures */ plc_image_public_fields; /* public fields for all image objects */ plc_image_private_fields; /* private fields for all image objects */ /* JPEG specific data follows */ Boolean init; /* jpeg initialization complete? */ struct jpeg_decompress_struct cinfo; /* jpeg decompressor */ plc_jpeg_err_mgr jerr; /* error manager object */ }PLCImageJPEG; #else /* !HAVE_LIBJPEG */ /***** * dummy JPEG image object *****/ typedef struct{ plc_common_object_fields; /* fields common for all PLC structures */ }PLCImageJPEG; #endif /* HAVE_LIBJPEG */ /***** * PNG image object *****/ #ifdef HAVE_LIBPNG typedef struct{ plc_common_object_fields; /* fields common for all PLC structures */ plc_image_public_fields; /* public fields for all image objects */ plc_image_private_fields; /* private fields for all image objects */ /* PNG specific data follows */ }PLCImagePNG; #else /* !HAVE_LIBPNG */ /***** * dummy PNG image object *****/ typedef struct{ plc_common_object_fields; /* fields common for all PLC structures */ }PLCImagePNG; #endif /* HAVE_LIBPNG */ /***** * XPM image object *****/ typedef struct{ plc_common_object_fields; /* fields common for all PLC structures */ plc_image_public_fields; /* public fields for all image objects */ plc_image_private_fields; /* private fields for all image objects */ /* XPM specific data follows */ }PLCImageXPM; /***** * XBM image object *****/ typedef struct{ plc_common_object_fields; /* fields common for all PLC structures */ plc_image_public_fields; /* public fields for all image objects */ plc_image_private_fields; /* private fields for all image objects */ /* XBM specific data follows */ int raster_length; int data_start; }PLCImageXBM; /***** * document object *****/ typedef struct{ plc_common_object_fields; /* fields common for all PLC structures */ /* Document specific data follows */ }PLCDocument; /***** * This is the final PLC Object definition. It is a union of all the above * object-specific structures. The type of the object in a PLC is identified * by the value of the "type" member of this union. *****/ typedef union _PLCObject{ Byte type; /* must not be changed, first element */ PLCAny plc_any; PLCImage plc_any_image; /* common object for all image PLC's */ PLCImageGIF plc_gif_image; PLCImageGZF plc_gzf_image; PLCImagePNG plc_png_image; PLCImageJPEG plc_jpeg_image; PLCImageXPM plc_xpm_image; PLCImageXBM plc_xbm_image; PLCDocument plc_doc; /* future extension */ }PLCObject; /***** * Possible values for the type field in the PLCObject union. * anyImage is an internal object used by the main plc code. It is also used * by the GIF and GZF decoders which have a lot in common: GZF is my own * GIF format in which only the format of the compressed data differs. *****/ enum{ /* 0 is a reserved value */ plcAny = 1, /* common object */ plcAnyImage, /* common image object */ plcGIF, /* gif image */ plcGZF, /* gzf image */ plcPNG, /* png image */ plcJPEG, /* jpeg image */ plcXPM, /* xpm image */ plcXBM, /* xbm image */ plcDocument /* html document */ }; /***** * Private functions *****/ /* make a data request */ extern Boolean _PLCDataRequest(PLC *plc); /* read bytes from current PLC descriptor */ extern size_t _PLCReadOK(PLC *plc, Byte *buf, int size); /***** * Read a block of bytes from a PLC descriptor. A block of bytes is * identified by a byte count followed by a block of data containing * byte_count bytes of data (only used for gif and gzf images). *****/ extern size_t _PLCGetDataBlock(PLC *plc, Byte *buf); /* rewind the current input buffer */ #define _PLCRewindInputBuffer(PLC) do{ \ (PLC)->left = (PLC)->size; /* no of unprocessed bytes */ \ (PLC)->next_in = (PLC)->buffer; /* ptr to last processed byte */ \ }while(0) /***** * PLCProc definitions for the progressive gif loader * defined in readGIFplc.c *****/ extern void _PLC_GIF_Init(PLC *plc); extern void _PLC_GIF_Destructor(PLC *plc); extern void _PLC_GIF_ScanlineProc(PLC *plc); /***** * PLCProc definitions for the progressive gzf loader * defined in readGIFplc.c *****/ extern void _PLC_GZF_Init(PLC *plc); extern void _PLC_GZF_Destructor(PLC *plc); extern void _PLC_GZF_ScanlineProc(PLC *plc); /***** * PLCProc definitions for the progressive JPEG loader * defined in readJPEGplc.c *****/ extern void _PLC_JPEG_Init(PLC *plc); extern void _PLC_JPEG_Destructor(PLC *plc); extern void _PLC_JPEG_ScanlineProc(PLC *plc); /***** * PLCProc definitions for the progressive PNG loader * defined in readPNGplc.c *****/ #ifdef PLC_PNG extern void _PLC_PNG_Init(PLC *plc); extern void _PLC_PNG_Destructor(PLC *plc); extern void _PLC_PNG_ScanlineProc(PLC *plc); #endif /***** * PLCProc definitions for the progressive XPM loader * defined in readXPM.c *****/ extern void _PLC_XPM_Init(PLC *plc); extern void _PLC_XPM_Destructor(PLC *plc); extern void _PLC_XPM_ScanlineProc(PLC *plc); /***** * PLCProc definitions for the progressive XBM loader * defined in readBitmap.c *****/ extern void _PLC_XBM_Init(PLC *plc); extern void _PLC_XBM_Destructor(PLC *plc); extern void _PLC_XBM_ScanlineProc(PLC *plc); /***** * PLCProc definitions for the progressive document loader. * defined in plc/format.c *****/ #ifdef PLC_DOC extern void _PLC_DOC_Init(PLC *plc); extern void _PLC_DOC_Destructor(PLC *plc); extern void _PLC_DOC_DisplayProc(PLC *plc); #endif /* PLC_DOC */ /* Don't add anything after this endif! */ #endif /* _plc_h_ */ XmHTML-1.1.10/include/common/PaxHeaders.1031/XmHTMLconf.h0000644000175000001440000000013212613377377020615 xustar000000000000000030 mtime=1445854975.105545877 30 atime=1445854975.105545877 30 ctime=1445854975.105545877 XmHTML-1.1.10/include/common/XmHTMLconf.h0000644000175000001440000002241112613377377020215 0ustar00chrisusers00000000000000/***** * XmHTMLconf.h : overall configuration settings. * * This file Version $Revision: 1.1 $ * * Creation date: Tue Oct 13 23:49:13 CEST 1998 * Last modification: $Date$ * By: $Author$ * Current State: $State$ * * Author: XmHTML Developers Account * * Copyright (C) 1994-1998 by Ripley Software Development * All Rights Reserved * * This file is part of the XmHTML Widget Library * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * *****/ /***** * $Source$ *****/ /***** * ChangeLog * $Log$ * *****/ /***** * This file contains a number of default values that can only be set at * compile-time. These values modify the default behaviour of the XmHTML * widget, so be carefull when modifying these values. *****/ #ifndef _XmHTMLconf_h_ #define _XmHTMLconf_h_ #include #ifndef BYTE_ALREADY_TYPEDEFED #define BYTE_ALREADY_TYPEDEFED typedef unsigned char Byte; #endif /* BYTE_ALREADY_TYPEDEFED */ /***** * Time window in which button press & release trigger an anchor activation. * (specified in milliseconds). *****/ #define XmHTML_BUTTON_RELEASE_TIME 500 /***** * Default horizontal & vertical marginwidth. *****/ #define XmHTML_DEFAULT_MARGIN 20 /***** * Number of pixels to scroll when the scrollbar isn't being dragged but * moved by either keyboard actions or arrow pressing. Be warned that * using large values will cause a jumpy scrolling as XmHTML will have to * render increasing amounts of data. *****/ #define XmHTML_HORIZONTAL_SCROLL_INCREMENT 12 /* average char width */ #define XmHTML_VERTICAL_SCROLL_INCREMENT 18 /* average line height */ /***** * Width of a horizontal tab (in spaces) for preformatted text. *****/ #define XmHTML_DEFAULT_TABWIDTH 8 /***** * Number of milliseconds that must elapse before the next scroll movement * (through the keyboard interface) will be honored. *****/ #define XmHTML_DEFAULT_REPEAT_DELAY 25 /***** * Absolute maximum no of colors XmHTML may use. It is the maximum value for * the XmNmaxImageColors resource. * Increasing this number isn't a wise thing to do since all image routines * are optimized for using paletted images. If you want XmHTML to handle more * than 256 colors, you will have to modify the code. *****/ #define XmHTML_MAX_IMAGE_COLORS 256 /***** * Initial size of the Pixel hashtable. A large value will provide a sparse * hashtable with few collisions. A small value will make the table compact * but can lead to a (considerable) number of collisions. * Calculating the optimal value is a tradeoff between speed and memory: * in a sparse table, few collisions will occur but the memory consumption * will be considerable (each entry occupies 28 bytes). A compact table will * undoubtably lead to a number of collisions which has its impact on both * storing and retrieving a value from the hashtable. * Note: this setting is unused by Gtk/XmHTML, it uses hashing routines * provided for by gtk. *****/ #define XmHTML_COLORHASH_SIZE 1024 /***** * Default character set and fonts sets for proportional and fixed * text. *****/ #define XmHTML_DEFAULT_CHARSET "iso8859-1" #define XmHTML_DEFAULT_FONT_TYPE XmFONT_IS_FONT #define XmHTML_DEFAULT_PROPORTIONAL_FONT "adobe-times-normal-*" #define XmHTML_DEFAULT_FIXED_FONT "adobe-courier-normal-*" #define XmHTML_DEFAULT_PROPORTIONAL_XFT_FONT "times:medium" #define XmHTML_DEFAULT_FIXED_XFT_FONT "courier:medium" /***** * Default font sizes * Scalable size array: default,sub/superscript,h1,h2,h3,h4,h5,h6 * Fixed size array : default,sub/superscript *****/ #define XmHTML_DEFAULT_FONT_SCALABLE_SIZES "14,8,24,18,14,12,10,8" #define XmHTML_DEFAULT_FONT_FIXED_SIZES "12,8" /***** * Default Table border width, cell & row spacing and padding. * Default border width is only used if the border attribute is present * but doesn't have a value. * BTW: the rowspacing and rowpadding attributes are not part of the * HTML spec. *****/ #define XmHTML_DEFAULT_TABLE_BORDERWIDTH 1 #define XmHTML_DEFAULT_CELLSPACING 0 #define XmHTML_DEFAULT_ROWSPACING 0 #define XmHTML_DEFAULT_CELLPADDING 2 #define XmHTML_DEFAULT_ROWPADDING 2 /* default value for resource minColPadding which is the minimum horizontal padding for the contents of table cells. */ #define XmHTML_DEFAULT_MIN_COL_PADDING 0 #define XmHTML_DEFAULT_ADD_H_TEXT_PADDING_IN_TABLES 2 /***** * Maximum depth of nested lists and the default indentation for a single * list item. *****/ #define XmHTML_NESTED_LISTS_MAX 26 #define XmHTML_INDENT_SPACES 3 /***** * Maximum number of iterations the text-justification routines may reach. * Decreasing the default value of 1500 will lead to an increasing amount * of warnings. *****/ #define XmHTML_MAX_JUSTIFY_ITERATIONS 1500 /***** * Maximum number of iterations the table layout computation routines may * reach. This only occurs when the minimum suggested table width is smaller * than the available width and the maximum suggested table width is larger * than the available width. In this case, the layout routines have to compute * an optimum balance between the different column widths within the available * width. The algorithm used should be convergent, but could be divergent for * nested tables or tables prefixed with an extreme indentation (nested lists * and such). Hence the safeguard. *****/ #define XmHTML_MAX_TABLE_ITERATIONS 128 /***** * Default gamma correction value for your display. This is only used for * images that support gamma correction (JPEG and PNG). * 2.2 is a good assumption for almost every X display. * For a Silicon Graphics displays, change this to 1.8 * For Macintosh displays (MkLinux), change this to 1.4 (so I've been told) * If you change this value, it *must* be a floating point value. * Note: this define is the default value for the XmNscreenGamma resource. *****/ #define XmHTML_DEFAULT_GAMMA 2.2 /***** * Maximum size of the PLC get_data() buffer. This is the maximum amount * of data that will be requested to a function installed on the * XmNprogressiveReadProc. Although this define can have any value, using * a very small value will make progressive loading very slow, while using * a large value will make the response of XmHTML slow while any PLC's are * active. * The first call to the get_data() routine will request PLC_MAX_BUFFER_SIZE * bytes, while the size requested by any following calls will depend on the * type of image being loaded and the amount of data left in the current input * buffer. *****/ #define PLC_MAX_BUFFER_SIZE 2048 /***** * The default timeout value for the Progressive Loader Context. This * timeout is the default value for the XmNprogressiveInitialDelay and * specifies the polling interval between subsequent PLC calls. * * Specified in milliseconds (1 second = 1000 milliseconds) * XmHTML dynamically adjusts the timeout value as necessary and recomputes * it after each PLC call. * PLC_MIN_DELAY is the minimum value XmHTML can reduce the timeout to while * PLC_MAX_DELAY is the maximum value XmHTML can increase the timeout to. *****/ #define PLC_DEFAULT_DELAY 250 #define PLC_MIN_DELAY 5 #define PLC_MAX_DELAY 1000 /***************** End of User configurable section *****************/ /***** * magic number for the XmHTMLImage structure. XmHTML uses this field to verify * the return value from a user-installed primary image cache. *****/ #define XmHTML_IMAGE_MAGIC 0xce /***** * Number of default icon entities. This number must equal the number * of elements in the _XmHTMLIconEntities array in icons.h *****/ #define NUM_ESCAPE_ICONS 61 /* lint kludge */ #ifdef lint #undef True #undef False #define True ((Boolean)1) #define False ((Boolean)0) #endif /* lint */ /***** * When X was written, noboby ever heard of C++, let alone what words * would be reserved for this language, and as a result of this, a few * structures in X contain words that could cause a problem when compiling * XmHTML with a C++ compiler. *****/ #if defined(__cplusplus) || defined(c_plusplus) #define MEMBER_CLASS c_class #define MEMBER_NEW c_new #define MEMBER_DELETE c_delete #else #define MEMBER_CLASS class #define MEMBER_NEW new #define MEMBER_DELETE delete #endif /***** * None can be undefined if we aren't compiled for Xt/Motif. *****/ #ifndef None #define None 0 #endif #define IdleKeep False #define IdleRemove True #define NullTimeout None /***** * Sanity check: production is only allowed when both ndebug and _library * have been defined. *****/ #ifdef production # ifndef NDEBUG # error You can not define production without defining NDEBUG. # endif /* NDEBUG */ # ifndef _LIBRARY # error Configuration error: production defined without _LIBRARY defined. # endif /* _LIBRARY */ #endif /* production */ /* Don't add anything after this endif! */ #endif /* _XmHTMLconf_h_ */ XmHTML-1.1.10/include/common/PaxHeaders.1031/HTMLWarnings.h0000644000175000001440000000013212613377377021153 xustar000000000000000030 mtime=1445854975.104545877 30 atime=1445854975.104545877 30 ctime=1445854975.104545877 XmHTML-1.1.10/include/common/HTMLWarnings.h0000644000175000001440000004763012613377377020565 0ustar00chrisusers00000000000000/***** * Automatically generated file. * ***DO NOT EDIT THIS FILE*** *****/ /***** * mkStrings Version 1.30, Build Date: Oct 25 2015 10:20:15 * File created at: Sun Oct 25 10:20:15 2015 *****/ #ifndef __XmHTML_Messages_h__ #define __XmHTML_Messages_h__ _XFUNCPROTOBEGIN /***** * Don't define XmHTML_STRINGDEFINES if you want to save space *****/ #ifndef XmHTML_STRINGDEFINES # ifndef _XmConst # ifdef __STDC__ # define _XmConst const # else # define _XmConst # endif # endif extern _XmConst char _XmHTMLMessages[]; #endif #ifdef XmHTML_STRINGDEFINES # define XMHTML_MSG_0 \ "Bad %s value, reset to %s " # define XMHTML_MSG_1 \ "Shape extension not supported by XServer, resetting XmNballoonStyle to XmBALLOON_SQUARE." # define XMHTML_MSG_2 \ "XmBalloon requires a non-NULL parent" # define XMHTML_MSG_3 \ "Invalid escape sequence: %s..." # define XMHTML_MSG_4 \ "tag %s has no value." # define XMHTML_MSG_5 \ "Failed to allocate colors, falling back to black and white." # define XMHTML_MSG_6 \ "Non default visual detected, using private colormap" # define XMHTML_MSG_7 \ "Oops! no colors available, images will look *really* ugly." # define XMHTML_MSG_8 \ "Representation type resource convertor %s not found/installed.\n Please contact ripley@xs4all.nl." # define XMHTML_MSG_9 \ "The specified value for %s (%i) is too small.\n Reset to %i" # define XMHTML_MSG_10 \ "Internal Error: unknown scrollbar!" # define XMHTML_MSG_11 \ "%s of %s scrollbar (%i) exceeds %s of parent widget (%i).\n Reset to %i." # define XMHTML_MSG_12 \ "%s is a ReadOnly resource, it can not be modified." # define XMHTML_MSG_13 \ "%s: invalid num_params. Must be exactly 1." # define XMHTML_MSG_14 \ "server side imagemaps not supported yet." # define XMHTML_MSG_15 \ "Bad value for XmNmaxImageColors: %i colors selected while display only\n supports %i colors. Reset to %i." # define XMHTML_MSG_16 \ "Invalid value for XmNprogressive%sDelay (%i)\n Reset to %i." # define XMHTML_MSG_17 \ "XmNprogressiveMaximumDelay (%i) less than XmNprogressive%sDelay (%i).\n Set to %i" # define XMHTML_MSG_18 \ "Misaligned anchor stack (id=%i), trying to recover." # define XMHTML_MSG_19 \ "String to Warning conversion may not have any arguments." # define XMHTML_MSG_20 \ "Cannot convert string \"%s\" to XmCWarningMode." # define XMHTML_MSG_21 \ "%s passed to %s." # define XMHTML_MSG_22 \ "Formatted text output: postscript requires a papertype." # define XMHTML_MSG_23 \ "Formatted text output: custom papersize misses a papersize definition." # define XMHTML_MSG_24 \ "Formatted text output: Invalid type selected." # define XMHTML_MSG_25 \ "XmImageDestroy: can't find display on which image was created.\n image %s not destroyed." # define XMHTML_MSG_26 \ "Can't export image type GIF: LZW support not available (and never will \n until Unisys decides to change their stupid licensing policy." # define XMHTML_MSG_27 \ "Can't export image type %s. This image requires support for %s, which\n was disabled when this version of the XmHTML Widget Library was build.\n To enable support for this image type, you will have to recompile\n this library." # define XMHTML_MSG_28 \ "Can't locate named anchor %s.\n" # define XMHTML_MSG_29 \ "Bad color name %s." # define XMHTML_MSG_30 \ "XAllocColor failed for color %s." # define XMHTML_MSG_31 \ "HTML 3.2 color violation: color %s not known, ignoring.\n" # define XMHTML_MSG_32 \ "Bad color entry on line %i of palette." # define XMHTML_MSG_33 \ "Requested XmNmaxImageColors value of %i could not be matched exactly.\n Using %i colors out of %i total." # define XMHTML_MSG_34 \ "%s parent passed to %s." # define XMHTML_MSG_35 \ "Failed to load font %s\n Font probably doesn't exist. Ignored." # define XMHTML_MSG_36 \ "Failed to load default font %s\n Guessing for one." # define XMHTML_MSG_37 \ "Unknown font switch. Using default font." # define XMHTML_MSG_38 \ "Font cache corrupted: could not find an entry for this %s." # define XMHTML_MSG_39 \ "XmHTMLGetFontCacheInfo: can't find info for display %s." # define XMHTML_MSG_40 \ "Empty XmHTML-1.1.10/examples/test-pages/PaxHeaders.1031/eye8.xpm0000644000175000001440000000013212613377377021104 xustar000000000000000030 mtime=1445854975.091545877 30 atime=1445854975.091545877 30 ctime=1445854975.091545877 XmHTML-1.1.10/examples/test-pages/eye8.xpm0000644000175000001440000000462512613377377020513 0ustar00chrisusers00000000000000/* XPM */ static char * eye8[] = { /* eye8 pixmap * width height ncolors chars_per_pixel */ "32 32 4 2 ", " c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", ". c #000 s s_#000 ", "X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", "o c #32329999CCCC s s_#32329999CCCC ", /* pixels */ " ", " ", " . . . . . . . ", " . . . X X X X X X X . . . ", " . . X X X X X X X X X X X X X . . ", " . X X X X X X X X X X X X X X X X X . ", " . X X X X X X X X X X X X X X X X X X X . ", " . X X X X X X X X X X X X X X X X X X X X X . ", " . X X X X X X X X . X . X . X . X X X X X X X X . ", " . X X X X X X X . . . . . X X X X X X X . ", " . X X X X X X X . . o o . . X X X X X X X . ", " . X X X X X X X . . o o o o o . . X X X X X X X . ", " . X X X X X X . . o o o o o o . . X X X X X X . ", " . X X X . X X X X . o o o o o o o o . X X X X . X X X . ", " . X X . X X X X . . o o o o o o o . . X X X X . X X . ", " . X X . X X X X X . o o o o o o o o o . X X X X X . X X . ", " . X X . X X X . . o o o o o o o . . X X X . X X . ", " . X X . X X X . . o o o o o . . X X X . X X . ", " . X X . X X X X . . o o . . X X X X . X X . ", " . X X . X X X X . . . . . X X X X . X X . ", " . X X X X . X X X X . X . X . X . X X X X . X X X X . ", " . X X X X . X X X X X X X X X X X X X X X . X X X X . ", " . X X X X . X X X X X X X X X X X X X X X . X X X X . ", " . . . . X X X X X X X X X X X X X X X X X . . . . ", " . . . . X X X . . . X X X X . . . ", " . X X . . X X . ", " . X X . . X X . ", " . X X . . X X . ", " . X X . . X X X X . ", " . X X . . X . . . . X . ", " . X X X X . . . X X X X . . ", " . . . . . . . . . . . . " } ; XmHTML-1.1.10/examples/test-pages/PaxHeaders.1031/table5.html0000644000175000001440000000013212613377377021546 xustar000000000000000030 mtime=1445854975.091545877 30 atime=1445854975.091545877 30 ctime=1445854975.091545877 XmHTML-1.1.10/examples/test-pages/table5.html0000644000175000001440000000314312613377377021147 0ustar00chrisusers00000000000000
    Headings
    • H1 - Level 1 header
    • H2 - Level 2 header
    • H3 - Level 3 header
    • H4 - Level 4 header
    • H5 - Level 5 header
    • H6 - Level 6 header
    Lists
    • UL - Unordered list
    • OL - Ordered list
    • DIR - Directory list
    • MENU - Menu item list
    • LI - List item
    • DL - Definition list
      • DT - Definition term
      • DD- Definition
    Text containers Others
    • DIV - Logical division
    • CENTER - Centered division
    • FORM - Input form
    • HR - Horizontal rule
    • TABLE - Tables
    XmHTML-1.1.10/examples/test-pages/PaxHeaders.1031/null_end.html0000644000175000001440000000013212613377377022172 xustar000000000000000030 mtime=1445854975.091545877 30 atime=1445854975.091545877 30 ctime=1445854975.091545877 XmHTML-1.1.10/examples/test-pages/null_end.html0000644000175000001440000000113612613377377021573 0ustar00chrisusers00000000000000Null end tag test

    this is some useless text

    WebTechs HTML 2.0 Checked! W3C Wilbur Checked! WebTechs Mozilla Checked! XmHTML-1.1.10/examples/test-pages/PaxHeaders.1031/eye2.xpm0000644000175000001440000000013212613377377021076 xustar000000000000000030 mtime=1445854975.090545877 30 atime=1445854975.090545877 30 ctime=1445854975.090545877 XmHTML-1.1.10/examples/test-pages/eye2.xpm0000644000175000001440000000462512613377377020505 0ustar00chrisusers00000000000000/* XPM */ static char * eye2[] = { /* eye2 pixmap * width height ncolors chars_per_pixel */ "32 32 4 2 ", " c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", ". c #000 s s_#000 ", "X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", "o c #32329999CCCC s s_#32329999CCCC ", /* pixels */ " ", " ", " . . . . . . . ", " . . . X X X X X X X . . . ", " . . X X X X X X X X X X X X X . . ", " . X X X X X X X X X X X X X X X X X . ", " . X X X X X X X X X X X X X X X X X X X . ", " . X X X X X X X X X X X X X X X X X X X X X . ", " . X X X X X X X X X X X X X X X X . X . X . X X . ", " . X X X X X X X X X X X X X X X . . . . X . ", " . X X X X X X X X X X X X X X X . . o . . X . ", " . X X X X X X . X X X X X X X . . o o o o o . . ", " . X X X X X . X X . X X X X . . o o o o o o . ", " . X X X X . X X . X X X X X X . o o o o o o o . . ", " . X X X . X X . X X X X X X . . o o o o o o o . ", " . X X . X X . X X X X X X X X . o o o o o o o o . . ", " . X X X . X X . X X X X X X . . o o o o o o o . ", " . X X X X . X X . . . X X X X . . o o o o o . . ", " . X X X X . X X X X . X X X X . . o o . . ", " . X X X X X . X X X X . X X X X . . . . X . ", " . X X X X . . X X X . X X X X X . X . X . X . ", " . X X . X X X X . X X X X X X X X X X X . ", " . X X . X X . X X X X X X X X X X X . ", " . . X . . X X X X X X X X X X . . ", " . X X X X X X X X X . . . ", " . X X X X . . . . ", " . X X . X X . ", " . . X X . . X X . . . ", " . X X X . . X X . . . X X . ", " . X X X . . . . X X X X X . ", " . X X X X X . . X X X . . ", " . . . . . . . . . " } ; XmHTML-1.1.10/examples/test-pages/PaxHeaders.1031/table8.html0000644000175000001440000000013212613377377021551 xustar000000000000000030 mtime=1445854975.092545877 30 atime=1445854975.092545877 30 ctime=1445854975.092545877 XmHTML-1.1.10/examples/test-pages/table8.html0000644000175000001440000000603112613377377021151 0ustar00chrisusers00000000000000











    XmHTML-1.1.10/examples/test-pages/PaxHeaders.1031/README0000644000175000001440000000013212613377377020364 xustar000000000000000030 mtime=1445854975.090545877 30 atime=1445854975.090545877 30 ctime=1445854975.090545877 XmHTML-1.1.10/examples/test-pages/README0000644000175000001440000001132312613377377017764 0ustar00chrisusers00000000000000This directory contains a number of documents that can be used to test certain features of XmHTML. The XmHTML version number at which a certain document can be displayed is used to see if something gets broken in subsequent releases. HTML comments ------------- The document comments.html contains a few examples of good and bad HTML comments. Starting from XmHTML 1.0.18, every comment should be removed properly and three warnings will be generated. Frames ------ The frame?.html documents contain a number of different frame configurations. Documents frame.html to frame4.html should be displayed successfully by example_2 starting from XmHTML version 1.0.15. The document frame5.html does *not* get displayed correctly with XmHTML version 1.0.15. Images ------ The document png.html contains two png images. Should be displayed succesfully by example_2.c starting from XmHTML version 1.0.13 Animations ---------- The documents animation1.html and animation2.html both contain an animation made up of the xpm images located in this directory. animation1.html contains a two animations while animation2.html contains three and some text to test the scrolling behaviour of animations. Should be displayed succesfully by example_2.c starting from XmHTML version 1.0.10 Animation3.html contains an animated gif. Should be displayed succesfully by example_2.c starting from XmHTML version 1.0.11 Imagemap testing ---------------- The document image-map.html contains the image black.jpg and a client-side imagemap. When DEBUG has been defined during compilation, the selection areas will be drawn onto this image. The document itself contains four different areas: poly, circle, rect and default. One of these areas (a rect) has the nohref attribute set while the other ones reference a html page with the name of their shape. Run with example_2 to see the names of the urls referenced by the respective areas. Should be displayed succesfully starting from XmHTML version 1.0.9 Font Consistency/Word glueing ----------------------------- The document font-stuff.html contains some bogus text with different mixed font styles and word glueing. Should be displayed succesfully starting from XmHTML version 1.0.8 Face specification ------------------ The document face.html contains a number of font elements with a face tag. The following face values/combinations are tested and shows the way XmHTML deals with the face tag: arial (always fails unless you have installed this m$-windoze font); helvetica (standard 75dpi and 100dpi iso8859-i); New Century Schoolbook (standard 75dpi and 100dpi iso8859-1); and combinations of bold and italic to show the XmHTML font handling scheme. This document should be displayed successfully starting from XmHTML version 1.0.7. SGML Shorttags -------------- (Original documents found at: http://www.absurd.org/dark_side/) The following pages test XmHTML's ability to deal with SGML shorttags: dark_side.html empty.html empty1.html null_end.html null_end1.html unclosed.html unclosed1.html These documents should be displayed successfully starting from XmHTML version 1.0.6. Cyrillic Font handling ---------------------- (Original document found at: http://www.relcom.ru/koi/Russification/WinNetscape/test1251.html) The following document contains some russian text: cyrillic.html and can be used to test XmHTML's ability to deal with cyrillic fonts. To test it, you will need to have a cyrillic font installed and tell XmHTML to use this font by setting the XmNcharset resource. Setting this resource alone will display the russian text, but you can achieve better results by also setting the XmNfontfamily and XmNfontFamilyFixed resources. For the koi8 cyrillic font, the best results can be achieved by setting the aforementioned resources to the following values: *XmHTML*charset: koi8-* *XmHTML*fontFamily: cronyx-times-*-* *XmHTML*fontFamilyFixed: cronyx-fixed-*-* This document should be displayed successfully starting from XmHTML version 1.0.7. Starting from example_2, XmHTML version 1.0.21, the document should be displayed in russian automatically if you have the koi8 font installed. Japanese Font Handling ---------------------- [No pages available, maybe someone can send me some? The new XmHTML font specification should work properly with japanese fonts too.] To test it, you will need to have a japanese font installed and tell XmHTML to use this font by setting the XmNcharset resource. Setting this resource alone will display the japanese text, but you can achieve better results by also setting the XmNfontfamily and XmNfontFamilyFixed resources. *XmHTML*charset: [tbd] *XmHTML*fontFamily: [tbd] *XmHTML*fontFamilyFixed: [tbd] This document should be displayed successfully starting from XmHTML version 1.0.7. XmHTML-1.1.10/examples/test-pages/PaxHeaders.1031/dusan.html0000644000175000001440000000013212613377377021504 xustar000000000000000030 mtime=1445854975.090545877 30 atime=1445854975.090545877 30 ctime=1445854975.090545877 XmHTML-1.1.10/examples/test-pages/dusan.html0000644000175000001440000001167012613377377021111 0ustar00chrisusers00000000000000 ArahDobby 2.8f: Saddlew5835

    Saddlew5835

    ArahDobby 2.8f: Saddlew5835
    http://www.arahne.si
    © 1993-98 Arahne; pallas:dusan
    07.09.1998
    Length of fabric 90.00 m
    Raw width 155.00 cm
    Finished width 150.00 cm
    Density Warp10.20 / cm
    Density Weft8.10 / cm
    Regulator 1
    Weaving-in 2.50%
    Loss 8.00%
    Consumption46.12 kg
    Raw weight471.5 g/m
    304.2 g/m2
    Reed space Reed number Denting Dents
    185.50 cm16.00 / cm2804
    Repeat
    threads
    Weave
    DesignDenting
    Regulator
    Weave
    Design
    Total
    Warp64
    4 Shafts
    64
    6.27 cm
    2
    1 Dents
    64
    6.27 cm
    64
    6.27 cm
    Weft468
    8.29 cm
    1
    1 advances
    68
    8.29 cm
    68
    8.29 cm
    Coverfactor
    WarpWeftTotalTransparency
    78.23%67.45%72.84%7.08%
    Warp pattern (25x): 24A 2B 38A
    Leftover (8 threads): 8A
    WarpRepeat
    threads
    Design
    threads
    Selvedges
    threads
    Total
    threads
    Repeat
    %
    Design
    kg
    Selvedges
    kg
    Total
    kg
    A6215582*6157096.8823.2860.17923.465
    B2500503.120.7470.0000.747
    Total8+25*64=1608+12=162024.033+0.179=24.212
    WarpAB
    Count (tex)149.00149.00
    Twists / m300 Z/2300 Z/2
    1
    50.0%
    50.0%
    66.7%
    33.3%
    218-0121 Elm Green14-6319 Meadow
    319-3642 Royal Purple17-3834 Dahlia Purple
    Weft pattern: 33(1a 1b) 2c
    WeftRepeat
    threads
    Repeat
    %
    kg
    a3348.5310.632
    b3348.5310.632
    c22.940.644
    Total6821.909
    Weftabc
    Count (tex)149.00149.00149.00
    Twists / m300 Z/2300 Z/2400 S/2
    1
    50.0%
    50.0%
    50.0%
    50.0%
    19-1532 Rosewood
    218-1016 Cub14-6305 Pelican17-1118 Lead Gray
    316-1126 Antelope18-0939 Drab18-0835 Dried Tobacco
    shaft1234
    threads402402402402
    g/m59.959.959.959.9
    XmHTML-1.1.10/examples/test-pages/PaxHeaders.1031/table9.html0000644000175000001440000000013212613377377021552 xustar000000000000000030 mtime=1445854975.092545877 30 atime=1445854975.092545877 30 ctime=1445854975.092545877 XmHTML-1.1.10/examples/test-pages/table9.html0000644000175000001440000000117512613377377021156 0ustar00chrisusers00000000000000

    XmNanchorUnderlineType
    Underlining style for anchors. Can be any of the following:

    XmNO_LINE /* no underlines */
    XmSINGLE_LINE /* a single, solid, underline */
    XmDOUBLE_LINE /* a double, solid, underline */
    XmSINGLE_DASHED_LINE /* a single, dashed, underline */
    XmDOUBLE_DASHED_LINE /* a double, dashed, underline */

    This resource is only honored when the XmNanchorButtons resource is set to False

    XmHTML-1.1.10/examples/test-pages/PaxHeaders.1031/eye13.xpm0000644000175000001440000000013212613377377021160 xustar000000000000000030 mtime=1445854975.090545877 30 atime=1445854975.090545877 30 ctime=1445854975.090545877 XmHTML-1.1.10/examples/test-pages/eye13.xpm0000644000175000001440000000462712613377377020571 0ustar00chrisusers00000000000000/* XPM */ static char * eye13[] = { /* eye13 pixmap * width height ncolors chars_per_pixel */ "32 32 4 2 ", " c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", ". c #000 s s_#000 ", "X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", "o c #32329999CCCC s s_#32329999CCCC ", /* pixels */ " ", " ", " . . . . . . . ", " . . . X X X X X X X . . . ", " . . X X X X X X X X X X X X X . . ", " . X X X X X X X X X X X X X X X X X . ", " . X X X X X X X X X X X X X X X X X X X . ", " . X X X X X X X X X X X X X X X X X X X X X . ", " . X X . X . X . X X X X X X X X X X X X X X X X . ", " . X . . . . X X X X X X X X X X X X X X X . ", " . X . o o . . X X X X X X X X X X X X X X X . ", " . . o o o o o . . X X X X X X X . X X X X X X . ", " . o o o o o o . . X X X X . X X . X X X X X . ", " . . o o o o o o o . X X X X X X . X X . X X X X . ", " . o o o o o o o . . X X X X X X . X X . X X X . ", " . . o o o o o o o o . X X X X X X X X . X X . X X . ", " . o o o o o o o . . X X X X X X . X X . X X X . ", " . . o o o o o . . X X X X . . . X X . X X X X . ", " . . o o . . X X X X . X X X X . X X X X . ", " . X . . . . X X X X . X X X X . X X X X X . ", " . X . X . X . X X X X X . X X X . . X X X X . ", " . X X X X X X X X X X X . X X X X . X X . ", " . X X X X X X X X X X X . X X . X X . ", " . . X X X X X X X X X X . . X . . ", " . . . X X X X X X X X X . ", " . . . . X X X X . ", " . . . . X X . X X . ", " . X X X . . . X X . X X . ", " . X X X X X X X . X X X . ", " . . . X . . . X . X X X . ", " . X X X X X X X X X . ", " . . . . . . . . . " } ; XmHTML-1.1.10/examples/test-pages/PaxHeaders.1031/table6.html0000644000175000001440000000013212613377377021547 xustar000000000000000030 mtime=1445854975.091545877 30 atime=1445854975.091545877 30 ctime=1445854975.091545877 XmHTML-1.1.10/examples/test-pages/table6.html0000644000175000001440000000202712613377377021150 0ustar00chrisusers00000000000000
    A test table with merged cells
    Average other
    category
    Misc
    height weight
    males 1.9 0.003
    females 1.7 0.002

    This could appear as follows, in a text browser:

              A test table with merged cells
    /--------------------------------------------------\ 
    |          |      Average      |  other   |  Misc  |
    |          |-------------------| category |--------|
    |          |  height |  weight |          |        |
    |-----------------------------------------|--------|
    | males    |   1.9   |  0.003  |          |        |
    |-----------------------------------------|--------|
    | females  |   1.7   |  0.002  |          |        |
    \--------------------------------------------------/
    
    XmHTML-1.1.10/examples/test-pages/PaxHeaders.1031/eye21.xpm0000644000175000001440000000013212613377377021157 xustar000000000000000030 mtime=1445854975.091545877 30 atime=1445854975.091545877 30 ctime=1445854975.091545877 XmHTML-1.1.10/examples/test-pages/eye21.xpm0000644000175000001440000000455412613377377020567 0ustar00chrisusers00000000000000/* XPM */ static char * eye21[] = { /* eye21 pixmap * width height ncolors chars_per_pixel */ "32 32 3 2 ", " c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", ". c #000 s s_#000 ", "X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", /* pixels */ " . . . . . . . ", " . . . X X X X X X X . . . ", " . . X X X X X X X X X X X X X . . ", " . X X X X X X X X X X X X X X X X X . ", " . X X X X X X X X X X X X X X X X X X X . ", " . X X X X X X X X X X X X X X X X X X X X X . ", " . X X X X X X X X X X X X X X X X X X X X X X X . ", " . X X X X X X X X X X X X X X X X X X X X X X X . ", " . X X X X X X X X X X X X X X X X X X X X X X X X X . ", " . . X X X X X X X X X X X X X X X X X X X X X X X X X . . ", " . . X X X X X X X X X X X X X X X X X X X X X X X X X . . ", " . X . X X X X X X X X X X X X X X X X X X X X X X X X X . X . ", " . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", " . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", " . X X X X X X X X X X X X X X X X X X X X X X X X X X X . ", " . X X X X X X X X X X X X X X X X X X X X X X X X X . ", " . X X X X X X X X X X X X X X X X X X X X X X X X X . ", " . X X X X X X X X X X X X X X X X X X X X X X X . ", " . . X X X X X X X X X X X X X X X X X X X X X X X . . ", " . X . X X X X X X X X X X X X X X X X X X X X X . X . ", " . X X . X X X X X X X X X X X X X X X X X X X . X X . ", " . . . . X X X X X X X X X X X X X X X X X . . . . ", " . . . X X X X . . . X X X X . . . ", " . X X . . X X . ", " . X X . . X X . ", " . X X . . X X . ", " . X X X X . . X X . ", " . X X X X X X . . X X . ", " . . . . . . . X X X X . ", " . . . . . . ", " ", " " } ; XmHTML-1.1.10/examples/test-pages/PaxHeaders.1031/eye18.xpm0000644000175000001440000000013212613377377021165 xustar000000000000000030 mtime=1445854975.090545877 30 atime=1445854975.090545877 30 ctime=1445854975.090545877 XmHTML-1.1.10/examples/test-pages/eye18.xpm0000644000175000001440000000462712613377377020576 0ustar00chrisusers00000000000000/* XPM */ static char * eye18[] = { /* eye18 pixmap * width height ncolors chars_per_pixel */ "32 32 4 2 ", " c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", ". c #000 s s_#000 ", "X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", "o c #32329999CCCC s s_#32329999CCCC ", /* pixels */ " ", " ", " . . . . . . . ", " . . . X X X X X X X . . . ", " . . X X X X X X X X X X X X X . . ", " . X X X X X X X X X X X X X X X X X . ", " . X X X X X X X X X X X X X X X X X X X . ", " . X X X X X X X X X X X X X X X X X X X X X . ", " . X X . X . X . X X X X X X X X X X X X X X X X . ", " . X . . . . X X X X X X X X X X X X X X X . ", " . X . o o . . X X X X X X X X X X X X X X X . ", " . . o o o o o . . X X X X X X X . X X X X X X . ", " . o o o o o o . . X X X X . X X . X X X X X . ", " . . o o o o o o o . X X X X X X . X X . X X X X . ", " . o o o o o o o . . X X X X X X . X X . X X X . ", " . . o o o o o o o o . X X X X X X X X . X X . X X . ", " . o o o o o o o . . X X X X X X . X X . X X X . ", " . . o o o o o . . X X X X . . . X X . X X X X . ", " . . o o . . X X X X . X X X X . X X X X . ", " . X . . . . X X X X . X X X X . X X X X X . ", " . X . X . X . X X X X X . X X X . . X X X X . ", " . X X X X X X X X X X X . X X X X . X X . ", " . X X X X X X X X X X X . X X . X X . ", " . . X X X X X X X X X X . . X . . ", " . . . X X . X X X X X X . ", " . . . X X X . . . ", " . X X . . X X . ", " . X X . . X X . ", " . X X . . . X X . ", " . . . . X X . X X X X . ", " . X X X X X X X . . . . . ", " . . . . . . . . . " } ; XmHTML-1.1.10/examples/test-pages/PaxHeaders.1031/table1.html0000644000175000001440000000013212613377377021542 xustar000000000000000030 mtime=1445854975.091545877 30 atime=1445854975.091545877 30 ctime=1445854975.091545877 XmHTML-1.1.10/examples/test-pages/table1.html0000644000175000001440000000063012613377377021141 0ustar00chrisusers00000000000000
    XmNO_LINE /* no underlines */
    XmSINGLE_LINE /* a single, solid, underline */
    XmDOUBLE_LINE /* a double, solid, underline */
    XmSINGLE_DASHED_LINE /* a single, dashed, underline */
    XmDOUBLE_DASHED_LINE /* a double, dashed, underline */
    XmHTML-1.1.10/examples/test-pages/PaxHeaders.1031/eye.xpm0000644000175000001440000000013212613377377021014 xustar000000000000000030 mtime=1445854975.090545877 30 atime=1445854975.090545877 30 ctime=1445854975.090545877 XmHTML-1.1.10/examples/test-pages/eye.xpm0000644000175000001440000000462312613377377020421 0ustar00chrisusers00000000000000/* XPM */ static char * eye[] = { /* eye pixmap * width height ncolors chars_per_pixel */ "32 32 4 2 ", " c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", ". c #000 s s_#000 ", "X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", "o c #32329999CCCC s s_#32329999CCCC ", /* pixels */ " ", " ", " . . . . . . . ", " . . . X X X X X X X . . . ", " . . X X X X X X X X X X X X X . . ", " . X X X X X X X X X X X X X X X X X . ", " . X X X X X X X X X X X X X X X X X X X . ", " . X X X X X X X X X X X X X X X X X X X X X . ", " . X X X X X X X X X X X X X X X X . X . X . X X . ", " . X X X X X X X X X X X X X X X . . . . X . ", " . X X X X X X X X X X X X X X X . . o . . X . ", " . X X X X X X . X X X X X X X . . o o o o o . . ", " . X X X X X . X X . X X X X . . o o o o o o . ", " . X X X X . X X . X X X X X X . o o o o o o o . . ", " . X X X . X X . X X X X X X . . o o o o o o o . ", " . X X . X X . X X X X X X X X . o o o o o o o o . . ", " . X X X . X X . X X X X X X . . o o o o o o o . ", " . X X X X . X X . . . X X X X . . o o o o o . . ", " . X X X X . X X X X . X X X X . . o . . . ", " . X X X X X . X X X X . X X X X . . . . X . ", " . X X X X . . X X X . X X X X X . X . X . X . ", " . X X . X X X X . X X X X X X X X X X X . ", " . X X . X X . X X X X X X X X X X X . ", " . . X . . X X X X X X X X X X . . ", " . X X X X X X X X X . . . ", " . X X X X . . . . ", " . X X . X X . ", " . X X . X X . ", " . X X . . . . . . . ", " . X . X X X X X . . X . . ", " . X X X X X X X X X X . X X . ", " . . . . . . . . . . . . . X . . " } ; XmHTML-1.1.10/examples/test-pages/PaxHeaders.1031/table7.html.swp0000644000175000001440000000013212613377377022360 xustar000000000000000030 mtime=1445854975.092545877 30 atime=1445854975.092545877 30 ctime=1445854975.092545877 XmHTML-1.1.10/examples/test-pages/table7.html.swp0000644000175000001440000004000012613377377021752 0ustar00chrisusers00000000000000b0VIM 4.6K\…4]P ( newthorizon.rsd.xs4all.nl~newt/src/XmHTML/XmHTML-1.1.7/examples/test-pages/table7.html3210#"! Utpÿ–ÿÿÿÿ«—oBad„–ùò×϶µuoK Ó˦œ”‡nd)"þ Ù › ^ P H A 8 7 ø ó Ë ± œ W "   ß ¶ ­ ¥ ž ‰ R I ? Ò Ä ¹ ¥ š [ 0 "   ø î ¹ ‚ t i U J @ çÙÎÄ»±|QC8.ùÒĹN@5+öÑø®¡˜…{zaZT= ø»«d ü÷ñ±ª^VH?4+#ØÑ™w\RC8.%æØÎ¹±ª„ƒ - Your own personalized WebCrawler Channel My Page
    Channels
  •  US Targets Internet Porn
  •  Prosecution Rests in Denver Counsel
  •  Reno Decides No Outside
  • weather stock quotes classifieds horoscopes maps people finder newsgroups yellow pages
      WIDTH="200" HEIGHT="25" ISMAP USEMAP="#gnav" BORDER="0">
    Home     "looking for!" WIDTH="242" HEIGHT="50" BORDER="0"> WebCrawler - Just what you're  WebCrawleradÓoÌ£g_XRIHD;ðéÅ«€oK&ñ Ê ¹ • r a =  ý Ù ´ £  ` U M F 3 ,  Í Â ¬ ˆ Q F 0 Ç ¼ ´ ­ £ ™ ˜ ” S M 4  û õ Á ™ \ 7 / '    Á³ª†L=3-#"˶j4ý½­iY ̱ª“l/ûѪ£›“’ HREF="http://www.microsoft.com/ie/"> HREF="http://home.netscape.com/comprod/mirror/index.html"> HREF="yellowpages.html"> Yellow PagesBuy BooksFree Classified AdsFind & Buy Music HREF="/Help/Help.html"> HelpEmailYour WebCrawler Page Excite, Inc. © 1997  copyright

    USEMAP="#footerbar" BORDER="0"> .

    Advertise on WebCrawler  ·  About Excite  ·  Bookmark WebCrawler U.K. · Sweden · Netherlands · Japan · Germany · France · Australia Global Excite:


    click here WIDTH="125" HEIGHT="48" BORDER="0"> click here #include #include #ifdef HAVE_STRINGS_H #include #endif #include #include #include #include #include #include #include #include #include "misc.h" #ifdef DMALLOC #include #endif /***** * external function prototypes *****/ /* can be found in XmHTML */ extern char *my_strcasestr(const char *s1, const char *s2); /***** * Local function prototypes *****/ static int normalizePathname(char *pathname); static int compressPathname(char *pathname); static char *nextSlash(char *ptr); static char *prevSlash(char *ptr); static int compareThruSlash(char *string1, char *string2); static void copyThruSlash(char **toString, char **fromString); /***** * countStrings: count the number of strings in a string with a given * separator. * In: * src: source containing strings to be counted * sep: separator used between the strings. * Returns: * the number of strings in src. *****/ short int countStrings(char *src, const char sep) { register char *chPtr; static short int numStr = 0; for(chPtr = &src[0]; *chPtr != '\0'; chPtr++) { if(*chPtr == sep) numStr++; } /* * if the last character in the given string is not terminated by the * given separation character, add one to the counted strings * We always return the total number of separate strings found. The * following test will add 1 to the counted strings if the array given * is not terminated with a closing separator. * As a side effect, it will set numStr to 1 if there is only one string * present. */ if(src[strlen(src)-1] != sep) numStr++; return(numStr); } static char* nextSlash(char *ptr) { for(; *ptr!='/'; ptr++) { if (*ptr == '\0') return(NULL); } return(ptr + 1); } static char* prevSlash(char *ptr) { for(ptr -= 2; *ptr!='/'; ptr--); return(ptr + 1); } static void copyThruSlash(char **toString, char **fromString) { char *to = *toString; char *from = *fromString; while (1) { *to = *from; if (*from =='\0') { *fromString = NULL; return; } if (*from=='/') { *toString = to + 1; *fromString = from + 1; return; } from++; to++; } } static int compareThruSlash(char *string1, char *string2) { while (1) { if (*string1 != *string2) return(0); if (*string1 =='\0' || *string1=='/') return(1); string1++; string2++; } } static int compressPathname(char *pathname) { char *inPtr, *outPtr; /* compress out . and .. */ inPtr = &pathname[1]; /* start after initial / */ outPtr = &pathname[1]; while (1) { /* if the next component is "../", remove previous component */ if ((compareThruSlash(inPtr, "../"))!= 0) { /* error if already at beginning of string */ if (outPtr == &pathname[1]) return(0); /* back up outPtr to remove last path name component */ outPtr = prevSlash(outPtr); inPtr = nextSlash(inPtr); } else if ((compareThruSlash(inPtr, "./"))!= 0) /* don't copy the component if it's a redundant "./" */ inPtr = nextSlash(inPtr); else /* copy the component to outPtr */ copyThruSlash(&outPtr, &inPtr); if (inPtr == NULL) return(1); } } static int normalizePathname(char *pathname) { char oldPathname[MAXPATHLEN+1], wd[MAXPATHLEN+1]; /* If this path is relative, prepend the current working directory */ if (pathname[0] != '/') { strcpy(oldPathname, pathname); getcwd(wd, MAXPATHLEN+1); strcpy(pathname, wd); strcat(pathname, "/"); strcat(pathname, oldPathname); } /* compress out .. and . */ return(compressPathname(pathname)); } /***** * Decompose a Unix file name into a file name and a path * This function originally comes from Nedit. * Used with kind permission of Mark Edel (Author of Nedit). *****/ int parseFilename(char *fullname, char *filename, char *pathname) { int fullLen = strlen(fullname); int i, pathLen, fileLen; /* find the last slash */ for (i=fullLen-1; i>=0; i--) if (fullname[i] == '/') break; /* move chars before / (or ] or :) into pathname,& after into filename */ pathLen = i + 1; fileLen = fullLen - pathLen; strncpy(pathname, fullname, pathLen); pathname[pathLen] = 0; strncpy(filename, &fullname[pathLen], fileLen); filename[fileLen] = 0; return(normalizePathname(pathname)); } /***** * Name: XMessage * Return Type: void * Description: displays a message dialog * In: * widget: parent widget; * msg: message to be displayed; * Returns: * nothing *****/ void XMessage(Widget widget, String msg) { static Widget dialog; Arg args[2]; XmString xms; /* create dialog */ if(!dialog) { dialog = XmCreateInformationDialog(widget, "Message", NULL, 0); /* remove the cancel and help button */ XtUnmanageChild( XmMessageBoxGetChild(dialog, XmDIALOG_CANCEL_BUTTON)); XtUnmanageChild( XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON)); /* set the title */ XtVaSetValues(XtParent(dialog), XmNtitle, "Message", NULL); } /* create message */ xms = XmStringCreateLtoR(msg, XmSTRING_DEFAULT_CHARSET); /* set it */ XtSetArg(args[0], XmNmessageString, xms); XtSetArg(args[1], XmNmessageAlignment, XmALIGNMENT_CENTER); XtSetValues(dialog, args, 2); /* no longer needed, free it */ XmStringFree(xms); /* show it */ XtManageChild(dialog); XtPopup(XtParent(dialog), XtGrabNone); XMapRaised(XtDisplay(dialog), XtWindow(XtParent(dialog))); } /***** * Name: setBusy * Return Type: void * Description: changes the cursor from or to a stopwatch to indicate we are * busy doing something lengthy processing which can't be * interrupted. * In: * state: True to display the cursor as busy, False to display the * normal cursor. * Returns: * nothing. *****/ void setBusy(Widget w, Boolean state) { static Boolean busy; static Cursor cursor; Display *display = XtDisplay(w); if(!cursor) { cursor = XCreateFontCursor(display, XC_watch); busy = False; } if(busy != state) { busy = state; if(busy) XDefineCursor(display, XtWindow(w), cursor); else XUndefineCursor(display, XtWindow(w)); } XFlush(display); } /***** * Follow symbolic links (if any) to translate filename into the name of the * real file that it represents. Returns TRUE if the call was successful, * meaning the links were translated successfully, or the file was not * linked to begin with (or there was no file). Returns false if some * error prevented the call from determining if there were symbolic links * to process, or there was an error in processing them. The error * can be read from the unix global variable errno. *****/ Boolean followSymLinks(String filename) { /***** * FIXME * * readlink doesn't seem to do anything at all on Linux 2.0.27, * libc 5.3.12 *****/ int cc; char buf[1024]; cc = readlink(filename, buf, 1024); if (cc == -1) { #ifdef __sgi if (errno == EINVAL || errno == ENOENT || errno == ENXIO) #else if (errno == EINVAL || errno == ENOENT) #endif /* no error, just not a symbolic link, or no file */ return(True); else return(False); } else { buf[cc] = '\0'; strcpy(filename, buf); return(True); } } /***** * Name: getMimeType * Return Type: int * Description: make a guess at the mime type of a document by looking at * the extension of the given document. * In: * file: file for which to get a mime-type; * Returns: * mime type of the given file. *****/ mimeType getMimeType(String file) { String chPtr; unsigned char img_type; if((chPtr = strstr(file, ".")) != NULL) { String start; /* first check if this is plain HTML or not */ for(start = &file[strlen(file)-1]; *start && *start != '.'; start--); if(!strcasecmp(start, ".html") || !strcasecmp(start, ".htm")) return(MIME_HTML); if(!strcasecmp(start, ".htmlp")) return(MIME_HTML_PERFECT); } /* something else then? */ /* check if this is an image XmHTML knows of */ if((img_type = XmHTMLImageGetType(file, NULL, 0)) == IMAGE_ERROR) return(MIME_ERR); /***** * Not an image we know of, get first line in file and see if it's * html anyway *****/ if(img_type == IMAGE_UNKNOWN) { FILE *fp; char buf[128]; /* open file */ if((fp = fopen(file, "r")) == NULL) return(MIME_ERR); /* read first line in file */ if((chPtr = fgets(buf, 128, fp)) == NULL) { /* close again */ fclose(fp); return(MIME_ERR); } /* close again */ fclose(fp); /* see if it contains any of these strings */ if(my_strcasestr(buf, " #endif XCOMM XCOMM Use the Debug version of libXmHTML if it exists, else use static lib. XCOMM #if DebugLibXmHTML XMHTMLLIB = $(BUILDINCTOP)/src/libXmHTML_d.a DEPLIB = $(XMHTMLLIB) #else #if SharedLibXmHTML XMHTMLLIB = -L$(BUILDINCTOP)/src -lXmHTML #else XMHTMLLIB = $(BUILDINCTOP)/src/libXmHTML.a DEPLIB = $(XMHTMLLIB) #endif #endif XCOMM INCLUDES = -I$(BUILDINCTOP)/include $(DMALLOCINC) DEPLIBS = $(DEPXMLIB) $(DEPXTOOLLIB) $(DEPXLIB) XCOMM XCOMM Richard's http client-side library (used by example_4) XCOMM HTTPLIB = -L$(BUILDINCTOP)/http -lhttp XCOMM required libraries LOCAL_LIBS = $(XMHTMLLIB) $(XMLIB) $(XTOOLLIB) $(XLIB) $(DMALLOCLIB) XCOMM common routines for all examples XCOMM MSRCS = visual.c misc.c cache.c menu.c MOBJS = visual.o misc.o cache.o menu.o SRCS = example_1.c example_2.c example_4.c OBJS1 = example_1.o OBJS2 = example_2.o $(MOBJS) OBJS4 = example_4.o AllTarget(example_1 example_2 example_4) NormalProgramTarget(example_1,$(OBJS1),$(DEPLIB),$(LOCAL_LIBS),) NormalProgramTarget(example_2,$(OBJS2),$(DEPLIB),$(LOCAL_LIBS),) NormalProgramTarget(example_4,$(OBJS4),$(DEPLIB),$(LOCAL_LIBS) $(HTTPLIB),) DependTarget() XCOMM XCOMM Special rules for creating a distribution with the barebone makefiles XCOMM distclean:: clean $(RM) core *.out make.world *.bak *.last *.auto stamp-includes $(CP) Makefile.org Makefile #endif XmHTML-1.1.10/examples/PaxHeaders.1031/menu.c0000644000175000001440000000013212613377377016540 xustar000000000000000030 mtime=1445854975.089545877 30 atime=1445854975.089545877 30 ctime=1445854975.089545877 XmHTML-1.1.10/examples/menu.c0000644000175000001440000003753412613377377016154 0ustar00chrisusers00000000000000/***** * menu.c : X11/Motif menu creation/convenience routines * * This file Version: $Revision: 2.1 $ * * Creation date: 06/15/1994 * Last modification: $Date: 1997/02/11 02:23:27 $ * By: $Author: newt $ * Current State: $State: Exp $ * * Author: koen * * Copyright (C) 1994-1997 by Ripley Software Development * All Rights Reserved * * This file is part of the XmHTML Widget Library * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * History: * iEdit * XntHelp *****/ /***** * Revision Log: * $Log: menu.c,v $ * Revision 2.1 1997/02/11 02:23:27 newt * Migration into eXweb * *****/ #include #include #include /* X11 includes */ #include #include /* Motif includes */ #include #include #include #include #include #include #include #include #include /* Local includes */ #include "menu.h" /***** * Name: MenuBuild * Return Type: Widget * Description: multiple menu type creation routine * In: * parent: parent for this menu * type: type of desired menu, see below * title: title for this menu * mnemonic: shortcut key for this menu * items: menu descriptions, see menu.h * Returns: * On success, the created menu. Can exit the application if the menu * specification is invalid * Notes: * - This function is a modified version of the buildMenu function * in The Motif Programming Manual, Volume 6 in the O'Reilly X Window * System Series. * - The menu types supported are: XmMENU_PULLDOWN, XmMENU_OPTION and * XmMENU_POPUP * - The class of the menu buttons can be: * xmCascadeButtonGadgetClass, xmLabelGadgetClass, xmPushButtonGadgetClass, * xmSeparatorGadgetClass, xmToggleButtonGadgetClass and all of their Widget * counterparts. *****/ Widget MenuBuild(Widget parent, int type, String title, KeySym mnemonic, MenuItem *items) { int i, argc = 0; Widget menu, cascade, widget; String resource; char menu_name[512]; Arg args[5]; sprintf(menu_name,"%sMenu", title); /* create appropriate RowColum container */ switch(type) { case XmMENU_PULLDOWN: menu = XmCreatePulldownMenu(parent, menu_name, NULL, 0); break; case XmMENU_OPTION: strcat(menu_name, "_Option"); menu = XmCreatePulldownMenu(parent, menu_name, NULL, 0); break; case XmMENU_POPUP: strcat(menu_name, "_Popup"); menu = XmCreatePopupMenu(parent, menu_name, NULL, 0); break; default: return(NULL); } /* create menu triggerer */ if(type == XmMENU_PULLDOWN) { cascade = XtVaCreateManagedWidget(title, xmCascadeButtonGadgetClass, parent, XmNsubMenuId, menu, NULL); if(mnemonic != None) { XtVaSetValues(cascade, XmNmnemonic, mnemonic, NULL); } } else if(type == XmMENU_OPTION) { argc = 0; XtSetArg(args[argc], XmNsubMenuId, menu); argc++; cascade = XmCreateOptionMenu(parent, title, args, argc); } /* add all menu items */ for(i = 0; items[i].name != NULL; i++) { /* check for pull-rights */ if(items[i].subitems) { if(type == XmMENU_OPTION) { fprintf(stderr, "MenuBuild:\n" "\tsubmenus in option menus are not allowed.\n"); return(NULL); } else widget = MenuBuild(menu, XmMENU_PULLDOWN, items[i].name, items[i].mnemonic, items[i].subitems); } else widget = XtCreateManagedWidget(items[i].name, *items[i].class, menu, NULL, 0); /* configure the new menu item */ if(items[i].class != &xmSeparatorGadgetClass && items[i].class != &xmSeparatorWidgetClass) { argc = 0; /* callback? */ if(items[i].callback) { if(items[i].class == &xmToggleButtonWidgetClass || items[i].class == &xmToggleButtonGadgetClass) resource = XmNvalueChangedCallback; else resource = XmNactivateCallback; XtAddCallback(widget, resource, items[i].callback, items[i].client_data); } /* do we have an mnemonic for this item? */ if(items[i].mnemonic != None) { XtSetArg(args[argc], XmNmnemonic, items[i].mnemonic); argc++; } /* initial state? */ if(items[i].class == &xmToggleButtonWidgetClass || items[i].class == &xmToggleButtonGadgetClass) resource = XmNset; else resource = XmNsensitive; XtSetArg(args[argc], resource, items[i].sensitive); argc++; /* userData? */ if(items[i].id != (XtPointer)-1) { XtSetArg(args[argc], XmNuserData, items[i].id); argc++; } /* set them */ if(argc) XtSetValues(widget, args, argc); } } return(type == XmMENU_POPUP ? menu : cascade); } /***** * Name: MenuBuildShared * Return Type: Widget * Description: creates a ``floating'' menu suitable for sharing between * multiple menubars * In: * parent: parent for this menu; * type: type of menu to be created; * title: name of this menu; * items: items for this menu; * Returns: * the created menu. *****/ Widget MenuBuildShared(Widget parent, int type, String title, MenuItem *items) { int i, argc = 0; Widget menu, widget; String resource; char menu_name[512]; Arg args[5]; sprintf(menu_name,"%sMenu", title); /* create appropriate RowColum container */ switch(type) { case XmMENU_PULLDOWN: menu = XmCreatePulldownMenu(parent, menu_name, NULL, 0); break; case XmMENU_OPTION: strcat(menu_name, "_Option"); menu = XmCreatePulldownMenu(parent, menu_name, NULL, 0); break; case XmMENU_POPUP: strcat(menu_name, "_Popup"); menu = XmCreatePopupMenu(parent, menu_name, NULL, 0); break; default: return(NULL); } /* add all menu items */ for(i = 0; items[i].name != NULL; i++) { /* check for pull-rights */ if(items[i].subitems) { if(type == XmMENU_OPTION) { fprintf(stderr, "MenuBuildShared:\n" "\tsubmenus in option menus are not allowed.\n"); return(NULL); } else widget = MenuBuild(menu, XmMENU_PULLDOWN, items[i].name, items[i].mnemonic, items[i].subitems); } else widget = XtCreateManagedWidget(items[i].name, *items[i].class, menu, NULL, 0); /* configure the new menu item */ if(items[i].class != &xmSeparatorGadgetClass && items[i].class != &xmSeparatorWidgetClass) { argc = 0; /* callback? */ if(items[i].callback) { if(items[i].class == &xmToggleButtonWidgetClass || items[i].class == &xmToggleButtonGadgetClass) resource = XmNvalueChangedCallback; else resource = XmNactivateCallback; XtAddCallback(widget, resource, items[i].callback, items[i].client_data); } /* do we have an mnemonic for this item? */ if(items[i].mnemonic != None) { XtSetArg(args[argc], XmNmnemonic, items[i].mnemonic); argc++; } /* initial state? */ if(items[i].class == &xmToggleButtonWidgetClass || items[i].class == &xmToggleButtonGadgetClass) resource = XmNset; else resource = XmNsensitive; XtSetArg(args[argc], resource, items[i].sensitive); argc++; /* userData? */ if(items[i].id != (XtPointer)-1) { XtSetArg(args[argc], XmNuserData, items[i].id); argc++; } /* set them */ if(argc) XtSetValues(widget, args, argc); } } return(menu); } /***** * Name: MenuAddShared * Return Type: Widget * Description: creates a menubar entry and adds the given menu to it. * In: * parent: parent for this menu * type: type of desired menu, see below * title: title for this menu * mnemonic: shortcut key for this menu * items: menu items; * Returns: * The new menubar entry when a pulldown or optionmenu was requested, NULL * otherwise. *****/ Widget MenuAddShared(Widget parent, int type, String title, KeySym mnemonic, Widget items) { Arg args[2]; int argc = 0; /* create menu triggerer */ switch(type) { case XmMENU_PULLDOWN: XtSetArg(args[argc], XmNsubMenuId, items); argc++; if(mnemonic != None) { XtSetArg(args[argc], XmNmnemonic, mnemonic); argc++; } return(XmCreateCascadeButtonGadget(parent, title, args, argc)); case XmMENU_OPTION: XtSetArg(args[argc], XmNsubMenuId, items); argc++; return(XmCreateOptionMenu(parent, title, args, argc)); default: fprintf(stderr, "MenuAddShared: unknown menu type!\n"); return(NULL); } } /********** ***** Common menu convenience routines **********/ /***** * Name: MenuGetChildren * Return Type: void * Description: Get the children of a menu. * In: * menu: menu of which to get the children * children: children of menu. This elemenent is filled upon return. * num_children: number of elements in children. This element is filled * upon return. * Returns: * nothing *****/ void MenuGetChildren(Widget menu, WidgetList *children, int *num_children) { Widget foo = NULL; *children = NULL; *num_children = 0; if (XtIsSubclass(menu, xmCascadeButtonWidgetClass) || XtIsSubclass(menu, xmCascadeButtonGadgetClass)) { XtVaGetValues(menu, XmNsubMenuId, &foo, NULL); XtVaGetValues(foo, XmNchildren, &*children, XmNnumChildren, &*num_children, NULL); } else if ((XmIsRowColumn(menu)) == 1) { XtVaGetValues(menu, XmNchildren, &*children, XmNnumChildren, &*num_children, NULL); } else { fprintf(stderr, "MenuGetChildren:\n" "\tcan't retrieve children: menu is of unknown class.\n"); return; } } /***** * Name: MenuFindButtonById * Return Type: Widget * Description: Find a widget identified by Id in a pointer array of widgets * In: * menu: list of widgets to search * id: id of widget to find * Returns: * widget found or NULL on failure. *****/ Widget MenuFindButtonById(Widget menu, int id) { register WidgetList child_ptr; WidgetList childs; int num_childs; MenuGetChildren(menu, &childs, &num_childs); for(child_ptr = childs; child_ptr != NULL; child_ptr++) { if((MenuButtonGetId(*child_ptr)) == id) return(*child_ptr); } return(NULL); /* not found */ } /***** * Name: MenuFindButtonByName * Return Type: Widget * Description: Find a named widget in a pointer array of widgets * In: * wlist: list of widgets to search * name: name of widget to find * Returns: * widget found or NULL on failure. *****/ Widget MenuFindButtonByName(WidgetList wlist, String name) { WidgetList child_ptr; Widget child = NULL; for(child_ptr = wlist; child_ptr != NULL; child_ptr++) { child = *child_ptr; if (strcmp(XtName(child),name) == 0) return(child); } return(NULL); /* not found */ } /***** * Name: MenuButtonGetId * Return Type: int * Description: This routine finds out what number a menubutton has by * examining the XmNuserData field of the widget * In: * button: button for which to fetch the userData value * Returns: * value of the XmNuserData resource *****/ int MenuButtonGetId(Widget button) { int w_num = -1; XtVaGetValues(button, XmNuserData, &w_num, NULL); return(w_num); } /***** * Name: MenuIsToggleMenu * Return Type: void * Description: Make a menu with togglebuttons act as a radiobox * In: * menu: menu of which to set state * Returns: * nothing *****/ void MenuIsToggleMenu(Widget menu) { Widget foo = NULL; if (XtIsSubclass(menu, xmCascadeButtonWidgetClass) || XtIsSubclass(menu, xmCascadeButtonGadgetClass)) { XtVaGetValues(menu, XmNsubMenuId, &foo, NULL); XtVaSetValues(foo, XmNradioBehavior, True, XmNradioAlwaysOne, True, NULL); } else { fprintf(stderr, "MenuToggleSet:\n\tmenu %s is no subclass " "of CascadeButton (internal error).\n", XtName(menu)); } } /********** ***** Option menu specific convenience routines **********/ /***** * Name: MenuOptionSelectItem * Return Type: void * Description: selects the given option menu button; * In: * menu: menu of which to select a menu item * id: id of menu item to set * Returns: * nothing *****/ void MenuOptionSelectItem(Widget menu, int id) { Widget option_menu = NULL; Widget pb; /* Get all children and number of items contained */ XtVaGetValues(menu, XmNsubMenuId, &option_menu, NULL); /* sanity check */ if(!option_menu) { fprintf(stderr, "MenuSelectOption:\n" "\tcan't select requested menu: menu has no children.\n"); return; } /* get correct menu entry */ if((pb = MenuFindButtonById(menu, id)) == NULL) { fprintf(stderr, "MenuSelectOption:\n" "\tcan't select requested menu: requested id out of range.\n"); return; } /* Select it */ XtVaSetValues(option_menu, XmNmenuHistory, pb, NULL); } /***** * Name: MenuOptionSetSensitivity * Return Type: void * Description: Set the sensitivity state of an item in a option menu * In: * menu:option menu id * id: id of menu item of which the state is to be set. * Zero based index. * state: state of the item. * Returns: * nothing *****/ void MenuOptionSetSensitivity(Widget menu, int id, int state) { Widget pb; /* get correct menu entry */ if((pb = MenuFindButtonById(menu, id)) == NULL) { fprintf(stderr, "MenuOptionSetSensitivity:\n" "\tcan't select requested menu: requested id out of range.\n"); return; } XtSetSensitive(pb, state); } /***** * Name: MenuOptionGetSelected * Return Type: int * Description: Return the id of the selected option menu item * In: * menu: Option menu of which to return the selected menu item * Returns: * the id (XmNuserData field) of the selected menu item. -1 upon failure. *****/ int MenuOptionGetSelected(Widget menu) { int item_no; Widget item; XtVaGetValues(menu, XmNmenuHistory, &item, NULL); if(!item) { fprintf(stderr, "MenuOptionGetSelected:\n" "\tcan't retrieve selected item in option menu: XtVaGetValues " "returned NULL.\n"); return(-1); } XtVaGetValues(item, XmNuserData, &item_no, NULL); return(item_no); } /********** ***** Toggle menu specific convenience routines **********/ /***** * Name: MenuToggleSelected * Return Type: Boolean * Description: See if a toggle button is checked * In: * toggle: toggle button widget to check * Returns: * selection state of toggle *****/ Boolean MenuToggleSelected(Widget toggle) { Boolean value = False; XtVaGetValues(toggle, XmNset, &value, NULL); return(value); } /***** * Name: MenuToggleSetState * Return Type: void * Description: sets the selection state of a togglebutton. * In: * menu: menu of which an item has to be set; * id: id of menubutton to be set; * state: new toggle state; * Returns: * nothing. *****/ void MenuToggleSetState(Widget menu, int id, Boolean state) { Widget toggle; /* get correct menu entry */ if((toggle = MenuFindButtonById(menu, id)) == NULL) { fprintf(stderr, "MenuToggleSetState:\n" "\tcan't select requested menu: requested id out of range.\n"); return; } XtVaSetValues(toggle, XmNset, state, NULL); } /***** * Name: MenuToggleGetState * Return Type: void * Description: gets the selection state of a togglebutton. * In: * menu: menu for which an item has to be checked; * id: id of menubutton to be checked; * Returns: * False when it's not selected, True otherwise. *****/ Boolean MenuToggleGetState(Widget menu, int id) { Widget toggle; Boolean value = False; /* get correct menu entry */ if((toggle = MenuFindButtonById(menu, id)) == NULL) { fprintf(stderr, "MenuToggleSetState:\n" "\tcan't get requested menu: requested id out of range.\n"); return(False); } XtVaGetValues(toggle, XmNset, &value, NULL); return(value); } XmHTML-1.1.10/examples/PaxHeaders.1031/history.h0000644000175000001440000000013212613377377017302 xustar000000000000000030 mtime=1445854975.089545877 30 atime=1445854975.089545877 30 ctime=1445854975.089545877 XmHTML-1.1.10/examples/history.h0000644000175000001440000000460312613377377016705 0ustar00chrisusers00000000000000/***** * history.h : public header for XmHTML history routines * * This file Version $Revision: 1.1 $ * * Creation date: Sun Aug 30 21:39:34 CEST 1998 * Last modification: $Date$ * By: $Author$ * Current State: $State$ * * Author: XmHTML Developers Account * * Copyright (C) 1994-1998 by Ripley Software Development * All Rights Reserved * * This file is part of the XmHTML Widget Library * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * *****/ /***** * $Source$ *****/ /***** * ChangeLog * $Log$ * *****/ #ifndef _history_h_ #define _history_h_ typedef struct{ String file; int line_no; String location; }HistoryData; /* Initialize the history routines. Level > 0 : debug mode */ extern void HistoryInitialize(int level); /* add an item to the history */ extern Boolean HistoryAdd(Widget w, String file, int line_no, String location); /* remove the history for the given widget */ extern void HistoryRemove(Widget w); /* remove all history items associated with the given file */ extern Boolean HistoryRemoveRefs(Widget w, String file); /***** * History fetching routines. * All these routines return pointers to static data, so do not free * the returned data. *****/ /* get the previous item in the history list */ extern HistoryData *HistoryBack(Widget w); /* get the current item in the history list */ extern HistoryData *HistoryCurrent(Widget w); /* get the next item in the history list */ extern HistoryData *HistoryForward(Widget w); /* verify if a backward move in the history will return valid data */ extern Boolean HistoryVerifyBack(Widget w); /* verify if a forward move in the history will return valid data */ extern Boolean HistoryVerifyForward(Widget w); /* Don't add anything after this endif! */ #endif /* _history_h_ */ XmHTML-1.1.10/examples/PaxHeaders.1031/visual.c0000644000175000001440000000013212613377377017077 xustar000000000000000030 mtime=1445854975.092545877 30 atime=1445854975.092545877 30 ctime=1445854975.092545877 XmHTML-1.1.10/examples/visual.c0000644000175000001440000001656612613377377016515 0ustar00chrisusers00000000000000/***** * visual.c : visual & colormap support code for the XmHTML examples. * * This file Version $Revision: 1.1 $ * * Creation date: Thu May 1 00:17:12 GMT+0100 1997 * Last modification: $Date: 1997/05/28 02:01:34 $ * By: $Author: newt $ * Current State: $State: Exp $ * * Author: John L. Cwikla * X Programmer * Wolfram Research Inc. * cwikla@wri.com * * Copyright (C) 1996 by John C. Cwikla * Copyright (C) 1997 by Ripley Software Development * All Rights Reserved * * This file is part of the XmHTML Widget Library. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU [Library] General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU [Library] General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * *****/ /***** * ChangeLog * $Log: visual.c,v $ * Revision 1.1 1997/05/28 02:01:34 newt * Initial Revision * *****/ #include #include #include #include /*** External Function Prototype Declarations ***/ /*** Public Variable Declarations ***/ /*** Private Datatype Declarations ****/ #define XmNvisualID "visualID" #define XmNapplicationDepth "applicationDepth" #define XmNvisualClass "visualClass" #define XmNusePrivateColormap "usePrivateColormap" #define XmCVisualID "VisualID" #define XmCApplicationDepth "ApplicationDepth" #define XmCVisualClass "VisualClass" #define XmCUsePrivateColormap "UsePrivateColormap" /*** Private Function Prototype Declarations ****/ /*** Private Variable Declarations ***/ typedef struct _OurResourceStruct { int visualID; int applicationDepth; int visualClass; Boolean usePrivateColormap; }OurResourceStruct, *OurResourcePtr; OurResourceStruct ourResources; #define UNDEFINED_DEFAULT -1 #define TheOffset(a) XtOffset(OurResourcePtr, a) static XtResource AppResources[] = { { XmNvisualID, XmCVisualID, XtRInt, sizeof(int), TheOffset(visualID), XtRImmediate, (XtPointer)UNDEFINED_DEFAULT }, { XmNapplicationDepth, XmCApplicationDepth, XtRInt, sizeof(int), TheOffset(applicationDepth), XtRImmediate, (XtPointer)UNDEFINED_DEFAULT }, { XmNvisualClass, XmCVisualClass, XtRInt, sizeof(int), TheOffset(visualClass), XtRImmediate, (XtPointer)UNDEFINED_DEFAULT }, { XmNusePrivateColormap, XmCUsePrivateColormap, XtRBoolean, sizeof(Boolean), TheOffset(usePrivateColormap), XtRImmediate, (XtPointer)FALSE }, }; /***** * Name: getStartupVisual * Return Type: int * Description: pick visual and colormap that are in balance. * In: * shell: widget for which to pick visual and colormap; * visual: visual picked, updated upon return; * colormap: created colormap (default or privated), updated upon return; * depth: required depth. * Returns: * True when args have been updated, false if not. * Note: * This routine comes from an article of John Cwikla that appeared in the * X Advisor Journal, ``Beyond the Default Visual'', dated june 1995. Read it * to get the full story and why the resources. You can find this article at: * http://www.unx.com/DD/advisor/docs/jun95/jun95.cwikla1.shtml *****/ int getStartupVisual(Widget shell, Visual **visual, int *depth, Colormap *colormap) { Display *display; int success = FALSE, screen; int theVisualClass; XVisualInfo theVisualInfo; static Visual *theVisual; static Colormap theColormap; static int theApplicationDepth; display = XtDisplay(shell); XtGetApplicationResources(shell, &ourResources, AppResources, XtNumber(AppResources), NULL, 0); /* if no resources have been set, just return */ if(ourResources.visualID == UNDEFINED_DEFAULT && ourResources.applicationDepth == UNDEFINED_DEFAULT && ourResources.visualClass == UNDEFINED_DEFAULT && ourResources.usePrivateColormap == FALSE) { return(FALSE); } if(ourResources.visualID != UNDEFINED_DEFAULT) { XVisualInfo vtemp, *vinfos; int vitems; vtemp.visualid = ourResources.visualID; vinfos = XGetVisualInfo(display, VisualIDMask, &vtemp, &vitems); if(vinfos != NULL) { /* Better only be one match! */ theVisual = vinfos[0].visual; theApplicationDepth = vinfos[0].depth; theVisualClass = vinfos[0].class; XFree(vinfos); success = TRUE; } } screen = DefaultScreen(display); if(!success) { /* Step 2 */ if((ourResources.applicationDepth == UNDEFINED_DEFAULT) && (ourResources.visualClass == UNDEFINED_DEFAULT)) { theVisual = DefaultVisual(display, screen); theApplicationDepth = DefaultDepth(display, screen); theVisualClass = theVisual->class; } else { /* Step 3 */ if(ourResources.applicationDepth == UNDEFINED_DEFAULT) theApplicationDepth = DefaultDepth(display, screen); else theApplicationDepth = ourResources.applicationDepth; if(ourResources.visualClass == UNDEFINED_DEFAULT) theVisualClass = DefaultVisual(display, screen)->class; else theVisualClass = ourResources.visualClass; if(XMatchVisualInfo(display, screen, theApplicationDepth, theVisualClass, &theVisualInfo) != 0) { theVisual = theVisualInfo.visual; theApplicationDepth = theVisualInfo.depth; theVisualClass = theVisualInfo.class; } else { /* Step 4 */ XVisualInfo visTemplate; XVisualInfo *visReturn; int numVis, n; visReturn = (XVisualInfo *)NULL; n = 0; /* See if we can find a visual at the depth they ask for. */ if(ourResources.applicationDepth != UNDEFINED_DEFAULT) { visTemplate.depth = ourResources.applicationDepth; visReturn = XGetVisualInfo(display, VisualDepthMask, &visTemplate, &numVis); /* * If numVis > 1 you may want to have it pick your favorite * visual. This is not necessary since the user still has * finer control by setting XtNvisualClass or XtNvisualID. */ /* Step 5 */ if(visReturn == (XVisualInfo *)NULL) { visTemplate.class = theVisualClass; visReturn = XGetVisualInfo(display, VisualClassMask, &visTemplate, &numVis); if(visReturn != (XVisualInfo *)NULL) { int i, d = 0; for(i = 1; i < numVis; i++) { if(d < visReturn[i].depth) { d = visReturn[i].depth; n = i; } } } } /* Step 6 */ if(visReturn == (XVisualInfo *)NULL) { theVisual = DefaultVisual(display, screen); theApplicationDepth = DefaultDepth(display, screen); theVisualClass = theVisual->class; } else { theVisual = visReturn[n].visual; theApplicationDepth = visReturn[n].depth; theVisualClass = visReturn[n].class; } } } } } if((theVisual->visualid == DefaultVisual(display, screen)->visualid) && !ourResources.usePrivateColormap) theColormap = DefaultColormap(display, screen); else theColormap = XCreateColormap(display, RootWindow(display, screen), theVisual, AllocNone); /* get everything, set return values */ *visual = theVisual; *depth = theApplicationDepth; *colormap = theColormap; return(True); } XmHTML-1.1.10/examples/PaxHeaders.1031/README0000644000175000001440000000013212613377377016310 xustar000000000000000030 mtime=1445854975.086545877 30 atime=1445854975.086545877 30 ctime=1445854975.086545877 XmHTML-1.1.10/examples/README0000644000175000001440000000264612613377377015720 0ustar00chrisusers00000000000000This file: README for the XmHTML examples directory. Files in this directory: - example_1.c: a very simple HTML viewer. - example_1_irix.c Same as example_1.c but modified to play nice with SGI/IRIX desktop themes. Needs GNU Make and GCC installed. Build with: make -f Makefile.irix - example_2.c: main XmHTML's demonstrator. Supports private colormaps and a whole bunch of other features. Doesn't support remote URL's though. - example_3.c: XmHTMLParser demonstrator. This example is disfunctional for the moment due to ongoing modifications of the XmHTMLParserObject. It can be found in the alpha directory. - example_4.c: XmNformCallback & HTTP.c demonstrator. - visual.c: supporting code for specifying a visual and/or colormap in a resource file. Only used by example_2.c - cache.c: generic caching routines. Includes a way to store mappings to the same image. Only used by example_2.c - misc.c: commonly used routines - HTTP.c: simple HTTP/1.0 implementation (by courtesy of Richard Offer ) - form-test.pl: small perl script to verify a form submit. To use this script, copy it to your local cgi-bin directory and load the file test-pages/form-test.html in example_4 - HTMLDemos.ad: a default resource file which can be used by all examples. Copy this file to your home directory and rename to HTMLDemos (or include it in your .Xdefaults file and prefix each resource with HTMLDemos*) XmHTML-1.1.10/examples/PaxHeaders.1031/menuItems.h0000644000175000001440000000013212613377377017547 xustar000000000000000030 mtime=1445854975.089545877 30 atime=1445854975.089545877 30 ctime=1445854975.089545877 XmHTML-1.1.10/examples/menuItems.h0000644000175000001440000002725512613377377017162 0ustar00chrisusers00000000000000/***** * menuItems.h : example_2 menu item definitions * * This file Version $Revision$ * * Creation date: Sun Dec 14 17:16:11 GMT+0100 1997 * Last modification: $Date$ * By: $Author$ * Current State: $State$ * * Author: newt * * Copyright (C) 1994-1997 by Ripley Software Development * All Rights Reserved * * This file is part of the XmHTML Widget Library. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU [Library] General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU [Library] General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * *****/ /***** * $Source$ *****/ /***** * ChangeLog * $Log$ *****/ #ifndef _menuItems_h_ #define _menuItems_h_ #include #include #include #include /**** * Menu defines *****/ /* File Menu defines */ #define FILE_NEW 0 #define FILE_OPEN 1 #define FILE_OPEN_URL 2 #define FILE_SAVEAS 3 #define FILE_RELOAD 4 #define FILE_VIEW 5 #define FILE_PRINT 6 #define FILE_CLOSE 7 #define FILE_QUIT 8 /* File->View defines */ #define VIEW_INFO 0 #define VIEW_SOURCE 1 #define VIEW_FONTS 2 #define VIEW_STRUCTURE 3 /* File->SaveAs defines */ #define SAVE_HTML_PLAIN 0 /* original source */ #define SAVE_HTML_PARSER 1 /* parser output */ #define SAVE_TXT_PLAIN 2 /* plain text */ #define SAVE_TXT_FORMATTED 3 /* formatted text */ #define SAVE_PS 4 /* postscript */ /* Edit Menu defines */ #define EDIT_FIND 0 #define EDIT_FIND_AGAIN 1 /* Option Menu defines */ #define OPTIONS_GENERAL 0 #define OPTIONS_DOCUMENT 1 #define OPTIONS_ANCHOR 2 #define OPTIONS_IMAGES 3 #define OPTIONS_FONTS 4 #define OPTIONS_START 5 #define OPTIONS_ANCHOR_BUTTONS ( OPTIONS_START ) #define OPTIONS_ANCHOR_HIGHLIGHT ( OPTIONS_START + 1 ) #define OPTIONS_ANCHOR_TRACKING ( OPTIONS_START + 2 ) #define OPTIONS_ANCHOR_TIPS ( OPTIONS_START + 3 ) #define OPTIONS_BODY_COLORS ( OPTIONS_START + 4 ) #define OPTIONS_BODY_IMAGES ( OPTIONS_START + 5 ) #define OPTIONS_ALLOW_COLORS ( OPTIONS_START + 6 ) #define OPTIONS_ALLOW_FONTS ( OPTIONS_START + 7 ) #define OPTIONS_JUSTIFY ( OPTIONS_START + 8 ) #define OPTIONS_STRICTHTML ( OPTIONS_START + 9 ) #define OPTIONS_BADHTML ( OPTIONS_START + 10 ) #define OPTIONS_ANIMATION_FREEZE ( OPTIONS_START + 11 ) #define OPTIONS_ENABLE_IMAGES ( OPTIONS_START + 12 ) #define OPTIONS_AUTOLOAD_IMAGES ( OPTIONS_START + 13 ) #define OPTIONS_SAVE ( OPTIONS_START + 14 ) #define OPTIONS_TABWIDTH ( OPTIONS_START + 15 ) #define OPTIONS_ICONSUPPORT ( OPTIONS_START + 16 ) #define OPTIONS_ICON_ALIGN ( OPTIONS_START + 17 ) #define OPTIONS_LAST ( OPTIONS_START + 18 ) /* Warning menu defines correspond with XmHTML warning type defines */ /* Window Menu defines */ #define WINDOW_RAISE 0 #define WINDOW_LOWER 1 /* Help Menu defines */ #define HELP_ABOUT 0 /* Any menu items that are commented out aren't supported (yet) */ static MenuItem viewMenu[] = { {"viewInfo", &xmPushButtonGadgetClass, None, True, (XtPointer)VIEW_INFO, viewCB, NULL, NULL }, {"viewSource", &xmPushButtonGadgetClass, None, True, (XtPointer)VIEW_SOURCE, viewCB, NULL, NULL }, {"viewFonts", &xmPushButtonGadgetClass, None, True, (XtPointer)VIEW_FONTS, viewCB, NULL, NULL }, {"viewStructure", &xmPushButtonGadgetClass, None, True, (XtPointer)VIEW_STRUCTURE, viewCB, NULL, NULL }, {NULL, NULL, None, True, NULL, NULL, NULL, NULL }, }; /* Any menu items that are commented out aren't supported (yet) */ static MenuItem saveMenu[] = { {"saveHtmlPlain", &xmPushButtonGadgetClass, None, True, (XtPointer)SAVE_HTML_PLAIN, saveCB, NULL, NULL }, {"saveHtmlParser", &xmPushButtonGadgetClass, None, True, (XtPointer)SAVE_HTML_PARSER, saveCB, NULL, NULL }, {"saveTxtPlain", &xmPushButtonGadgetClass, None, True, (XtPointer)SAVE_TXT_PLAIN, saveCB, NULL, NULL }, {"saveTxtFormatted", &xmPushButtonGadgetClass, None, True, (XtPointer)SAVE_TXT_FORMATTED, saveCB, NULL, NULL }, {"savePs", &xmPushButtonGadgetClass, None, True, (XtPointer)SAVE_PS, saveCB, NULL, NULL }, {NULL, NULL, None, True, NULL, NULL, NULL, NULL }, }; static MenuItem fileMenu[] = { #if 0 {"new", &xmPushButtonGadgetClass, None, False, (XtPointer)FILE_NEW, fileCB, NULL, NULL }, {"_separator_", &xmSeparatorGadgetClass, None, True, NULL, NULL, NULL, NULL }, #endif {"open", &xmPushButtonGadgetClass, None, True, (XtPointer)FILE_OPEN, fileCB, NULL, NULL }, #if 0 {"openURL", &xmPushButtonGadgetClass, None, False, (XtPointer)FILE_OPEN_URL, fileCB, NULL, NULL }, #endif {"saveas", &xmPushButtonGadgetClass, None, True, (XtPointer)FILE_SAVEAS, fileCB, NULL, saveMenu }, {"reload", &xmPushButtonGadgetClass, None, False, (XtPointer)FILE_RELOAD, fileCB, NULL, NULL }, {"_separator_", &xmSeparatorGadgetClass, None, True, NULL, NULL, NULL, NULL }, {"view", &xmCascadeButtonGadgetClass, None, True, (XtPointer)FILE_VIEW, fileCB, NULL, viewMenu}, {"_separator_", &xmSeparatorGadgetClass, None, True, NULL, NULL, NULL, NULL }, #if 0 {"print", &xmPushButtonGadgetClass, None, False, (XtPointer)FILE_PRINT, fileCB, NULL, NULL }, {"_separator_", &xmSeparatorGadgetClass, None, True, NULL, NULL, NULL, NULL }, {"close", &xmPushButtonGadgetClass, None, False, (XtPointer)FILE_CLOSE, fileCB, NULL, NULL }, #endif {"quit", &xmPushButtonGadgetClass, None, True, (XtPointer)FILE_QUIT, fileCB, NULL, NULL }, {NULL, NULL, None, True, NULL, NULL, NULL, NULL }, }; static MenuItem warningMenu[] = { {"none", &xmToggleButtonGadgetClass, None, False, (XtPointer)XmHTML_NONE, warningCB, NULL, NULL }, {"all", &xmToggleButtonGadgetClass, None, True, (XtPointer)XmHTML_ALL, warningCB, NULL, NULL }, {"_separator_", &xmSeparatorGadgetClass, None, True, NULL, NULL, NULL, NULL }, {"unknownElement", &xmToggleButtonGadgetClass, None, False, (XtPointer)XmHTML_UNKNOWN_ELEMENT, warningCB, NULL, NULL }, {"bad", &xmToggleButtonGadgetClass, None, False, (XtPointer)XmHTML_BAD, warningCB, NULL, NULL }, {"openBlock", &xmToggleButtonGadgetClass, None, False, (XtPointer)XmHTML_OPEN_BLOCK, warningCB, NULL, NULL }, {"closeBlock", &xmToggleButtonGadgetClass, None, False, (XtPointer)XmHTML_CLOSE_BLOCK, warningCB, NULL, NULL }, {"openElement", &xmToggleButtonGadgetClass, None, False, (XtPointer)XmHTML_OPEN_ELEMENT, warningCB, NULL, NULL }, {"nested", &xmToggleButtonGadgetClass, None, False, (XtPointer)XmHTML_NESTED, warningCB, NULL, NULL }, {"violation", &xmToggleButtonGadgetClass, None, False, (XtPointer)XmHTML_VIOLATION, warningCB, NULL, NULL }, {NULL, NULL, None, True, NULL, NULL, NULL, NULL }, }; static MenuItem iconAlignMenu[] = { {"top", &xmToggleButtonGadgetClass, None, False, (XtPointer)XmALIGNMENT_BASELINE_TOP, iconAlignCB, NULL, NULL }, {"middle", &xmToggleButtonGadgetClass, None, True, (XtPointer)XmALIGNMENT_CENTER, iconAlignCB, NULL, NULL }, {"bottom", &xmToggleButtonGadgetClass, None, True, (XtPointer)XmALIGNMENT_BASELINE_BOTTOM, iconAlignCB, NULL, NULL }, {NULL, NULL, None, True, NULL, NULL, NULL, NULL }, }; static MenuItem optionMenu[] = { #if 0 {"general", &xmPushButtonGadgetClass, None, False, (XtPointer)OPTIONS_GENERAL, optionsCB, NULL, NULL }, {"document", &xmPushButtonGadgetClass, None, False, (XtPointer)OPTIONS_DOCUMENT, optionsCB, NULL, NULL }, {"anchor", &xmPushButtonGadgetClass, None, False, (XtPointer)OPTIONS_ANCHOR, optionsCB, NULL, NULL }, {"images", &xmPushButtonGadgetClass, None, False, (XtPointer)OPTIONS_IMAGES, optionsCB, NULL, NULL }, {"fonts", &xmPushButtonGadgetClass, None, False, (XtPointer)OPTIONS_FONTS, optionsCB, NULL, NULL }, {"_separator_", &xmSeparatorGadgetClass, None, True, NULL, NULL, NULL, NULL }, #endif /* anchor options */ {"anchorButtons", &xmToggleButtonGadgetClass, None, True, (XtPointer)OPTIONS_ANCHOR_BUTTONS, optionsCB, NULL, NULL }, {"highlightOnEnter", &xmToggleButtonGadgetClass, None, True, (XtPointer)OPTIONS_ANCHOR_HIGHLIGHT, optionsCB, NULL, NULL }, {"imageAnchorTracking", &xmToggleButtonGadgetClass, None, True, (XtPointer)OPTIONS_ANCHOR_TRACKING, optionsCB, NULL, NULL }, {"anchorTips", &xmToggleButtonGadgetClass, None, True, (XtPointer)OPTIONS_ANCHOR_TIPS, optionsCB, NULL, NULL }, {"_separator_", &xmSeparatorGadgetClass, None, True, NULL, NULL, NULL, NULL }, /* body options */ {"enableBodyColors", &xmToggleButtonGadgetClass, None, True, (XtPointer)OPTIONS_BODY_COLORS, optionsCB, NULL, NULL }, {"enableBodyImages", &xmToggleButtonGadgetClass, None, True, (XtPointer)OPTIONS_BODY_IMAGES, optionsCB, NULL, NULL }, {"enableDocumentColors", &xmToggleButtonGadgetClass, None, True, (XtPointer)OPTIONS_ALLOW_COLORS, optionsCB, NULL, NULL }, {"enableDocumentFonts", &xmToggleButtonGadgetClass, None, True, (XtPointer)OPTIONS_ALLOW_FONTS, optionsCB, NULL, NULL }, {"enableOutlining", &xmToggleButtonGadgetClass, None, True, (XtPointer)OPTIONS_JUSTIFY, optionsCB, NULL, NULL }, {"tabWidth", &xmPushButtonGadgetClass, None, True, (XtPointer)OPTIONS_TABWIDTH, optionsCB, NULL, NULL}, {"_separator_", &xmSeparatorGadgetClass, None, True, NULL, NULL, NULL, NULL }, {"enableIconSupport", &xmToggleButtonGadgetClass, None, True, (XtPointer)OPTIONS_ICONSUPPORT, optionsCB, NULL, NULL}, {"iconAlign", &xmCascadeButtonGadgetClass, None, True, (XtPointer)OPTIONS_ICON_ALIGN, optionsCB, NULL, iconAlignMenu}, {"_separator_", &xmSeparatorGadgetClass, None, True, NULL, NULL, NULL, NULL }, /* parser options */ {"strictHTMLChecking", &xmToggleButtonGadgetClass, None, False, (XtPointer)OPTIONS_STRICTHTML, optionsCB, NULL, NULL }, {"warning", &xmCascadeButtonGadgetClass, None, True, (XtPointer)OPTIONS_BADHTML, optionsCB, NULL, warningMenu}, {"_separator_", &xmSeparatorGadgetClass, None, True, NULL, NULL, NULL, NULL }, /* image options */ {"freezeAnimations", &xmToggleButtonGadgetClass, None, True, (XtPointer)OPTIONS_ANIMATION_FREEZE, optionsCB, NULL, NULL }, {"imageEnable", &xmToggleButtonGadgetClass, None, True, (XtPointer)OPTIONS_ENABLE_IMAGES, optionsCB, NULL, NULL }, {"autoImageLoad", &xmToggleButtonGadgetClass, None, True, (XtPointer)OPTIONS_AUTOLOAD_IMAGES, optionsCB, NULL, NULL }, {"_separator_", &xmSeparatorGadgetClass, None, True, NULL, NULL, NULL, NULL }, {"save", &xmPushButtonGadgetClass, None, False, (XtPointer)OPTIONS_SAVE, optionsCB, NULL, NULL }, {NULL, NULL, None, True, NULL, NULL, NULL, NULL }, }; /* the Edit menu */ static MenuItem editMenu[] = { {"find", &xmPushButtonGadgetClass, None, True, (XtPointer)EDIT_FIND, editCB, NULL, NULL }, {"findAgain", &xmPushButtonGadgetClass, None, True, (XtPointer)EDIT_FIND_AGAIN, editCB, NULL, NULL }, {NULL, NULL, None, True, NULL, NULL, NULL, NULL }, }; /* the Window menu */ static MenuItem windowMenu[] = { {"raise", &xmPushButtonGadgetClass, None, True, (XtPointer)WINDOW_RAISE, windowCB, NULL, NULL }, {"lower", &xmPushButtonGadgetClass, None, True, (XtPointer)WINDOW_LOWER, windowCB, NULL, NULL }, {NULL, NULL, None, True, NULL, NULL, NULL, NULL }, }; /* the Help menu */ static MenuItem helpMenu[] = { {"about", &xmPushButtonGadgetClass, None, True, (XtPointer)HELP_ABOUT, helpCB, NULL, NULL }, {NULL, NULL, None, True, NULL, NULL, NULL, NULL }, }; /* Don't add anything after this endif! */ #endif /* _menuItems_h_ */ XmHTML-1.1.10/examples/PaxHeaders.1031/example_1.c0000644000175000001440000000013212613377377017447 xustar000000000000000030 mtime=1445854975.087545877 30 atime=1445854975.086545877 30 ctime=1445854975.087545877 XmHTML-1.1.10/examples/example_1.c0000644000175000001440000001572012613377377017054 0ustar00chrisusers00000000000000/***** * example_1.c : simple demonstration on how to use XmHTML * * This file Version $Revision: 1.6 $ * * Creation date: Mon Jan 27 02:06:08 GMT+0100 1997 * Last modification: $Date: 1997/10/23 00:28:37 $ * By: $Author: newt $ * Current State: $State: Exp $ * * Author: newt * * Copyright (C) 1994-1997 by Ripley Software Development * All Rights Reserved * * This file is part of the XmHTML Widget Library. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU [Library] General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU [Library] General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * *****/ /***** * ChangeLog * $Log: example_1.c,v $ * Revision 1.6 1997/10/23 00:28:37 newt * XmHTML Beta 1.1.0 release * * Revision 1.5 1997/05/28 02:02:49 newt * Changes to reflect updated convenience function protos. * * Revision 1.4 1997/03/20 08:20:37 newt * enlarged default with and height * * Revision 1.3 1997/03/11 20:08:55 newt * Changed XmHTMLSetText to XmHTMLTextSet * * Revision 1.2 1997/03/04 01:02:45 newt * Added printing of XmHTML version strings * * Revision 1.1 1997/02/11 01:58:25 newt * Initial Revision * *****/ #include #include #include #include #include #include #include #include "debug.h" /*** Private Variable Declarations ***/ static Widget html; /***** * Change this to change the application class of the examples *****/ #define APP_CLASS "HTMLDemos" /***** * Name: exitCB * Return Type: void * Description: callback for the exit button * In: * widget: button widget id * client_data:unused * call_data: unused * Returns: * *****/ static void exitCB(Widget widget, XtPointer client_data, XtPointer call_data) { printf("Bye!\n"); exit(EXIT_SUCCESS); } /***** * Name: anchorCB * Return Type: void * Description: XmNactivateCallback for the XmHTML widget * In: * widget: widget id, in this case that of the HTML widget * client_data:data registered with callback, unused * cbs: XmHTML callback structure. * Returns: * nothing. * Note: * We don't care what sort of url has been selected. * Setting the doit field to True instructs XmHTML to do it's own scrolling. * XmHTML is smart enought to only scroll to a location in this document if * it really exists. * Setting the visited field also to True will cause XmHTML to render the * selected anchor as being visited. *****/ static void anchorCB(Widget widget, XtPointer client_data, XmHTMLAnchorCallbackStruct *cbs) { cbs->doit = True; cbs->visited = True; } /***** * Name: loadFile * Return Type: String * Description: loads the contents of the given file. * In: * filename: name of the file to load * Returns: * contents of the loaded file. *****/ static String loadFile(String filename) { FILE *file; int size; static String content; /* open the given file */ if((file = fopen(filename, "r")) == NULL) { perror(filename); return(NULL); } /* see how large this file is */ fseek(file, 0, SEEK_END); size = ftell(file); rewind(file); /* allocate a buffer large enough to contain the entire file */ if((content = malloc(size+1)) == NULL) { fprintf(stderr, "malloc failed for %i bytes\n", size); exit(EXIT_FAILURE); } /* now read the contents of this file */ if((fread(content, 1, size, file)) != size) printf("Warning: did not read entire file!\n"); fclose(file); /* sanity */ content[size] = '\0'; return(content); } /* debug-action, executed some time after start */ static void DebugAction( XtPointer client_data, XtIntervalId id ) { #if 0 XmHTMLScrollToYPos( html, 1 ); XmHTMLScrollToYPos( html, 2 ); XmHTMLScrollToYPos( html, 3 ); XmHTMLScrollToYPos( html, 4 ); XmHTMLScrollToYPos( html, 5 ); #endif } /***** * Name: main * Return Type: int * Description: main for example 1 * In: * argc: no of arguments on command line * argv: array of command line arguments * Returns: * EXIT_FAILURE when an error occurs, EXIT_SUCCESS otherwise * Note: * this example should be started with the name of a HTML file to display. *****/ int main(int argc, char **argv) { XtAppContext context; Widget toplevel, form, frame, button; String content; fprintf(stderr, "%s, %i\n", XmHTMLVERSION_STRING, XmHTMLGetVersion()); /* set the debugging levels */ _XmHTMLSetDebugLevels(&argc, argv); /* check command line arguments, but allow for X11 options */ if(argc < 2) { printf("%s: simple XmHTML example\n", argv[0]); printf("\tUsage: %s \n", argv[0]); exit(EXIT_FAILURE); } content = loadFile(argv[1]); /* create toplevel widget */ toplevel = XtVaAppInitialize(&context, APP_CLASS, NULL, 0, &argc, argv, NULL, NULL, NULL); /* XSynchronize( XtDisplay( toplevel ), True ); */ /* create a form as the main container */ form = XtVaCreateWidget("form", xmFormWidgetClass, toplevel, NULL); /* create the exit button */ button = XtVaCreateManagedWidget("Exit", xmPushButtonWidgetClass, form, XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 10, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 10, NULL); /* add the exit callback */ XtAddCallback(button, XmNactivateCallback, (XtCallbackProc)exitCB, NULL); /* create a frame as the html container */ frame = XtVaCreateManagedWidget("frame", xmFrameWidgetClass, form, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, button, XmNtopOffset, 10, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 10, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 10, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 10, XmNshadowType, XmSHADOW_IN, NULL); /* create the HTML widget using the default resources */ html = XtVaCreateManagedWidget("html", xmHTMLWidgetClass, frame, XmNmarginWidth, 20, XmNmarginHeight, 20, XmNwidth, 600, XmNheight, 500, NULL); if(content == NULL) XmHTMLTextSetString(html, "Could not read given " "file"); else { XmHTMLTextSetString(html, content); free(content); } /* add a simple anchor callback so XmHTML can jump to local anchors */ XtAddCallback(html, XmNactivateCallback, (XtCallbackProc)anchorCB, NULL); /* manage the form */ XtManageChild(form); /* realize the main application */ XtRealizeWidget(toplevel); /* The HTML widget has the focus */ XmProcessTraversal(html, XmTRAVERSE_CURRENT); /* schedule debug-action in one second */ XtAppAddTimeOut( context, 1000, DebugAction, NULL ); /* enter the event loop */ XtAppMainLoop(context); /* never reached, but keeps compiler happy */ exit(EXIT_SUCCESS); } XmHTML-1.1.10/examples/PaxHeaders.1031/Makefile0000644000175000001440000000013212613377377017070 xustar000000000000000030 mtime=1445854975.086545877 30 atime=1445854975.086545877 30 ctime=1445854975.086545877 XmHTML-1.1.10/examples/Makefile0000644000175000001440000000302112613377377016464 0ustar00chrisusers00000000000000 # List of sources SRCS = example_1.c example_2.c example_4.c MSRCS= visual.c misc.c cache.c menu.c history.c # List of object files OBJS = example_1.o example_2.o example_4.o MOBJS= visual.o misc.o cache.o menu.o history.o # Targets to make EXAMPLES=example_1 example_2 example_4 # The XmHTML library XMHTMLLIB = -L../lib -lXmHTML # Richard Offer's http client-side library HTTPLIB = -L../http -lhttp # Libraries against which all examples are linked LINKLIBS = $(XMHTMLLIB) $(LOADLIBES) $(DMALLOCLIB) # rule to create .o files from .c files .c.o: $(RM) $@ $(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -c $< all: $(EXAMPLES) # targets to build example_1:: ../src/libXmHTML.a example_1.o $(RM) $@ \ $(CC) -o $@ $(LDFLAGS) example_1.o $(LINKLIBS) example_2:: ../src/libXmHTML.a example_2.o $(MOBJS) $(RM) $@ \ $(CC) -o $@ $(LDFLAGS) example_2.o $(MOBJS) $(LINKLIBS) example_4:: ../src/libXmHTML.a example_4.o $(RM) $@ \ $(CC) -o $@ $(LDFLAGS) example_4.o $(LINKLIBS) $(HTTPLIB) .PHONY: ../src/libXmHTML.a .PHONY: stamp-includes includes:: stamp-includes depend:: $(SRCS) $(MSRCS) $(MAKEDEPEND) $(INCLUDES) $(CPPFLAGS) $(SRCS) $(MSRCS) clean:: $(RM) $(OBJS) $(MOBJS) $(RM) $(EXAMPLES) distclean:: clean $(RM) core *.out *.log make.world *.bak *.last *.auto *.rej *.orig #$(CP) Makefile.org Makefile #-------------------------------------------------------------------------- # don't delete anything below this line, makedepend depends on it #--------------------------------------------------------------------------